use of org.cytoscape.model.CyTableFactory in project cytoscape-impl by cytoscape.
the class CyActivator method start.
@Override
public void start(BundleContext bc) {
CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
CyEventHelper cyEventHelperRef = getService(bc, CyEventHelper.class);
CyNetworkNaming cyNetworkNamingServiceRef = getService(bc, CyNetworkNaming.class);
UndoSupport undoSupportServiceRef = getService(bc, UndoSupport.class);
CyNetworkViewFactory cyNetworkViewFactoryServiceRef = getService(bc, CyNetworkViewFactory.class);
CyNetworkFactory cyNetworkFactoryServiceRef = getService(bc, CyNetworkFactory.class);
CyRootNetworkManager cyRootNetworkFactoryServiceRef = getService(bc, CyRootNetworkManager.class);
VisualMappingManager visualMappingManagerServiceRef = getService(bc, VisualMappingManager.class);
CyNetworkViewWriterManager networkViewWriterManagerServiceRef = getService(bc, CyNetworkViewWriterManager.class);
CyNetworkManager cyNetworkManagerServiceRef = getService(bc, CyNetworkManager.class);
CyNetworkViewManager cyNetworkViewManagerServiceRef = getService(bc, CyNetworkViewManager.class);
CyApplicationManager cyApplicationManagerServiceRef = getService(bc, CyApplicationManager.class);
CySessionManager cySessionManagerServiceRef = getService(bc, CySessionManager.class);
CyTableFactory cyTableFactoryServiceRef = getService(bc, CyTableFactory.class);
CyTableManager cyTableManagerServiceRef = getService(bc, CyTableManager.class);
CyLayoutAlgorithmManager cyLayoutsServiceRef = getService(bc, CyLayoutAlgorithmManager.class);
CyTableWriterManager cyTableWriterManagerRef = getService(bc, CyTableWriterManager.class);
SynchronousTaskManager<?> synchronousTaskManagerServiceRef = getService(bc, SynchronousTaskManager.class);
TunableSetter tunableSetterServiceRef = getService(bc, TunableSetter.class);
CyRootNetworkManager rootNetworkManagerServiceRef = getService(bc, CyRootNetworkManager.class);
CyNetworkTableManager cyNetworkTableManagerServiceRef = getService(bc, CyNetworkTableManager.class);
RenderingEngineManager renderingEngineManagerServiceRef = getService(bc, RenderingEngineManager.class);
CyNetworkViewFactory nullNetworkViewFactory = getService(bc, CyNetworkViewFactory.class, "(id=NullCyNetworkViewFactory)");
CyGroupManager cyGroupManager = getService(bc, CyGroupManager.class);
CyGroupFactory cyGroupFactory = getService(bc, CyGroupFactory.class);
{
DynamicTaskFactoryProvisionerImpl factory = new DynamicTaskFactoryProvisionerImpl(serviceRegistrar);
registerAllServices(bc, factory);
}
createPreferencesTaskFactories(bc, serviceRegistrar);
createFilterTaskFactories(bc, serviceRegistrar);
createTableTaskFactories(bc, serviceRegistrar, undoSupportServiceRef, cyNetworkManagerServiceRef, cyApplicationManagerServiceRef, cyTableFactoryServiceRef, cyTableManagerServiceRef, cyTableWriterManagerRef, tunableSetterServiceRef, rootNetworkManagerServiceRef, cyNetworkTableManagerServiceRef);
createNetworkTaskFactories(bc, serviceRegistrar, cyEventHelperRef, cyNetworkNamingServiceRef, undoSupportServiceRef, cyNetworkViewFactoryServiceRef, cyNetworkFactoryServiceRef, cyRootNetworkFactoryServiceRef, visualMappingManagerServiceRef, cyNetworkManagerServiceRef, cyNetworkViewManagerServiceRef, cyApplicationManagerServiceRef, synchronousTaskManagerServiceRef, rootNetworkManagerServiceRef, cyNetworkTableManagerServiceRef, renderingEngineManagerServiceRef, nullNetworkViewFactory, cyGroupManager, cyGroupFactory, networkViewWriterManagerServiceRef, tunableSetterServiceRef);
createViewTaskFactories(bc, cyEventHelperRef, undoSupportServiceRef, visualMappingManagerServiceRef, networkViewWriterManagerServiceRef, cyNetworkViewManagerServiceRef, cyApplicationManagerServiceRef, cyLayoutsServiceRef, tunableSetterServiceRef, renderingEngineManagerServiceRef, cyNetworkManagerServiceRef, cySessionManagerServiceRef, serviceRegistrar);
createVizmapTaskFactories(bc, serviceRegistrar);
createSessionTaskFactories(bc, serviceRegistrar);
createGroupTaskFactories(bc, undoSupportServiceRef, cyApplicationManagerServiceRef, cyGroupManager, cyGroupFactory, serviceRegistrar);
createNodeEdgeTaskFactories(bc, serviceRegistrar, cyEventHelperRef, undoSupportServiceRef, cyNetworkViewManagerServiceRef, tunableSetterServiceRef, cyApplicationManagerServiceRef, cyTableManagerServiceRef, renderingEngineManagerServiceRef, visualMappingManagerServiceRef);
createLayoutTaskFactories(bc, serviceRegistrar);
createHelpTaskFactories(bc, serviceRegistrar);
}
use of org.cytoscape.model.CyTableFactory in project cytoscape-impl by cytoscape.
the class LoadTableReaderTask method loadAnnotation.
private void loadAnnotation(TaskMonitor tm) {
tm.setProgress(0.0);
TextTableReader reader = this.reader;
AttributeMappingParameters readerAMP = (AttributeMappingParameters) reader.getMappingParameter();
String primaryKey = readerAMP.getAttributeNames()[readerAMP.getKeyIndex()];
tm.setProgress(0.1);
final CyTableFactory tableFactory = serviceRegistrar.getService(CyTableFactory.class);
final CyTable table = tableFactory.createTable("AttrTable " + inputName.substring(inputName.lastIndexOf('/') + 1) + " " + Integer.toString(numImports++), primaryKey, String.class, true, true);
cyTables = new CyTable[] { table };
tm.setProgress(0.3);
try {
this.reader.readTable(table);
} catch (IOException e) {
e.printStackTrace();
}
tm.setProgress(1.0);
}
use of org.cytoscape.model.CyTableFactory in project cytoscape-impl by cytoscape.
the class Cy3SessionReaderImplTest method testRestoreVirtualColumnsWithCircularDependencies.
@Test(expected = Exception.class)
public void testRestoreVirtualColumnsWithCircularDependencies() throws Exception {
// This should never happen, but let's make sure it doesn't get into an infinite loop
{
VirtualColumn vc = new VirtualColumn();
vc.setName("a");
vc.setSourceColumn("a");
vc.setSourceJoinKey("id");
vc.setTargetJoinKey("id");
vc.setSourceTable("t2");
vc.setTargetTable("t3");
reader.virtualColumns.add(vc);
}
{
VirtualColumn vc = new VirtualColumn();
vc.setName("a");
vc.setSourceColumn("a");
vc.setSourceJoinKey("id");
vc.setTargetJoinKey("id");
vc.setSourceTable("t1");
vc.setTargetTable("t2");
reader.virtualColumns.add(vc);
}
{
VirtualColumn vc = new VirtualColumn();
vc.setName("a");
vc.setSourceColumn("a");
vc.setSourceJoinKey("id");
vc.setTargetJoinKey("id");
vc.setSourceTable("t2");
vc.setTargetTable("t3");
reader.virtualColumns.add(vc);
}
CyTableFactory tblFactory = tblTestSupport.getTableFactory();
CyTable tbl1 = tblFactory.createTable("t1", "id", Integer.class, true, true);
CyTable tbl2 = tblFactory.createTable("t2", "id", Integer.class, true, true);
CyTable tbl3 = tblFactory.createTable("t3", "id", Integer.class, true, true);
reader.filenameTableMap.put(tbl1.getTitle(), tbl1);
reader.filenameTableMap.put(tbl2.getTitle(), tbl2);
reader.filenameTableMap.put(tbl3.getTitle(), tbl3);
reader.restoreVirtualColumns();
}
use of org.cytoscape.model.CyTableFactory in project clusterMaker2 by RBVI.
the class CyActivator method start.
public void start(BundleContext bc) {
// See if we have a graphics console or not
boolean haveGUI = true;
CySwingApplication swingAppRef = getService(bc, CySwingApplication.class);
if (swingAppRef == null) {
// if haveGUI is false, we don't want to provide any hooks to the treeview
haveGUI = false;
}
CyApplicationManager appRef = getService(bc, CyApplicationManager.class);
CyServiceRegistrar serviceRegistrar = getService(bc, CyServiceRegistrar.class);
CyGroupManager groupManager = getService(bc, CyGroupManager.class);
CyGroupFactory groupFactory = getService(bc, CyGroupFactory.class);
CyTableFactory tableFactory = getService(bc, CyTableFactory.class);
CyTableManager tableManager = getService(bc, CyTableManager.class);
// Create our context object. This will probably keep track of all of the
// registered clustering algorithms, settings, etc.
ClusterManagerImpl clusterManager = new ClusterManagerImpl(appRef, serviceRegistrar, groupFactory, groupManager, tableFactory, tableManager);
registerServiceListener(bc, clusterManager, "addClusterAlgorithm", "removeClusterAlgorithm", ClusterTaskFactory.class);
registerServiceListener(bc, clusterManager, "addClusterVisualizer", "removeClusterVisualizer", ClusterVizFactory.class);
registerServiceListener(bc, clusterManager, "addRankingAlgorithm", "removeRankingAlgorithm", RankFactory.class);
// Register each of our algorithms
// Attribute clusterers
registerService(bc, new AttributeClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new AutoSOMETaskFactory(clusterManager, true), ClusterTaskFactory.class, new Properties());
registerService(bc, new FeatureVectorTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new HierarchicalTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new KMeansTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new KMedoidTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new HopachPAMTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new PAMTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
// FIXME: FFT is seriously broken!
registerService(bc, new FFTTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new DBSCANTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
/*
* Hold off on these until we get improve the performance sufficiently
* to allow them to be useful
*/
// registerService(bc, new BicFinderTaskFactory(clusterManager),
// ClusterTaskFactory.class, new Properties());
// registerService(bc, new BiMineTaskFactory(clusterManager),
// ClusterTaskFactory.class, new Properties());
registerService(bc, new ChengChurchTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
// Network clusterers
registerService(bc, new NetworkClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new APClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new AutoSOMETaskFactory(clusterManager, false), ClusterTaskFactory.class, new Properties());
registerService(bc, new FuzzifierTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new GLayClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new ConnectedComponentsTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new FCMClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new MCLClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new MCODEClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new SCPSClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new TransClustClusterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
// Cluster ranking
registerService(bc, new MAATaskFactory(clusterManager), RankFactory.class, new Properties());
registerService(bc, new MAMTaskFactory(clusterManager), RankFactory.class, new Properties());
registerService(bc, new PRWPTaskFactory(clusterManager), RankFactory.class, new Properties());
registerService(bc, new PRTaskFactory(clusterManager), RankFactory.class, new Properties());
registerService(bc, new HITSTaskFactory(clusterManager), RankFactory.class, new Properties());
// Filters
registerService(bc, new FilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new BestNeighborFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new CuttingEdgeFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new DensityFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new HairCutFilterTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
// registerService(bc, new UITaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
// Visualizations
registerService(bc, new NewNetworkViewFactory(clusterManager, false), ClusterVizFactory.class, new Properties());
registerService(bc, new NewNetworkViewFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
registerService(bc, new HeatMapViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
registerService(bc, new KnnViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
registerService(bc, new BiclusterViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
registerService(bc, new TreeViewTaskFactory(clusterManager), ClusterVizFactory.class, new Properties());
registerService(bc, new CreateResultsPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
registerService(bc, new CreateRankingPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
registerService(bc, new DestroyResultsPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
registerService(bc, new DestroyRankingPanelTaskFactory(clusterManager, true), ClusterVizFactory.class, new Properties());
// Dimensionality Reduction
// registerService(bc, new PCAMenuTaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new PCATaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new PCoATaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
registerService(bc, new tSNETaskFactory(clusterManager), ClusterTaskFactory.class, new Properties());
{
// Link Network Selections
LinkSelectionTaskFactory linkTaskFactory = new LinkSelectionTaskFactory(clusterManager);
Properties linkSelectionProps = new Properties();
linkSelectionProps.setProperty(INSERT_SEPARATOR_BEFORE, "true");
linkSelectionProps.setProperty(PREFERRED_MENU, "Apps.clusterMaker Visualizations");
linkSelectionProps.setProperty(TITLE, "Link selection across networks");
linkSelectionProps.setProperty(COMMAND, "linkSelection");
linkSelectionProps.setProperty(COMMAND_NAMESPACE, "clusterviz");
linkSelectionProps.setProperty(ENABLE_FOR, "networkAndView");
linkSelectionProps.setProperty(IN_MENU_BAR, "true");
linkSelectionProps.setProperty(MENU_GRAVITY, "100.0");
registerService(bc, linkTaskFactory, NetworkTaskFactory.class, linkSelectionProps);
}
{
// UnLink Network Selections
UnlinkSelectionTaskFactory unlinkTaskFactory = new UnlinkSelectionTaskFactory(clusterManager);
Properties unlinkSelectionProps = new Properties();
unlinkSelectionProps.setProperty(PREFERRED_MENU, "Apps.clusterMaker Visualizations");
unlinkSelectionProps.setProperty(TITLE, "Unlink selection across networks");
unlinkSelectionProps.setProperty(COMMAND, "unlinkSelection");
unlinkSelectionProps.setProperty(COMMAND_NAMESPACE, "clusterviz");
unlinkSelectionProps.setProperty(ENABLE_FOR, "networkAndView");
unlinkSelectionProps.setProperty(IN_MENU_BAR, "true");
unlinkSelectionProps.setProperty(MENU_GRAVITY, "100.0");
registerService(bc, unlinkTaskFactory, NetworkTaskFactory.class, unlinkSelectionProps);
}
// Commands
// These task factories provide useful commands that only make sense in the context of REST or
// the command interface
{
TaskFactory commandTaskFactory = new CommandTaskFactory(clusterManager, "hascluster");
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "cluster");
props.setProperty(COMMAND, CommandTaskFactory.HASCLUSTER);
props.setProperty(COMMAND_DESCRIPTION, "Test to see if this network has a cluster of the requested type");
registerService(bc, commandTaskFactory, TaskFactory.class, props);
}
{
TaskFactory commandTaskFactory = new CommandTaskFactory(clusterManager, "getnetworkcluster");
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "cluster");
props.setProperty(COMMAND, CommandTaskFactory.GETNETWORKCLUSTER);
props.setProperty(COMMAND_DESCRIPTION, "Get a cluster network cluster result");
registerService(bc, commandTaskFactory, TaskFactory.class, props);
}
{
TaskFactory commandTaskFactory = new CommandTaskFactory(clusterManager, "getcluster");
Properties props = new Properties();
props.setProperty(COMMAND_NAMESPACE, "cluster");
props.setProperty(COMMAND, CommandTaskFactory.GETCLUSTER);
props.setProperty(COMMAND_DESCRIPTION, "Get an attribute cluster result");
registerService(bc, commandTaskFactory, TaskFactory.class, props);
}
}
use of org.cytoscape.model.CyTableFactory in project cytoscape-impl by cytoscape.
the class ExpressionReader method copyToAttribs.
/**
* Copies ExpressionData data structure into CyAttributes data structure.
*
* @param nodeAttribs Node Attributes CyTable.
* @param taskMonitor Task Monitor. Can be null.
*/
private void copyToAttribs(TaskMonitor taskMonitor) {
String[] condNames = getConditionNames();
final CyTableFactory tableFactory = serviceRegistrar.getService(CyTableFactory.class);
table = tableFactory.createTable("Expression Matrix", "geneName", String.class, /* public = */
true, /* mutable = */
true);
// first set up the columns
for (int condNum = 0; condNum < condNames.length; condNum++) {
String condName = condNames[condNum];
String eStr = condName + "exp";
String sStr = condName + "sig";
table.createColumn(eStr, Double.class, false);
table.createColumn(sStr, Double.class, false);
}
// now create the rows and populate
for (int i = 0; i < geneNames.size(); i++) {
String canName = geneNames.get(i);
CyRow row = table.getRow(canName);
for (int condNum = 0; condNum < condNames.length; condNum++) {
String condName = condNames[condNum];
String eStr = condName + "exp";
String sStr = condName + "sig";
mRNAMeasurement mm = getMeasurement(canName, condName);
if (mm != null) {
row.set(eStr, new Double(mm.getRatio()));
row.set(sStr, new Double(mm.getSignificance()));
}
// Report on Progress to the Task Monitor.
if (taskMonitor != null) {
int currentCoordinate = (condNum * geneNames.size()) + i;
int matrixSize = condNames.length * geneNames.size();
double percent = ((double) currentCoordinate / matrixSize) * 100.0;
taskMonitor.setProgress(percent);
}
}
}
}
Aggregations