From d610358dc7f768b93bda1ae0dbd2231f7029385b Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Sun, 4 Jun 2017 10:01:54 +0100 Subject: [PATCH] =?utf8?q?JAL-2582=20recognise=20ENS=E2=80=A6P=20peptide=20I?= =?utf8?q?Ds=20and=20make=20two=20getParent=20requests=20to=20get=20gene=20I?= =?utf8?q?D.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/ext/ensembl/EnsemblGene.java | 13 +++++++++++++ src/jalview/ext/ensembl/EnsemblRestClient.java | 15 +++++++++++++++ 2 files changed, 28 insertions(+) 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 -- 1.7.10.2