mygene conversion to ensembl
0
0
Entering edit mode
3.4 years ago

I'd like to convert the genes identifiers from the following format to ensembl with mygene:

'RP11.27G24.3', 'CTD.2035E11.4', 'CTD.2515C13.2', 'RP11.366M4.18'

This is the function:

import mygene
def get_ensembl_gene_mapping(ensembl_gene_ids):
    mg = mygene.MyGeneInfo()

    records = mg.querymany(
        ensembl_gene_ids,
        scopes='symbol',
        fields='ensembl.gene',
        species='human'
    )

    symbol_to_ensembl = dict()
    ensembl_to_symbol = dict()
    for record in records:
        if 'ensembl' in record:
            if 'gene' in record['ensembl']:
                symbol_to_ensembl[record['query']] = record['ensembl']['gene']
                ensembl_to_symbol[record['ensembl']['gene']] = record['query']
    return symbol_to_ensembl, ensembl_to_symbol

With scopes='symbol', the gene symbols above cannot be found. Does anybody know what the correct scope is?

gene mygene • 646 views
ADD COMMENT

Login before adding your answer.

Traffic: 2801 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6