Package org.gvt.model.biopaxl2

Examples of org.gvt.model.biopaxl2.BioPAXGraph


      for (Object obj : allNodes)
    {
        //get entity of Node
      if (obj instanceof Actor)
      {
        Actor act = (Actor) obj;
        entity = act.getEntity();
      }
      else if (obj instanceof Complex)
      {
        Complex com = (Complex) obj;
        entity = com.getEntity();
View Full Code Here


      }
    }

    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())
    {
      BioPAXEdge edge = (BioPAXEdge) o;
      if (highlightMap.containsKey(edge.getIDHash()))
      {
        edge.setHighlightColor(highlightMap.get(edge.getIDHash()));
        edge.setHighlight(true);
      }
    }
  }
View Full Code Here

      }
    }

    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())
    {
      BioPAXEdge edge = (BioPAXEdge) o;
      if (highlightMap.containsKey(edge.getIDHash()))
      {
        edge.setHighlightColor(highlightMap.get(edge.getIDHash()));
        edge.setHighlight(true);
      }
    }
  }
View Full Code Here

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

    String name;

    if (root instanceof BioPAXGraph)
    {
      BioPAXGraph graph = (BioPAXGraph) root;

      if (graph.isMechanistic() && graph.getPathway() == null)
      {
        pathway p = createNewPathway();
        if (graph.getName() != null)
        {
          p.setNAME(adviceTabName(graph.getName()));
        }
        else
        {
          p.setNAME(adviceTabName(null));
        }
        graph.setName(p.getNAME());

        graph.setName(p.getNAME());
        graph.setPathway(p);
        graph.registerContentsToPathway();
        allPathwayNames.add(p.getNAME());
      }
      else
      {
        graph.setName(graph.getPathway() != null ? graph.getPathway().getNAME() :
          adviceTabName(graph.getName()));
      }

      name = graph.getName();
    }
    else
    {
      name = adviceTabName(null);
    }
View Full Code Here

    ScrollingGraphicalViewer viewer = tabToViewerMap.get(tab);
    CompoundModel root = (CompoundModel) viewer.getContents().getModel();

    if (root instanceof BioPAXGraph)
    {
      BioPAXGraph graph = (BioPAXGraph) root;

      assert graph.getName().equals(tab.getText()) :
        "graph name: " + graph.getName() + " tab name: " + tab.getText();

      if (rememberLayout && graph.isMechanistic())
      {
        graph.recordLayout();
      }
    }
    boolean removed = openTabNames.remove(tab.getText());

    assert removed : "tab name: " + tab.getText();
View Full Code Here


    Object compmod = tabToViewerMap.get(tab).getContents().getModel();
    if (compmod instanceof BioPAXGraph)
    {
      BioPAXGraph graph = (BioPAXGraph) compmod;
      pathway p = graph.getPathway();

      if (p != null)
      {
        p.setNAME(newName);
      }
      graph.setName(newName);
    }
    tab.setText(newName);

    assert nameToTabMap.size() == openTabNames.size();
  }
View Full Code Here

    {
      man.associateExperimentData(rootGraph);

      for (ScrollingGraphicalViewer viewer : tabToViewerMap.values())
      {
        BioPAXGraph graph = (BioPAXGraph) viewer.getContents().getModel();
        man.associateExperimentData(graph);
      }
    }
  }
View Full Code Here

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

    String name;

    if (root instanceof BioPAXGraph)
    {
      BioPAXGraph graph = (BioPAXGraph) root;

      if (graph.isMechanistic() && graph.getPathway() == null)
      {
        pathway p = createNewPathway();
        if (graph.getName() != null)
        {
          p.setNAME(adviceTabName(graph.getName()));
        }
        else
        {
          p.setNAME(adviceTabName(null));
        }
        graph.setName(p.getNAME());

        graph.setName(p.getNAME());
        graph.setPathway(p);
        graph.registerContentsToPathway();
        allPathwayNames.add(p.getNAME());
      }
      else
      {
        graph.setName(graph.getPathway() != null ? graph.getPathway().getNAME() :
          adviceTabName(graph.getName()));
      }

      name = graph.getName();
    }
    else
    {
      name = adviceTabName(null);
    }
View Full Code Here

    ScrollingGraphicalViewer viewer = tabToViewerMap.get(tab);
    CompoundModel root = (CompoundModel) viewer.getContents().getModel();

    if (root instanceof BioPAXGraph)
    {
      BioPAXGraph graph = (BioPAXGraph) root;

      assert graph.getName().equals(tab.getText()) :
        "graph name: " + graph.getName() + " tab name: " + tab.getText();

      if (rememberLayout && graph.isMechanistic())
      {
        graph.recordLayout();
      }
    }
    boolean removed = openTabNames.remove(tab.getText());

    assert removed : "tab name: " + tab.getText();
View Full Code Here


    Object compmod = tabToViewerMap.get(tab).getContents().getModel();
    if (compmod instanceof BioPAXGraph)
    {
      BioPAXGraph graph = (BioPAXGraph) compmod;
      pathway p = graph.getPathway();

      if (p != null)
      {
        p.setNAME(newName);
      }
      graph.setName(newName);
    }
    tab.setText(newName);

    assert nameToTabMap.size() == openTabNames.size();
  }
View Full Code Here

TOP

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

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.