Sessions

22 views
Skip to first unread message

Neil Dhruva

unread,
Jul 5, 2012, 11:42:42 AM7/5/12
to cytoscap...@googlegroups.com
Hi all,

I am creating a CyTable and attaching it to a network using the setTable(CyNetwork network, Class<? extends CyIdentifiable> type, String namespace, CyTable table) method of CyNetworkTableManager. I am storing some information in this CyTable. I have a few doubts regarding this:
  1. What is the function of  Class<? extends CyIdentifiable> type in the setTable() method above?
  2. How is the String namespace in the setTable() method above different from String title in the createTable(String title, String primaryKey, Class<?> primaryKeyType, boolean pub, boolean isMutable) method of CyTableFactory?
  3. Also, I want to preserve information in my custom CyTable attached to the network across sessions. How do I go about that? I noticed that there is a sample app for sessions in the 'Samples' directory and the description is here [1]. Is this the only approach? Or is there a way to store my CyTable in the .cys file which stores the session or some other way entirely?

Thanks,
Neil


References:

Jason Montojo

unread,
Jul 5, 2012, 4:25:28 PM7/5/12
to cytoscap...@googlegroups.com
Hi Neil,

  1. What is the function of  Class<? extends CyIdentifiable> type in the setTable() method above?
CyNetworkTableManager lets you associate tables with networks.  The "type" parameter in setTable() determines whether the table will be a network-, node-, or edge-specific table.  This means the primary key of the table will be network, node, or edge SUIDs, respectively.  Right now, it's not possible to associate an arbitrary table with a network (i.e. tables where the primary key doesn't correspond to SUIDs of networks, nodes, or edges).
  1. How is the String namespace in the setTable() method above different from String title in the createTable(String title, String primaryKey, Class<?> primaryKeyType, boolean pub, boolean isMutable) method of CyTableFactory?
A network's tables are organized by namespace.  The tables displayed by the table browser have the namespace CyNetwork.DEFAULT_ATTRS.  Networks also have tables in the namespace CyNetwork.HIDDEN_ATTRS.  These are internal identifiers that the user will likely never see.  A network can only have one table for each (type, namespace) pair; e.g. a network can only have one CyNode table in the CyNetwork.DEFAULT_ATTRS namespace.
  1. Also, I want to preserve information in my custom CyTable attached to the network across sessions. How do I go about that? I noticed that there is a sample app for sessions in the 'Samples' directory and the description is here [1]. Is this the only approach? Or is there a way to store my CyTable in the .cys file which stores the session or some other way entirely?
All you need to do is register your table with CyTableManager.  That will ensure your CyTable will get stored in the .cys file.

Hope this helps!
Jason

Neil Dhruva

unread,
Jul 7, 2012, 3:10:44 AM7/7/12
to cytoscap...@googlegroups.com
Hi Jason,

Thanks a lot for the help. I'll post again if I have more questions.

Thanks,
Neil

--
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.

Neil Dhruva

unread,
Aug 4, 2012, 2:16:54 PM8/4/12
to cytoscap...@googlegroups.com
Hi Jason,

I was able to save CyTables across sessions by associating them with a CyNetwork using the CyNetworkTableManager along with a CyTableManager. Is there a way to save a CyTable using only CyTableManager, ie, without associating it with a CyNetwork? This would be useful when there are standalone CyTables that are not attached to a CyNetwork.
What I did was:
        cyNetworkTableMgr.setTable(CyNetwork, CyNetwork.class, "Table Title", myCyTable);
        cyTableManager.addTable(myCyTable);
However, I am now trying to implement something like this:
        cyTableManager.addTable(myCyTable);
        myCyTable.setSavePolicy(SavePolicy.SESSION_FILE);

Is this the right approach?

Thanks,
Neil

On Fri, Jul 6, 2012 at 1:55 AM, Jason Montojo <jrr...@gmail.com> wrote:

--

Jason Montojo

unread,
Aug 7, 2012, 10:17:09 AM8/7/12
to cytoscap...@googlegroups.com
Hi Neil,

Yes, that's correct.  If you use CyTableManager.addTable and CyTable.setSavePolicy(SavePolicy.SESSION_FILE), your table should show up under "Unassigned tables" after you load your session.  Is that not the case?

Thanks,
Jason

Neil Dhruva

unread,
Aug 7, 2012, 1:25:21 PM8/7/12
to cytoscap...@googlegroups.com
Hi Jason,

Yeah I just got it working. Thanks!
Although, there is one problem I'm encountering. I am listening to a SetCurrentNetworkEvent which is supposed to use one of the Unassigned Tables. However, when a session is opened, the SetCurrentNetworkEvent is triggered before all the tables are loaded. Hence, I am not able to view the CyTable I saved while catering to the SetCurrentNetworkEvent. Is there any way to wait for all the tables to load before executing my code? That'd be really helpful for what I'm trying to accomplish.

Thanks,
Neil

Jason Montojo

unread,
Aug 7, 2012, 1:43:48 PM8/7/12
to cytoscap...@googlegroups.com
Hi Neil,

How about SessionLoadedEvent?


Is there a particular reason you're waiting for the SetCurrentNetworkEvent to access a table that isn't associated to a network?

Thanks,
Jason

Neil Dhruva

unread,
Aug 7, 2012, 2:46:00 PM8/7/12
to cytoscap...@googlegroups.com
Hey Jason,

I am trying to make use of the DefaultNodeTable of the currently added event. Even if I wait for the DefaultNodeTable to be added, it might occur before my CyTable is added. So I may not be able to trigger my app using that either. But I think SessionLoadedEvent might be the right one to use here so I'll work it out and get back to you.

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