Package org.gvt.model.biopaxl2

Examples of org.gvt.model.biopaxl2.Control


  public CTabItem createNewTab(CompoundModel root)
  {
    if (root == null)
    {
      root = new BioPAXL2Graph();
    }
    root.setAsRoot();

    String name;
View Full Code Here


      if (model != null)
      {
        BioPAXLevel level = model.getLevel();
        if (level == BioPAXLevel.L2)
        {
          root = new BioPAXL2Graph(model);
          BioPAXL2Reader reader = new BioPAXL2Reader(model);
          reader.createGraph((BioPAXL2Graph) root);
        }
        else if (level == BioPAXLevel.L3)
        {
View Full Code Here

        for (String selected : selectionResult)
        {
          //search among all sourceAddedCompartments
          for (int j = 0 ; j < sourceAddedCompartments.size() ; j++)
          {
            Compartment compartment = sourceAddedCompartments.get(j);

            //if corresponding compartment is found
            if (selected != null &&
              selected.equals(compartment.getName()))
            {
              //remove compartment from sourceAddedCompartments ArrayList
              sourceAddedCompartments.remove(j);

              //remove compartment name from source compartment list
              entityList.remove(selected);
            }
          }
         }
      }
    });

    //Target add button

    targetAddButton = new Button(shell, SWT.NONE);
    targetAddButton.setText("Add...");
    gridData = new GridData(GridData.END, GridData.BEGINNING, true, false);
    gridData.minimumWidth = 100;
    gridData.horizontalIndent = 5;
    targetAddButton.setLayoutData(gridData);
    targetAddButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent arg0)
      {
        //new addCompartmentDialog
        AddCompartmentDialog addCompartment =
          new AddCompartmentDialog(new Shell(), allCompartments);

        //open dialog
        boolean addPressed = addCompartment.open();

        //if add button is pressed
        if (addPressed)
        {
          //for each selected compartment
          for (Compartment compartment :
            addCompartment.getSelectedCompartments())
          {
            //check if compartment has been added before
            if (!previouslyAdded(compartment, targetAddedCompartments))
            {
              //add compartment name to target compartment list
              targetCompartmentList.add(compartment.getName());

              //add compartment to targetAddedCompartments ArrayList
              targetAddedCompartments.add(compartment);
            }
          }
        }
      }
    });

    //Target remove button

    targetRemoveButton = new Button(shell, SWT.NONE);
    targetRemoveButton.setText("Remove");
    gridData = new GridData(GridData.BEGINNING, GridData.BEGINNING,
      true, false);
    gridData.horizontalIndent = 5;
    gridData.minimumWidth = 100;
    targetRemoveButton.setLayoutData(gridData);
    targetRemoveButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent arg0)
      {
        String[] selectionResult = targetCompartmentList.getSelection();

        //for each selected string
        for (String selected : selectionResult)
        {
          //search among all targetAddedCompartments
          for (int j = 0 ; j < targetAddedCompartments.size() ; j++)
          {
            Compartment compartment = targetAddedCompartments.get(j);

            //if corresponding compartment is found
            if (selected != null &&
              selected.equals(compartment.getName()))
            {
              //remove compartment from targetAddedCompartments ArrayList
              targetAddedCompartments.remove(j);

              //remove compartment name from target compartment list
View Full Code Here

        Actor act = (Actor) obj;
        entity = act.getEntity();
      }
      else if (obj instanceof Complex)
      {
        Complex com = (Complex) obj;
        entity = com.getEntity();
      }
      else
      {
        entity = null;
      }
View Full Code Here

          related.addAll(node.getUpstream());
          related.addAll(node.getDownstream());

          if (node instanceof ComplexMember)
          {
            Complex cmp = ((ComplexMember) node).getParentComplex();
            related.addAll(cmp.getUpstream());
            related.addAll(cmp.getDownstream());
          }
        }
      }

      BioPAXGraph graph = main.getRootGraph().excise(related);
View Full Code Here

      for (GraphObject go : content)
      {
        if (go instanceof Conversion)
        {
          Conversion conv = (Conversion) go;
          conversion cnv = conv.getConversion();
          convSet.add(cnv);
        }
      }

      Set<pathwayComponent> components = l2p.getPATHWAY_COMPONENTS();

      for (conversion cnv : convSet)
      {
        if (!components.contains(cnv))
        {
          l2p.addPATHWAY_COMPONENTS(cnv);
        }
      }
    }
    else if (l3p != null)
    {
      for (Process pc : new HashSet<Process>(l3p.getPathwayComponent()))
      {
        l3p.removePathwayComponent(pc);
      }

      Set<org.biopax.paxtools.model.level3.Conversion> convSet =
        new HashSet<org.biopax.paxtools.model.level3.Conversion>();

      for (GraphObject go : content)
      {
        if (go instanceof ChbConversion)
        {
          ChbConversion conv = (ChbConversion) go;
          org.biopax.paxtools.model.level3.Conversion cnv = conv.getConversion();
          convSet.add(cnv);
        }
      }

      Set<Process> components = l3p.getPathwayComponent();
View Full Code Here

      for (GraphObject go : withContent)
      {
        if (go instanceof Conversion)
        {
          Conversion conv = (Conversion) go;
          conversion cnv = conv.getConversion();
          convSet.add(cnv);
        }
      }

      Set<pathwayComponent> components = p.getPATHWAY_COMPONENTS();
View Full Code Here

    Map<Integer, Color> highlightMap = new HashMap<Integer, Color>();

    for (Object o : graph.getNodes())
    {
      IBioPAXNode node = (IBioPAXNode) o;
      if (node.isHighlighted())
      {
        highlightMap.put(node.getIDHash(), node.getHighlightColor());
      }
    }

    for (Object o : graph.getEdges())
    {
      BioPAXEdge edge = (BioPAXEdge) o;
      if (edge.isHighlighted())
      {
        highlightMap.put(edge.getIDHash(), edge.getHighlightColor());
      }
    }

    // Reset highlight

    HighlightLayer hLayer = (HighlightLayer)
      ((ChsScalableRootEditPart) viewer.getRootEditPart()).getLayer(
        HighlightLayer.HIGHLIGHT_LAYER);

    hLayer.removeAll();
    hLayer.highlighted.clear();

    viewer.deselectAll();

    // Record layout
    graph.recordLayout();

    // Create updated graph
    pathway p = graph.getPathway();
    BioPAXGraph newGraph = main.getRootGraph().excise(p);
    newGraph.setName(p.getNAME());
    newGraph.setAsRoot();

    // Replace the graph
    viewer.setContents(newGraph);

    // Use same layout
    boolean layedout = newGraph.fetchLayout();

    if (!layedout)
    {
      new CoSELayoutAction(main).run();
    }

    viewer.deselectAll();
    GraphAnimation.run(viewer);

    // Recover highlights

    for (Object o : newGraph.getNodes())
    {
      IBioPAXNode node = (IBioPAXNode) o;
      if (highlightMap.containsKey(node.getIDHash()))
      {
        node.setHighlightColor(highlightMap.get(node.getIDHash()));
        node.setHighlight(true);
      }
    }

    for (Object o : newGraph.getEdges())
    {
View Full Code Here

    Map<Integer, Color> highlightMap = new HashMap<Integer, Color>();

    for (Object o : graph.getNodes())
    {
      IBioPAXNode node = (IBioPAXNode) o;
      if (node.isHighlighted())
      {
        highlightMap.put(node.getIDHash(), node.getHighlightColor());
      }
    }

    for (Object o : graph.getEdges())
    {
      BioPAXEdge edge = (BioPAXEdge) o;
      if (edge.isHighlighted())
      {
        highlightMap.put(edge.getIDHash(), edge.getHighlightColor());
      }
    }

    // Reset highlight

    HighlightLayer hLayer = (HighlightLayer)
      ((ChsScalableRootEditPart) viewer.getRootEditPart()).getLayer(
        HighlightLayer.HIGHLIGHT_LAYER);

    hLayer.removeAll();
    hLayer.highlighted.clear();

    viewer.deselectAll();

    // Record layout
    graph.recordLayout();

    // Create updated graph
    pathway p = graph.getPathway();

    // Update pathway components if update needed

    if (withContent != null)
    {
      for (pathwayComponent pc : new HashSet<pathwayComponent>(p.getPATHWAY_COMPONENTS()))
      {
        p.removePATHWAY_COMPONENTS(pc);
      }
     
      Set<conversion> convSet = new HashSet<conversion>();

      for (GraphObject go : withContent)
      {
        if (go instanceof Conversion)
        {
          Conversion conv = (Conversion) go;
          conversion cnv = conv.getConversion();
          convSet.add(cnv);
        }
      }

      Set<pathwayComponent> components = p.getPATHWAY_COMPONENTS();

      for (conversion cnv : convSet)
      {
        if (!components.contains(cnv))
        {
          p.addPATHWAY_COMPONENTS(cnv);
        }
      }
    }

    // Excise pathway

    BioPAXGraph newGraph = main.getRootGraph().excise(p);
    newGraph.setName(p.getNAME());
    newGraph.setAsRoot();

    // Replace the graph
    viewer.setContents(newGraph);

    // Use same layout
    boolean layedout = newGraph.fetchLayout();

    if (!layedout)
    {
      new CoSELayoutAction(main).run();
    }

    viewer.deselectAll();
    GraphAnimation.run(viewer);

    // Recover highlights

    for (Object o : newGraph.getNodes())
    {
      IBioPAXNode node = (IBioPAXNode) o;
      if (highlightMap.containsKey(node.getIDHash()))
      {
        node.setHighlightColor(highlightMap.get(node.getIDHash()));
        node.setHighlight(true);
      }
    }

    for (Object o : newGraph.getEdges())
    {
View Full Code Here

TOP

Related Classes of org.gvt.model.biopaxl2.Control

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.