Delete/Clear nodes from node table.

1,064 views
Skip to first unread message

Victor Lopez

unread,
Jul 29, 2013, 4:05:07 PM7/29/13
to cytoscape...@googlegroups.com
Hi Everyone,

I'm having a hard time trying to figure this out.

I'm writing a plugin that involves getting data from a database and then expand/refresh the current graph.
Each time I fetch data I wish to clean the current view/network and refresh it with some data.

The problem is that entries on the Node table start to duplicate each time I perform an operation.

I've tried:

         CyRootNetwork rootNet = adapter.getCyRootNetworkManager().getRootNetwork(network);

         List<Long> pKeys = new ArrayList<>();
           
         for(CyNode n : this.network.getNodeList()){
             pKeys.add(n.getSUID());
         }
        
          this.network.removeEdges(this.network.getEdgeList());
          this.network.removeNodes(this.network.getNodeList());
          rootNet.removeNodes(rootNet.getNodeList());
          rootNet.removeEdges(rootNet.getEdgeList());
          this.network.getDefaultNodeTable().deleteRows(pKeys);

          // Build network from database query


When I debug the code I can see all that the count of those lists and tables is set to 0 before adding the new ones, however the corresponding table on the UI shows the previous elements and the new ones.
It's like those elements were not erased form the table. So each time I perform an operation the table grows and grows.

How can I effectively erase the nodes from the node table?
Or is this the wrong strategy? Should I "refresh" the view in some other way?


Thank you,

Victor



 

Victor Lopez

unread,
Jul 31, 2013, 1:12:25 PM7/31/13
to cytoscape...@googlegroups.com
Update:

I added this line:

 rootNet.getSharedNodeTable().deleteRows(pKeys);

The rows are still there but all the values of those rows are now blank only the SUID remains. Is this a bug?

Jason Montojo

unread,
Jul 31, 2013, 1:36:56 PM7/31/13
to cytoscape...@googlegroups.com
Hi Victor,

As strange as it may seem, that behaviour is by design.  CyRows aren't deleted from node and edge tables unless the corresponding CyNodes and CyEdges have been deleted from the CyRootNetwork.  Deleting a node/edge from a CySubNetwork won't remove it from the CyRootNetwork, but deleting it from the CyRootNetwork will delete it from all its CySubNetworks.

Hope this helps,
Jason


--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.
To post to this group, send email to cytoscape...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-helpdesk.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Scooter Morris

unread,
Jul 31, 2013, 3:07:13 PM7/31/13
to cytoscape...@googlegroups.com
Hi Victor,
    So, I see you are deleting the nodes from the root network -- my guess is that the facade table (an internal implementation detail) isn't cleaning up when the underlying nodes are deleted.  Here is a different approach that *should* get you going again.  First, get the root network for the network you are looking at.  Then, remove your network from that root.  Now, delete all of the nodes and edges. in the root.  When you want to get new data, create a new subnetwork for your data (CyRootNetwork.addNetwork(Iterable<CyNode> nodes, Iterable<CyEdge> edges).  That *should* give you a clean network.

-- scooter

Jason Montojo

unread,
Jul 31, 2013, 4:20:21 PM7/31/13
to cytoscape...@googlegroups.com
Sorry about that!  I didn't look at your first post carefully enough.  I didn't realize you already are removing those nodes from the CyRootNetwork.  So yes, what you're seeing is a bug.

I've created a ticket for it here so you can track the progress.  It will be fixed for the 3.1 release.


Thanks,
Jason

Jason Montojo

unread,
Jul 31, 2013, 7:30:34 PM7/31/13
to cytoscape...@googlegroups.com
Hi Victor,

What version of Cytoscape are you using?  I can't reproduce this in 3.1-SNAPSHOT (i.e. latest sources in "develop" branch).

Thanks,
Jason

Victor Lopez

unread,
Aug 1, 2013, 11:45:25 AM8/1/13
to cytoscape...@googlegroups.com
I'm using 3.0.1.

Here is a screenshot of the bug.

http://i.imgur.com/BSWsWxm.jpg


Before I added this line:

rootNet.getSharedNodeTable().deleteRows(pKeys);

Instead of blank rows I would see duplicated rows but with some attribures missing.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpdesk+unsub...@googlegroups.com.

Victor Lopez

unread,
Aug 1, 2013, 1:52:36 PM8/1/13
to cytoscape...@googlegroups.com
@Jason

I've just downloaded the 3.0.2 version released today and It seems that the problem is gone. 

Jason Montojo

unread,
Aug 1, 2013, 1:58:51 PM8/1/13
to cytoscape...@googlegroups.com
Hi Victor,

Great to hear!  Thanks for letting us know!

Jason


To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.

Liat Rudner

unread,
Mar 29, 2014, 5:44:49 AM3/29/14
to cytoscape...@googlegroups.com
Hey!

I also tried to delete the rows of deleted nodes (I did it from AboutToRemoveNodesListener) and got the same problem - the rows of the deleted nodes were blank and only the SUID stayed there.
The cytoscape version I'm using is 3.1

I guess that it's not the best way to handle the deleted nodes.
If so, is there a way to know whether a node was deleted from the network view without having to delete it's corresponding row from the current table?

Thanks,
Liat

Liat Rudner

unread,
May 2, 2014, 5:05:40 AM5/2/14
to cytoscape...@googlegroups.com
Well, I found out that the answer to my second question is using containsNode function on the current network.

But I'm still trying to figure out what is the best way to keep the table updated with the current network after object deletion?

Thanks again,
Liat

Katherine M

unread,
May 24, 2014, 1:45:05 PM5/24/14
to cytoscape...@googlegroups.com
I seem to be having the same problem. I am trying to create a simple network (no nesting or roots). When I delete a node, the lines remain in the Edge Table (with no information in them).  When I delete an edge, all the information remains in the Edge Table even though the edge itself is gone.

Is it a bug or is there some way to clean up the tables once nodes and/or edges are deleted?

Thanks,
Katherine

Tim Hull

unread,
May 27, 2014, 10:54:37 PM5/27/14
to cytoscape...@googlegroups.com
If you delete a node or edge from a network, it will remain in the network collection (CyRootNetwork). As such, the row will still be in the CyTable. You could manually delete the node/edge and its row from the CyTable of the CyRootNetwork (which you would get using a CyRootNetworkManager), though this can only be done programmatically (not from the user interface).

Hope this helps...

Tim


--
You received this message because you are subscribed to the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.
To post to this group, send email to cytoscape...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-helpdesk.
For more options, visit https://groups.google.com/d/optout.

Scott Needham

unread,
Mar 5, 2015, 12:04:54 PM3/5/15
to cytoscape...@googlegroups.com
We are having similar issues to Katherine. Deleted notes and edges remain in the table. But also any changes to the name of a node are not reflected in the edge table. Exporting the edge table is misleading for any other use as it does not provide a description of the current edges. I have provided a very simple example changing node 3 to be named 4. The exported edge table make no reference of the edge between 2 and 4 and still refers to the now gone 3.

We love Cytoscape for working with an existing graph. It is great for hiding nodes and trimming down a large graph. But with the above issues it is not clear to me how the GUI can be used to alter and update a graph. Unless you ignore the tables, but these are one of our favourite features compared to more pure graph editors.

I don't mean to complain, but wanted to understand whether in future graph edge and node changes would be reflected in the tables (and vice versa eg. edge changes in the table are not reflected in the graph). There may be a good reason why this doesn't occur that we are not aware of. I just wanted to clear this up before giving up and returning to other tools that lack some of Cystoscopes great features.

While we are keen to primarily work with the GUI, we do have some dev resource here. Is there a way to use the scripting or a utility to refresh the node and edge tables to match the graph after making changes and before exporting tables? If so it would be great if you could point us in the right direction or to the right person that would be great.

Thanks in advance

Scott
To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpdesk+unsub...@googlegroups.com.

To post to this group, send email to cytoscape...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-helpdesk.
After changing 3 to 4.JPG
Before.JPG

Scooter Morris

unread,
Mar 5, 2015, 12:15:44 PM3/5/15
to cytoscape...@googlegroups.com
Hi Scott,
   Which version of Cytoscape are you running?  There was a bug in Cytoscape 3.2 that we fixed in 3.2.1.

-- scooter

Scott Needham

unread,
Mar 5, 2015, 9:54:49 PM3/5/15
to cytoscape...@googlegroups.com

Hi Scooter,

 

I’m using 3.2.1.

 

We were having a problem with importing spreadsheets in 3.2.0, but that was fixed in 3.2.1.

 

Thanks, Scott

To unsubscribe from this group and stop receiving emails from it, send an email to cytoscape-helpd...@googlegroups.com.


To post to this group, send email to cytoscape...@googlegroups.com.
Visit this group at http://groups.google.com/group/cytoscape-helpdesk.

For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to a topic in the Google Groups "cytoscape-helpdesk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/cytoscape-helpdesk/1Rt971XFxnE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to cytoscape-helpd...@googlegroups.com.

Scooter Morris

unread,
Mar 5, 2015, 10:11:59 PM3/5/15
to cytoscape...@googlegroups.com
On 03/05/2015 06:54 PM, Scott Needham wrote:

Hi Scooter,

 

I’m using 3.2.1.

 

We were having a problem with importing spreadsheets in 3.2.0, but that was fixed in 3.2.1.

Grrr... I thought we had this fixed in 3.2.1, but I'm still seeing it allso.  I'll take another crack at it...

-- scooter

Scott Needham

unread,
Mar 6, 2015, 12:23:59 AM3/6/15
to cytoscape...@googlegroups.com

Thanks Scooter, I am happy to offer my services as a user tester when the time comes.

Reply all
Reply to author
Forward
0 new messages