Search in sources :

Example 86 with CyNetwork

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);
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork)

Example 87 with CyNetwork

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);
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork) File(java.io.File) Test(org.junit.Test)

Example 88 with CyNetwork

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);
}
Also used : CyNetwork(org.cytoscape.model.CyNetwork) File(java.io.File) Test(org.junit.Test)

Example 89 with CyNetwork

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)));
}
Also used : SetSelectedNetworksEvent(org.cytoscape.application.events.SetSelectedNetworksEvent) ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork)

Example 90 with CyNetwork

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);
}
Also used : ArrayList(java.util.ArrayList) CyNetwork(org.cytoscape.model.CyNetwork) CyEvent(org.cytoscape.event.CyEvent)

Aggregations

CyNetwork (org.cytoscape.model.CyNetwork)517 CyNode (org.cytoscape.model.CyNode)183 CyNetworkView (org.cytoscape.view.model.CyNetworkView)129 CyEdge (org.cytoscape.model.CyEdge)108 Test (org.junit.Test)107 ArrayList (java.util.ArrayList)87 CyTable (org.cytoscape.model.CyTable)75 CyApplicationManager (org.cytoscape.application.CyApplicationManager)70 CyIdentifiable (org.cytoscape.model.CyIdentifiable)57 CyRow (org.cytoscape.model.CyRow)48 HashSet (java.util.HashSet)45 CyNetworkManager (org.cytoscape.model.CyNetworkManager)40 HashMap (java.util.HashMap)35 CyRootNetwork (org.cytoscape.model.subnetwork.CyRootNetwork)35 CySubNetwork (org.cytoscape.model.subnetwork.CySubNetwork)32 CyNetworkViewManager (org.cytoscape.view.model.CyNetworkViewManager)31 VisualStyle (org.cytoscape.view.vizmap.VisualStyle)30 AbstractNetworkReaderTest (org.cytoscape.io.internal.read.AbstractNetworkReaderTest)27 TaskIterator (org.cytoscape.work.TaskIterator)27 List (java.util.List)26