JAL-3518 basic refactoring / pull up of superposeStructures; to tidy!
[jalview.git] / test / jalview / ext / rbvi / chimera / ChimeraXCommandsTest.java
index d8b60c2..a9eaca3 100644 (file)
@@ -31,6 +31,8 @@ import jalview.datamodel.SequenceI;
 import jalview.gui.AlignFrame;
 import jalview.gui.SequenceRenderer;
 import jalview.schemes.JalviewColourScheme;
+import jalview.structure.AtomSpecModel;
+import jalview.structure.StructureCommandsI;
 import jalview.structure.StructureMapping;
 import jalview.structure.StructureSelectionManager;
 
@@ -191,4 +193,25 @@ public class ChimeraXCommandsTest
     // S and G are both coloured #4949b6
     assertTrue(theCommand.contains("color #0/A:26-30|#1/B:26-30"));
   }
+
+  @Test(groups = { "Functional" })
+  public void testSuperposeStructures()
+  {
+    StructureCommandsI testee = new ChimeraXCommands();
+    AtomSpecModel ref = new AtomSpecModel();
+    ref.addRange(1, 12, 14, "A");
+    ref.addRange(1, 18, 18, "B");
+    ref.addRange(1, 22, 23, "B");
+    AtomSpecModel toAlign = new AtomSpecModel();
+    toAlign.addRange(2, 15, 17, "B");
+    toAlign.addRange(2, 20, 21, "B");
+    toAlign.addRange(2, 22, 22, "C");
+    String command = testee.superposeStructures(ref, toAlign);
+    String refSpec = "#1/A:12-14/B:18,22-23";
+    String toAlignSpec = "#2/B:15-17,20-21/C:22";
+    String expected = String.format(
+            "align %s %s;~display all; chain @CA|P; ribbon %s|%s; focus",
+            refSpec, toAlignSpec, refSpec, toAlignSpec);
+    assertEquals(command, expected);
+  }
 }