1 package jalview.ext.ensembl;
3 import jalview.datamodel.DBRefSource;
4 import jalview.ws.seqfetcher.DbSourceProxyImpl;
6 import com.stevesoft.pat.Regex;
9 * A base class for Ensembl sequence fetchers
13 abstract class EnsemblSequenceFetcher extends DbSourceProxyImpl
16 * accepts ENSG/T/E/P with 11 digits
17 * or ENSMUSP or similar for other species
18 * or CCDSnnnnn.nn with at least 3 digits
20 private static final Regex ACCESSION_REGEX = new Regex(
21 "(ENS([A-Z]{3}|)[GTEP]{1}[0-9]{11}$)" + "|" + "(CCDS[0-9.]{3,}$)");
24 * possible values for the 'feature' parameter of the /overlap REST service
25 * @see http://rest.ensembl.org/documentation/info/overlap_id
27 protected enum EnsemblFeatureType
29 gene, transcript, cds, exon, repeat, simple, misc, variation,
30 somatic_variation, structural_variation, somatic_structural_variation,
31 constrained, regulatory
35 public String getDbSource()
37 // NB ensure Uniprot xrefs are canonicalised from "Ensembl" to "ENSEMBL"
38 return DBRefSource.ENSEMBL; // "ENSEMBL"
42 public String getDbVersion()
48 public String getAccessionSeparator()
54 * Ensembl accession are ENST + 11 digits for human transcript, ENSG for human
55 * gene. Other species insert 3 letters e.g. ENSMUST..., ENSMUSG...
57 * @see http://www.ensembl.org/Help/View?id=151
60 public Regex getAccessionValidator()
62 return ACCESSION_REGEX;
66 public boolean isValidReference(String accession)
68 return getAccessionValidator().search(accession);
78 * Default test query is a transcript
81 public String getTestQuery()
83 // has CDS on reverse strand:
84 return "ENST00000288602";
85 // ENST00000461457 // forward strand
89 public boolean isDnaCoding()