JAL-1803 JAL-2188 experimental:
authorJim Procter <jprocter@issues.jalview.org>
Thu, 1 Sep 2016 09:16:48 +0000 (10:16 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Thu, 1 Sep 2016 09:16:48 +0000 (10:16 +0100)
Don’t go looking for new cross-references if we already have a mapping between a PDBEntry and a sequence - speeds up viewing already downloaded structure data.

src/jalview/gui/StructureChooser.java

index b2cc70f..33c7ff3 100644 (file)
@@ -33,6 +33,7 @@ import jalview.fts.core.FTSRestRequest;
 import jalview.fts.core.FTSRestResponse;
 import jalview.fts.service.pdb.PDBFTSRestClient;
 import jalview.jbgui.GStructureChooser;
+import jalview.structure.StructureMapping;
 import jalview.structure.StructureSelectionManager;
 import jalview.util.MessageManager;
 import jalview.ws.DBRefFetcher;
@@ -865,8 +866,27 @@ public class StructureChooser extends GStructureChooser implements
     if (SiftsSettings.isMapWithSifts())
     {
       ArrayList<SequenceI> seqsWithoutSourceDBRef = new ArrayList<SequenceI>();
+      int p = 0;
+      // TODO: skip PDBEntry:Sequence pairs where PDBEntry doesn't look like a
+      // real PDB ID. For moment, we can also safely do this if there is already
+      // a known mapping between the PDBEntry and the sequence.
       for (SequenceI seq : sequences)
       {
+        PDBEntry pdbe = pdbEntriesToView[p++];
+        if (pdbe != null && pdbe.getFile() != null)
+        {
+          StructureMapping[] smm = ssm.getMapping(pdbe.getFile());
+          if (smm != null && smm.length > 0)
+          {
+            for (StructureMapping sm : smm)
+            {
+              if (sm.getSequence() == seq)
+              {
+                continue;
+              }
+            }
+          }
+        }
         if (seq.getPrimaryDBRefs().size() == 0)
         {
             seqsWithoutSourceDBRef.add(seq);