*/
public class EnsemblGene extends EnsemblSeqProxy
{
- private static final String GENE_PREFIX = "gene:";
-
/*
* accepts anything as we will attempt lookup of gene or
* transcript id or gene name
* look for exon features of the transcript, failing that for CDS
* (for example ENSG00000124610 has 1 CDS but no exon features)
*/
- String parentId = "transcript:" + accId;
+ String parentId = accId;
List<SequenceFeature> splices = findFeatures(gene,
SequenceOntologyI.EXON, parentId);
if (splices.isEmpty())
* Ensembl has gene name as transcript Name
* EnsemblGenomes doesn't, but has a url-encoded description field
*/
- String description = (String) transcriptFeature.getValue(NAME);
+ String description = transcriptFeature.getDescription();
if (description == null)
{
description = (String) transcriptFeature.getValue(DESCRIPTION);
*/
protected String getTranscriptId(SequenceFeature feature)
{
- return (String) feature.getValue("transcript_id");
+ return (String) feature.getValue(JSON_ID);
}
/**
{
List<SequenceFeature> transcriptFeatures = new ArrayList<>();
- String parentIdentifier = GENE_PREFIX + accId;
+ String parentIdentifier = accId;
List<SequenceFeature> sfs = geneSequence.getFeatures()
.getFeaturesByOntology(SequenceOntologyI.TRANSCRIPT);
}
/**
- * 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<SequenceFeature> getIdentifyingFeatures(SequenceI seq,
+ String accId)
{
- if (SequenceOntologyFactory.getInstance().isA(sf.getType(),
- SequenceOntologyI.GENE))
+ List<SequenceFeature> result = new ArrayList<>();
+ List<SequenceFeature> sfs = seq.getFeatures()
+ .getFeaturesByOntology(SequenceOntologyI.GENE);
+ for (SequenceFeature sf : sfs)
{
- // NB features as gff use 'ID'; rest services return as 'id'
- String id = (String) sf.getValue("ID");
- if ((GENE_PREFIX + accId).equalsIgnoreCase(id))
+ String id = (String) sf.getValue(JSON_ID);
+ if (accId.equalsIgnoreCase(id))
{
- return true;
+ result.add(sf);
}
}
- return false;
+ return result;
}
/**
if (isTranscript(type))
{
String parent = (String) sf.getValue(PARENT);
- if (!(GENE_PREFIX + accessionId).equalsIgnoreCase(parent))
+ if (!accessionId.equalsIgnoreCase(parent))
{
return false;
}
}
/**
- * 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
*/