JAL-2422 JAL-3551 unit tests updated for code changes
[jalview.git] / test / jalview / ext / rbvi / chimera / ChimeraCommandsTest.java
index 5afbd7a..f087020 100644 (file)
@@ -23,10 +23,6 @@ package jalview.ext.rbvi.chimera;
 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;
@@ -35,6 +31,10 @@ import java.util.Map;
 
 import org.testng.annotations.Test;
 
+import jalview.structure.AtomSpecModel;
+import jalview.structure.StructureCommandI;
+import jalview.structure.StructureCommandsI;
+
 public class ChimeraCommandsTest
 {
 
@@ -57,12 +57,9 @@ 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" })
@@ -205,11 +202,13 @@ public class ChimeraCommandsTest
     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);
   }
 
@@ -221,34 +220,34 @@ public class ChimeraCommandsTest
     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");
   
   }
 
@@ -272,7 +271,8 @@ public class ChimeraCommandsTest
     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")