X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fensembl%2FEnsemblGene.java;h=ad013241c136a5478645c24b94fb18073b2aecd4;hb=89c708e1eef23578fe57be6eeda5379becfd3afa;hp=2d4d61abfa27a14aa4f5cb44946c3242b85e98dd;hpb=19fe93b91d4c50834b1a7101da2b1c240c55ae84;p=jalview.git
diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java
index 2d4d61a..ad01324 100644
--- a/src/jalview/ext/ensembl/EnsemblGene.java
+++ b/src/jalview/ext/ensembl/EnsemblGene.java
@@ -110,7 +110,8 @@ public class EnsemblGene extends EnsemblSeqProxy
*
resolves an external identifier by looking up xref-ed gene ids
* fetches the gene sequence
* fetches features on the sequence
- * identifies "transcript" features whose Parent is the requested gene
+ * identifies "transcript" features whose Parent is the requested
+ * gene
* fetches the transcript sequence for each transcript
* makes a mapping from the gene to each transcript
* copies features from gene to transcript sequences
@@ -191,7 +192,22 @@ public class EnsemblGene extends EnsemblSeqProxy
geneIds.add(geneId);
}
}
+ else if (isProteinIdentifier(acc))
+ {
+ String tscriptId = new EnsemblLookup(getDomain()).getParent(acc);
+ if (tscriptId != null)
+ {
+ String geneId = new EnsemblLookup(getDomain())
+ .getParent(tscriptId);
+ if (geneId != null && !geneIds.contains(geneId))
+ {
+ geneIds.add(geneId);
+ }
+ }
+ // NOTE - acc is lost if it resembles an ENS.+ ID but isn't actually
+ // resolving to one... e.g. ENSMICP00000009241
+ }
/*
* if given a gene or other external name, lookup and fetch
* the corresponding gene for all model organisms
@@ -298,8 +314,8 @@ public class EnsemblGene extends EnsemblSeqProxy
* the parent gene sequence, with features
* @return
*/
- SequenceI makeTranscript(SequenceFeature transcriptFeature,
- AlignmentI al, SequenceI gene)
+ SequenceI makeTranscript(SequenceFeature transcriptFeature, AlignmentI al,
+ SequenceI gene)
{
String accId = getTranscriptId(transcriptFeature);
if (accId == null)
@@ -348,7 +364,8 @@ public class EnsemblGene extends EnsemblSeqProxy
mappedFrom.add(new int[] { sf.getBegin(), sf.getEnd() });
}
- Sequence transcript = new Sequence(accId, seqChars, 1, transcriptLength);
+ Sequence transcript = new Sequence(accId, seqChars, 1,
+ transcriptLength);
/*
* Ensembl has gene name as transcript Name
@@ -411,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
@@ -422,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);
}
}
@@ -551,8 +573,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