1 package jalview.ext.ensembl;
3 import jalview.datamodel.SequenceFeature;
4 import jalview.io.gff.SequenceOntologyFactory;
5 import jalview.io.gff.SequenceOntologyI;
9 import com.stevesoft.pat.Regex;
12 * A client to fetch CDNA sequence from Ensembl (i.e. that part of the genomic
13 * sequence that is transcribed to RNA, but not necessarily translated to
19 public class EnsemblCdna extends EnsemblSeqProxy
22 * accepts ENST or ENSTG with 11 digits
23 * or ENSMUST or similar for other species
24 * or CCDSnnnnn.nn with at least 3 digits
26 private static final Regex ACCESSION_REGEX = new Regex(
27 "(ENS([A-Z]{3}|)[TG][0-9]{11}$)" + "|" + "(CCDS[0-9.]{3,}$)");
30 * fetch exon features on genomic sequence (to identify the cdna regions)
31 * and cds and variation features (to retain)
33 private static final EnsemblFeatureType[] FEATURES_TO_FETCH = {
34 EnsemblFeatureType.exon, EnsemblFeatureType.cds,
35 EnsemblFeatureType.variation };
38 * Default constructor (to use rest.ensembl.org)
46 * Constructor given the target domain to fetch data from
50 public EnsemblCdna(String d)
56 public String getDbName()
58 return "ENSEMBL (CDNA)";
62 protected EnsemblSeqType getSourceEnsemblType()
64 return EnsemblSeqType.CDNA;
68 public Regex getAccessionValidator()
70 return ACCESSION_REGEX;
74 protected EnsemblFeatureType[] getFeaturesToFetch()
76 return FEATURES_TO_FETCH;
80 * Answers true unless the feature type is 'transcript' (or a sub-type in the
84 protected boolean retainFeature(SequenceFeature sf, String accessionId)
86 if (isTranscript(sf.getType()))
90 return featureMayBelong(sf, accessionId);
94 * Answers true if the sequence feature type is 'exon' (or a subtype of exon
95 * in the Sequence Ontology), and the Parent of the feature is the transcript
99 protected boolean identifiesSequence(SequenceFeature sf, String accId)
101 if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
102 SequenceOntologyI.EXON))
104 String parentFeature = (String) sf.getValue(PARENT);
105 if (("transcript:" + accId).equals(parentFeature))
114 protected List<String> getCrossReferenceDatabases()
116 return super.getCrossReferenceDatabases();
117 // 30/01/16 also found Vega_transcript, OTTT, ENS_LRG_transcript, UCSC,
118 // HGNC_trans_name, RefSeq_mRNA, RefSeq_mRNA_predicted