Author: scooter
Date: 2010-12-30 22:26:19 -0800 (Thu, 30 Dec 2010)
New Revision: 23285
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/AnalysisActions.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/AnalysisCommands.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/CommandUtils.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureVizCommandHandler.java
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
Log:
Add support for limits and model selection for Find H-bonds
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/AnalysisActions.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/AnalysisActions.java
2010-12-30 20:10:14 UTC (rev 23284)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/AnalysisActions.java
2010-12-31 06:26:19 UTC (rev 23285)
@@ -53,11 +53,18 @@
return chimera.commandReply("~findclash");
}
- public static List<String> findHBondAction(Chimera chimera, String
atomSpec) {
+ public static List<String> findHBondAction(Chimera chimera, String
atomSpec, String limit,
+ boolean intramodel, boolean
intermodel) {
String command = "findhbond";
if (atomSpec != null) {
command += " spec "+atomSpec;
}
+ if (!intermodel)
+ command += " intermodel false";
+ if (!intramodel)
+ command += " intramodel false";
+ if (limit != null)
+ command += " "+limit;
return chimera.commandReply(command);
}
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/AnalysisCommands.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/AnalysisCommands.java
2010-12-30 20:10:14 UTC (rev 23284)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/AnalysisCommands.java
2010-12-31 06:26:19 UTC (rev 23285)
@@ -113,11 +113,17 @@
* @param chimera the Chimera object
* @param result the CyCommandResult
* @param structureList the structureList we're looking to find clashes
between
+ * @param limit the limits on the detection
+ * @param intermodel whether to find H-bonds between models
+ * @param intramodel whether to find H-bonds within models
* @return the updated CyCommandResult
*/
static public CyCommandResult findHBondsStructure(Chimera chimera,
CyCommandResult result,
-
List<Structure>structureList) {
- return findHBondsSpecList(chimera, result,
specListFromStructureList(chimera, structureList));
+
List<Structure>structureList, String limit,
+ boolean intermodel,
boolean intramodel)
+ throws
CyCommandException {
+ return findHBondsSpecList(chimera, result,
specListFromStructureList(chimera, structureList),
+ limit, intermodel, intramodel);
}
/**
@@ -126,11 +132,15 @@
* @param chimera the Chimera object
* @param result the CyCommandResult
* @param specList the specList we're looking to find clashes between
- * @param continuous the continuous flag
+ * @param limit the limits on the detection
+ * @param intermodel whether to find H-bonds between models
+ * @param intramodel whether to find H-bonds within models
* @return the updated CyCommandResult
*/
static public CyCommandResult findHBondsSpecList(Chimera chimera,
CyCommandResult result,
-
List<ChimeraStructuralObject>specList) {
+
List<ChimeraStructuralObject>specList, String limit,
+ boolean intermodel,
boolean intramodel)
+ throws
CyCommandException {
String atomSpec = "";
for (ChimeraStructuralObject cso: specList) {
if (atomSpec.length() == 0)
@@ -138,7 +148,12 @@
else
atomSpec += ","+cso.toSpec();
}
- List<String> c = AnalysisActions.findHBondAction(chimera,
atomSpec);
+ // Make sure we have a "legal" limit
+ if (limit != null) {
+ if (!limit.equals("cross") && !limit.equals("both") &&
!limit.equals("any"))
+ throw new CyCommandException("limit argument
must be one of 'cross' or 'both' or 'any'");
+ }
+ List<String> c = AnalysisActions.findHBondAction(chimera,
atomSpec, limit, intermodel, intramodel);
return addReplies(result, c, "Finding HBonds for "+atomSpec);
}
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/CommandUtils.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/CommandUtils.java
2010-12-30 20:10:14 UTC (rev 23284)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/CommandUtils.java
2010-12-31 06:26:19 UTC (rev 23285)
@@ -169,7 +169,7 @@
model =
chimera.getChimeraModel(st.modelNumber());
spec = modelSpec[1];
}
- if (spec.indexOf('.') > 0) {
+ if (spec.indexOf('.') >= 0) {
String[] chainSpec = spec.split("\\.",2);
// If we don't have a model at this point, then
// chainSpec[0] must be the model
@@ -181,8 +181,11 @@
} else {
// We already have a model, so
chainSpec[0] is a residue-range
chain = model.getChain(chainSpec[1]);
- // Get the residues
-
specList.addAll(chain.getResidueRange(chainSpec[0]));
+ if (chainSpec[0].length() > 0) {
+ // Get the residues
+
specList.addAll(chain.getResidueRange(chainSpec[0]));
+ } else
+ specList.add(chain);
}
} else {
// No chain spec
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureVizCommandHandler.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureVizCommandHandler.java
2010-12-30 20:10:14 UTC (rev 23284)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/commands/StructureVizCommandHandler.java
2010-12-31 06:26:19 UTC (rev 23285)
@@ -62,22 +62,23 @@
ALIGNCHAINS("align chains",
"Perform sequence-driven structural superposition on a
group of structures by chain",
"referencechain|chainlist|showsequences=false|createedges=false|assignattributes=true"),
- CLEARCLASHES("clear clashes", "Clear clashes", ""),
- CLEARHBONDS("clear hbonds", "Clear hydrogen bonds", ""),
- CLEARSELECT("clear selection", "Clear all selection", ""),
+ CLEARCLASHES("clear clashes", "Clear clashes", null),
+ CLEARHBONDS("clear hbonds", "Clear hydrogen bonds", null),
+ CLEARSELECT("clear selection", "Clear all selection", null),
CLOSE("close", "Close some or all of the currently opened
structures","structurelist=selected"),
COLOR("color", "Color part of all of a structure",
"preset|residues|labels|ribbons|surfaces|structurelist|atomspec"),
DEPICT("depict", "Change the depiction of a structure",
"preset|style|ribbonstyle|surfacestyle|transparency|structurelist|atomspec=selected"),
- EXIT("exit", "Exit Chimera",""),
+ EXIT("exit", "Exit Chimera",null),
FINDCLASHES("find clashes", "Find clashes between two models or parts
of models","structurelist|atomspec=selected|continuous"),
- FINDHBONDS("find hbonds", "Find hydrogen bonds between two models or
parts of models","structurelist|atomspec=selected"),
+ FINDHBONDS("find hbonds", "Find hydrogen bonds between two models or
parts of models",
+
"structurelist|atomspec=selected|limit=any|intramodel=true|intermodel=true"),
FOCUS("focus", "Focus on a structure or part of a
structure","structurelist|atomspec"),
HIDE("hide", "Hide parts of a structure",
"structurelist|atomspec=selected|structuretype"),
LISTCHAINS("list chains", "List the chains in a structure",
"structurelist=all"),
LISTRES("list residues", "List the residues in a structure",
"structurelist=all|chain"),
- LISTSTRUCTURES("list structures", "List all of the open structures",""),
+ LISTSTRUCTURES("list structures", "List all of the open
structures",null),
MOVE("move", "Move (translate) a model","x|y|z|structurelist=selected"),
OPENSTRUCTURE("open structure", "Open a new structure in
Chimera","pdbid|modbaseid|nodelist|showdialog=false"),
RAINBOW("rainbow", "Color part of all of a structure in a rainbow
scheme",
@@ -117,7 +118,10 @@
public static final String CHAINLIST = "chainlist";
public static final String CONTINUOUS = "continuous";
public static final String CREATEEDGES = "createedges";
+ public static final String INTERMODEL = "intermodel";
+ public static final String INTRAMODEL = "intramodel";
public static final String LABELS = "labels";
+ public static final String LIMIT = "limit";
public static final String MODELLIST = "modellist";
public static final String NODELIST = "nodelist";
public static final String PRESET = "preset";
@@ -311,16 +315,20 @@
result =
AnalysisCommands.findClashesSpecList(chimera, result, specList, continuous);
}
//
- // FINDHBONDS("find hbonds", "Find hydrogen bonds between two
models or parts of models","structurelist|atomspec=selected"),
+ // FINDHBONDS("find hbonds", "Find hydrogen bonds between two
models or parts of models",
+ //
"structurelist|atomspec=selected|limit=any|intramodel=true|intermodel=true"),
+ //
//
} else if (Command.FINDHBONDS.equals(command)) {
- String continuous = getArg(command, CONTINUOUS, args);
+ String limit = getArg(command,LIMIT, args);
+ boolean intermodel = getBooleanArg(command,INTERMODEL,
args);
+ boolean intramodel = getBooleanArg(command,INTRAMODEL,
args);
if (structureList != null) {
- result =
AnalysisCommands.findHBondsStructure(chimera, result, structureList);
+ result =
AnalysisCommands.findHBondsStructure(chimera, result, structureList, limit,
intermodel, intramodel);
} else {
String atomSpec = getArg(command,ATOMSPEC,
args);
List<ChimeraStructuralObject> specList =
CommandUtils.getSpecList(atomSpec,chimera);
- result =
AnalysisCommands.findHBondsSpecList(chimera, result, specList);
+ result =
AnalysisCommands.findHBondsSpecList(chimera, result, specList, limit,
intermodel, intramodel);
}
//
Modified:
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
===================================================================
---
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
2010-12-30 20:10:14 UTC (rev 23284)
+++
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
2010-12-31 06:26:19 UTC (rev 23285)
@@ -410,7 +410,11 @@
chimeraMenu.add(clashMenu);
JMenu hBondMenu = new JMenu("Hydrogen bond detection");
- addMenuItem(hBondMenu, "Find hydrogen bonds", FINDHBOND,
"findhbond sel any");
+ JMenu fHBondMenu = new JMenu("Find hydrogen bonds");
+ addMenuItem(fHBondMenu, "Between models", FINDHBOND, "findhbond
sel any intermodel true intramodel false");
+ addMenuItem(fHBondMenu, "Within models", FINDHBOND, "findhbond
sel any intermodel false intramodel true");
+ addMenuItem(fHBondMenu, "Both", FINDHBOND, "findhbond sel any
intermodel true intramodel true");
+ hBondMenu.add(fHBondMenu);
addMenuItem(hBondMenu, "Clear hydrogen bonds", COMMAND,
"~findhbond");
chimeraMenu.add(hBondMenu);
--
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.