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
@@ -381,12 +487,18 @@ public class EnsemblGene extends EnsemblSeqProxy
*/
protected String getTranscriptId(SequenceFeature feature)
{
- return (String) feature.getValue("transcript_id");
+ return (String) feature.getValue(JSON_ID);
}
/**
* 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
@@ -395,23 +507,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;
- SequenceFeature[] sfs = geneSequence.getSequenceFeatures();
+ String parentIdentifier = accId;
- if (sfs != null)
+ List sfs = geneSequence.getFeatures()
+ .getFeaturesByOntology(SequenceOntologyI.TRANSCRIPT);
+ sfs.addAll(geneSequence.getFeatures().getPositionalFeatures(
+ SequenceOntologyI.NMD_TRANSCRIPT_VARIANT));
+
+ for (SequenceFeature sf : sfs)
{
- for (SequenceFeature sf : sfs)
+ String parent = (String) sf.getValue(PARENT);
+ if (parentIdentifier.equalsIgnoreCase(parent))
{
- if (isTranscript(sf.getType()))
- {
- String parent = (String) sf.getValue(PARENT);
- if (parentIdentifier.equals(parent))
- {
- transcriptFeatures.add(sf);
- }
- }
+ transcriptFeatures.add(sf);
}
}
@@ -437,22 +547,26 @@ 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))
+ String id = (String) sf.getValue(JSON_ID);
+ if (accId.equalsIgnoreCase(id))
{
- return true;
+ result.add(sf);
}
}
- return false;
+ return result;
}
/**
@@ -474,7 +588,7 @@ public class EnsemblGene extends EnsemblSeqProxy
if (isTranscript(type))
{
String parent = (String) sf.getValue(PARENT);
- if (!(GENE_PREFIX + accessionId).equals(parent))
+ if (!accessionId.equalsIgnoreCase(parent))
{
return false;
}
@@ -483,17 +597,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
*/
@@ -524,11 +627,12 @@ public class EnsemblGene extends EnsemblSeqProxy
return new FeatureSettingsAdapter()
{
SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+
@Override
- public boolean isFeatureDisplayed(String type)
+ public boolean isFeatureHidden(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
@@ -536,7 +640,7 @@ public class EnsemblGene extends EnsemblSeqProxy
{
if (so.isA(type, SequenceOntologyI.EXON))
{
- return new FeatureColourAdapter()
+ return new FeatureColour()
{
@Override
public boolean isColourByLabel()
@@ -547,7 +651,7 @@ public class EnsemblGene extends EnsemblSeqProxy
}
if (so.isA(type, SequenceOntologyI.SEQUENCE_VARIANT))
{
- return new FeatureColourAdapter()
+ return new FeatureColour()
{
@Override