From: Jim Procter Date: Sun, 4 Jun 2017 09:01:54 +0000 (+0100) Subject: JAL-2582 recognise ENS…P peptide IDs and make two getParent requests to get gene ID. X-Git-Tag: Release_2_10_2~3^2~40 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=d610358dc7f768b93bda1ae0dbd2231f7029385b;p=jalview.git JAL-2582 recognise ENS…P peptide IDs and make two getParent requests to get gene ID. --- diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java index 24e3e95..47b473a 100644 --- a/src/jalview/ext/ensembl/EnsemblGene.java +++ b/src/jalview/ext/ensembl/EnsemblGene.java @@ -190,7 +190,20 @@ public class EnsemblGene extends EnsemblSeqProxy geneIds.add(geneId); } } + else if (isProteinIdentifier(acc)) + { + String tscriptId = new EnsemblLookup(getDomain()).getParent(acc); + if (tscriptId != null) + { + String geneId = new EnsemblLookup(getDomain()) + .getParent(tscriptId); + if (geneId != null && !geneIds.contains(geneId)) + { + geneIds.add(geneId); + } + } + } /* * if given a gene or other external name, lookup and fetch * the corresponding gene for all model organisms diff --git a/src/jalview/ext/ensembl/EnsemblRestClient.java b/src/jalview/ext/ensembl/EnsemblRestClient.java index 5960f81..2437588 100644 --- a/src/jalview/ext/ensembl/EnsemblRestClient.java +++ b/src/jalview/ext/ensembl/EnsemblRestClient.java @@ -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