Package org.gvt.model

Examples of org.gvt.model.CompoundModel


    }
  }

  public Rectangle getBounds(ScrollingGraphicalViewer viewer, Figure f)
  {
    CompoundModel rootModel = (CompoundModel) ((ChsRootEditPart) viewer.
      getRootEditPart().getChildren().get(0)).getModel();

    org.eclipse.draw2d.geometry.Rectangle bounds
      = rootModel.calculateBounds();
    org.eclipse.draw2d.geometry.Rectangle boundsRoot = f.getBounds();

    boundsRoot.setSize(bounds.x + bounds.width + CompoundModel.MARGIN_SIZE,
      bounds.y + bounds.height + CompoundModel.MARGIN_SIZE);
View Full Code Here


    ScrollingGraphicalViewer viewer = main.getTabToViewerMap().get(tab);

    main.closeTab(tab, false);

    CompoundModel root = (CompoundModel) viewer.getContents().getModel();

    if (root instanceof BioPAXGraph)
    {
      BioPAXGraph graph = (BioPAXGraph) root;
View Full Code Here

      name = name.toLowerCase().trim();

      // Iterate all nodes in graph
     
      CompoundModel root = (CompoundModel) ((ChsRootEditPart)main.getViewer().
        getRootEditPart().getChildren().get(0)).getModel();

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

      while (nodeIter.hasNext())
      {
        NodeModel node = nodeIter.next();
View Full Code Here

    {
      Set<Node> unfinished = new HashSet<Node>();

      for (Node node : toProcess)
      {
        CompoundModel compound = ((NodeModel) node).getParentModel();

        if (map.containsKey(compound))
        {
          CompoundModel newRoot = (CompoundModel) map.get(compound);

          if (node instanceof Compartment)
          {
            Compartment orig = (Compartment) node;
            map.put(orig, new Compartment(orig, newRoot));
View Full Code Here

      // Complex will be processed later.
      if (pe instanceof Complex) continue;

      // Create simple states (Actors)

      CompoundModel parent = extractCompartment(pe, map);
      if (parent == null) parent = root;

      if (!isUbique(pe))
      {
        if (pe.getComponentOf().isEmpty() || !pe.getParticipantOf().isEmpty())
        {
          Actor actor = new Actor(parent, pe, null);
          map.put(pe.getRDFId(), actor);
        }
      }
      else
      {
        for (Interaction inter : pe.getParticipantOf())
        {
          Actor actor = new Actor(parent, pe, inter);
          map.put(pe.getRDFId() + inter.getRDFId(), actor);
        }
      }
    }

    // Create complexes

    for (Complex cmp : model.getObjects(Complex.class))
    {
      if (cmp.getParticipantOf().isEmpty())
      {
        ChbComplex c = new ChbComplex(root, cmp);
        createComplexContent(c, cmp, cmp, map);
      }
      else
      {
        CompoundModel compart = getCompartment(cmp, map, root);

        if (compart == root)
        {
          String nm = ChbComplex.suggestCompartmentNameUsingMembers(cmp.getComponent());

          if (nm != null)
          {
            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)
View Full Code Here

      {
        Collection<List<physicalEntityParticipant>> coll = groupParticipants(pe);
       
        for (List<physicalEntityParticipant> list : coll)
        {
          CompoundModel compart = getCompartment(list.get(0), map, root);
         
          Actor actor = new Actor(compart, pe, list);
         
          for (physicalEntityParticipant par : list)
          {
            map.put(par.getRDFId(), actor);
          }
        }
      }
    }
   
    // Create complexes

    for (complex cmp : model.getObjects(complex.class))
    {
      if (cmp.isPHYSICAL_ENTITYof().isEmpty())
      {
        Complex c = new Complex(root, cmp, new ArrayList<physicalEntityParticipant>(0));
        createComplexContent(c, cmp, new ArrayList<physicalEntityParticipant>());
      }
      else
      {
        Collection<List<physicalEntityParticipant>> coll = groupParticipants(cmp);
       
        for (List<physicalEntityParticipant> list : coll)
        {
          CompoundModel compart = getCompartment(list.get(0), map, root);

          if (compart == root)
          {
            String nm = Complex.suggestCompartmentNameUsingMembers(cmp.getCOMPONENTS());

            if (nm != null)
            {
              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);
View Full Code Here

    {
      Set<Node> unfinished = new HashSet<Node>();

      for (Node node : toProcess)
      {
        CompoundModel compound = ((NodeModel) node).getParentModel();

        if (map.containsKey(compound))
        {
          CompoundModel newRoot = (CompoundModel) map.get(compound);

          if (node instanceof Compartment)
          {
            Compartment orig = (Compartment) node;
            map.put(orig, new Compartment(orig, newRoot));
View Full Code Here

    {
      Set<Node> unfinished = new HashSet<Node>();

      for (Node node : toProcess)
      {
        CompoundModel compound = ((NodeModel) node).getParentModel();

        if (map.containsKey(compound))
        {
          CompoundModel newRoot = (CompoundModel) map.get(compound);

          if (node instanceof Compartment)
          {
            Compartment orig = (Compartment) node;
            map.put(orig, new Compartment(orig, newRoot));
View Full Code Here

    Ranker<CompoundModel> r = new Ranker<CompoundModel>();

    for (NodeModel neigh : neighbors)
    {
      if (neigh instanceof ComplexMember) neigh = neigh.getParentModel();
      CompoundModel cm = neigh.getParentModel();
      if (cm != null) r.count(cm);
    }

    List<List<CompoundModel>> list = r.getRankedList();
    if (list.isEmpty()) return;

    List<CompoundModel> firstGroup = list.get(0);

    CompoundModel comp;

    if (firstGroup.size() == 1)
    {
      comp = firstGroup.get(0);
    }
    else
    {
      for (NodeModel neigh : neighbors)
      {
        if (neigh instanceof ComplexMember) neigh = neigh.getParentModel();
        CompoundModel cm = neigh.getParentModel();
        if (cm != null) cm = cm.getParentModel();
        if (cm != null) r.count(cm);
      }

      list = r.getRankedList();
      List<CompoundModel> secondGroup = list.get(0);
View Full Code Here

    {
      Set<Node> unfinished = new HashSet<Node>();

      for (Node node : toProcess)
      {
        CompoundModel compound = ((NodeModel) node).getParentModel();

        if (map.containsKey(compound))
        {
          CompoundModel newRoot = (CompoundModel) map.get(compound);

          if (node instanceof Compartment)
          {
            Compartment orig = (Compartment) node;
            map.put(orig, new Compartment(orig, newRoot));
View Full Code Here

TOP

Related Classes of org.gvt.model.CompoundModel

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.