Hi,
so I tried to create a prototype for the time series plugin but it seems
that Cytoscape currently does not support user-defined tables
associated with a network.
To be specific:
After creating the table, I tried to
register the table with the network and my custom TimeSeries class (extending
CyIdentifiable):
CyTable timeSeriesTable = cyTableFactory.createTable("Time Series Definitions", "SUID" /*Key column*/, Long.class /*Key type*/, true /*public*/, true/*isMutable*/);
cyTableManager.addTable(timeSeriesTable);
cyNetworkTableManager.setTable(network,
TimeSeries.class, TimeSeriesManager.TIME_SERIES_TABLE_CONTEXT /*String constant for context*/, timeSeriesTable);
This mostly works while the session is running - when querying the network for the table, it works:
network.getTable(TimeSeries.class, TimeSeriesManager.TIME_SERIES_TABLE_CONTEXT); //returns the table
However, from the moment the table is created, it is displayed in "Unassigned tables"
Further, the table is always saved as a global (unassigned) table, so when I
save and load the session, the table is no longer associated with the
network and the getTable call above returns null.
I also checked the .cys file and table is indeed stored under tables/global.
The
reason for this is that any table whose type is not included in
CyTableManagerImpl.COMPATIBLE_TYPES is treated as a global table, regardless of its association with a network -
CyTableManagerImpl.getGlobalTables explicitly enumarates all tables and
returns those with types not in CyTableManagerImpl.COMPATIBLE_TYPES as
global.
Currently, CyTableManagerImpl.COMPATIBLE_TYPES includes only CyNode, CyEdge and CyNetwork.
Is this the intended behavior? If so, what is the correct way to associate custom data with networks?