import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import java.awt.Color;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.ColumnSelection;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
-import java.awt.Color;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
public class JmolCommandsTest
{
// they were added; within colour, by model, by chain, ranges in start order
List<StructureCommandI> commands = new JmolCommands()
.colourBySequence(map);
- assertEquals(commands.size(), 3);
+ assertEquals(commands.size(), 1);
String expected1 = "select 2-5:A/1.1|9-23:A/1.1|7:B/1.1|1:A/2.1|4-7:B/2.1;color[0,0,255]";
String expected2 = "select 3-5:A/2.1|8:A/2.1;color[255,255,0]";
String expected3 = "select 3-9:A/1.1;color[255,0,0]";
- assertEquals(commands.get(0).getCommand(), expected1);
- assertEquals(commands.get(1).getCommand(), expected2);
- assertEquals(commands.get(2).getCommand(), expected3);
+ assertEquals(commands.get(0).getCommand(),
+ expected1 + ";" + expected2 + ";" + expected3);
}
@Test(groups = { "Functional" })
import static org.testng.Assert.assertEquals;
-import jalview.structure.AtomSpecModel;
-import jalview.structure.StructureCommandI;
-import jalview.structure.StructureCommandsI;
-
import java.awt.Color;
import java.util.LinkedHashMap;
import java.util.List;
import org.testng.annotations.Test;
+import jalview.structure.AtomSpecModel;
+import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI;
+
public class PymolCommandsTest
{
{
PymolCommands testee = new PymolCommands();
assertEquals(testee.openCommandFile("commands.pml").toString(),
- "@commands.pml");
+ "run(commands.pml)");
}
@Test(groups = "Functional")
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.structure.AtomSpecModel;
-import jalview.structure.StructureCommandI;
-import jalview.structure.StructureCommandsI;
-
import java.awt.Color;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.testng.annotations.Test;
+import jalview.structure.AtomSpecModel;
+import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI;
+
public class ChimeraCommandsTest
{
// they were added; within colour, by model, by chain, ranges in start order
List<StructureCommandI> commands = new ChimeraCommands()
.colourBySequence(map);
- assertEquals(commands.size(), 3);
+ assertEquals(commands.size(), 1);
assertEquals(commands.get(0).getCommand(),
- "color #0000ff #0:2-5.A,9-23.A,7.B|#1:1.A,4-7.B");
- assertEquals(commands.get(1).getCommand(),
- "color #ffff00 #1:3-5.A,8.A");
- assertEquals(commands.get(2).getCommand(), "color #ff0000 #0:3-9.A");
+ "color #0000ff #0:2-5.A,9-23.A,7.B|#1:1.A,4-7.B;color #ffff00 #1:3-5.A,8.A;color #ff0000 #0:3-9.A");
}
@Test(groups = { "Functional" })
toAlign.addRange("2", 22, 22, "C");
List<StructureCommandI> command = testee.superposeStructures(ref,
toAlign);
- String refSpec = "#1:12-14.A,18.B,22-23.B@CA|P&~@.B-Z&~@.2-9";
- String toAlignSpec = "#2:15-17.B,20-21.B,22.C@CA|P&~@.B-Z&~@.2-9";
+ // 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";
+ String toAlignSpec = "#2:15-17.B,20-21.B,22.C";
String expected = String.format(
- "match %s %s; ribbon %s|%s; focus",
- refSpec, toAlignSpec, refSpec, toAlignSpec);
+ "match %s%s %s%s; ribbon %s|%s; focus", toAlignSpec,
+ carbonAlphas, refSpec, carbonAlphas, toAlignSpec, refSpec);
assertEquals(command.get(0).getCommand(), expected);
}
assertEquals(testee.getAtomSpec(model, true), "");
model.addRange("1", 2, 4, "A");
assertEquals(testee.getAtomSpec(model, true),
- "#1:2-4.A@CA|P&~@.B-Z&~@.2-9");
+ "#1:2-4.A@CA&~@.B-Z&~@.2-9");
model.addRange("1", 8, 8, "A");
assertEquals(testee.getAtomSpec(model, true),
- "#1:2-4.A,8.A@CA|P&~@.B-Z&~@.2-9");
+ "#1:2-4.A,8.A@CA&~@.B-Z&~@.2-9");
model.addRange("1", 5, 7, "B");
assertEquals(testee.getAtomSpec(model, true),
- "#1:2-4.A,8.A,5-7.B@CA|P&~@.B-Z&~@.2-9");
+ "#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),
- "#1:2-5.A,8.A,5-7.B@CA|P&~@.B-Z&~@.2-9");
+ "#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),
- "#0:1-4.B@CA|P&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-7.B@CA|P&~@.B-Z&~@.2-9");
+ "#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),
- "#0:1-4.B,5-9.C@CA|P&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-7.B@CA|P&~@.B-Z&~@.2-9");
+ "#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),
- "#0:1-4.B,5-9.C@CA|P&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA|P&~@.B-Z&~@.2-9");
+ "#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),
- "#0:1-4.B,5-9.C@CA|P&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA|P&~@.B-Z&~@.2-9");
+ "#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),
- "#0:1-4.B,3-10.C@CA|P&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA|P&~@.B-Z&~@.2-9");
+ "#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),
- "#0:1-4.B,3-10.C@CA|P&~@.B-Z&~@.2-9|#1:2-5.A,8.A,5-10.B@CA|P&~@.B-Z&~@.2-9|#5:25-35.@CA|P&~@.B-Z&~@.2-9");
+ "#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");
}
ChimeraCommands testee = new ChimeraCommands();
List<StructureCommandI> cmds = testee.showBackbone();
assertEquals(cmds.size(), 1);
- assertEquals(cmds.get(0).getCommand(), "~display all;chain @CA|P");
+ assertEquals(cmds.get(0).getCommand(),
+ "~display all;~ribbon;chain @CA|P");
}
@Test(groups = "Functional")
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import jalview.structure.AtomSpecModel;
-import jalview.structure.StructureCommandI;
-import jalview.structure.StructureCommandsI;
-
import java.awt.Color;
import java.util.HashMap;
import java.util.LinkedHashMap;
import org.testng.annotations.Test;
+import jalview.structure.AtomSpecModel;
+import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI;
+
public class ChimeraXCommandsTest
{
@Test(groups = { "Functional" })
*/
List<StructureCommandI> commands = new ChimeraXCommands()
.colourBySequence(map);
- assertEquals(commands.size(), 3);
+ assertEquals(commands.size(), 1);
assertEquals(commands.get(0).getCommand(),
- "color #1/A:2-5,9-23/B:7|#2/A:1/B:4-7 #0000ff");
- assertEquals(commands.get(1).getCommand(), "color #2/A:3-5,8 #ffff00");
- assertEquals(commands.get(2).getCommand(), "color #1/A:3-9 #ff0000");
+ "color #1/A:2-5,9-23/B:7|#2/A:1/B:4-7 #0000ff;color #2/A:3-5,8 #ffff00;color #1/A:3-9 #ff0000");
}
@Test(groups = { "Functional" })
* ribbon command does not
*/
String expected = String.format(
- "align %s@CA|P toAtoms %s@CA|P; ribbon %s|%s; view",
- refSpec, toAlignSpec, refSpec, toAlignSpec);
+ "align %s@CA toAtoms %s@CA; ribbon %s|%s; view",
+ toAlignSpec, refSpec, toAlignSpec, refSpec);
assertEquals(cmd, expected);
}
AtomSpecModel model = new AtomSpecModel();
assertEquals(testee.getAtomSpec(model, true), "");
model.addRange("1", 2, 4, "A");
- assertEquals(testee.getAtomSpec(model, true), "#1/A:2-4@CA|P");
+ assertEquals(testee.getAtomSpec(model, true), "#1/A:2-4@CA");
model.addRange("1", 8, 8, "A");
- assertEquals(testee.getAtomSpec(model, true), "#1/A:2-4,8@CA|P");
+ assertEquals(testee.getAtomSpec(model, true), "#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|P");
+ assertEquals(testee.getAtomSpec(model, true), "#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|P");
+ assertEquals(testee.getAtomSpec(model, true), "#1/A:2-5,8/B:5-7@CA");
model.addRange("0", 1, 4, "B");
assertEquals(testee.getAtomSpec(model, true),
- "#0/B:1-4@CA|P|#1/A:2-5,8/B:5-7@CA|P");
+ "#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),
- "#0/B:1-4/C:5-9@CA|P|#1/A:2-5,8/B:5-7@CA|P");
+ "#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),
- "#0/B:1-4/C:5-9@CA|P|#1/A:2-5,8/B:5-10@CA|P");
+ "#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),
- "#0/B:1-4/C:5-9@CA|P|#1/A:2-5,8/B:5-10@CA|P");
+ "#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),
- "#0/B:1-4/C:3-10@CA|P|#1/A:2-5,8/B:5-10@CA|P");
+ "#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),
- "#0/B:1-4/C:3-10@CA|P|#1/A:2-5,8/B:5-10@CA|P|#5/:25-35@CA|P");
+ "#0/B:1-4/C:3-10@CA|#1/A:2-5,8/B:5-10@CA|#5/:25-35@CA");
}
@Test(groups = "Functional")
List<StructureCommandI> showBackbone = testee.showBackbone();
assertEquals(showBackbone.size(), 1);
assertEquals(showBackbone.get(0).getCommand(),
- "~display all;show @CA|P pbonds");
+ "~display all;~ribbon;show @CA|P atoms");
}
@Test(groups = "Functional")
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import java.awt.Color;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.BitSet;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
import jalview.api.AlignmentViewPanel;
import jalview.api.SequenceRenderer;
import jalview.datamodel.Alignment;
import jalview.structure.StructureCommandI;
import jalview.structure.StructureMapping;
import jalview.structure.StructureSelectionManager;
-
-import java.awt.Color;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.BitSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
import junit.extensions.PA;
/**
return null;
}
+ /*
+ * for this test, let structure model ids be 0, 1, ...
+ * corresponding to first, second etc pdbfile
+ */
@Override
- protected String getModelIdForFile(String chainId)
+ protected String getModelIdForFile(String pdbfile)
{
+ for (int i = 0; i < this.getPdbCount(); i++)
+ {
+ if (pdbfile.equals(this.getPdbEntry(i).getFile()))
+ {
+ return String.valueOf(i);
+ }
+ }
return "";
}
SequenceI[][] seqs = new SequenceI[][] { { seq1 }, { seq2 } };
String[] files = new String[] { "seq1.pdb", "seq2.pdb" };
PDBEntry[] pdbFiles = new PDBEntry[2];
- pdbFiles[0] = new PDBEntry("PDB1", "A", Type.PDB, "INLINEPDB1");
- pdbFiles[1] = new PDBEntry("PDB2", "B", Type.PDB, "INLINEPDB2");
+ pdbFiles[0] = new PDBEntry("PDB1", "A", Type.PDB, "seq1.pdb");
+ pdbFiles[1] = new PDBEntry("PDB2", "B", Type.PDB, "seq2.pdb");
StructureSelectionManager ssm = new StructureSelectionManager();
/*