Examples of BioPAXGraph


Examples of org.gvt.model.biopaxl2.BioPAXGraph

    if (main.getViewer() == null)
    {
      return;
    }

    BioPAXGraph graph = main.getPathwayGraph();

    if (graph == null)
    {
      MessageDialog.openError(main.getShell(), "Not applicable!",
        "This feature works only for process views.");
View Full Code Here

Examples of org.gvt.model.biopaxl2.BioPAXGraph

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

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

      if (graph.isMechanistic())
      {
        graph.forgetLayout();
        Model model = graph.getBiopaxModel();
        pathway p = graph.getPathway();
        model.remove(p);

        main.getAllPathwayNames().remove(p.getNAME());
      }
    }
View Full Code Here

Examples of org.gvt.model.biopaxl2.BioPAXGraph

  }

  // Replace graph
  private void updateViewerContent(ScrollingGraphicalViewer viewer)
  {
    BioPAXGraph graph = (BioPAXGraph) viewer.getContents().getModel();

    // Updating is supported only for mechanistic views
    if (!graph.isMechanistic()) return;

    // Remember highlighted object's original nodes (members of chisio root graph)

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

Examples of org.gvt.model.biopaxl2.BioPAXGraph

    }
  }

  private void updateRoot()
  {
    BioPAXGraph root = (BioPAXGraph) new BioPAXReader(main.getOwlModel()).readXMLFile(null);
    main.setRootGraph(root);
  }
View Full Code Here

Examples of org.gvt.model.biopaxl2.BioPAXGraph

      main.lockWithMessage("Saving ...");

      // Record layout of all views
      for (ScrollingGraphicalViewer viewer : main.getTabToViewerMap().values())
      {
        BioPAXGraph graph = (BioPAXGraph) viewer.getContents().getModel();
        if (graph.isMechanistic())
        {
          graph.recordLayout();
        }
      }

      JenaIOHandler jenaIOHandler = main.getJenaIOHandler();
View Full Code Here

Examples of org.gvt.model.biopaxl2.BioPAXGraph

      result = main.getPathwayGraph().getCorrespMember(result);
    }
    //if result should be viewed in New View
    else
    {
      BioPAXGraph pathwayGraph = main.getRootGraph().excise(result);
      pathwayGraph.setName(query);
      main.createNewTab(pathwayGraph);
      new CoSELayoutAction(main).run();

      result = pathwayGraph.getCorrespMember(result);
    }

    //highlight result GraphObjects
    for (GraphObject go : result)
    {
View Full Code Here

Examples of org.gvt.model.biopaxl2.BioPAXGraph

    }
  }

  private void calculateAverageNodeDegree()
  {
    BioPAXGraph graph = main.getRootGraph();

    int totalDegree = 0;
    int nodeCounted = 0;

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

      if (node instanceof ComplexMember ||
        node instanceof Compartment ||
View Full Code Here

Examples of org.gvt.model.biopaxl2.BioPAXGraph

      try
      {
        main.lockWithMessage("Loading BioPAX model ...");

        BioPAXGraph root = this.graph;

        if (root == null)
        {
          File xmlfile = filename == null ? null : new File(filename);
          BioPAXReader reader = model == null ?
            new BioPAXReader(main.getJenaIOHandler()): new BioPAXReader(model);
          root = (BioPAXGraph) reader.readXMLFile(xmlfile);
        }

        if (root != null)
        {
          if (!root.modelConstainsPathway())
          {
            String name = pathwayName == null ? filename : pathwayName;

            if (name != null)
            {
              if (name.contains("\\"))
              {
                name = name.substring(name.lastIndexOf("\\") + 1);
              }
              else if (name.contains("/"))
              {
                name = name.substring(name.lastIndexOf("/") + 1);
              }

              if (name.contains("."))
              {
                name = name.substring(0, name.lastIndexOf("."));
              }
            }
            else
            {
              name = "Auto-created Pathway";
            }
            root.createGlobalPathway(name);
            pathwayName = name;
            main.getAllPathwayNames().add(pathwayName);
          }

          main.closeAllTabs(false);
View Full Code Here

Examples of org.gvt.model.biopaxl2.BioPAXGraph

  }

  // Replace graph
  private void updateViewerContent(ScrollingGraphicalViewer viewer)
  {
    BioPAXGraph graph = (BioPAXGraph) viewer.getContents().getModel();

    // Updating is supported only for mechanistic views
    if (!graph.isMechanistic()) return;

    // Remember highlighted object's original nodes (members of chisio root graph)

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

Examples of org.gvt.model.biopaxl2.BioPAXGraph

    }
  }

  private void updateRoot()
  {
    BioPAXGraph root = (BioPAXGraph) new BioPAXReader(main.getOwlModel()).readXMLFile(null);
    main.setRootGraph(root);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.