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
@@ -383,12 +484,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
@@ -397,23 +504,21 @@ public class EnsemblGene extends EnsemblSeqProxy
protected List getTranscriptFeatures(String accId,
SequenceI geneSequence)
{
- List transcriptFeatures = new ArrayList();
+ List transcriptFeatures = new ArrayList<>();
+
+ String parentIdentifier = accId;
- String parentIdentifier = GENE_PREFIX + accId;
- SequenceFeature[] sfs = geneSequence.getSequenceFeatures();
+ List sfs = geneSequence.getFeatures()
+ .getFeaturesByOntology(SequenceOntologyI.TRANSCRIPT);
+ sfs.addAll(geneSequence.getFeatures().getPositionalFeatures(
+ SequenceOntologyI.NMD_TRANSCRIPT_VARIANT));
- if (sfs != null)
+ 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);
}
}
@@ -432,29 +537,34 @@ public class EnsemblGene extends EnsemblSeqProxy
@Override
public String getTestQuery()
{
- return "ENSG00000157764"; // BRAF, 5 transcripts, reverse strand
+ return Platform.isJS() ? "ENSG00000123569" : "ENSG00000157764";
+ // ENSG00000123569 // H2BFWT histone, 2 transcripts, reverse strand
+ // ENSG00000157764 // BRAF, 5 transcripts, reverse strand
// ENSG00000090266 // NDUFB2, 15 transcripts, forward strand
// ENSG00000101812 // H2BFM histone, 3 transcripts, forward strand
- // ENSG00000123569 // H2BFWT histone, 2 transcripts, reverse strand
}
/**
- * 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;
}
/**
@@ -467,7 +577,7 @@ public class EnsemblGene extends EnsemblSeqProxy
@Override
protected boolean retainFeature(SequenceFeature sf, String accessionId)
{
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
String type = sf.getType();
if (so.isA(type, SequenceOntologyI.GENE))
{
@@ -476,7 +586,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;
}
@@ -485,17 +595,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
*/
@@ -507,6 +606,10 @@ public class EnsemblGene extends EnsemblSeqProxy
@Override
public Regex getAccessionValidator()
{
+ if (ACCESSION_REGEX == null)
+ {
+ ACCESSION_REGEX = Platform.newRegex(".*", null);
+ }
return ACCESSION_REGEX;
}
@@ -525,12 +628,13 @@ public class EnsemblGene extends EnsemblSeqProxy
{
return new FeatureSettingsAdapter()
{
- SequenceOntologyI so = SequenceOntologyFactory.getInstance();
+ SequenceOntologyI so = SequenceOntologyFactory.getSequenceOntology();
+
@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