import jalview.structure.AtomSpecModel;
import jalview.structure.StructureCommand;
import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
public class PymolCommandsTest
{
assertEquals(commands.size(), 3);
assertEquals(commands.get(0), new StructureCommand("color", "0x0000ff",
"0//A/2-5+9-23/ 0//B/7/ 1//A/1/ 1//B/4-7/"));
- assertEquals(commands.get(
- 1),
+ assertEquals(commands.get(1),
new StructureCommand("color", "0xffff00", "1//A/3-5+8/"));
- assertEquals(commands.get(
- 2),
+ assertEquals(commands.get(2),
new StructureCommand("color", "0xff0000", "0//A/3-9/"));
}
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);
- 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";
+ toAlign, AtomSpecType.ALPHA);
+ assertEquals(commands.size(), 4);
+ 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";
String refSpec = "1//A/12-14/ 1//B/18+22-23/";
String toAlignSpec = "2//B/15-17+20-21/ 2//C/22/";
-
+ String altLoc = " and (altloc '' or altloc 'a'))";
// super command: separate arguments for regions to align
- assertEquals(commands.get(0),
- new StructureCommand("super", refSpecCA, toAlignSpecCA));
+ assertEquals(commands.get(1), new StructureCommand("pair_fit",
+ toAlignSpecCA + altLoc, refSpecCA + altLoc));
// show aligned regions: one argument for combined atom specs
- assertEquals(commands.get(1), new StructureCommand("show", "cartoon",
+ assertEquals(commands.get(3), new StructureCommand("show", "cartoon",
refSpec + " " + toAlignSpec));
}
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");
}
@Test(groups = "Functional")
public void testColourResidues()
{
- assertEquals(testee.colourResidues("something",
- Color.MAGENTA),
+ assertEquals(testee.colourResidues("something", Color.MAGENTA),
new StructureCommand("color", "0xff00ff", "something"));
}
@Test(groups = "Functional")
public void testSetBackgroundColour()
{
- assertEquals(testee.setBackgroundColour(
- Color.PINK),
+ assertEquals(testee.setBackgroundColour(Color.PINK),
new StructureCommand("bg_color", "0xffafaf"));
}
"p.jv_side_chain_binding_='<html>metal <a href=\"http:a.b.c/x\"> 'ion!'");
assertEquals(commands.get(0), expected3);
}
+
+ @Test(groups = "Functional")
+ public void testCloseViewer()
+ {
+ assertEquals(testee.closeViewer(), new StructureCommand("quit"));
+ }
}