Entering edit mode
                    12.9 years ago
        jergosh
        
    
        ▴
    
    70
    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?