feature locations are retrieved by associated accession string
[jalview.git] / src / jalview / appletgui / AppletJmol.java
index 2c2a979..53115d2 100644 (file)
@@ -67,6 +67,7 @@ public class AppletJmol extends Frame
   TextField inputLine;
   TextArea history;
   SequenceI[] sequence;
+  String [] chains;
   StructureSelectionManager ssm;
   RenderPanel renderPanel;
   AlignmentPanel ap;
@@ -78,11 +79,13 @@ public class AppletJmol extends Frame
 
   public AppletJmol(PDBEntry pdbentry,
                     SequenceI[] seq,
+                    String[] chains,
                     AlignmentPanel ap,
                     String protocol)
   {
     this.ap = ap;
     this.sequence = seq;
+    this.chains = chains;
     this.pdbentry = pdbentry;
 
    String alreadyMapped = StructureSelectionManager
@@ -92,8 +95,9 @@ public class AppletJmol extends Frame
     if (alreadyMapped != null)
     {
        StructureSelectionManager.getStructureSelectionManager()
-            .setMapping(seq, pdbentry.getFile(), protocol);
-        return;
+            .setMapping(seq, chains, pdbentry.getFile(), protocol);
+       //PROMPT USER HERE TO ADD TO NEW OR EXISTING VIEW?
+       //FOR NOW, LETS JUST OPEN A NEW WINDOW
     }
 
     renderPanel = new RenderPanel();
@@ -165,9 +169,7 @@ public class AppletJmol extends Frame
           viewer.openFile(pdbentry.getFile());
     }
 
-    this.setBounds(400, 400, 400, 400);
-
-    this.setVisible(true);
+    jalview.bin.JalviewLite.addFrame(this, "Jmol", 400,400);
   }
 
   public void loadInline(String string)
@@ -460,6 +462,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)
   {
@@ -493,7 +503,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++)
           {
@@ -606,14 +617,14 @@ public class AppletJmol extends Frame
       MCview.PDBfile pdb;
       if (loadedInline)
       {
-        pdb = ssm.setMapping(sequence,
+        pdb = ssm.setMapping(sequence,chains,
                                 pdbentry.getFile(),
                                 AppletFormatAdapter.PASTE);
         pdbentry.setFile("INLINE"+pdb.id);
       }
       else
       {
-         pdb = ssm.setMapping(sequence,
+         pdb = ssm.setMapping(sequence,chains,
                               pdbentry.getFile(),
                               AppletFormatAdapter.URL);
       }