This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Arbitrary Queries To Ensembl Api In Python (Retrieving Stable Id History)

I would like to be map between Ensembl stable IDs between different releases

I found a small tool to do this in Perl (link) which essentially boils down to connecting to the Ensembl registry:

my $registry = 'Bio::EnsEMBL::Registry';
$registry->load_registry_from_db( -host => 'ensembldb.ensembl.org',
                              -user => 'anonymous' );
my $adaptor = $registry->get_DBAdaptor( $species, 'Core' );

and performing the following query:

SELECT  old_version,
        old_release,
        new_stable_id, new_version,
        new_release,
        score
FROM    stable_id_event
  JOIN  mapping_session USING (mapping_session_id)
WHERE   old_stable_id = ?
ORDER BY old_version ASC, CAST(new_release AS UNSIGNED)

I would like to the same in Python and I looked into pygr/pyensembl which is outdated and pycogent (couldn't figure out how to do this kind of custom query). What's the best way to do the mapping in Python?

ensembl python

1 answer

Your best bet would be to program against the Ensembl Rest API I would of thought

http://www.ensembl.info/blog/2012/09/27/ensembl-rest-api-ensembl-data-from-any-language/

Log in to answer this question.