JAL-3551 tidying, improved commands, fix Jmol model number derivation
[jalview.git] / src / jalview / ext / rbvi / chimera / ChimeraCommands.java
index 7e04f39..c355abe 100644 (file)
@@ -52,12 +52,13 @@ import java.util.Map;
  */
 public class ChimeraCommands extends StructureCommandsBase
 {
-  private static final StructureCommand SHOW_BACKBONE = new StructureCommand("~display all;chain @CA|P");
+  private static final StructureCommand SHOW_BACKBONE = new StructureCommand(
+          "~display all;~ribbon;chain @CA|P");
 
   public static final String NAMESPACE_PREFIX = "jv_";
 
   private static final StructureCommandI COLOUR_BY_CHARGE = new StructureCommand(
-          "color white;color red ::ASP;color red ::GLU;color blue ::LYS;color blue ::ARG;color yellow ::CYS");
+          "color white;color red ::ASP,GLU;color blue ::LYS,ARG;color yellow ::CYS");
 
   private static final StructureCommandI COLOUR_BY_CHAIN = new StructureCommand(
           "rainbow chain");
@@ -508,25 +509,27 @@ public class ChimeraCommands extends StructureCommandsBase
   }
 
   @Override
-  public List<StructureCommandI> superposeStructures(AtomSpecModel spec,
-          AtomSpecModel ref)
+  public List<StructureCommandI> superposeStructures(AtomSpecModel ref,
+          AtomSpecModel spec)
   {
     /*
      * Form Chimera match command to match spec to ref
+     * (the first set of atoms are moved on to the second)
      * 
      * match #1:1-30.B,81-100.B@CA #0:21-40.A,61-90.A@CA
      * 
-     * @see
-     * https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
+     * @see https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/midas/match.html
      */
     StringBuilder cmd = new StringBuilder();
-    String atomSpec = getAtomSpec(spec, true);
-    String refSpec = getAtomSpec(ref, true);
-    cmd.append("match ").append(atomSpec).append(" ").append(refSpec);
+    String atomSpecAlphaOnly = getAtomSpec(spec, true);
+    String refSpecAlphaOnly = getAtomSpec(ref, true);
+    cmd.append("match ").append(atomSpecAlphaOnly).append(" ").append(refSpecAlphaOnly);
 
     /*
      * show superposed residues as ribbon
      */
+    String atomSpec = getAtomSpec(spec, false);
+    String refSpec = getAtomSpec(ref, false);
     cmd.append("; ribbon ");
     cmd.append(atomSpec).append("|").append(refSpec).append("; focus");
 
@@ -621,7 +624,8 @@ public class ChimeraCommands extends StructureCommandsBase
        * restrict to alpha carbon, no alternative locations
        * (needed to ensuring matching atom counts for superposition)
        */
-      sb.append("@CA|P").append(NO_ALTLOCS);
+      // TODO @P instead if RNA - add nucleotide flag to AtomSpecModel?
+      sb.append("@CA").append(NO_ALTLOCS);
     }
   }