Merge branch 'features/JAL-2885UniprotHttps' into releases/Release_2_10_4_Branch
authorJim Procter <jprocter@issues.jalview.org>
Fri, 23 Feb 2018 16:01:42 +0000 (16:01 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 23 Feb 2018 16:01:42 +0000 (16:01 +0000)
1  2 
src/jalview/ext/ensembl/EnsemblLookup.java
src/jalview/ext/ensembl/EnsemblSequenceFetcher.java
test/jalview/ext/ensembl/EnsemblGeneTest.java

@@@ -41,6 -41,17 +41,19 @@@ import org.json.simple.parser.ParseExce
   */
  public class EnsemblLookup extends EnsemblRestClient
  {
+   private static final String OBJECT_TYPE_TRANSLATION = "Translation";
+   private static final String PARENT = "Parent";
+   private static final String OBJECT_TYPE_TRANSCRIPT = "Transcript";
+   private static final String ID = "id";
+   private static final String OBJECT_TYPE_GENE = "Gene";
+   private static final String OBJECT_TYPE = "object_type";
++  /**
++   * keep track of last identifier retrieved to break loops
++   */
+   private String lastId;
    /**
     * Default constructor (to use rest.ensembl.org)
     */
      BufferedReader br = null;
      try
      {
 -      URL url = getUrl(identifier);
++
 +      URL url = getUrl(identifier, objectType);
++
+       if (identifier.equals(lastId))
+       {
+         System.err.println("** Ensembl lookup " + url.toString()
+                 + " looping on Parent!");
+         return null;
+       }
++
+       lastId = identifier;
++
        if (url != null)
        {
          br = getHttpResponse(url, ids);
@@@ -41,22 -52,10 +52,22 @@@ abstract class EnsemblSequenceFetcher e
            "(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|"
                    + "(CCDS[0-9.]{3,}$)");
  
-   protected static final String ENSEMBL_GENOMES_REST = "http://rest.ensemblgenomes.org";
+   protected final String ensemblGenomesDomain;
  
-   protected static final String ENSEMBL_REST = "http://rest.ensembl.org";
+   protected final String ensemblDomain;
  
 +  protected static final String OBJECT_TYPE_TRANSLATION = "Translation";
 +
 +  protected static final String OBJECT_TYPE_TRANSCRIPT = "Transcript";
 +
 +  protected static final String OBJECT_TYPE_GENE = "Gene";
 +
 +  protected static final String PARENT = "Parent";
 +
 +  protected static final String ID = "id";
 +
 +  protected static final String OBJECT_TYPE = "object_type";
 +
    /*
     * possible values for the 'feature' parameter of the /overlap REST service
     * @see http://rest.ensembl.org/documentation/info/overlap_id