use of org.cytoscape.model.subnetwork.CySubNetwork in project cytoscape-impl by cytoscape.
the class AbstractGroupTask method getGroup.
protected CyGroup getGroup(String groupName) {
CyRootNetwork rootNet = ((CySubNetwork) net).getRootNetwork();
Set<CyGroup> allGroups = groupMgr.getGroupSet(net);
for (CyGroup group : allGroups) {
CyRow groupRow = rootNet.getRow(group.getGroupNode(), CyRootNetwork.SHARED_ATTRS);
if (groupName.length() > 5 && groupName.substring(0, 5).equalsIgnoreCase("suid:")) {
String suidString = groupRow.get(CyNetwork.SUID, Long.class).toString();
if (suidString != null && groupName.substring(5).equals(suidString))
return group;
} else if (groupName.equals(groupRow.get(CyRootNetwork.SHARED_NAME, String.class)))
return group;
}
return null;
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project cytoscape-impl by cytoscape.
the class NetworkMainPanel method getNetworkListOrder.
public Map<Long, Integer> getNetworkListOrder() {
final Map<Long, Integer> order = new HashMap<>();
final List<SubNetworkPanel> items = getAllSubNetworkItems();
int count = 0;
for (SubNetworkPanel snp : items) {
final CySubNetwork net = snp.getModel().getNetwork();
order.put(net.getSUID(), count++);
}
return order;
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project cytoscape-impl by cytoscape.
the class NetworkMainPanel method getSubNetworkPanel.
SubNetworkPanel getSubNetworkPanel(final CyNetwork net) {
if (net instanceof CySubNetwork) {
final CySubNetwork subNet = (CySubNetwork) net;
final CyRootNetwork rootNet = subNet.getRootNetwork();
final RootNetworkPanel rootNetPanel = getRootNetworkPanel(rootNet);
if (rootNetPanel != null)
return rootNetPanel.getItem(subNet);
}
return null;
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project cytoscape-impl by cytoscape.
the class ViewUtil method getParent.
public static CySubNetwork getParent(final CySubNetwork net, final CyServiceRegistrar serviceRegistrar) {
final CyTable hiddenTable = net.getTable(CyNetwork.class, CyNetwork.HIDDEN_ATTRS);
final CyRow row = hiddenTable != null ? hiddenTable.getRow(net.getSUID()) : null;
final Long suid = row != null ? row.get(PARENT_NETWORK_COLUMN, Long.class) : null;
if (suid != null) {
final CyNetwork parent = serviceRegistrar.getService(CyNetworkManager.class).getNetwork(suid);
if (parent instanceof CySubNetwork)
return (CySubNetwork) parent;
}
return null;
}
use of org.cytoscape.model.subnetwork.CySubNetwork in project cytoscape-impl by cytoscape.
the class GraphMLReader method run.
@Override
public void run(final TaskMonitor taskMonitor) throws Exception {
this.taskMonitor = taskMonitor;
try {
final SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
final SAXParser sp = spf.newSAXParser();
final XMLReader xmlReader = sp.getXMLReader();
CyRootNetwork root = getRootNetwork();
final CySubNetwork newNetwork;
if (root != null) {
newNetwork = root.addSubNetwork();
} else {
// Need to create new network with new root.
newNetwork = (CySubNetwork) cyNetworkFactory.createNetwork();
root = newNetwork.getRootNetwork();
}
parser = new GraphMLParser(taskMonitor, cyNetworkFactory, cyRootNetworkManager, root, newNetwork);
xmlReader.setContentHandler(parser);
final InputSource inputSource = new InputSource(inputStream);
inputSource.setEncoding("UTF-8");
xmlReader.parse(inputSource);
} finally {
if (inputStream != null) {
inputStream.close();
inputStream = null;
}
}
}
Aggregations