sfs = sequence.getFeatures()
+ .getFeaturesByOntology(term);
for (SequenceFeature sf : sfs)
{
- if (retainFeature(sf.getType()))
+ String parent = (String) sf.getValue(PARENT);
+ if (parent != null && parent.equalsIgnoreCase(parentId))
{
- transferFeature(sf, targetSequence, overlap);
+ result.add(sf);
}
}
+
+ return result;
}
/**
- * Answers true if the feature type is one to attach to the retrieved sequence
+ * Answers true if the feature type is either 'NMD_transcript_variant' or
+ * 'transcript' (or one of its sub-types in the Sequence Ontology). This is
+ * because NMD_transcript_variant behaves like 'transcript' in Ensembl
+ * although strictly speaking it is not (it is a sub-type of
+ * sequence_variant).
+ *
+ * (This test was needed when fetching transcript features as GFF. As we are
+ * now fetching as JSON, all features have type 'transcript' so the check for
+ * NMD_transcript_variant is redundant. Left in for any future case arising.)
*
- * @param type
+ * @param featureType
* @return
*/
- protected boolean retainFeature(@SuppressWarnings("unused") String type)
+ public static boolean isTranscript(String featureType)
{
- return true; // default is to keep all
+ return SequenceOntologyI.NMD_TRANSCRIPT_VARIANT.equals(featureType)
+ || SequenceOntologyFactory.getInstance().isA(featureType,
+ SequenceOntologyI.TRANSCRIPT);
}
}