private SortedSet<String> getPathwaySetFromEnzymeReactionEdges(CyNetwork network) {
   SortedSet<String> pathwaySet = new TreeSet<String>();
   for (Object edge : network.edgesList()) {
     CyEdge cyEdge = (CyEdge) edge;
     List<?> pathways =
         Attributes.edge.getListAttribute(
             cyEdge.getIdentifier(), EnzymeReactionAttribute.PATHWAYS.toAttributeName());
     if (pathways != null) {
       for (Object pathway : pathways) pathwaySet.add(pathway.toString());
     }
   }
   return pathwaySet;
 }
 private SortedSet<String> getPathwaySetFromReactionEdges(CyNetwork network) {
   SortedSet<String> pathwaySet = new TreeSet<String>();
   for (Object edge : network.edgesList()) {
     CyEdge cyEdge = (CyEdge) edge;
     String pathway =
         Attributes.edge.getStringAttribute(
             cyEdge.getIdentifier(), ReactionAttribute.PATHWAY.toAttributeName());
     if (pathway != null) {
       pathwaySet.add(pathway);
     }
   }
   return pathwaySet;
 }
 private void applySelectionToCompoundNetwork(CyNetwork network, Set<String> selection) {
   Set<CyNode> nodesSet = new HashSet<CyNode>();
   Set<CyEdge> edgesSet = new HashSet<CyEdge>();
   for (Object edge : network.edgesList()) {
     CyEdge cyEdge = (CyEdge) edge;
     String pathway =
         Attributes.edge.getStringAttribute(
             cyEdge.getIdentifier(), ReactionAttribute.PATHWAY.toAttributeName());
     if (pathway != null && selection.contains(pathway)) {
       nodesSet.add((CyNode) cyEdge.getSource());
       nodesSet.add((CyNode) cyEdge.getTarget());
       edgesSet.add(cyEdge);
     }
   }
   network.setSelectedNodeState(nodesSet, true);
   network.setSelectedEdgeState(edgesSet, true);
 }
Exemplo n.º 4
0
 @Override
 public Collection<CyNode> getNeighbours(CyNode node) {
   Collection<CyNode> neighbours = new HashSet<CyNode>();
   CyNetwork network = getProxied();
   int nodeIndex = node.getRootGraphIndex();
   for (int index : network.getAdjacentEdgeIndicesArray(nodeIndex, true, true, true)) {
     CyEdge edge = (CyEdge) network.getEdge(index);
     CyNode other = (CyNode) edge.getSource();
     if (other.getRootGraphIndex() == nodeIndex) {
       other = (CyNode) edge.getTarget();
       if (other.getRootGraphIndex() == nodeIndex) {
         continue;
       }
     }
     neighbours.add((CyNode) other);
   }
   return neighbours;
 }
 private void applySelectionToCGNetwork(CyNetwork network, Set<String> selection) {
   Set<CyNode> nodesSet = new HashSet<CyNode>();
   Set<CyEdge> edgesSet = new HashSet<CyEdge>();
   for (Object edge : network.edgesList()) {
     CyEdge cyEdge = (CyEdge) edge;
     List<?> pathways =
         Attributes.edge.getListAttribute(
             cyEdge.getIdentifier(), EnzymeReactionAttribute.PATHWAYS.toAttributeName());
     for (Object pathway : pathways) {
       if (selection.contains(pathway)) {
         nodesSet.add((CyNode) cyEdge.getSource());
         nodesSet.add((CyNode) cyEdge.getTarget());
         edgesSet.add(cyEdge);
         break;
       }
     }
   }
   network.setSelectedNodeState(nodesSet, true);
   network.setSelectedEdgeState(edgesSet, true);
 }