1 package jalview.ext.ensembl;
3 import jalview.datamodel.SequenceFeature;
4 import jalview.datamodel.SequenceI;
5 import jalview.io.gff.SequenceOntologyFactory;
6 import jalview.io.gff.SequenceOntologyI;
10 public class EnsemblCds extends EnsemblSeqProxy
13 * fetch cds features on genomic sequence (to identify the CDS regions)
14 * and exon and variation features (to retain for display)
16 private static final EnsemblFeatureType[] FEATURES_TO_FETCH = {
17 EnsemblFeatureType.cds, EnsemblFeatureType.exon,
18 EnsemblFeatureType.variation };
29 public String getDbName()
31 return "ENSEMBL (CDS)";
35 protected EnsemblSeqType getSourceEnsemblType()
37 return EnsemblSeqType.CDS;
41 protected EnsemblFeatureType[] getFeaturesToFetch()
43 return FEATURES_TO_FETCH;
47 * Answers true unless the feature type is 'CDS' (or a sub-type of CDS in the
48 * Sequence Ontology). CDS features are only retrieved in order to identify
49 * the cds sequence range, and are redundant information on the cds sequence
53 protected boolean retainFeature(SequenceFeature sf, String accessionId)
55 if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
56 SequenceOntologyI.CDS))
60 return featureMayBelong(sf, accessionId);
64 * Answers true if the sequence feature type is 'CDS' (or a subtype of CDS in
65 * the Sequence Ontology), and the Parent of the feature is the transcript we
69 protected boolean identifiesSequence(SequenceFeature sf, String accId)
71 if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
72 SequenceOntologyI.CDS))
74 String parentFeature = (String) sf.getValue(PARENT);
75 if (("transcript:" + accId).equals(parentFeature))
84 * Overrides this method to trivially return a range which is the whole of the
85 * nucleotide sequence. This is both faster than scanning for CDS features,
86 * and also means we don't need to keep CDS features on CDS sequence (where
87 * they are redundant information).
90 protected int getCdsRanges(SequenceI dnaSeq, List<int[]> ranges)
92 int len = dnaSeq.getLength();
93 ranges.add(new int[] { 1, len });