How to get all the nodes with a specific value?

31 views
Skip to first unread message

karabulu...@gmail.com

unread,
Jul 12, 2017, 2:06:03 AM7/12/17
to cytoscape...@googlegroups.com
Hello,

I am just began to develop cytoscape plugin. I am trying to hide all nodes which has "pronaliz:status" statement in its "shared name" column. I saw the link below and i tryed it but could not make it. It is not hiding any node.


Here is my code. I am just warming up to Cytoscape classes and methods. Anyone can help me please?

public void actionPerformed(ActionEvent e){
    final CyApplicationManager manager = adapter.getCyApplicationManager();
    final CyNetworkView networkView = manager.getCurrentNetworkView();
    final CyNetwork network = networkView.getModel();
    final CyTable table = network.getDefaultNodeTable();

    Set<CyNode> nodes;
    nodes=getNodesWithValue(network,table,"shared name",":status");


    for(CyNode node: nodes){
        networkView.getNodeView(node).setVisualProperty(BasicVisualLexicon.NODE_VISIBLE, false);
    }

    networkView.updateView();
}

private static Set<CyNode> getNodesWithValue(final CyNetwork net, final CyTable table, final String colname, final Object value) {
    final Collection<CyRow> matchingRows = table.getMatchingRows(colname, value);
    final Set<CyNode> nodes = new HashSet<CyNode>();
    for (final CyRow row : matchingRows)
    {
        final CyNode node = row.get("shared name",CyNode.class);
        nodes.add(node);
    }
    return nodes;
}

Scooter Morris

unread,
Jul 13, 2017, 11:15:57 AM7/13/17
to cytoscape-helpdesk
Cross-posted to cytoscape-app-dev -- answered there.

-- scooter
Reply all
Reply to author
Forward
0 new messages