Author: scooter
Date: 2011-09-20 20:43:09 -0700 (Tue, 20 Sep 2011)
New Revision: 26905
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/CreateNetworkDialog.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
Log:
In the process of implementing connectivity edges...
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
2011-09-20 23:26:44 UTC (rev 26904)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
2011-09-21 03:43:09 UTC (rev 26905)
@@ -468,6 +468,10 @@
chimeraSend("listen stop select; "+command+"; listen start
select");
}
+ public void selectNoReply(String command) {
+ chimeraSendNoReply("listen stop select; "+command+"; listen
start select");
+ }
+
public List<String> commandReply(String text) {
List<String> r = chimeraSend(text);
if (r == null)
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
2011-09-20 23:26:44 UTC (rev 26904)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
2011-09-21 03:43:09 UTC (rev 26905)
@@ -472,7 +472,7 @@
enableNodeSelection = enable;
}
- private static List<Structure> getStructures(CyNode node,
+ public static List<Structure> getStructures(CyNode node,
List<Structure>
structureList,
String matchName) {
if (structureList == null) {
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
2011-09-20 23:26:44 UTC (rev 26904)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/ChimeraResidue.java
2011-09-21 03:43:09 UTC (rev 26905)
@@ -37,6 +37,7 @@
import java.util.List;
import java.util.Set;
+import structureViz.actions.Chimera;
import structureViz.model.ChimeraModel;
/**
@@ -65,6 +66,12 @@
private static int displayType = THREE_LETTER; // the current display
type
private boolean selected = false; // the selection state
+ // Return the ChimeraResidue that matches this spec. If create is
true, and we don't have that
+ // residue, create it.
+ public static ChimeraResidue getResidueFromSpec(Chimera chimeraObject,
String spec, boolean create) {
+ return null;
+ }
+
/**
* Constructor to create a new ChimeraResidue
*
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/CreateNetworkDialog.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/CreateNetworkDialog.java
2011-09-20 23:26:44 UTC (rev 26904)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/CreateNetworkDialog.java
2011-09-21 03:43:09 UTC (rev 26905)
@@ -67,9 +67,12 @@
// StructureViz imports
import structureViz.actions.Chimera;
+import structureViz.actions.CyChimera;
import structureViz.model.ChimeraChain;
import structureViz.model.ChimeraModel;
import structureViz.model.ChimeraResidue;
+import structureViz.model.Structure;
+import structureViz.model.Structure.StructureType;
/**
*/
@@ -225,6 +228,11 @@
edgeList.addAll(parseHBondReplies(replyList, nodeList));
// printReply(replyList);
}
+ if (includeConnectivity) {
+ String command = "listphysicalchains";
+ List<String>replyList =
chimeraObject.commandReply(command);
+
edgeList.addAll(parseConnectivityReplies(replyList, nodeList));
+ }
int[] edges = new int[edgeList.size()];
int[] nodes = new int[edgeList.size()*2];
@@ -236,8 +244,6 @@
edgeCount++;
}
- // Add seed information (from selection)
-
// Create the network
CyNetwork network = Cytoscape.getCurrentNetwork();
String name = network.getTitle();
@@ -251,7 +257,14 @@
Cytoscape.setCurrentNetwork(newNetwork.getIdentifier());
Cytoscape.setCurrentNetworkView(newNetwork.getIdentifier());
- // Activate structureViz on this network
+ // Activate structureViz for all of our nodes
+ CyAttributes nodeAttributes =
Cytoscape.getNodeAttributes();
+ for (CyNode node: nodeList) {
+ String residueSpec =
nodeAttributes.getStringAttribute(node.getIdentifier(), RESIDUE_ATTR);
+ String structure =
CyChimera.findStructures(residueSpec);
+ Structure s = Structure.getStructure(structure,
node, StructureType.PDB_MODEL);
+ s.setResidueList(node, residueSpec);
+ }
setVisible(false);
return;
@@ -375,6 +388,35 @@
return new ArrayList<CyEdge>(distanceMap.keySet());
}
+ /**
+ * Parse the connectivity information from Chimera. The data is of the
form:
+ * physical chain #0:283.A #0:710.A
+ * physical chain #0:283.B #0:710.B
+ * physical chain #0:283.C #0:710.C
+ *
+ * We don't use this data to create new nodes -- only new edges. If
two nodes are within the
+ * same physical chain, we connect them with a "Connected" edge
+ */
+ private List<CyEdge> parseConnectivityReplies(List<String> replyLog,
List<CyNode>nodes) {
+ List<ChimeraResidue[]> rangeList = new
ArrayList<ChimeraResidue[]>();
+ for (String line: replyLog) {
+ String[] tokens = line.split(" ");
+ if (tokens.length != 4) continue;
+ String start = tokens[2];
+ String end = tokens[3];
+
+ ChimeraResidue[] range = new ChimeraResidue[2];
+
+ // Get the residues from the reside spec
+ range[0] =
ChimeraResidue.getResidueFromSpec(chimeraObject, start, false);
+ range[1] =
ChimeraResidue.getResidueFromSpec(chimeraObject, end, false);
+ rangeList.add(range);
+ }
+
+ // Now, make the edges based on whether any pair of nodes are
in the same range
+ return null;
+ }
+
private CyEdge createEdge(List<CyNode>nodes, String sourceAlias, String
targetAlias, String type) {
// Create our two nodes. Note that makeResidueNode also adds
three attributes:
// 1) FunctionalResidues
@@ -416,7 +458,8 @@
// Add our attributes
CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
- nodeAttributes.setAttribute(nodeName, RESIDUE_ATTR,
model.getModelName()+"#"+residue.getIndex()+"."+residue.getChainId());
+ nodeAttributes.setAttribute(nodeName, RESIDUE_ATTR,
+
model.getModelName()+"#"+residue.getIndex()+"."+residue.getChainId());
nodeAttributes.setAttribute(nodeName, SEED_ATTR,
Boolean.valueOf(residue.isSelected()));
if (backbone)
nodeAttributes.setAttribute(nodeName, BACKBONE_ATTR,
Boolean.TRUE);
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
2011-09-20 23:26:44 UTC (rev 26904)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
2011-09-21 03:43:09 UTC (rev 26905)
@@ -135,17 +135,18 @@
}
private void setResidueSelection(Chimera chimera, Collection<String>
selStrs) {
- if (selStrs == null || selStrs.size() == 0)
- return;
-
String command = null;
- for (String selStr: selStrs) {
- if (command == null)
- command = "select "+selStr;
- else
- command = command.concat(" | "+selStr);
+ if (selStrs == null || selStrs.size() == 0) {
+ command = "~select";
+ } else {
+ for (String selStr: selStrs) {
+ if (command == null)
+ command = "select "+selStr;
+ else
+ command = command.concat(" | "+selStr);
+ }
}
// System.out.println("Selection command: "+command);
- chimera.select(command);
+ chimera.selectNoReply(command);
}
}
--
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.