Make sure sequence is in mouse over alignment
[jalview.git] / src / jalview / appletgui / AppletJmol.java
index 375fe4d..4951516 100644 (file)
@@ -30,7 +30,6 @@ import jalview.io.*;
 import org.jmol.api.*;
 import org.jmol.adapter.smarter.SmarterJmolAdapter;
 
-
 import org.jmol.popup.*;
 import jalview.schemes.*;
 
@@ -94,13 +93,13 @@ public class AppletJmol extends Frame
     {
        StructureSelectionManager.getStructureSelectionManager()
             .setMapping(seq, pdbentry.getFile(), protocol);
-        return;
+       //PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW?
+       //FOR NOW, LETS JUST OPEN A NEW WINDOW
     }
 
     renderPanel = new RenderPanel();
 
     this.add(renderPanel, BorderLayout.CENTER);
-
     viewer = JmolViewer.allocateViewer(renderPanel, new SmarterJmolAdapter());
 
     viewer.setAppletContext("jalview",
@@ -462,6 +461,14 @@ public class AppletJmol extends Frame
 //End StructureListener
 ////////////////////////////
 
+  public Color getColour(int atomIndex, int pdbResNum, String chain, String pdbfile)
+  {
+    if (!pdbfile.equals(pdbentry.getFile()))
+      return null;
+
+    return new Color(viewer.getAtomArgb(atomIndex));
+  }
+
   FeatureRenderer fr;
   public void colourBySequence(AlignmentPanel ap)
   {
@@ -495,7 +502,8 @@ public class AppletJmol extends Frame
     {
       for (int m = 0; m < mapping.length; m++)
       {
-        if (mapping[m].getSequence() == sequence[s])
+        if (mapping[m].getSequence() == sequence[s]
+            && ap.av.alignment.findIndex(sequence[s])>-1)
         {
           for (int r = 0; r < sequence[s].getLength(); r++)
           {