X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fensembl%2FEnsemblSequenceFetcher.java;h=c4abb20db32f0c5ca6bc13bd5fecf738edc7f02f;hb=17ff1f476e009b3a3c7e892e416edc2a4af8a2bc;hp=67c5e6350970eac576d19fa8adf28b66935ef373;hpb=ef9282b464dc189faf9ce40a4b7420a204266668;p=jalview.git diff --git a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java index 67c5e63..c4abb20 100644 --- a/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java +++ b/src/jalview/ext/ensembl/EnsemblSequenceFetcher.java @@ -1,3 +1,23 @@ +/* + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors + * + * This file is part of Jalview. + * + * Jalview is free software: you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * + * Jalview is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR + * PURPOSE. See the GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. + */ package jalview.ext.ensembl; import jalview.datamodel.DBRefSource; @@ -12,9 +32,30 @@ import com.stevesoft.pat.Regex; */ abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl { - // TODO modify to accept other species e.g. ENSMUSTnnn + /* + * accepts ENSG/T/E/P with 11 digits + * or ENSMUSP or similar for other species + * or CCDSnnnnn.nn with at least 3 digits + */ private static final Regex ACCESSION_REGEX = new Regex( - "(ENSP|ENST|ENSG|CCDS)[0-9.]{3,}$"); + "(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 static final String ENSEMBL_REST = "http://rest.ensembl.org"; + + 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 @@ -27,17 +68,17 @@ abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl constrained, regulatory } + private String domain = ENSEMBL_REST; + @Override public String getDbSource() { // NB ensure Uniprot xrefs are canonicalised from "Ensembl" to "ENSEMBL" - return DBRefSource.ENSEMBL; // "ENSEMBL" - } - - @Override - public String getDbVersion() - { - return "0"; + if (ENSEMBL_GENOMES_REST.equals(getDomain())) + { + return DBRefSource.ENSEMBLGENOMES; + } + return DBRefSource.ENSEMBL; } @Override @@ -86,4 +127,20 @@ abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl { return true; } + + /** + * Returns the domain name to query e.g. http://rest.ensembl.org or + * http://rest.ensemblgenomes.org + * + * @return + */ + protected String getDomain() + { + return domain; + } + + protected void setDomain(String d) + { + domain = d; + } }