From b3ad9eb10b8d77634a5dae103fa0d0834e6ffe6a Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 2 Oct 2017 15:41:02 +0100 Subject: [PATCH] JAL-2525 lookup transcript features by Ontology --- src/jalview/ext/ensembl/EnsemblGene.java | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java index 365c1c2..ad01324 100644 --- a/src/jalview/ext/ensembl/EnsemblGene.java +++ b/src/jalview/ext/ensembl/EnsemblGene.java @@ -428,6 +428,12 @@ public class EnsemblGene extends EnsemblSeqProxy /** * Returns a list of the transcript features on the sequence whose Parent is * the gene for the accession id. + *

+ * Transcript features are those of type "transcript", or any of its sub-types + * in the Sequence Ontology e.g. "mRNA", "processed_transcript". We also + * include "NMD_transcript_variant", because this type behaves like a + * transcript identifier in Ensembl, although strictly speaking it is not in + * the SO. * * @param accId * @param geneSequence @@ -439,19 +445,18 @@ public class EnsemblGene extends EnsemblSeqProxy List transcriptFeatures = new ArrayList(); String parentIdentifier = GENE_PREFIX + accId; - // todo optimise here by transcript type! + List sfs = geneSequence.getFeatures() - .getPositionalFeatures(); + .getFeaturesByOntology(SequenceOntologyI.TRANSCRIPT); + sfs.addAll(geneSequence.getFeatures().getPositionalFeatures( + SequenceOntologyI.NMD_TRANSCRIPT_VARIANT)); for (SequenceFeature sf : sfs) { - if (isTranscript(sf.getType())) + String parent = (String) sf.getValue(PARENT); + if (parentIdentifier.equals(parent)) { - String parent = (String) sf.getValue(PARENT); - if (parentIdentifier.equals(parent)) - { - transcriptFeatures.add(sf); - } + transcriptFeatures.add(sf); } } -- 1.7.10.2