Merge branch 'develop' into features/r2_11_2_alphafold/JAL-629
[jalview.git] / src / jalview / ws / sifts / SiftsClient.java
index 0c707e5..24526cf 100644 (file)
@@ -57,6 +57,7 @@ import jalview.analysis.scoremodels.ScoreMatrix;
 import jalview.analysis.scoremodels.ScoreModels;
 import jalview.api.DBRefEntryI;
 import jalview.api.SiftsClientI;
+import jalview.bin.Console;
 import jalview.datamodel.DBRefEntry;
 import jalview.datamodel.DBRefSource;
 import jalview.datamodel.SequenceI;
@@ -116,7 +117,7 @@ public class SiftsClient implements SiftsClientI
 
   private static final String NOT_OBSERVED = "Not_Observed";
 
-  private static final String SIFTS_FTP_BASE_URL = "http://ftp.ebi.ac.uk/pub/databases/msd/sifts/xml/";
+  private static final String SIFTS_SPLIT_FTP_BASE_URL = "https://ftp.ebi.ac.uk/pub/databases/msd/sifts/split_xml/";
 
   private final static String NEWLINE = System.lineSeparator();
 
@@ -305,7 +306,7 @@ public class SiftsClient implements SiftsClientI
       pdbId = pdbId.replace(".cif", "");
     }
     String siftFile = pdbId + ".xml.gz";
-    String siftsFileFTPURL = SIFTS_FTP_BASE_URL + siftFile;
+    String siftsFileFTPURL = getDownloadUrlFor(siftFile);
 
     /*
      * Download the file from URL to either
@@ -348,6 +349,14 @@ public class SiftsClient implements SiftsClientI
     return downloadTo;
   }
 
+  public static String getDownloadUrlFor(String siftFile)
+  {
+    String durl = SIFTS_SPLIT_FTP_BASE_URL+siftFile.substring(1, 3)+"/"+siftFile;
+    Console.trace("SIFTS URL for "+siftFile+" is "+durl);
+    return durl;
+    
+  }
+
   /**
    * Delete the SIFTs file for the given PDB Id in the local SIFTs download
    * directory
@@ -535,7 +544,7 @@ public class SiftsClient implements SiftsClientI
 
     if (mapping.isEmpty())
     {
-      throw new SiftsException("SIFTS mapping failed");
+      throw new SiftsException("SIFTS mapping failed for "+entityId+" and "+seq.getName());
     }
     // also construct a mapping object between the seq-coord sys and the PDB
     // seq's coord sys