JAL-2885 xfam https
[jalview.git] / src / jalview / ws / dbsources / Uniprot.java
index 94bc582..6b09eb6 100644 (file)
@@ -20,6 +20,7 @@
  */
 package jalview.ws.dbsources;
 
+import jalview.bin.Cache;
 import jalview.datamodel.Alignment;
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
@@ -52,6 +53,8 @@ import com.stevesoft.pat.Regex;
  */
 public class Uniprot extends DbSourceProxyImpl
 {
+  private static final String DEFAULT_UNIPROT_DOMAIN = "https://www.uniprot.org";
+
   private static final String BAR_DELIMITER = "|";
 
   /*
@@ -60,11 +63,6 @@ public class Uniprot extends DbSourceProxyImpl
   private static Mapping map;
 
   /**
-   * configurable parameter controlling prefixing of entry names with accessions
-   */
-  private boolean includeAllIds = false;
-
-  /**
    * Constructor
    */
   public Uniprot()
@@ -72,6 +70,11 @@ public class Uniprot extends DbSourceProxyImpl
     super();
   }
 
+  private String getDomain()
+  {
+    return Cache.getDefault("UNIPROT_DOMAIN", DEFAULT_UNIPROT_DOMAIN);
+  }
+
   /*
    * (non-Javadoc)
    * 
@@ -168,7 +171,7 @@ public class Uniprot extends DbSourceProxyImpl
               "(UNIPROT\\|?|UNIPROT_|UNIREF\\d+_|UNIREF\\d+\\|?)", "");
       AlignmentI al = null;
 
-      String downloadstring = "http://www.uniprot.org/uniprot/" + queries
+      String downloadstring = getDomain() + "/uniprot/" + queries
               + ".xml";
       URL url = null;
       URLConnection urlconn = null;
@@ -208,7 +211,7 @@ public class Uniprot extends DbSourceProxyImpl
    */
   public SequenceI uniprotEntryToSequenceI(UniprotEntry entry)
   {
-    String id = getUniprotEntryId(entry, includeAllIds);
+    String id = getUniprotEntryId(entry);
     SequenceI sequence = new Sequence(id,
             entry.getUniprotSequence().getContent());
     sequence.setDescription(getUniprotEntryDescription(entry));
@@ -318,21 +321,9 @@ public class Uniprot extends DbSourceProxyImpl
    *          UniprotEntry
    * @return The accession id(s) and name(s) delimited by '|'.
    */
-  public static String getUniprotEntryId(UniprotEntry entry,
-          boolean includeAllIds)
+  public static String getUniprotEntryId(UniprotEntry entry)
   {
     StringBuilder name = new StringBuilder(32);
-    if (includeAllIds)
-    {
-      // // use 'canonicalised' name for optimal id matching
-      name.append(DBRefSource.UNIPROT);
-      for (String accessionId : entry.getAccession())
-      {
-        name.append(BAR_DELIMITER);
-        name.append(accessionId);
-      }
-
-    }
     for (String n : entry.getName())
     {
       if (name.length() > 0)