Package org.gvt.model

Examples of org.gvt.model.BioPAXGraph


    item.setBackground(1, ChisioMain.higlightColor);
  }

  private void prepareForBioPAXGraph()
  {
    BioPAXGraph graph = (BioPAXGraph) model;

    for (String[] property : graph.getInspectable())
    {
      addRow(table, property[0]).setText(1, property[1]);
    }
    table.getColumn(1).pack();
    table.pack();
View Full Code Here


  }

  public void run()
  {
    ScrollingGraphicalViewer viewer = main.getViewer();
    BioPAXGraph pathwayGraph = main.getPathwayGraph();

    if (pathwayGraph == null)
    {
      MessageDialog.openError(main.getShell(), "Error!", "No BioPAX pathway.");
      return;
    }

    if (viewer != null)
    {
      BioPAXGraph original = (BioPAXGraph) viewer.getContents().getModel();

      if (!original.isMechanistic())
      {
        MessageDialog.openError(main.getShell(), "Not Supported!",
          "Duplication is supported only in mechanistic views.");

        return;
      }

      original.recordLayout();

      PathwayHolder p = original.getPathway();
      BioPAXGraph graph = main.getRootGraph().excise(p);
      graph.setPathway(null);

      String name = p.getName();

      // If the name contains a copy number at the end (like "pathway name (2)"), remove it

      if (name.indexOf(" ") > 0)
      {
        String last = name.substring(name.lastIndexOf(" ") + 1);
        if (last.indexOf("(") == 0 && last.indexOf(")") == last.length() - 1)
        {
          boolean isdigit = true;
          for (int i = 1; isdigit && i < last.length() - 1; i++)
          {
            isdigit = Character.isDigit(last.charAt(i));
          }

          if (isdigit) name = name.substring(0, name.lastIndexOf(" "));
        }
      }

      graph.setName(name);
      main.createNewTab(graph);
      graph.fetchLayout(original.getPathwayRDFID());
    }
  }
View Full Code Here

      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

          }
        }
      }
    }

    BioPAXGraph excised = excise(set);
    excised.setName(p.getName());
    excised.setPathway(p);

    return excised;
  }
View Full Code Here

          }
        }
      }
    }

    BioPAXGraph excised = excise(set);
    excised.setName(p.getName());
    excised.setPathway(p);

    return excised;
  }
View Full Code Here

    this.entities = new HashSet<EntityHolder>(entities);
  }

  public void run()
  {
    BioPAXGraph root = main.getRootGraph();

    if (root == null)
    {
      MessageDialog.openError(main.getShell(), "Error!", "No BioPAX model.");
      return;
    }

    // If no enitty list is given, then fetch from selected graph

    if (entities == null)
    {
      entities = new HashSet<EntityHolder>();

      if (main.getViewer() != null)
      {
        for (Object o : main.getSelectedModel())
        {
          if (o instanceof EntityAssociated)
          {
            entities.add(((EntityAssociated) o).getEntity());
          }
        }
      }
    }

    // Still no entity? Then open the list of entities and make user to select

    // Prepare data structures to access entities

    Map<EntityHolder, List<Node>> entityToNodeMap = root.getEntityToNodeMap();

    if (entities.isEmpty())
    {
      List<String> allEntityNames = new ArrayList<String>();
      Map<String, EntityHolder> nametoEntityMap = new HashMap<String, EntityHolder>();

      for (EntityHolder eh : entityToNodeMap.keySet())
      {
        String name = eh.getName();

        assert name != null;

        nametoEntityMap.put(name, eh);
        allEntityNames.add(name);
      }

      List<String> userSelection = new ArrayList<String>();

      ItemSelectionDialog dialog = new ItemSelectionDialog(main.getShell(), 350,
        "Entity Selection Dialog",
        "Select entities whose neighborhood is to be found",
        allEntityNames,
        userSelection,
        true, true, null);

      dialog.setMinValidSelect(1);
      dialog.setDoSort(true);
      dialog.open();

      if (!dialog.isCancelled())
      {
        for (String s : userSelection)
        {
          entities.add(nametoEntityMap.get(s));
        }
      }
    }

    if (!entities.isEmpty())
    {
      List<GraphObject> related = new ArrayList<GraphObject>();

      for (EntityHolder pe : entities)
      {
        for (Node node : entityToNodeMap.get(pe))
        {
          related.add(node);

          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);

      String name = "Neighborhood of";

      for (EntityHolder entity : entities)
      {
        name += " " + entity.getName();
      }

      graph.setName(name);

      main.createNewTab(graph);

      new CoSELayoutAction(main).run();

      // Highlight the source set of nodes
      graph.hihglightRelatedNodes(entities);
    }

    this.entities = null;
  }
View Full Code Here

      {
        Object o = viewer.getContents().getModel();

        if (o instanceof BioPAXGraph)
        {
          BioPAXGraph graph = (BioPAXGraph) o;
          if (graph.isMechanistic())
          {
            graph.recordLayout();
          }
        }
      }

      BioPAXIOHandler exporter = new SimpleIOHandler(main.getOwlModel().getLevel());
View Full Code Here

      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(): new BioPAXReader(model);
          root = (BioPAXGraph) reader.readXMLFile(xmlfile);
        }

        if (root != null)
        {
          if (!root.modelConstainsPathway() || pathwayName != null)
          {
            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

    this.main = main;
  }

  public void run()
  {
    BioPAXGraph graph = main.getPathwayGraph();

    if (graph == null)
    {
      MessageDialog.openError(main.getShell(), "Error!", "No BioPAX pathway.");
      return;
    }

    if (!graph.isMechanistic())
    {
      MessageDialog.openError(main.getShell(), "Not Supported!",
        "Cropping is supported only for mechanistic views.");

      return;
    }

    Set<GraphObject> cropto = new HashSet<GraphObject>();

    for (Object o : graph.getNodes())
    {
      NodeModel node = (NodeModel) o;
      if (node.isHighlight())
      {
        cropto.add((GraphObject) node);
      }
    }

    for (Object o : graph.getEdges())
    {
      EdgeModel edge = (EdgeModel) o;
      if (edge.isHighlight())
      {
        cropto.add((GraphObject) edge);
      }
    }

    if (cropto.isEmpty())
    {
      MessageDialog.openError(main.getShell(), "Error!",
        "Nothing is highlighted.");
      return;     
    }

    BioPAXGraph excised = graph.excise(cropto, true);
    excised.setName(graph.getName() + " cropped");

    main.createNewTab(excised);
    new CoSELayoutAction(main).run();
    excised.recordLayout();
  }
View Full Code Here

    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

TOP

Related Classes of org.gvt.model.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.