import jalview.structure.StructureCommandsBase;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
+import jalview.structure.StructureCommandsI.AtomSpecType;
import jalview.util.Comparison;
import jalview.util.Platform;
*/
@Override
public List<StructureCommandI> superposeStructures(AtomSpecModel refAtoms,
- AtomSpecModel atomSpec, boolean isNucleotide)
+ AtomSpecModel atomSpec, AtomSpecType backbone)
{
StringBuilder sb = new StringBuilder(64);
String refModel = refAtoms.getModels().iterator().next();
* command examples don't include modelspec with atoms, getAtomSpec does;
* it works, so leave it as it is for simplicity
*/
- sb.append(getAtomSpec(atomSpec, true)).append("}{");
- sb.append(getAtomSpec(refAtoms, true)).append("}");
+ sb.append(getAtomSpec(atomSpec, backbone)).append("}{");
+ sb.append(getAtomSpec(refAtoms, backbone)).append("}");
sb.append(" ROTATE TRANSLATE ");
sb.append(getCommandSeparator());
/*
* show residues used for superposition as ribbon
*/
- sb.append("select ").append(getAtomSpec(atomSpec, false)).append("|");
- sb.append(getAtomSpec(refAtoms, false)).append(getCommandSeparator())
+ sb.append("select ").append(getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY)).append("|");
+ sb.append(getAtomSpec(refAtoms, AtomSpecType.RESIDUE_ONLY)).append(getCommandSeparator())
.append("cartoons");
return Arrays.asList(new StructureCommand(sb.toString()));
* a separate clause in the {@code compare} (superposition) command.
*/
@Override
- public String getAtomSpec(AtomSpecModel model, boolean alphaOnly)
+ public String getAtomSpec(AtomSpecModel model, AtomSpecType specType)
{
StringBuilder sb = new StringBuilder(128);
@Override
public List<StructureCommandI> superposeStructures(AtomSpecModel refAtoms,
- AtomSpecModel atomSpec, boolean isNucleotide)
+ AtomSpecModel atomSpec, AtomSpecType specType)
{
+
// https://pymolwiki.org/index.php/Super
List<StructureCommandI> commands = new ArrayList<>();
- String refAtomsAlphaOnly = "("+getAtomSpec(refAtoms, true)+" and (altloc '' or altloc 'a'))";
- String atomSpec2AlphaOnly = "("+getAtomSpec(atomSpec, true)+" and (altloc '' or altloc 'a'))";
+ String refAtomsAlphaOnly = "("+getAtomSpec(refAtoms, specType)+" and (altloc '' or altloc 'a'))";
+ String atomSpec2AlphaOnly = "("+getAtomSpec(atomSpec, specType)+" and (altloc '' or altloc 'a'))";
// pair_fit mobile -> reference
commands.add(new StructureCommand("pair_fit",
atomSpec2AlphaOnly, refAtomsAlphaOnly));
/*
* and show superposed residues as cartoon
*/
- String refAtomsAll = getAtomSpec(refAtoms, false);
- String atomSpec2All = getAtomSpec(atomSpec, false);
+ String refAtomsAll = getAtomSpec(refAtoms, AtomSpecType.RESIDUE_ONLY);
+ String atomSpec2All = getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY);
commands.add(new StructureCommand("show", "cartoon",
refAtomsAll + " " + atomSpec2All));
* @see https://pymolwiki.org/index.php/Selection_Macros
*/
@Override
- public String getAtomSpec(AtomSpecModel model, boolean alphaOnly)
+ public String getAtomSpec(AtomSpecModel model, AtomSpecType specType)
{
StringBuilder sb = new StringBuilder(64);
boolean first = true;
}
}
sb.append("/");
- if (alphaOnly)
+ if (specType == AtomSpecType.ALPHA)
{
sb.append("CA");
}
+ if (specType == AtomSpecType.PHOSPHATE)
+ {
+ sb.append("P");
+ }
}
}
return sb.toString();
StringBuilder sb = new StringBuilder(128);
sb.append("p.").append(attributeName).append("='")
.append(attributeValue).append("'");
- String atomSpec = getAtomSpec(atomSpecModel, false);
+ String atomSpec = getAtomSpec(atomSpecModel, AtomSpecType.RESIDUE_ONLY);
return new StructureCommand("iterate", atomSpec, sb.toString());
}
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
import jalview.structure.StructureCommandsBase;
+import jalview.structure.StructureCommandsI.AtomSpecType;
import jalview.util.ColorUtils;
/**
StringBuilder sb = new StringBuilder(128);
sb.append("setattr res ").append(attributeName).append(" '")
.append(attributeValue).append("' ");
- sb.append(getAtomSpec(atomSpecModel, false));
+ sb.append(getAtomSpec(atomSpecModel, AtomSpecType.RESIDUE_ONLY));
return new StructureCommand(sb.toString());
}
@Override
public List<StructureCommandI> superposeStructures(AtomSpecModel ref,
- AtomSpecModel spec, boolean isNucleotide)
+ AtomSpecModel spec, AtomSpecType backbone)
{
/*
* Form Chimera match command to match spec to ref
* @see https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
*/
StringBuilder cmd = new StringBuilder();
- String atomSpecAlphaOnly = getAtomSpec(spec, true);
- String refSpecAlphaOnly = getAtomSpec(ref, true);
+ String atomSpecAlphaOnly = getAtomSpec(spec, backbone);
+ String refSpecAlphaOnly = getAtomSpec(ref, backbone);
cmd.append("match ").append(atomSpecAlphaOnly).append(" ").append(refSpecAlphaOnly);
/*
* show superposed residues as ribbon
*/
- String atomSpec = getAtomSpec(spec, false);
- String refSpec = getAtomSpec(ref, false);
+ String atomSpec = getAtomSpec(spec, AtomSpecType.RESIDUE_ONLY);
+ String refSpec = getAtomSpec(ref, AtomSpecType.RESIDUE_ONLY);
cmd.append("; ribbon ");
cmd.append(atomSpec).append("|").append(refSpec).append("; focus");
* <pre>
*
* @param model
- * @param alphaOnly
+ * @param specType
* @return
* @see https://www.cgl.ucsf.edu/chimera/current/docs/UsersGuide/midas/frameatom_spec.html
*/
@Override
- public String getAtomSpec(AtomSpecModel atomSpec, boolean alphaOnly)
+ public String getAtomSpec(AtomSpecModel atomSpec, AtomSpecType specType)
{
StringBuilder sb = new StringBuilder(128);
boolean firstModel = true;
sb.append("|");
}
firstModel = false;
- appendModel(sb, model, atomSpec, alphaOnly);
+ appendModel(sb, model, atomSpec, specType);
}
return sb.toString();
}
* @param alphaOnly
*/
protected void appendModel(StringBuilder sb, String model,
- AtomSpecModel atomSpec, boolean alphaOnly)
+ AtomSpecModel atomSpec, AtomSpecType specType)
{
sb.append("#").append(model).append(":");
firstPositionForModel = false;
}
}
- if (alphaOnly)
+ if (specType == AtomSpecType.ALPHA)
{
/*
* restrict to alpha carbon, no alternative locations
* (needed to ensuring matching atom counts for superposition)
*/
- // TODO @P instead if RNA - add nucleotide flag to AtomSpecModel?
sb.append("@CA").append(NO_ALTLOCS);
}
+ if (specType == AtomSpecType.PHOSPHATE)
+ {
+ sb.append("@P").append(NO_ALTLOCS);
+ }
}
@Override
import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
/**
* Routines for generating ChimeraX commands for Jalview/ChimeraX binding
String attributeValue, AtomSpecModel atomSpecModel)
{
StringBuilder sb = new StringBuilder(128);
- sb.append("setattr ").append(getAtomSpec(atomSpecModel, false));
+ sb.append("setattr ").append(getAtomSpec(atomSpecModel, AtomSpecType.RESIDUE_ONLY));
sb.append(" res ").append(attributeName).append(" '")
.append(attributeValue).append("'");
sb.append(" create true");
* @return
*/
@Override
- public String getAtomSpec(AtomSpecModel atomSpec, boolean alphaOnly)
+ public String getAtomSpec(AtomSpecModel atomSpec, AtomSpecType specType)
{
StringBuilder sb = new StringBuilder(128);
boolean firstModel = true;
}
firstModel = false;
appendModel(sb, model, atomSpec);
- if (alphaOnly)
+ if (specType == AtomSpecType.ALPHA)
{
- // TODO @P if RNA - add nucleotide flag to AtomSpecModel?
sb.append("@CA");
}
+ if (specType == AtomSpecType.PHOSPHATE)
+ {
+ sb.append("@P");
+ }
}
return sb.toString();
}
@Override
public List<StructureCommandI> superposeStructures(AtomSpecModel ref,
- AtomSpecModel spec, boolean isNucleotide)
+ AtomSpecModel spec, AtomSpecType backbone)
{
/*
* Form ChimeraX match command to match spec to ref
* @see https://www.cgl.ucsf.edu/chimerax/docs/user/commands/align.html
*/
StringBuilder cmd = new StringBuilder();
- String atomSpec = getAtomSpec(spec, true);
- String refSpec = getAtomSpec(ref, true);
+ String atomSpec = getAtomSpec(spec, backbone);
+ String refSpec = getAtomSpec(ref, backbone);
cmd.append("align ").append(atomSpec).append(" toAtoms ")
.append(refSpec);
* show superposed residues as ribbon, others as chain
*/
cmd.append("; ribbon ");
- cmd.append(getAtomSpec(spec, false)).append("|");
- cmd.append(getAtomSpec(ref, false)).append("; view");
+ cmd.append(getAtomSpec(spec, AtomSpecType.RESIDUE_ONLY)).append("|");
+ cmd.append(getAtomSpec(ref, AtomSpecType.RESIDUE_ONLY)).append("; view");
return Arrays.asList(new StructureCommand(cmd.toString()));
}
protected StructureCommandI getColourCommand(AtomSpecModel atomSpecModel,
Color colour)
{
- String atomSpec = getAtomSpec(atomSpecModel, false);
+ String atomSpec = getAtomSpec(atomSpecModel, AtomSpecType.RESIDUE_ONLY);
return colourResidues(atomSpec, colour);
}
*
* @param refAtoms
* @param atomSpec
- * @param isNucleotide TODO
- * @param nucleotide - when true, superposition is based on phoshpate backbone, not peptide
+ * @param backbone - superpose based on which kind of atomType
* @return
*/
List<StructureCommandI> superposeStructures(AtomSpecModel refAtoms,
- AtomSpecModel atomSpec, boolean isNucleotide);
+ AtomSpecModel atomSpec, AtomSpecType backbone);
/**
* Returns a command to open a file of commands at the given path
*/
StructureCommandI saveSession(String filepath);
+ enum AtomSpecType { RESIDUE_ONLY, ALPHA, PHOSPHATE };
/**
* Returns a representation of the atom set represented by the model, in
* viewer syntax format. If {@code alphaOnly} is true, this is restricted to
* Alpha Carbon (peptide) or Phosphorous (rna) only
*
* @param model
- * @param alphaOnly
+ * @param specType
* @return
*/
- String getAtomSpec(AtomSpecModel model, boolean alphaOnly);
+ String getAtomSpec(AtomSpecModel model, AtomSpecType specType);
/**
* Returns the lowest model number used by the structure viewer (likely 0 or
import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommandI;
import jalview.structure.StructureCommandsI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
import jalview.structure.StructureListener;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
// todo better way to ensure synchronous than setting getReply true!!
executeCommands(commandGenerator.showBackbone(), true, null);
- boolean isNucleotide = structures[refStructure].isRna;
+ AtomSpecType backbone = structures[refStructure].isRna ? AtomSpecType.PHOSPHATE : AtomSpecType.ALPHA;
/*
* superpose each (other) structure to the reference in turn
*/
{
AtomSpecModel atomSpec = getAtomSpec(structures[i], matched);
List<StructureCommandI> commands = commandGenerator
- .superposeStructures(refAtoms, atomSpec,isNucleotide);
+ .superposeStructures(refAtoms, atomSpec, backbone);
List<String> replies = executeCommands(commands, true, null);
for (String reply : replies)
{
import jalview.schemes.JalviewColourScheme;
import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
public void testGetAtomSpec()
{
AtomSpecModel model = new AtomSpecModel();
- assertEquals(testee.getAtomSpec(model, false), "");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, false), "2-4:A/1.1");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "2-4:A/1.1");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, false), "2-4:A/1.1|8:A/1.1");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "2-4:A/1.1|8:A/1.1");
model.addRange("1", 5, 7, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-4:A/1.1|8:A/1.1|5-7:B/1.1");
model.addRange("1", 3, 5, "A");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-5:A/1.1|8:A/1.1|5-7:B/1.1");
model.addRange("2", 1, 4, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-5:A/1.1|8:A/1.1|5-7:B/1.1|1-4:B/2.1");
model.addRange("2", 5, 9, "C");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-5:A/1.1|8:A/1.1|5-7:B/1.1|1-4:B/2.1|5-9:C/2.1");
model.addRange("1", 8, 10, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-5:A/1.1|8:A/1.1|5-10:B/1.1|1-4:B/2.1|5-9:C/2.1");
model.addRange("1", 8, 9, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-5:A/1.1|8:A/1.1|5-10:B/1.1|1-4:B/2.1|5-9:C/2.1");
model.addRange("2", 3, 10, "C"); // subsumes 5-9
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-5:A/1.1|8:A/1.1|5-10:B/1.1|1-4:B/2.1|3-10:C/2.1");
model.addRange("5", 25, 35, " ");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"2-5:A/1.1|8:A/1.1|5-10:B/1.1|1-4:B/2.1|3-10:C/2.1|25-35:/5.1");
}
toAlign.addRange("2", 20, 21, "B");
toAlign.addRange("2", 22, 22, "C");
List<StructureCommandI> command = testee.superposeStructures(ref,
- toAlign, false); // doesn't matter for Jmol whether nuc or protein
+ toAlign, AtomSpecType.ALPHA); // doesn't matter for Jmol whether nuc or protein
assertEquals(command.size(), 1);
String refSpec = "12-14:A/1.1|18:B/1.1|22-23:B/1.1";
String toAlignSpec = "15-17:B/2.1|20-21:B/2.1|22:C/2.1";
import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
public class PymolCommandsTest
{
public void testGetAtomSpec()
{
AtomSpecModel model = new AtomSpecModel();
- assertEquals(testee.getAtomSpec(model, false), "");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, false), "1//A/2-4/");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "1//A/2-4/");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, false), "1//A/2-4+8/");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "1//A/2-4+8/");
model.addRange("1", 5, 7, "B");
- assertEquals(testee.getAtomSpec(model, false), "1//A/2-4+8/ 1//B/5-7/");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "1//A/2-4+8/ 1//B/5-7/");
model.addRange("1", 3, 5, "A");
- assertEquals(testee.getAtomSpec(model, false), "1//A/2-5+8/ 1//B/5-7/");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "1//A/2-5+8/ 1//B/5-7/");
model.addRange("0", 1, 4, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"0//B/1-4/ 1//A/2-5+8/ 1//B/5-7/");
model.addRange("0", 5, 9, "C");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"0//B/1-4/ 0//C/5-9/ 1//A/2-5+8/ 1//B/5-7/");
model.addRange("1", 8, 10, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"0//B/1-4/ 0//C/5-9/ 1//A/2-5+8/ 1//B/5-10/");
model.addRange("1", 8, 9, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"0//B/1-4/ 0//C/5-9/ 1//A/2-5+8/ 1//B/5-10/");
model.addRange("0", 3, 10, "C"); // subsumes 5-9
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"0//B/1-4/ 0//C/3-10/ 1//A/2-5+8/ 1//B/5-10/");
model.addRange("5", 25, 35, " ");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"0//B/1-4/ 0//C/3-10/ 1//A/2-5+8/ 1//B/5-10/ 5///25-35/");
}
toAlign.addRange("2", 20, 21, "B");
toAlign.addRange("2", 22, 22, "C");
List<StructureCommandI> commands = testee.superposeStructures(ref,
- toAlign, false);
+ toAlign, AtomSpecType.ALPHA);
assertEquals(commands.size(), 2);
String refSpecCA = "(1//A/12-14/CA 1//B/18+22-23/CA";
String toAlignSpecCA = "(2//B/15-17+20-21/CA 2//C/22/CA";
public void testGetAtomSpec_alphaOnly()
{
AtomSpecModel model = new AtomSpecModel();
- assertEquals(testee.getAtomSpec(model, true), "");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, true), "1//A/2-4/CA");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "1//A/2-4/CA");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, true), "1//A/2-4+8/CA");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "1//A/2-4+8/CA");
model.addRange("1", 5, 7, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"1//A/2-4+8/CA 1//B/5-7/CA");
model.addRange("1", 3, 5, "A");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"1//A/2-5+8/CA 1//B/5-7/CA");
model.addRange("0", 1, 4, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"0//B/1-4/CA 1//A/2-5+8/CA 1//B/5-7/CA");
model.addRange("0", 5, 9, "C");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"0//B/1-4/CA 0//C/5-9/CA 1//A/2-5+8/CA 1//B/5-7/CA");
model.addRange("1", 8, 10, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"0//B/1-4/CA 0//C/5-9/CA 1//A/2-5+8/CA 1//B/5-10/CA");
model.addRange("1", 8, 9, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"0//B/1-4/CA 0//C/5-9/CA 1//A/2-5+8/CA 1//B/5-10/CA");
model.addRange("0", 3, 10, "C"); // subsumes 5-9
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"0//B/1-4/CA 0//C/3-10/CA 1//A/2-5+8/CA 1//B/5-10/CA");
model.addRange("5", 25, 35, " ");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"0//B/1-4/CA 0//C/3-10/CA 1//A/2-5+8/CA 1//B/5-10/CA 5///25-35/CA");
}
import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
public class ChimeraCommandsTest
{
public void testGetAtomSpec()
{
AtomSpecModel model = new AtomSpecModel();
- assertEquals(testee.getAtomSpec(model, false), "");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, false), "#1:2-4.A");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1:2-4.A");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, false), "#1:2-4.A,8.A");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1:2-4.A,8.A");
model.addRange("1", 5, 7, "B");
- assertEquals(testee.getAtomSpec(model, false), "#1:2-4.A,8.A,5-7.B");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1:2-4.A,8.A,5-7.B");
model.addRange("1", 3, 5, "A");
- assertEquals(testee.getAtomSpec(model, false), "#1:2-5.A,8.A,5-7.B");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1:2-5.A,8.A,5-7.B");
model.addRange("0", 1, 4, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0:1-4.B|#1:2-5.A,8.A,5-7.B");
model.addRange("0", 5, 9, "C");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0:1-4.B,5-9.C|#1:2-5.A,8.A,5-7.B");
model.addRange("1", 8, 10, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0:1-4.B,5-9.C|#1:2-5.A,8.A,5-10.B");
model.addRange("1", 8, 9, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0:1-4.B,5-9.C|#1:2-5.A,8.A,5-10.B");
model.addRange("0", 3, 10, "C"); // subsumes 5-9
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0:1-4.B,3-10.C|#1:2-5.A,8.A,5-10.B");
model.addRange("5", 25, 35, " ");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0:1-4.B,3-10.C|#1:2-5.A,8.A,5-10.B|#5:25-35.");
}
toAlign.addRange("2", 20, 21, "B");
toAlign.addRange("2", 22, 22, "C");
List<StructureCommandI> command = testee.superposeStructures(ref,
- toAlign, false);
+ toAlign, AtomSpecType.ALPHA);
// qualifier to restrict match to CA and no altlocs
String carbonAlphas = "@CA&~@.B-Z&~@.2-9";
String refSpec = "#1:12-14.A,18.B,22-23.B";
public void testGetAtomSpec_alphaOnly()
{
AtomSpecModel model = new AtomSpecModel();
- assertEquals(testee.getAtomSpec(model, true), "");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#1:2-4.A@CA&~@.B-Z&~@.2-9");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#1:2-4.A,8.A@CA&~@.B-Z&~@.2-9");
model.addRange("1", 5, 7, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#1:2-4.A,8.A,5-7.B@CA&~@.B-Z&~@.2-9");
model.addRange("1", 3, 5, "A");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#1:2-5.A,8.A,5-7.B@CA&~@.B-Z&~@.2-9");
model.addRange("0", 1, 4, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0:1-4.B@CA&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-7.B@CA&~@.B-Z&~@.2-9");
model.addRange("0", 5, 9, "C");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0:1-4.B,5-9.C@CA&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-7.B@CA&~@.B-Z&~@.2-9");
model.addRange("1", 8, 10, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0:1-4.B,5-9.C@CA&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA&~@.B-Z&~@.2-9");
model.addRange("1", 8, 9, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0:1-4.B,5-9.C@CA&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA&~@.B-Z&~@.2-9");
model.addRange("0", 3, 10, "C"); // subsumes 5-9
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0:1-4.B,3-10.C@CA&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA&~@.B-Z&~@.2-9");
model.addRange("5", 25, 35, " "); // empty chain code
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0:1-4.B,3-10.C@CA&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA&~@.B-Z&~@.2-9|#5:25-35.@CA&~@.B-Z&~@.2-9");
}
import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
public class ChimeraXCommandsTest
{
toAlign.addRange("2", 20, 21, "B");
toAlign.addRange("2", 22, 22, "C");
List<StructureCommandI> command = testee.superposeStructures(ref,
- toAlign,false);
+ toAlign,AtomSpecType.ALPHA);
assertEquals(command.size(), 1);
String cmd = command.get(0).getCommand();
String refSpec = "#1/A:12-14/B:18,22-23";
public void testGetAtomSpec()
{
AtomSpecModel model = new AtomSpecModel();
- assertEquals(testee.getAtomSpec(model, false), "");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY
+ ), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, false), "#1/A:2-4");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1/A:2-4");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, false), "#1/A:2-4,8");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1/A:2-4,8");
model.addRange("1", 5, 7, "B");
- assertEquals(testee.getAtomSpec(model, false), "#1/A:2-4,8/B:5-7");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1/A:2-4,8/B:5-7");
model.addRange("1", 3, 5, "A");
- assertEquals(testee.getAtomSpec(model, false), "#1/A:2-5,8/B:5-7");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY), "#1/A:2-5,8/B:5-7");
model.addRange("0", 1, 4, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0/B:1-4|#1/A:2-5,8/B:5-7");
model.addRange("0", 5, 9, "C");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0/B:1-4/C:5-9|#1/A:2-5,8/B:5-7");
model.addRange("1", 8, 10, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0/B:1-4/C:5-9|#1/A:2-5,8/B:5-10");
model.addRange("1", 8, 9, "B");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0/B:1-4/C:5-9|#1/A:2-5,8/B:5-10");
model.addRange("0", 3, 10, "C"); // subsumes 5-9
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0/B:1-4/C:3-10|#1/A:2-5,8/B:5-10");
model.addRange("5", 25, 35, " ");
- assertEquals(testee.getAtomSpec(model, false),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.RESIDUE_ONLY),
"#0/B:1-4/C:3-10|#1/A:2-5,8/B:5-10|#5/:25-35");
}
public void testGetAtomSpec_alphaOnly()
{
AtomSpecModel model = new AtomSpecModel();
- assertEquals(testee.getAtomSpec(model, true), "");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, true), "#1/A:2-4@CA");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "#1/A:2-4@CA");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, true), "#1/A:2-4,8@CA");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "#1/A:2-4,8@CA");
model.addRange("1", 5, 7, "B");
- assertEquals(testee.getAtomSpec(model, true), "#1/A:2-4,8/B:5-7@CA");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "#1/A:2-4,8/B:5-7@CA");
model.addRange("1", 3, 5, "A");
- assertEquals(testee.getAtomSpec(model, true), "#1/A:2-5,8/B:5-7@CA");
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA), "#1/A:2-5,8/B:5-7@CA");
model.addRange("0", 1, 4, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0/B:1-4@CA|#1/A:2-5,8/B:5-7@CA");
model.addRange("0", 5, 9, "C");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0/B:1-4/C:5-9@CA|#1/A:2-5,8/B:5-7@CA");
model.addRange("1", 8, 10, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0/B:1-4/C:5-9@CA|#1/A:2-5,8/B:5-10@CA");
model.addRange("1", 8, 9, "B");
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0/B:1-4/C:5-9@CA|#1/A:2-5,8/B:5-10@CA");
model.addRange("0", 3, 10, "C"); // subsumes 5-9
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0/B:1-4/C:3-10@CA|#1/A:2-5,8/B:5-10@CA");
model.addRange("5", 25, 35, " "); // empty chain code
- assertEquals(testee.getAtomSpec(model, true),
+ assertEquals(testee.getAtomSpec(model, AtomSpecType.ALPHA),
"#0/B:1-4/C:3-10@CA|#1/A:2-5,8/B:5-10@CA|#5/:25-35@CA");
}
import jalview.structure.AtomSpec;
import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
import junit.extensions.PA;
Color mColor = new Color(0x82827d);
AtomSpecModel atomSpec = colours.get(mColor);
assertNotNull(atomSpec);
- assertEquals(helper.getAtomSpec(atomSpec, false), "#0:21.A|#1:21.B");
+ assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), "#0:21.A|#1:21.B");
/*
* H colour is #60609f, seq1.2 mapped to structure 0 residue 22
Color hColor = new Color(0x60609f);
atomSpec = colours.get(hColor);
assertNotNull(atomSpec);
- assertEquals(helper.getAtomSpec(atomSpec, false), "#0:22.A");
+ assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), "#0:22.A");
/*
* V colour is #ffff00, seq2.2 mapped to structure 1 residue 22
Color vColor = new Color(0xffff00);
atomSpec = colours.get(vColor);
assertNotNull(atomSpec);
- assertEquals(helper.getAtomSpec(atomSpec, false), "#1:22.B");
+ assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), "#1:22.B");
/*
* hidden columns are Gray (128, 128, 128)
Color gray = new Color(128, 128, 128);
atomSpec = colours.get(gray);
assertNotNull(atomSpec);
- assertEquals(helper.getAtomSpec(atomSpec, false), "#0:23-25.A|#1:23-25.B");
+ assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY), "#0:23-25.A|#1:23-25.B");
/*
* S and G are both coloured #4949b6, structure residues 26-30
Color sgColour = new Color(0x4949b6);
atomSpec = colours.get(sgColour);
assertNotNull(atomSpec);
- assertEquals(helper.getAtomSpec(atomSpec, false),
+ assertEquals(helper.getAtomSpec(atomSpec, AtomSpecType.RESIDUE_ONLY),
"#0:26-30.A|#1:26-30.B");
}
}
\ No newline at end of file