CyTable of network stored in saved session

35 views
Skip to first unread message

Jiao, Dazhi

unread,
Jul 11, 2012, 10:07:35 AM7/11/12
to cytoscap...@googlegroups.com

Hi,

 

I am writing a plugin that requires a table to be attached to a network. It’s a table about CyTable so the unique identifier in this table are table SUIDs. After I created the table and populated the rows, I attach it to a network (app.getTableFactory() returns CyTableFactory, app.getNetworkTableManager() returns CyNetworkTableManager):

 

CyTable table = app.getTableFactory().createTable(“my table”, “Table_ID”, Long.class, true, false)

table.setSavePolicy(SavePolicy.SESSION_FILE);

// create columns and add data

// attach the table to a network

app.getNetworkTableManager().setTable(network, CyTable.class, “my_table”, table);

 

// some where else, retrieve the table

app.getNetworkTableManager().getTable(network, CyTable.class, “my_table”);  // this works before close cy3, but returns null after session saved and then opened in cy3.

 

Then I close cytoscape and save the session. What I expect is that the table is still attached to the network, and I can use the CyNetworkTableManager.getTable and the namespace to retrieve the table. However, after the session file is reopened in cy3, CyNetworkTableManager.getTable(network, CyTable.class, “my_table”);   returns null.

 

Is this the intended behavior or a bug? If it’s intended, any suggestions on how to make the network-table relationship persists?

 

Thank you!

 

Dazhi

Jason Montojo

unread,
Jul 11, 2012, 10:56:33 AM7/11/12
to cytoscap...@googlegroups.com
Hi Dazhi,

You also need to register your table with the CyTableManager.  CyNetworkTableManager just maintains network-table relationships.  CyTableManager takes care of the CyTable lifecycle:


Hope this helps,
Jason

--
You received this message because you are subscribed to the Google Groups "cytoscape-discuss" group.
To post to this group, send email to cytoscap...@googlegroups.com.
To unsubscribe from this group, send email to cytoscape-disc...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cytoscape-discuss?hl=en.

Jiao, Dazhi

unread,
Jul 11, 2012, 11:43:08 AM7/11/12
to cytoscap...@googlegroups.com

Hi, Jason,

 

Thanks for the reply. But I actually added the table using the CyTableManager. After I open the session, I can see the table in the Table panel on the bottom of  Cy3 window. However, it’s not linked to the network.

 

Dazhi

Jason Montojo

unread,
Jul 11, 2012, 11:51:14 AM7/11/12
to cytoscap...@googlegroups.com
Hi Dazhi,

I just noticed that one of the parameters you're passing to CyNetworkTableManager.setTable() isn't right.  The second parameter has to be CyNetwork.class, CyNode.class, or CyEdge.class, to indicate a network, node, or edge table.

Hope this helps,
Jason

Jiao, Dazhi

unread,
Jul 11, 2012, 9:11:35 PM7/11/12
to cytoscap...@googlegroups.com

Hi, Jason,

 

Thanks for clarify that. I actually intentionally created this table to store some meta data of tables. The relationship between network and all my other tables (for CyNode.class type) can persist in the reopened session file, just as you said. But the relationship between the network and this table (for CyTable.class type) is lost in the saved session.

 

Is there any suggestion on how to store some metadata about tables when saving the session?

 

Thanks!

 

Da

Jason Montojo

unread,
Jul 18, 2012, 2:36:50 PM7/18/12
to cytoscap...@googlegroups.com
Hi Dazhi,

Sorry for the slow reply.  Right now, the only way to store generic tables in the session is by adding a global table; i.e. a table that's registered with CyTableManager but isn't associated with any networks.  Of course, the problem with this approach is that your table is no longer associated with any particular network.  What sort of metadata are you storing about your tables?

Thanks,
Jason
Reply all
Reply to author
Forward
0 new messages