+ @Override
+ protected EnsemblFeatureType[] getFeaturesToFetch()
+ {
+ return FEATURES_TO_FETCH;
+ }
+
+ /**
+ * Answers true unless the feature type is 'transcript' (or a sub-type of
+ * transcript in the Sequence Ontology), or has a parent other than the given
+ * accession id. Transcript features are only retrieved in order to identify
+ * the transcript sequence range, and are redundant information on the
+ * transcript sequence itself.
+ */
+ @Override
+ protected boolean retainFeature(SequenceFeature sf, String accessionId)
+ {
+ if (isTranscript(sf.getType()))
+ {
+ return false;
+ }
+ return featureMayBelong(sf, accessionId);
+ }
+
+ /**
+ * Answers a list of sequence features (if any) whose type is 'transcript' (or
+ * a subtype of transcript in the Sequence Ontology), and whose ID is the
+ * accession we are retrieving.
+ * <p>
+ * Note we also include features of type "NMD_transcript_variant", although
+ * not strictly 'transcript' in the SO, as they used in Ensembl as if they
+ * were.
+ */
+ @Override
+ protected List<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
+ {
+ List<SequenceFeature> result = new ArrayList<>();
+ List<SequenceFeature> sfs = seq.getFeatures().getFeaturesByOntology(
+ SequenceOntologyI.TRANSCRIPT,
+ SequenceOntologyI.NMD_TRANSCRIPT_VARIANT);
+ for (SequenceFeature sf : sfs)
+ {
+ String id = (String) sf.getValue(JSON_ID);
+ if (accId.equals(id))
+ {
+ result.add(sf);
+ }
+ }
+ return result;
+ }
+