use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class LoadNetworkReaderTask method loadNetwork.
private void loadNetwork(final TaskMonitor tm) throws IOException {
CyNetwork network;
if (this.rootNetwork == null) {
network = serviceRegistrar.getService(CyNetworkFactory.class).createNetwork();
rootNetwork = serviceRegistrar.getService(CyRootNetworkManager.class).getRootNetwork(network);
} else {
// CytoscapeServices.cyNetworkFactory.createNetwork();
network = this.rootNetwork.addSubNetwork();
}
tm.setProgress(0.10);
this.reader.setNetwork(network);
if (this.cancelled)
return;
this.reader.read();
tm.setProgress(0.80);
if (this.cancelled)
return;
networks = new CyNetwork[] { network };
tm.setProgress(1.0);
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class OBOReaderTest method testOBOReader1.
@Test
public void testOBOReader1() throws Exception {
File file = new File("./src/test/resources/" + ySlim);
CyNetwork dag = testFile(file);
assertEquals(91, dag.getNodeCount());
assertEquals(dag.getEdgeCount(), 134);
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class OBOReaderTest method testOBOReader2.
@Test
public void testOBOReader2() throws Exception {
File file = new File("./src/test/resources/" + genericSlim);
CyNetwork dag = testFile(file);
assertEquals(106, dag.getNodeCount());
assertEquals(dag.getEdgeCount(), 153);
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImpl method internalSetSelectedNetworks.
private void internalSetSelectedNetworks(List<CyNetwork> networks, List<CyEvent<?>> eventsToFire) {
Set<CyNetwork> selectedNetworks = networks != null ? new LinkedHashSet<>(networks) : new LinkedHashSet<CyNetwork>();
selectedNetworks = selectNetworks(selectedNetworks);
eventsToFire.add(new SetSelectedNetworksEvent(this, new ArrayList<>(selectedNetworks)));
}
use of org.cytoscape.model.CyNetwork in project cytoscape-impl by cytoscape.
the class CyApplicationManagerImpl method handleEvent.
@Override
public void handleEvent(final NetworkAboutToBeDestroyedEvent event) {
final CyNetwork toBeDestroyed = event.getNetwork();
final List<CyEvent<?>> eventsToFire = new ArrayList<>();
synchronized (lock) {
logger.debug("NetworkAboutToBeDestroyedEvent: " + toBeDestroyed + ". Current: " + currentNetwork);
if (toBeDestroyed.equals(currentNetwork)) {
internalSetCurrentNetwork(null, eventsToFire);
}
}
fireEvents(eventsToFire);
}
Aggregations