public class CytoscapeUtils extends Object
Constructor and Description |
---|
CytoscapeUtils() |
Modifier and Type | Method and Description |
---|---|
static Set<org.cytoscape.model.CyNode> |
getNodesWithValue(org.cytoscape.model.CyNetwork net,
org.cytoscape.model.CyTable table,
String colname,
Object value)
From the APP Developer Cookbook:
Get all the nodes with a given attribute value.
|
public static Set<org.cytoscape.model.CyNode> getNodesWithValue(org.cytoscape.model.CyNetwork net, org.cytoscape.model.CyTable table, String colname, Object value)
CyTable.getMatchingRows(java.lang.String, java.lang.Object)
.
It converts the table's primary keys (assuming they are node SUIDs) back to
nodes in the network.
Here is an example of using this method to find all nodes with a given name:
CyNetwork net = ...;
String nodeNameToSearchFor = ...;
Set<CyNode> nodes = getNodesWithValue(net, net.getDefaultNodeTable(), "name", nodeNameToSearchFor);
// nodes now contains all CyNodes with the name specified by nodeNameToSearchFor
net
- The network that contains the nodes you are looking for.table
- The node table that has the attribute value you are looking for;
the primary keys of this table must be SUIDs of nodes in net
.colname
- The name of the column with the attribute valuevalue
- The attribute valueCyNode
s with a matching value, or an empty set if no nodes match.Copyright © 2018. All rights reserved.