use of org.cytoscape.io.internal.read.xgmml.SessionXGMMLNetworkViewReader in project cytoscape-impl by cytoscape.
the class Cy3SessionReaderImpl method extractNetworkView.
private void extractNetworkView(InputStream is, String entryName) throws Exception {
// Get the token which identifies the network
Matcher matcher = NETWORK_VIEW_PATTERN.matcher(entryName);
Long oldNetId = null;
if (matcher.matches()) {
String netViewToken = matcher.group(2);
matcher = NETWORK_VIEW_NAME_PATTERN.matcher(netViewToken);
if (matcher.matches()) {
try {
oldNetId = Long.valueOf(matcher.group(1));
} catch (NumberFormatException nfe) {
logger.error("Cannot extract network view SUID from: " + netViewToken);
}
}
}
if (oldNetId != null) {
final CyNetwork network = cache.getNetwork(oldNetId);
if (network != null && !cancelled) {
// Create the view
final CyNetworkReader reader = networkReaderMgr.getReader(is, entryName);
reader.run(taskMonitor);
final CyNetworkView view = reader.buildCyNetworkView(network);
networkViews.add(view);
// Get its visual style name
if (reader instanceof SessionXGMMLNetworkViewReader) {
final String vsName = ((SessionXGMMLNetworkViewReader) reader).getVisualStyleName();
if (vsName != null && !vsName.isEmpty())
this.visualStyleMap.put(view, vsName);
}
}
} else {
logger.error("The network view will cannot be recreated. The network view entry is invalid: " + entryName);
}
}
Aggregations