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;
11 public class EnsemblCdna extends EnsemblSeqProxy
13 // TODO modify to accept other species e.g. ENSMUSPnnn
14 private static final Regex ACCESSION_REGEX = new Regex("((ENST|ENSG|CCDS)[0-9.]{3,})");
17 * fetch exon features on genomic sequence (to identify the cdna regions)
18 * and cds and variation features (to retain)
20 private static final EnsemblFeatureType[] FEATURES_TO_FETCH = {
21 EnsemblFeatureType.exon, EnsemblFeatureType.cds,
22 EnsemblFeatureType.variation };
30 public String getDbName()
32 return "ENSEMBL (CDNA)";
36 protected EnsemblSeqType getSourceEnsemblType()
38 return EnsemblSeqType.CDNA;
42 public Regex getAccessionValidator()
44 return ACCESSION_REGEX;
48 protected EnsemblFeatureType[] getFeaturesToFetch()
50 return FEATURES_TO_FETCH;
54 * Answers true unless the feature type is 'transcript' (or a sub-type in the
58 protected boolean retainFeature(SequenceFeature sf, String accessionId)
60 if (isTranscript(sf.getType()))
64 return featureMayBelong(sf, accessionId);
68 * Answers true if the sequence feature type is 'exon' (or a subtype of exon
69 * in the Sequence Ontology), and the Parent of the feature is the transcript
73 protected boolean identifiesSequence(SequenceFeature sf, String accId)
75 if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
76 SequenceOntologyI.EXON))
78 String parentFeature = (String) sf.getValue(PARENT);
79 if (("transcript:" + accId).equals(parentFeature))
88 protected List<String> getCrossReferenceDatabases()
90 return super.getCrossReferenceDatabases();
91 // 30/01/16 also found Vega_transcript, OTTT, ENS_LRG_transcript, UCSC,
92 // HGNC_trans_name, RefSeq_mRNA, RefSeq_mRNA_predicted