transcriptRange = Arrays.asList(new int[] {
+ transcript.getStart(), transcript.getEnd() });
+ MapList mapList = new MapList(transcriptRange, transcriptLoci, 1, 1);
+
+ transcript.setGeneLoci(loci.getSpeciesId(), loci.getAssemblyId(),
+ loci.getChromosomeId(), mapList);
+ }
+
+ /**
* Returns the 'transcript_id' property of the sequence feature (or null)
*
* @param feature
@@ -411,6 +494,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
@@ -419,22 +508,21 @@ public class EnsemblGene extends EnsemblSeqProxy
protected List getTranscriptFeatures(String accId,
SequenceI geneSequence)
{
- List transcriptFeatures = new ArrayList();
+ 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.equalsIgnoreCase(parent))
{
- String parent = (String) sf.getValue(PARENT);
- if (parentIdentifier.equals(parent))
- {
- transcriptFeatures.add(sf);
- }
+ transcriptFeatures.add(sf);
}
}
@@ -460,22 +548,27 @@ public class EnsemblGene extends EnsemblSeqProxy
}
/**
- * Answers true for a feature of type 'gene' (or a sub-type of gene in the
- * Sequence Ontology), whose ID is the accession we are retrieving
+ * Answers a list of sequence features (if any) whose type is 'gene' (or a
+ * subtype of gene in the Sequence Ontology), and whose ID is the accession we
+ * are retrieving
*/
@Override
- protected boolean identifiesSequence(SequenceFeature sf, String accId)
+ protected List getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
- SequenceOntologyI.GENE))
+ List result = new ArrayList<>();
+ List sfs = seq.getFeatures()
+ .getFeaturesByOntology(SequenceOntologyI.GENE);
+ for (SequenceFeature sf : sfs)
{
- String id = (String) sf.getValue(ID);
- if ((GENE_PREFIX + accId).equals(id))
+ // NB features as gff use 'ID'; rest services return as 'id'
+ String id = (String) sf.getValue("ID");
+ if ((GENE_PREFIX + accId).equalsIgnoreCase(id))
{
- return true;
+ result.add(sf);
}
}
- return false;
+ return result;
}
/**
@@ -497,7 +590,7 @@ public class EnsemblGene extends EnsemblSeqProxy
if (isTranscript(type))
{
String parent = (String) sf.getValue(PARENT);
- if (!(GENE_PREFIX + accessionId).equals(parent))
+ if (!(GENE_PREFIX + accessionId).equalsIgnoreCase(parent))
{
return false;
}
@@ -506,17 +599,6 @@ public class EnsemblGene extends EnsemblSeqProxy
}
/**
- * Answers false. This allows an optimisation - a single 'gene' feature is all
- * that is needed to identify the positions of the gene on the genomic
- * sequence.
- */
- @Override
- protected boolean isSpliceable()
- {
- return false;
- }
-
- /**
* Override to do nothing as Ensembl doesn't return a protein sequence for a
* gene identifier
*/
@@ -551,8 +633,8 @@ public class EnsemblGene extends EnsemblSeqProxy
@Override
public boolean isFeatureDisplayed(String type)
{
- return (so.isA(type, SequenceOntologyI.EXON) || so.isA(type,
- SequenceOntologyI.SEQUENCE_VARIANT));
+ return (so.isA(type, SequenceOntologyI.EXON)
+ || so.isA(type, SequenceOntologyI.SEQUENCE_VARIANT));
}
@Override