package jalview.ext.ensembl; import jalview.datamodel.SequenceFeature; import jalview.io.gff.SequenceOntology; import com.stevesoft.pat.Regex; public class EnsemblCdna extends EnsemblSeqProxy { /* * fetch exon features on genomic sequence (to identify the cdnaregions) * and cds and variation features (to retain) */ private static final EnsemblFeatureType[] FEATURES_TO_FETCH = { EnsemblFeatureType.exon, EnsemblFeatureType.cds, EnsemblFeatureType.variation }; public EnsemblCdna() { super(); } @Override public String getDbName() { return "ENSEMBL (CDNA)"; } @Override protected EnsemblSeqType getSourceEnsemblType() { return EnsemblSeqType.CDNA; } @Override public Regex getAccessionValidator() { return new Regex("((ENST|ENSG|CCDS)[0-9.]{3,})"); } @Override protected EnsemblFeatureType[] getFeaturesToFetch() { return FEATURES_TO_FETCH; } /** * Answers true unless the feature type is 'transcript' or 'exon' (or a * sub-type in the Sequence Ontology). These features are only retrieved in * order to identify the exon sequence loci, and are redundant information on * the exon sequence itself. */ @Override protected boolean retainFeature(SequenceFeature sf, String accessionId) { SequenceOntology so = SequenceOntology.getInstance(); String type = sf.getType(); if (isTranscript(type) || so.isA(type, SequenceOntology.EXON)) { return false; } return featureMayBelong(sf, accessionId); } /** * Answers true if the sequence feature type is 'exon' (or a subtype of exon * in the Sequence Ontology), and the Parent of the feature is the transcript * we are retrieving */ @Override protected boolean identifiesSequence(SequenceFeature sf, String accId) { if (SequenceOntology.getInstance().isA(sf.getType(), SequenceOntology.EXON)) { String parentFeature = (String) sf.getValue(PARENT); if (("transcript:" + accId).equals(parentFeature)) { return true; } } return false; } }