JAL-3855 check if an alpha fold ID and retrieve using that source
authorJim Procter <j.procter@dundee.ac.uk>
Tue, 27 Jul 2021 12:35:40 +0000 (13:35 +0100)
committerJim Procter <j.procter@dundee.ac.uk>
Tue, 27 Jul 2021 12:44:01 +0000 (13:44 +0100)
src/jalview/gui/AppJmol.java
src/jalview/gui/StructureViewerBase.java

index 7cf10e7..d085117 100644 (file)
@@ -51,6 +51,7 @@ import jalview.util.BrowserLauncher;
 import jalview.util.ImageMaker;
 import jalview.util.MessageManager;
 import jalview.util.Platform;
+import jalview.ws.dbsources.EBIAlfaFold;
 import jalview.ws.dbsources.Pdb;
 
 public class AppJmol extends StructureViewerBase
@@ -437,6 +438,8 @@ public class AppJmol extends StructureViewerBase
       // TODO: replace with reference fetching/transfer code (validate PDBentry
       // as a DBRef?)
       Pdb pdbclient = new Pdb();
+      EBIAlfaFold afclient = new EBIAlfaFold();
+      
       for (int pi = 0; pi < jmb.getPdbCount(); pi++)
       {
         String file = jmb.getPdbEntry(pi).getFile();
@@ -452,7 +455,12 @@ public class AppJmol extends StructureViewerBase
                   { pdbid }), hdl);
           try
           {
-            pdbseq = pdbclient.getSequenceRecords(pdbid);
+            if (afclient.isValidReference(pdbid))
+            {
+              pdbseq = afclient.getSequenceRecords(pdbid);
+            } else {
+              pdbseq = pdbclient.getSequenceRecords(pdbid);
+            }
           } catch (OutOfMemoryError oomerror)
           {
             new OOMWarning("Retrieving PDB id " + pdbid, oomerror);
index a0b199b..b349559 100644 (file)
@@ -63,6 +63,7 @@ import jalview.structure.StructureMapping;
 import jalview.structures.models.AAStructureBindingModel;
 import jalview.util.BrowserLauncher;
 import jalview.util.MessageManager;
+import jalview.ws.dbsources.EBIAlfaFold;
 import jalview.ws.dbsources.Pdb;
 
 /**
@@ -1121,6 +1122,7 @@ public abstract class StructureViewerBase extends GStructureViewer
   {
     String filePath = null;
     Pdb pdbclient = new Pdb();
+    EBIAlfaFold afclient =  new EBIAlfaFold();
     AlignmentI pdbseq = null;
     String pdbid = processingEntry.getId();
     long handle = System.currentTimeMillis()
@@ -1138,7 +1140,12 @@ public abstract class StructureViewerBase extends GStructureViewer
     // { pdbid }));
     try
     {
-      pdbseq = pdbclient.getSequenceRecords(pdbid);
+      if (afclient.isValidReference(pdbid))
+      {
+        pdbseq = afclient.getSequenceRecords(pdbid);
+      } else {
+        pdbseq = pdbclient.getSequenceRecords(pdbid);
+      }
     } catch (Exception e)
     {
       System.err.println(