JAL-2582 recognise ENS…P peptide IDs and make two getParent requests to get gene ID.
[jalview.git] / src / jalview / ext / ensembl / EnsemblRestClient.java
index 5960f81..2437588 100644 (file)
@@ -76,6 +76,9 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher
 
   private final static long VERSION_RETEST_INTERVAL = 1000L * 3600; // 1 hr
 
+  private static final Regex PROTEIN_REGEX = new Regex(
+          "(ENS)([A-Z]{3}|)P[0-9]{11}$");
+
   private static final Regex TRANSCRIPT_REGEX = new Regex(
           "(ENS)([A-Z]{3}|)T[0-9]{11}$");
 
@@ -125,6 +128,18 @@ abstract class EnsemblRestClient extends EnsemblSequenceFetcher
 
   /**
    * Answers true if the query matches the regular expression pattern for an
+   * Ensembl protein stable identifier
+   * 
+   * @param query
+   * @return
+   */
+  public boolean isProteinIdentifier(String query)
+  {
+    return query == null ? false : PROTEIN_REGEX.search(query);
+  }
+
+  /**
+   * Answers true if the query matches the regular expression pattern for an
    * Ensembl gene stable identifier
    * 
    * @param query