[ensembl-dev] Search HGNC symbol by Ensemble gene IDs through Mysql direct query

Tommaso Mazza t.mazza at css-mendel.it
Fri Sep 7 00:03:48 BST 2012


Hi all,
as in the object, I'm trying to get gene names from a list of Ensembl IDs.
I would like to do this programmatically, by directly connecting and querying the Mysql db by the following query:

mysql -h ensembldb.ensembl.org --port 5306  -u anonymous -D homo_sapiens_core_47_36i -A

> select distinct
   G.stable_id,
   S.synonym
from
  gene_stable_id as G,
  object_xref as OX,
  external_synonym as S,
  xref as X ,
  external_db as D
where
  D.external_db_id=X.external_db_id and
  X.xref_id=S.xref_id and
  OX.xref_id=X.xref_id and
  OX.ensembl_object_type="Gene" and
  G.gene_id=OX.ensembl_id and
  G.stable_id in ("ENSG00000197021", "ENSG00000204379");
This code generally works, but I do not figure out why I do not get any result for some ENS ids.

For example, this ID: ENSG00000130208 is associated to the APOC1 gene.
If I use this ID in the query, I did not get any result. in fact, the external_synonymous table does contain the name "APOC1".

However and obviously, by the Ensembl web interface I can get this information.

Where am I going wrong? Should I use other and more proper tables?

Thanks
Tommaso
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ensembl.org/pipermail/dev_ensembl.org/attachments/20120907/d3b36ec9/attachment.html>


More information about the Dev mailing list