use of org.baderlab.csplugins.enrichmentmap.model.EMSignatureDataSet in project EnrichmentMapApp by BaderLab.
the class CreateDiseaseSignatureNetworkTask method run.
/**
* This task is NOT cancellable.
*/
@Override
public void run(TaskMonitor tm) {
tm.setTitle("Post Analysis Geneset Similarities...");
CyNetwork network = networkManager.getNetwork(map.getNetworkID());
CyNetworkView networkView = getNetworKView(network);
taskResult.setNetwork(network);
taskResult.setNetworkView(networkView);
// Gene universe is all enrichment genes in the map
Set<Integer> geneUniverse = map.getAllEnrichmentGenes();
String prefix = params.getAttributePrefix();
//get the node attribute and edge attribute tables
tm.setStatusMessage("Creating Columns");
CyTable edgeTable = createEdgeColumns(network, "", prefix);
CyTable nodeTable = createNodeColumns(network, "", prefix);
tm.setProgress(0.1);
tm.setStatusMessage("Caching Nodes");
existingEdgeCache = createExistingEdgeCache(prefix, network, edgeTable);
tm.setProgress(0.2);
EMSignatureDataSet sigDataSet = createSignatureDataSet();
// Create Signature Hub Nodes
tm.setStatusMessage("Creating Nodes");
signatureGeneSets.forEach(sigDataSet.getGeneSetsOfInterest()::addGeneSet);
signatureGeneSets.forEach((hubName, sigGeneSet) -> createHubNode(hubName, network, networkView, prefix, edgeTable, nodeTable, geneUniverse, sigGeneSet, sigDataSet));
tm.setProgress(0.3);
// Layout nodes
tm.setStatusMessage("Laying out Nodes");
layoutHubNodes(networkView);
tm.setProgress(0.4);
// Create Signature Hub Edges
tm.setStatusMessage("Creating Edges");
DiscreteTaskMonitor dtm = new DiscreteTaskMonitor(tm, geneSetSimilarities.size(), 0.4, 0.9);
dtm.setStatusMessageTemplate("Similarity {0} of {1}");
for (SimilarityKey similarityKey : geneSetSimilarities.keySet()) {
boolean passedCutoff = passesCutoff(similarityKey, sigDataSet);
createEdge(similarityKey, network, networkView, prefix, edgeTable, nodeTable, passedCutoff, sigDataSet);
dtm.inc();
}
// Set edge widths
tm.setStatusMessage("Setting Edge Widths");
widthFunctionProvider.get().setEdgeWidths(network, prefix, tm);
tm.setProgress(1.0);
// Add the new data set to the map
map.addSignatureDataSet(sigDataSet);
}
Aggregations