JAL-3390 move StructureCommands to utils package
[jalview.git] / src / jalview / ext / rbvi / chimera / JalviewChimeraBinding.java
index 44bcbe4..dd0a75e 100644 (file)
@@ -40,6 +40,7 @@ import jalview.structure.StructureMappingcommandSet;
 import jalview.structure.StructureSelectionManager;
 import jalview.structures.models.AAStructureBindingModel;
 import jalview.util.MessageManager;
+import jalview.util.StructureCommands;
 
 import java.awt.Color;
 import java.io.File;
@@ -76,8 +77,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
 
   private static final String ALPHACARBON = "CA";
 
-  private List<String> chainNames = new ArrayList<>();
-
   private Hashtable<String, String> chainFile = new Hashtable<>();
 
   /*
@@ -650,32 +649,32 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
   /**
    * Sends a set of colour commands to the structure viewer
    * 
-   * @param colourBySequenceCommands
+   * @param commands
    */
   @Override
-  protected void colourBySequence(
-          StructureMappingcommandSet[] colourBySequenceCommands)
+  protected void colourBySequence(String[] commands)
   {
-    for (StructureMappingcommandSet cpdbbyseq : colourBySequenceCommands)
+    for (String command : commands)
     {
-      for (String command : cpdbbyseq.commands)
-      {
-        sendAsynchronousCommand(command, COLOURING_CHIMERA);
-      }
+      sendAsynchronousCommand(command, COLOURING_CHIMERA);
     }
   }
 
   /**
+   * Computes and returns a set of commands to colour residues in Chimera the same
+   * as mapped residues in the alignment
+   * 
    * @param files
    * @param viewPanel
    * @return
    */
   @Override
-  protected StructureMappingcommandSet[] getColourBySequenceCommands(
+  protected String[] getColourBySequenceCommands(
           String[] files, AlignmentViewPanel viewPanel)
   {
-    return ChimeraCommands.getColourBySequenceCommand(files, viewPanel,
-            this);
+    Map<Object, AtomSpecModel> colourMap = StructureCommands.buildColoursMap(this, viewPanel);
+
+    return ChimeraCommands.getColourBySequenceCommand(colourMap, this);
   }
 
   /**
@@ -1021,18 +1020,6 @@ public abstract class JalviewChimeraBinding extends AAStructureBindingModel
   }
 
   /**
-   * Returns a list of chains mapped in this viewer. Note this list is not
-   * currently scoped per structure.
-   * 
-   * @return
-   */
-  @Override
-  public List<String> getChainNames()
-  {
-    return chainNames;
-  }
-
-  /**
    * Send a 'focus' command to Chimera to recentre the visible display
    */
   public void focusView()