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