JAL-674 use PDB ID<>File registry to look up correct ID for PDB file derived annotati...
authorJim Procter <jprocter@dundee.ac.uk>
Thu, 30 Oct 2014 15:47:07 +0000 (15:47 +0000)
committerJim Procter <jprocter@dundee.ac.uk>
Thu, 30 Oct 2014 15:47:07 +0000 (15:47 +0000)
src/jalview/structure/StructureSelectionManager.java

index 449e133..9396be1 100644 (file)
@@ -246,17 +246,29 @@ public class StructureSelectionManager
      */
     MCview.PDBfile pdb = null;
     boolean parseSecStr=true;
-    for (SequenceI sq:sequence)
+    if (isPDBFileRegistered(pdbFile))
     {
-      SequenceI ds = sq;while (ds.getDatasetSequence()!=null) { ds = ds.getDatasetSequence();};
-      if (ds.getAnnotation()!=null)
+      for (SequenceI sq : sequence)
       {
-        for (AlignmentAnnotation ala:ds.getAnnotation())
+        SequenceI ds = sq;
+        while (ds.getDatasetSequence() != null)
         {
-          // false if any annotation present from this structure
-          if (MCview.PDBfile.isCalcIdForFile(ala.getCalcId(), pdbFile))
+          ds = ds.getDatasetSequence();
+        }
+        ;
+        if (ds.getAnnotation() != null)
+        {
+          for (AlignmentAnnotation ala : ds.getAnnotation())
           {
-            parseSecStr = false;
+
+            // false if any annotation present from this structure
+            // JBPNote this fails for jmol/chimera view because the *file* is
+            // passed, not the structure data ID -
+            if (MCview.PDBfile.isCalcIdForFile(ala.getCalcId(),
+                    findIdForPDBFile(pdbFile)))
+            {
+              parseSecStr = false;
+            }
           }
         }
       }
@@ -264,7 +276,11 @@ public class StructureSelectionManager
     try
     {
       pdb = new MCview.PDBfile(true, parseSecStr, pdbFile, protocol);
-      
+      if (pdb.id != null && pdb.id.trim().length() > 0
+              && FormatAdapter.FILE.equals(protocol))
+      {
+        registerPDBFile(pdb.id.trim(), pdbFile);
+      }
     } catch (Exception ex)
     {
       ex.printStackTrace();