completely delete a node programmatically

79 views
Skip to first unread message

Michael Zimmermann

unread,
Sep 18, 2012, 12:47:50 PM9/18/12
to cytoscape...@googlegroups.com
I would like to add/delete nodes based on user interaction with a given network. Adding is working fine with the following type of api call:
 
CyNode ntmp = Cytoscape.getCyNode(NewNodeID, true);
current_network.addNode(ntmp);
 
However, when I want to delete a node using:
 
current_network.removeNode(clickedNode.getRootGraphIndex(), true);
 
and later call:
 
List<Node> nodeList = Cytoscape.getCyNodesList();
 
the "removed" node is still found in nodeList. Do I need to somehow refresh the network between removeNode() and getCyNodeList() for it to register the removal? Or is there a different api call for total removal? The documentation found here makes it sound like removeNode() is what I want...
 
P.S. is this type of question most appropriate for here or the developer's list?
 

Jason Montojo

unread,
Sep 18, 2012, 12:54:31 PM9/18/12
to cytoscape...@googlegroups.com
Hi Michael,

Cytoscape.getCyNodesList() returns a list of all nodes in the root network, which contains all nodes and edges from all networks in Cytoscape.  If you delete a node from a particular network that isn't the root network, it will only be deleted from that network.  To delete a node from the root network, use this:


Hope this helps,
Jason

 

--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/cytoscape-helpdesk/-/I8tKBwCbHFAJ.
To post to this group, send email to cytoscape...@googlegroups.com.
To unsubscribe from this group, send email to cytoscape-helpd...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cytoscape-helpdesk?hl=en.

Michael Zimmermann

unread,
Sep 18, 2012, 2:34:54 PM9/18/12
to cytoscape...@googlegroups.com
I see, thank you Jason. I just want to loop through the nodes in the present network. Is there an analogous method to getCyNodeList() that only applies to the curent network?
 
Otherwise, I could use a hand with the initilization for accessing the rootGraph. From the link you sent, I would expect to do:
CytoscapeRootGraph rootGraph = Cytoscape.getRootGraph();
but I get "cannot find symbol" error - Do I need to import another class? It looks like this should be a method of cytoscape.Cytoscape.
 
I also tried other variantions like:
CytoscapeRootGraph rootGraph = Cytoscape.getCurrentNetwork().getRootGraph();
but haven't figured it out...
 

On Tuesday, September 18, 2012 11:54:32 AM UTC-5, Jason Montojo wrote:
Reply all
Reply to author
Forward
0 new messages