use of org.cytoscape.model.CyNetwork in project EnrichmentMapApp by BaderLab.
the class SessionModelIO method restoreModelFromTables.
private boolean restoreModelFromTables(CySession session) {
boolean sessionHasEM = false;
CyTable table = getPrivateTable();
if (table != null) {
for (CyRow row : table.getAllRows()) {
Long suid = COL_NETWORK_ID.get(row);
String json = COL_EM_JSON.get(row);
if (suid != null && json != null) {
CyNetwork network = networkManager.getNetwork(suid);
if (network != null) {
EnrichmentMap em = ModelSerializer.deserialize(json);
if (em != null) {
em.setServiceRegistrar(serviceRegistrar);
em.setNetworkID(network.getSUID());
updateSuids(em, session);
emManager.registerEnrichmentMap(em);
sessionHasEM = true;
}
}
}
}
}
return sessionHasEM;
}
use of org.cytoscape.model.CyNetwork in project EnrichmentMapApp by BaderLab.
the class LegacySessionLoadTest method test_2_LoadTwoDataSetWithPostAnalysisLegacySession.
@Test
@SessionFile("em_session_2.2_twodataset_pa.cys")
public void test_2_LoadTwoDataSetWithPostAnalysisLegacySession() {
EnrichmentMap map = getEnrichmentMap();
assertEquals(2, map.getDataSetCount());
assertEquals(11445, map.getAllGenes().size());
CyNetwork network = networkManager.getNetwork(map.getNetworkID());
Map<String, CyEdge> edges = TestUtils.getEdges(network);
assertEquals(15, edges.size());
assertTrue(edges.containsKey("PA_TOP8_MIDDLE8_BOTTOM8 (sig_set1) BOTTOM8_PLUS100"));
assertTrue(edges.containsKey("PA_TOP8_MIDDLE8_BOTTOM8 (sig_set1) TOP8_PLUS100"));
assertTrue(edges.containsKey("PA_TOP8_MIDDLE8_BOTTOM8 (sig_set1) MIDDLE8_PLUS100"));
}
use of org.cytoscape.model.CyNetwork in project EnrichmentMapApp by BaderLab.
the class Protocol1Test method testProtocol1.
@Test
public void testProtocol1() throws Exception {
EMBuildCommandTask task = injector.getInstance(EMBuildCommandTask.class);
File enrichmentFile = TestUtils.createTempFile(PATH, "gprofiler_results_mesenonly_ordered_computedinR.txt");
assertTrue(enrichmentFile.exists());
task.analysisType.setSelectedValue(EnrichmentMapParameters.method_generic);
task.coeffecients.setSelectedValue(EnrichmentMapParameters.SM_JACCARD);
task.enrichmentsDataset1 = enrichmentFile;
task.pvalue = 1.0;
task.qvalue = 0.00001;
task.similaritycutoff = 0.25;
SerialTestTaskManager taskManager = new SerialTestTaskManager();
taskManager.execute(new TaskIterator(task));
// Assert the network was created
CyNetwork generatedNetwork = assertAndGetOnlyNetwork();
CyNetwork expectedNetwork = importNetworkFromFile(PATH, "protocol_1_expected.xgmml");
Set<String> columnsToIgnore = ImmutableSet.of("EM1_ENR_SET", "EM1_ENRICHMENT_SET", "EM1_Data Set");
assertNetworksEqual(expectedNetwork, generatedNetwork, columnsToIgnore);
}
use of org.cytoscape.model.CyNetwork in project EnrichmentMapApp by BaderLab.
the class LegacySessionLoadTest method test_2_LoadTwoDataSetLegacySession.
@Test
@SessionFile("em_session_2.2_twodataset.cys")
public void test_2_LoadTwoDataSetLegacySession() {
EnrichmentMap map = getEnrichmentMap();
assertEquals(2, map.getDataSetCount());
assertEquals(11445, map.getAllGenes().size());
CyNetwork network = networkManager.getNetwork(map.getNetworkID());
Map<String, CyEdge> edges = TestUtils.getEdges(network);
assertEquals(12, edges.size());
assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set2) MIDDLE8_PLUS100"));
assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set2) TOP8_PLUS100"));
assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set2) TOP8_PLUS100"));
assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set2) TOP1_PLUS100"));
assertTrue(edges.containsKey("TOP8_PLUS100 (Geneset_Overlap_set2) TOP1_PLUS100"));
assertTrue(edges.containsKey("TOP8_PLUS100 (Geneset_Overlap_set1) TOP1_PLUS100"));
assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set2) TOP1_PLUS100"));
assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set1) TOP1_PLUS100"));
assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set1) MIDDLE8_PLUS100"));
assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set1) TOP1_PLUS100"));
assertTrue(edges.containsKey("BOTTOM8_PLUS100 (Geneset_Overlap_set1) TOP8_PLUS100"));
assertTrue(edges.containsKey("MIDDLE8_PLUS100 (Geneset_Overlap_set1) TOP8_PLUS100"));
}
use of org.cytoscape.model.CyNetwork in project cytoscape-api by cytoscape.
the class SetSelectedNetworksEventTest method testGoodGetSelectedNetworksEvent.
@Test
public void testGoodGetSelectedNetworksEvent() {
final List<CyNetwork> networks = new ArrayList<CyNetwork>();
final SetSelectedNetworksEvent e = new SetSelectedNetworksEvent(source, networks);
assertNotNull(e.getNetworks());
assertEquals(networks, e.getNetworks());
}
Aggregations