Author: scooter
Date: 2012-02-03 01:50:34 -0800 (Fri, 03 Feb 2012)
New Revision: 28188
Modified:
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/EdgeNamespace.java
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/NodeNamespace.java
Log:
Added edge delete and node delete commands
Modified:
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/EdgeNamespace.java
===================================================================
---
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/EdgeNamespace.java
2012-02-02 22:59:46 UTC (rev 28187)
+++
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/EdgeNamespace.java
2012-02-03 09:50:34 UTC (rev 28188)
@@ -64,6 +64,7 @@
public class EdgeNamespace extends AbstractGraphObjectHandler {
// Commands
+ private static String DELETE = "delete";
private static String DESELECT = "deselect";
private static String EXPORT = "export attributes";
private static String FIND = "find";
@@ -88,6 +89,10 @@
super(ns);
// Define our subcommands
+ addDescription(DELETE, "Delete an edge or group of edges.");
+ addArgument(DELETE, EDGE);
+ addArgument(DELETE, EDGELIST);
+
addDescription(DESELECT, "Deselect edges. If no edge(s) are
provided, all edges are deselected");
addArgument(DESELECT, EDGE);
addArgument(DESELECT, EDGELIST);
@@ -174,6 +179,21 @@
Cytoscape.getCurrentNetworkView().updateView();
}
+ // delete some edges
+ } else if (DELETE.equals(command)) {
+ CyNetwork net = getNetwork(command, args);
+ List<CyEdge> edgeList = getEdgeList(net, result, args);
+ if (edgeList == null)
+ throw new CyCommandException("edge: nothing to
delete");
+
+ for (CyEdge edge: edgeList) {
+ net.removeEdge(edge.getRootGraphIndex(), false);
+ }
+ result.addMessage("edge: deleted "+edgeList.size()+"
nodes");
+ if (net == Cytoscape.getCurrentNetwork()) {
+ Cytoscape.getCurrentNetworkView().updateView();
+ }
+
// return the list of currently selected edges
} else if (GETSEL.equals(command)) {
CyNetwork net = getNetwork("get selected", args);
Modified:
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/NodeNamespace.java
===================================================================
---
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/NodeNamespace.java
2012-02-02 22:59:46 UTC (rev 28187)
+++
cytoscape/trunk/coreplugins/CoreCommands/src/main/java/coreCommands/namespaces/NodeNamespace.java
2012-02-03 09:50:34 UTC (rev 28188)
@@ -66,6 +66,7 @@
public class NodeNamespace extends AbstractGraphObjectHandler {
// Commands
+ private static String DELETE = "delete";
private static String DESELECT = "deselect";
private static String FIND = "find";
private static String GETATTR = "get attribute";
@@ -89,6 +90,10 @@
super(ns);
// Define our subcommands
+ addDescription(DELETE, "Delete a node or group of nodes.");
+ addArgument(DELETE, NODE);
+ addArgument(DELETE, NODELIST);
+
addDescription(DESELECT, "Deselect nodes. If no node(s) are
provided, all nodes are deselected");
addArgument(DESELECT, NODE);
addArgument(DESELECT, NODELIST);
@@ -178,6 +183,21 @@
Cytoscape.getCurrentNetworkView().updateView();
}
+ // delete some ndoes
+ } else if (DELETE.equals(command)) {
+ CyNetwork net = getNetwork(command, args);
+ List<CyNode> nodeList = getNodeList(net, result, args);
+ if (nodeList == null)
+ throw new CyCommandException("node: nothing to
delete");
+
+ for (CyNode node: nodeList) {
+ net.removeNode(node.getRootGraphIndex(), false);
+ }
+ result.addMessage("node: deleted "+nodeList.size()+"
nodes");
+ if (net == Cytoscape.getCurrentNetwork()) {
+ Cytoscape.getCurrentNetworkView().updateView();
+ }
+
// return the list of currently selected nodes
} else if (GETSEL.equals(command)) {
CyNetwork net = getNetwork(command, args);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.