I have downloaded KIRC Methylation data (450K) using TCGA toolbox. The beta values given are with reference to CPG probes. Is there any package or function in R through which I can get the gene names corresponding to these probes? I was able to get the gene I.Ds using getMappedEntrezIDs
. Is there any function to map these I.Ds to respective gene names?
$\begingroup$
$\endgroup$
Add a comment
|
1 Answer
$\begingroup$
$\endgroup$
Here's a Python script (e.g., called map_entrez_to_ensembl.py
that uses mygene.info to convert a list of Entrez IDs to Ensembl gene names:
#!/usr/bin/env python
import sys
import mygene
mg = mygene.MyGeneInfo()
genes = ['3815',
'3816',
'2341']
results = mg.querymany(genes, scopes=['entrezgene'], fields=['ensembl'], species='human', verbose=False)
for res in results:
entrez_id = res['query']
if 'ensembl' in res and 'gene' in res['ensembl']:
sys.stdout.write('%s\t%s\n' % (entrez_id, res['ensembl']['gene']))
Result:
$ ./map_entrez_to_ensembl.py
3815 ENSG00000157404
3816 ENSG00000167748
Looks like there's an R-based interface to mygene.info, if you really need to use R.
You could use their API test page to see how data are structured and what keywords are available for different kinds of searches.
For instance, if you wanted aliases, in addition to Ensembl names:
#!/usr/bin/env python
import sys
import mygene
mg = mygene.MyGeneInfo()
genes = ['3815',
'3816',
'2341']
results = mg.querymany(genes, scopes=['entrezgene'], fields=['ensembl', 'alias'], species='human', verbose=False)
for res in results:
entrez_id = res['query']
if 'ensembl' in res and 'gene' in res['ensembl'] and 'alias' in res:
for alias in res['alias']:
sys.stdout.write('%s\t%s\t%s\n' % (entrez_id, alias, res['ensembl']['gene']))
Then:
$ ./map_entrez_to_alias_and_ensembl.py
3815 C-Kit ENSG00000157404
3815 CD117 ENSG00000157404
3815 PBT ENSG00000157404
3815 SCFR ENSG00000157404
3816 KLKR ENSG00000167748
3816 Klk6 ENSG00000167748
3816 hK1 ENSG00000167748