JAL-3193 removal of rest.ensemblgenomes.org
[jalview.git] / src / jalview / ext / ensembl / EnsemblSeqProxy.java
index 19065f2..0fabb7e 100644 (file)
@@ -62,8 +62,6 @@ import org.json.simple.parser.ParseException;
  */
 public abstract class EnsemblSeqProxy extends EnsemblRestClient
 {
-  protected static final String NAME = "Name";
-
   protected static final String DESCRIPTION = "description";
 
   /*
@@ -118,14 +116,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
   }
 
   /**
-   * Constructor given the target domain to fetch data from
-   */
-  public EnsemblSeqProxy(String d)
-  {
-    super(d);
-  }
-
-  /**
    * Makes the sequence queries to Ensembl's REST service and returns an
    * alignment consisting of the returned sequences.
    */
@@ -210,7 +200,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
        * exon, cds and variation features
        */
       SequenceI genomicSequence = null;
-      EnsemblFeatures gffFetcher = new EnsemblFeatures(getDomain());
+      EnsemblFeatures gffFetcher = new EnsemblFeatures();
       EnsemblFeatureType[] features = getFeaturesToFetch();
       AlignmentI geneFeatures = gffFetcher.getSequenceRecords(accId,
               features);
@@ -260,7 +250,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
     String accId = querySeq.getName();
     try
     {
-      AlignmentI protein = new EnsemblProtein(getDomain())
+      AlignmentI protein = new EnsemblProtein()
               .getSequenceRecords(accId);
       if (protein == null || protein.getHeight() == 0)
       {
@@ -355,7 +345,7 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
       seq = seq.getDatasetSequence();
     }
 
-    EnsemblXref xrefFetcher = new EnsemblXref(getDomain(), getDbSource(),
+    EnsemblXref xrefFetcher = new EnsemblXref(getDbSource(),
             getEnsemblDataVersion());
     List<DBRefEntry> xrefs = xrefFetcher.getCrossReferences(seq.getName());
     for (DBRefEntry xref : xrefs)
@@ -442,10 +432,10 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
   }
 
   /**
-   * Parses a JSON response into a list of sequences
+   * Parses a JSON response for a single sequence ID query
    * 
    * @param br
-   * @return
+   * @return a single jalview.datamodel.Sequence
    * @see http://rest.ensembl.org/documentation/info/sequence_id
    */
   protected List<SequenceI> parseSequenceJson(BufferedReader br)
@@ -867,9 +857,8 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
   protected boolean featureMayBelong(SequenceFeature sf, String identifier)
   {
     String parent = (String) sf.getValue(PARENT);
-    // using contains to allow for prefix "gene:", "transcript:" etc
     if (parent != null
-            && !parent.toUpperCase().contains(identifier.toUpperCase()))
+            && !parent.equalsIgnoreCase(identifier))
     {
       // this genomic feature belongs to a different transcript
       return false;
@@ -877,6 +866,9 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
     return true;
   }
 
+  /**
+   * Answers a short description of the sequence fetcher
+   */
   @Override
   public String getDescription()
   {
@@ -915,10 +907,14 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient
 
   /**
    * Answers true if the feature type is either 'NMD_transcript_variant' or
-   * 'transcript' or one of its sub-types in the Sequence Ontology. This is
-   * needed because NMD_transcript_variant behaves like 'transcript' in Ensembl
+   * 'transcript' (or one of its sub-types in the Sequence Ontology). This is
+   * because NMD_transcript_variant behaves like 'transcript' in Ensembl
    * although strictly speaking it is not (it is a sub-type of
    * sequence_variant).
+   * <p>
+   * (This test was needed when fetching transcript features as GFF. As we are
+   * now fetching as JSON, all features have type 'transcript' so the check for
+   * NMD_transcript_variant is redundant. Left in for any future case arising.)
    * 
    * @param featureType
    * @return