use of org.cytoscape.model.subnetwork.CyRootNetwork in project cytoscape-impl by cytoscape.
the class Cy3SessionReaderImpl method extractNetworks.
private void extractNetworks(InputStream is, String entryName) throws Exception {
CyNetworkReader reader = networkReaderMgr.getReader(is, entryName);
reader.run(taskMonitor);
final CyRootNetworkManager rootNetworkManager = serviceRegistrar.getService(CyRootNetworkManager.class);
final CyNetwork[] netArray = reader.getNetworks();
for (final CyNetwork net : netArray) {
// Add its root-network to the lookup map first
final CyRootNetwork rootNet = rootNetworkManager.getRootNetwork(net);
if (!networkLookup.containsKey(rootNet.getSUID()))
;
networkLookup.put(rootNet.getSUID(), rootNet);
networkLookup.put(net.getSUID(), net);
// Note: do NOT add the root-network to this set!
networks.add(net);
}
}
use of org.cytoscape.model.subnetwork.CyRootNetwork in project cytoscape-impl by cytoscape.
the class GenericXGMMLReader method init.
protected void init(final TaskMonitor tm) {
readDataMgr.init();
// TODO: refactor readDataMgr and delete this line
readDataMgr.setViewFormat(false);
// Now user has the option to import network into different collection
final CyRootNetwork networkCollection = getRootNetwork();
final Map<Object, CyNode> nMap = getNodeMap();
readDataMgr.setNodeMap(nMap);
readDataMgr.setParentNetwork(networkCollection);
}
use of org.cytoscape.model.subnetwork.CyRootNetwork in project cytoscape-impl by cytoscape.
the class NNFNetworkReader method run.
@Override
public void run(TaskMonitor tm) throws IOException {
final CyRootNetwork rootNetwork = getRootNetwork();
Map<Object, CyNode> nMap = this.getNodeMap();
this.parser = new NNFParser(rootNetwork, cyNetworkFactory, nMap, serviceRegistrar);
try {
readInput(tm);
} finally {
if (inputStream != null) {
try {
inputStream.close();
inputStream = null;
} catch (Exception e) {
logger.warn("Cannot close NNF input stream", e);
}
}
}
}
use of org.cytoscape.model.subnetwork.CyRootNetwork in project cytoscape-impl by cytoscape.
the class HandleGraph method handleCy3Model.
/**
* Handles "CyNetwork-type" XGMML from Cytoscape 3 session files only.
* @param tag
* @param atts
* @param current
* @return
* @throws SAXException
*/
private ParseState handleCy3Model(String tag, Attributes atts, ParseState current) throws SAXException {
final CyNetwork currentNet;
boolean register = isRegistered(atts);
if (manager.graphCount == 1) {
// Root graph == CyRootNetwork
currentNet = manager.createRootNetwork();
register = false;
} else if (manager.graphCount == 2) {
// First nested graph == base-network
final CyRootNetwork rootNet = manager.getRootNetwork();
currentNet = rootNet.getBaseNetwork();
} else {
// Other nested graphs == regular sub-networks
final CyRootNetwork rootNet = manager.getRootNetwork();
currentNet = rootNet.addSubNetwork();
}
final Object id = getId(atts);
addCurrentNetwork(id, currentNet, atts, register);
return current;
}
use of org.cytoscape.model.subnetwork.CyRootNetwork in project cytoscape-impl by cytoscape.
the class HandleGraph method handleGenericXGMMLGraph.
/**
* Handles standalone XGMML graphs, not associated with a session file.
* @param tag
* @param atts
* @param current
* @return
* @throws SAXException
*/
private ParseState handleGenericXGMMLGraph(String tag, Attributes atts, ParseState current) throws SAXException {
final CyNetwork currentNet;
if (manager.graphCount == 1) {
// Root (graph) element...
final CyRootNetwork parentNet = manager.getParentNetwork();
if (parentNet == null) {
final CyRootNetwork rootNet = manager.createRootNetwork();
currentNet = rootNet.getBaseNetwork();
} else {
currentNet = parentNet.addSubNetwork();
}
} else {
// Nested graph tag...
final CyRootNetwork rootNet = manager.getRootNetwork();
currentNet = rootNet.addSubNetwork();
}
final Object id = getId(atts);
addCurrentNetwork(id, currentNet, atts, true);
return current;
}
Aggregations