import jalview.util.StringUtils;
import java.awt.Color;
+import java.io.UnsupportedEncodingException;
+import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
*/
public class EnsemblGene extends EnsemblSeqProxy
{
+ private static final List<String> CROSS_REFERENCES = Arrays
+ .asList(new String[] { "CCDS" });
+
private static final String GENE_PREFIX = "gene:";
/*
EnsemblFeatureType.exon, EnsemblFeatureType.cds,
EnsemblFeatureType.variation };
+ /**
+ * Default constructor (to use rest.ensembl.org)
+ */
+ public EnsemblGene()
+ {
+ super();
+ }
+
+ /**
+ * Constructor given the target domain to fetch data from
+ *
+ * @param d
+ */
+ public EnsemblGene(String d)
+ {
+ super(d);
+ }
+
@Override
public String getDbName()
{
- return "ENSEMBL (GENE)";
+ return "ENSEMBL";
}
@Override
if (isTranscriptIdentifier(query))
{
// we are assuming all transcripts have the same gene parent here
- query = new EnsemblLookup().getParent(queries[0]);
+ query = new EnsemblLookup(getDomain()).getParent(queries[0]);
if (query == null)
{
return null;
*/
if (!isGeneIdentifier(query))
{
- List<String> geneIds = new EnsemblSymbol().getIds(query);
+ List<String> geneIds = new EnsemblSymbol(getDomain()).getIds(query);
if (geneIds.isEmpty())
{
return null;
*/
protected String getGeneIdentifiersForName(String query)
{
- List<String> ids = new EnsemblSymbol().getIds(query);
+ List<String> ids = new EnsemblSymbol(getDomain()).getIds(query);
if (ids != null)
{
for (String id : ids)
}
Sequence transcript = new Sequence(accId, seqChars, 1, transcriptLength);
- String geneName = (String) transcriptFeature.getValue(NAME);
- if (geneName != null)
+
+ /*
+ * Ensembl has gene name as transcript Name
+ * EnsemblGenomes doesn't, but has a url-encoded description field
+ */
+ String description = (String) transcriptFeature.getValue(NAME);
+ if (description == null)
{
- transcript.setDescription(geneName);
+ description = (String) transcriptFeature.getValue(DESCRIPTION);
+ }
+ if (description != null)
+ {
+ try
+ {
+ transcript.setDescription(URLDecoder.decode(description, "UTF-8"));
+ } catch (UnsupportedEncodingException e)
+ {
+ e.printStackTrace(); // as if
+ }
}
transcript.createDatasetSequence();
List<int[]> mapTo = new ArrayList<int[]>();
mapTo.add(new int[] { 1, transcriptLength });
MapList mapping = new MapList(mappedFrom, mapTo, 1, 1);
- new EnsemblCdna().transferFeatures(gene.getSequenceFeatures(),
+ EnsemblCdna cdna = new EnsemblCdna(getDomain());
+ cdna.transferFeatures(gene.getSequenceFeatures(),
transcript.getDatasetSequence(), mapping, parentId);
/*
* fetch and save cross-references
*/
- super.getCrossReferences(transcript);
+ cdna.getCrossReferences(transcript);
/*
* and finally fetch the protein product and save as a cross-reference
*/
- new EnsemblCdna().addProteinProduct(transcript);
+ cdna.addProteinProduct(transcript);
return transcript;
}
// found these for ENSG00000157764 on 30/01/2016:
// return new String[] {"Vega_gene", "OTTG", "ENS_LRG_gene", "ArrayExpress",
// "EntrezGene", "HGNC", "MIM_GENE", "MIM_MORBID", "WikiGene"};
- return super.getCrossReferenceDatabases();
+ return CROSS_REFERENCES;
}
/**