Package org.gvt.model

Examples of org.gvt.model.NodeModel


      Iterator<NodeModel> nodeIter = root.getNodes().iterator();

      while (nodeIter.hasNext())
      {
        NodeModel node = nodeIter.next();

        if (node.getText().toLowerCase().indexOf(name) >= 0 ||
          (node.getTooltipText() != null &&
            node.getTooltipText().toLowerCase().indexOf(name) >= 0))
        {
          node.setHighlight(true);
        }
      }
    }
   
    name = null;
View Full Code Here


   
    Set<physicalEntityParticipant> pars = con.getCONTROLLER();
   
    for (physicalEntityParticipant par : pars)
    {
      NodeModel node = map.get(par.getRDFId());
      new EffectorFirstHalf(node, this, par);
    }

    new EffectorSecondHalf(this, target, con);
   
    // Connect modulators.
   
    for (control c : con.isCONTROLLEDOf())
    {
      if (map.containsKey(c.getRDFId()))
      {
        Control mod = (Control) map.get(c.getRDFId());
        new EffectorSecondHalf(mod, this, mod.getControl());
      }
      else if (c.isCONTROLLEDOf().isEmpty() && c.getCONTROLLER().size() == 1)
      {
        NodeModel source = map.get(c.getCONTROLLER().iterator().next().getRDFId());
        new NonModulatedEffector(source, this, c, c.getCONTROLLER().iterator().next(), con);
      }
      else
      {
        Control ctrl = new Control(root, c, this, map);
View Full Code Here

    for (Controller controller : controllers)
    {
      if (controller instanceof PhysicalEntity)
      {
        PhysicalEntity ent = (PhysicalEntity) controller;
        NodeModel node = map.get(ent.getRDFId());
        new EffectorFirstHalf(node, this);
      }
    }
   
    new EffectorSecondHalf(this, target, con);
   
    // Connect modulators.
   
    for (Control c : con.getControlledOf())
    {
      if (map.containsKey(c.getRDFId()))
      {
        ChbControl mod = (ChbControl) map.get(c.getRDFId());
        new EffectorSecondHalf(mod, this, mod.getControl());
      }
      else if (c.getControlledOf().isEmpty() && c.getController().size() == 1)
      {
        NodeModel source = map.get(c.getController().iterator().next().getRDFId());
        new NonModulatedEffector(source, this, c, con);
      }
      else
      {
        ChbControl ctrl = new ChbControl(root, c, this, map);
View Full Code Here

            if (nestCompartments) nm = CompartmentManager.getUnifiedName(nm);
            compart = getCompartment(nm, map, root);
          }
        }

        NodeModel nd;

        if (cmp.getComponent().isEmpty())
        {
          nd = new Actor(compart, cmp, null);
        }
        else
        {
          ChbComplex c = new ChbComplex(compart, cmp);
          createComplexContent(c, cmp, cmp, map);
          nd = c;
        }

        map.put(cmp.getRDFId(), nd);
      }
    }

    // Create events

    for (Conversion conv : model.getObjects(Conversion.class))
    {
      String compName = ChbConversion.getPossibleCompartmentName(conv);

      if (compName != null && nestCompartments)
        compName = CompartmentManager.getUnifiedName(compName);

      CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);

//      if (compart == null)
//      {
//        System.out.println("");
//      }

      assert compart != null;
     
      ChbConversion forwd = null, rever = null;

      if (evidenceExists(conv, ChbConversion.LEFT_TO_RIGHT))
      {
        forwd = new ChbConversion(compart, conv, ChbConversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }
      if (evidenceExists(conv, ChbConversion.RIGHT_TO_LEFT))
      {
        rever = new ChbConversion(compart, conv, ChbConversion.RIGHT_TO_LEFT, map);
        rever.selectBestCompartment();
      }
      if (forwd == null && rever == null)
      {
        forwd = new ChbConversion(compart, conv, ChbConversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }
    }

//    for (TemplateReaction reac : model.getObjects(TemplateReaction.class))
//    {
//      String compName = ChbConversion.getPossibleCompartmentName(reac);
//
//      if (compName != null && nestCompartments)
//        compName = CompartmentManager.getUnifiedName(compName);
//
//      CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);
//
//    }

    for (Interaction inter : model.getObjects(Interaction.class))
    {
      boolean drawPPI = true;
      if (!drawPPI) break;

      if (!(inter instanceof Conversion) && !(inter instanceof Control))
      {
        // We constraint the participant list to Physical Entities only
        Set<Entity> interPartic = inter.getParticipant();
        Set<PhysicalEntity> pes = new HashSet<PhysicalEntity>();
        for (Entity e : interPartic)
        {
          if (e instanceof PhysicalEntity) pes.add((PhysicalEntity) e);
        }
        if (pes.isEmpty()) continue;

        boolean hasControl = !inter.getControlledOf().isEmpty();

        if (hasControl || pes.size() != 2)
        {
          String compName = Hub.getPossibleCompartmentName(pes);

          if (nestCompartments) compName = CompartmentManager.getUnifiedName(compName);

          CompoundModel compart = compName == null ? root :
            (CompoundModel) map.get(compName);

          Hub hub = new Hub(compart, inter, map);

          for (PhysicalEntity pe : pes)
          {
            NodeModel node = map.get(pe.getRDFId());

            assert node != null;

            new MultiTouch(node, hub);
          }
View Full Code Here

              if (nestCompartments) nm = CompartmentManager.getUnifiedName(nm);
              compart = getCompartment(nm, map, root);
            }
          }

          NodeModel nd;

          if (cmp.getCOMPONENTS().isEmpty())
          {
            nd = new Actor(compart, cmp, list);
          }
          else
          {
            Complex c = new Complex(compart, cmp, list);
            createComplexContent(c, cmp, list);
            nd = c;
          }

          for (physicalEntityParticipant par : list)
          {
            map.put(par.getRDFId(), nd);
          }
        }
      }
    }   
   
    // Create events
   
    for (conversion conv : model.getObjects(conversion.class))
    {
      String compName = Conversion.getPossibleCompartmentName(conv);

      if (compName != null && nestCompartments)
        compName = CompartmentManager.getUnifiedName(compName);
     
      CompoundModel compart = compName == null ? root : (CompoundModel) map.get(compName);
     
      Conversion forwd = null, rever = null;
     
      if (evidenceExists(conv, Conversion.LEFT_TO_RIGHT))
      {
        forwd = new Conversion(compart, conv, Conversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }     
      if (evidenceExists(conv, Conversion.RIGHT_TO_LEFT))
      {
        rever = new Conversion(compart, conv, Conversion.RIGHT_TO_LEFT, map);
        rever.selectBestCompartment();
      }
      if (forwd == null && rever == null)
      {
        forwd = new Conversion(compart, conv, Conversion.LEFT_TO_RIGHT, map);
        forwd.selectBestCompartment();
      }
    }

    for (interaction inter : model.getObjects(interaction.class))
    {
      boolean drawPPI = true;
      if (!drawPPI) break;

      if (!(inter instanceof conversion) && !(inter instanceof control))
      {
        Set<InteractionParticipant> interPartic = inter.getPARTICIPANTS();
        Set<physicalEntityParticipant> peps = new HashSet<physicalEntityParticipant>();

        boolean hasControl = !inter.isCONTROLLEDOf().isEmpty();

        for (InteractionParticipant partic : interPartic)
        {
          if (partic instanceof physicalEntityParticipant)
          {
            peps.add((physicalEntityParticipant) partic);
          }
        }

        if (hasControl || peps.size() != 2)
        {
          String compName = Hub.getPossibleCompartmentName(peps);

          if (nestCompartments) compName = CompartmentManager.getUnifiedName(compName);

          CompoundModel compart = compName == null ? root :
            (CompoundModel) map.get(compName);

          Hub hub = new Hub(compart, inter,
            new ArrayList<physicalEntityParticipant>(peps), map);

          for (physicalEntityParticipant pep : peps)
          {
            NodeModel node = map.get(pep.getRDFId());

            // TEMPORARY CODE -- REMOVE WHEN BUG IS FIXED
            if (node == null)
            {
              System.err.println("PEP without PE");
View Full Code Here

    Set<physicalEntityParticipant> prodSet = direction == RIGHT_TO_LEFT ?
      conv.getLEFT() : conv.getRIGHT();
   
    for (physicalEntityParticipant par : subsSet)
    {
      NodeModel sub = map.get(par.getRDFId());
      new Substrate(sub, this, par);
    }
    for (physicalEntityParticipant par : prodSet)
    {
      NodeModel prod = map.get(par.getRDFId());
      new Product(this, prod, par);
    }

    // Infer if this conversion is a transcription

    if (!t && subsSet.isEmpty() && prodSet.size() == 1)
    {
      t = true;
//      this.setText("t");
      util.recordModelTag(BioPAXL2Graph.TRANSCRIPTION_TAG, "");
    }

    // Create effectors.
   
    for (control con : conv.isCONTROLLEDOf())
    {
      if (map.containsKey(con.getRDFId()))
      {
        Control cont = (Control) map.get(con.getRDFId());
        new EffectorSecondHalf(cont, this, cont.getControl());
      }
      else if (con.isCONTROLLEDOf().isEmpty() && con.getCONTROLLER().size() == 1)
      {
        NodeModel source = map.get(con.getCONTROLLER().iterator().next().getRDFId());
        new NonModulatedEffector(source, this, con,
          con.getCONTROLLER().iterator().next(), conv);
      }
      else
      {
View Full Code Here

    int totalDegree = 0;
    int nodeCounted = 0;

    for (Object o : graph.getNodes())
    {
      NodeModel node = (NodeModel) o;

      if (node instanceof ComplexMember ||
        node instanceof Compartment ||
        (node instanceof Actor && ((Actor) node).isUbique()))
      {
        continue;
      }

      int degree = node.getSourceConnections().size() + node.getTargetConnections().size();

      if (degree > 15)
      {
        System.out.println("degree = " + degree + " node = " + node.getText() + " type = " +
          node.getClass().getName().substring(
            node.getClass().getName().lastIndexOf(".") + 1));
      }

      totalDegree += degree;
      nodeCounted++;
    }
View Full Code Here

    super();
  }

  public void execute()
  {
    NodeModel node = null;
    boolean highlight = false;
    List<EdgeModel> highlightedEdges = new ArrayList();

    for (int i = 0; i < getCommands().size(); i++)
    {
      Command cmd = (Command) getCommands().get(i);

      if (cmd instanceof OrphanChildCommand)
      {
        node = ((OrphanChildCommand) cmd).getChild();
        // remove node highlight
        highlight = node.isHighlight();
        node.setHighlight(false);

        // remove edge highlights
        List edges = node.getSourceConnections();
        Iterator<EdgeModel> iter = edges.iterator();

        while (iter.hasNext())
        {
          EdgeModel edge = iter.next();

          if (edge.isHighlight())
          {
            highlightedEdges.add(edge);
            edge.setHighlight(false);
          }
        }
      }

      cmd.execute();
    }

    // restore node highlights
    for (int i = 0; i < getCommands().size(); i++)
    {
      Command cmd = (Command) getCommands().get(i);

      if (cmd instanceof OrphanChildCommand)
      {
        node = ((OrphanChildCommand) cmd).getChild();

        if (node != null && highlight)
        {
          node.setHighlight(true);
        }
      }
    }

    // restore edge highlights
View Full Code Here

    Set<PhysicalEntity> prodSet = direction == RIGHT_TO_LEFT ?
      conv.getLeft() : conv.getRight();
   
    for (PhysicalEntity ent : subsSet)
    {
      NodeModel sub = mapLookup(ent, conv, map);
      new Substrate(sub, this);
    }
    for (PhysicalEntity par : prodSet)
    {
      NodeModel prod = mapLookup(par, conv, map);
      new Product(this, prod);
    }

    // Infer if this conversion is a transcription

    if (!t && subsSet.isEmpty() && prodSet.size() == 1)
    {
      t = true;
//      this.setText("t");
      util.recordModelTag(BioPAXL3Graph.TRANSCRIPTION_TAG, "");
    }

    // Create effectors.
   
    for (Control con : conv.getControlledOf())
    {
      if (map.containsKey(con.getRDFId()))
      {
        ChbControl cont = (ChbControl) map.get(con.getRDFId());
        new EffectorSecondHalf(cont, this, cont.getControl());
      }
      else if (con.getControlledOf().isEmpty() && con.getController().size() == 1)
      {
        NodeModel source = map.get(con.getController().iterator().next().getRDFId());
        new NonModulatedEffector(source, this, con, conv);
      }
      else
      {
        ChbControl ctrl = new ChbControl(root, con, this, map);
View Full Code Here

    }
  }

  private NodeModel mapLookup(PhysicalEntity pe, Conversion conv, Map<String, NodeModel> map)
  {
    NodeModel nm = map.get(pe.getRDFId());
    if (nm == null) nm = map.get(pe.getRDFId() + conv.getRDFId());
    return nm;
  }
View Full Code Here

TOP

Related Classes of org.gvt.model.NodeModel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.