JAL-3438 spotless for 2.11.2.0
[jalview.git] / src / jalview / structures / models / AAStructureBindingModel.java
index 3414e95..44d698d 100644 (file)
@@ -61,6 +61,7 @@ import jalview.structure.AtomSpec;
 import jalview.structure.AtomSpecModel;
 import jalview.structure.StructureCommandI;
 import jalview.structure.StructureCommandsI;
+import jalview.structure.StructureCommandsI.AtomSpecType;
 import jalview.structure.StructureListener;
 import jalview.structure.StructureMapping;
 import jalview.structure.StructureSelectionManager;
@@ -69,9 +70,9 @@ import jalview.util.MessageManager;
 
 /**
  * 
- * A base class to hold common function for 3D structure model binding.
- * Initial version created by refactoring JMol and Chimera binding models, but
- * other structure viewers could in principle be accommodated in future.
+ * A base class to hold common function for 3D structure model binding. Initial
+ * version created by refactoring JMol and Chimera binding models, but other
+ * structure viewers could in principle be accommodated in future.
  * 
  * @author gmcarstairs
  *
@@ -91,6 +92,9 @@ public abstract class AAStructureBindingModel
 
     public String chain = "";
 
+    /**
+     * is the mapped sequence not protein ?
+     */
     public boolean isRna;
 
     /*
@@ -167,6 +171,9 @@ public abstract class AAStructureBindingModel
 
   protected boolean colourBySequence = true;
 
+  /**
+   * true if all sequences appear to be nucleotide
+   */
   private boolean nucleotide;
 
   private boolean finishedInit = false;
@@ -584,7 +591,6 @@ public abstract class AAStructureBindingModel
       }
     }
   }
-  
 
   @Override
   public abstract void highlightAtoms(List<AtomSpec> atoms);
@@ -716,7 +722,7 @@ public abstract class AAStructureBindingModel
               structures[pdbfnum].chain = chain;
             }
             structures[pdbfnum].pdbId = mapping.getPdbId();
-            structures[pdbfnum].isRna = theSequence.getRNA() != null;
+            structures[pdbfnum].isRna = !theSequence.isProtein();
 
             /*
              * move on to next pdb file (ignore sequences for other chains
@@ -919,6 +925,9 @@ public abstract class AAStructureBindingModel
       // todo better way to ensure synchronous than setting getReply true!!
       executeCommands(commandGenerator.showBackbone(), true, null);
 
+      AtomSpecType backbone = structures[refStructure].isRna
+              ? AtomSpecType.PHOSPHATE
+              : AtomSpecType.ALPHA;
       /*
        * superpose each (other) structure to the reference in turn
        */
@@ -928,12 +937,13 @@ public abstract class AAStructureBindingModel
         {
           AtomSpecModel atomSpec = getAtomSpec(structures[i], matched);
           List<StructureCommandI> commands = commandGenerator
-                  .superposeStructures(refAtoms, atomSpec);
+                  .superposeStructures(refAtoms, atomSpec, backbone);
           List<String> replies = executeCommands(commands, true, null);
           for (String reply : replies)
           {
             // return this error (Chimera only) to the user
-            if (reply.toLowerCase(Locale.ROOT).contains("unequal numbers of atoms"))
+            if (reply.toLowerCase(Locale.ROOT)
+                    .contains("unequal numbers of atoms"))
             {
               error += "; " + reply;
             }