Skip to content

Instantly share code, notes, and snippets.

@buchanae
Created July 19, 2018 16:23
Show Gist options
  • Save buchanae/5cba60894e190c35da1ac3e1c7e5e511 to your computer and use it in GitHub Desktop.
Save buchanae/5cba60894e190c35da1ac3e1c7e5e511 to your computer and use it in GitHub Desktop.
import mygene
mg = mygene.MyGeneInfo()
mg.querymany("BRCA1", returnall=True)
querying 1-1...done.
Finished.
1 input query terms found no hit:
	['BRCA1']





{'out': [{'query': 'BRCA1', 'notfound': True}],
 'dup': [],
 'missing': ['BRCA1']}
mg.query("BRCA1", returnall=True)
{'max_score': 428.93326,
 'took': 33,
 'total': 4778,
 'hits': [{'_id': '672',
   '_score': 428.93326,
   'entrezgene': 672,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9606},
  {'_id': '12189',
   '_score': 363.50424,
   'entrezgene': 12189,
   'name': 'breast cancer 1, early onset',
   'symbol': 'Brca1',
   'taxid': 10090},
  {'_id': '497672',
   '_score': 309.35406,
   'entrezgene': 497672,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'Brca1',
   'taxid': 10116},
  {'_id': '101814437',
   '_score': 290.66235,
   'entrezgene': 101814437,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 59894},
  {'_id': '100347269',
   '_score': 290.66235,
   'entrezgene': 100347269,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9986},
  {'_id': '101429125',
   '_score': 290.66235,
   'entrezgene': 101429125,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9361},
  {'_id': '110388719',
   '_score': 290.66235,
   'entrezgene': 110388719,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 8996},
  {'_id': '106858689',
   '_score': 290.66235,
   'entrezgene': 106858689,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9172},
  {'_id': '106948321',
   '_score': 290.66235,
   'entrezgene': 106948321,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'brca1',
   'taxid': 48699},
  {'_id': '109963046',
   '_score': 290.66235,
   'entrezgene': 109963046,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'brca1',
   'taxid': 43700}]}
mg.querymany("BRCA1", species='human', fields="ensembl,symbol,hgnc,alias", scopes="symbol,alias", returnall=True)
querying 1-1...done.
Finished.
1 input query terms found dup hits:
	[('BRCA1', 2)]





{'out': [{'query': 'BRCA1',
   '_id': '672',
   '_score': 85.786644,
   'alias': ['BRCAI',
    'BRCC1',
    'BROVCA1',
    'FANCS',
    'IRIS',
    'PNCA4',
    'PPP1R53',
    'PSCP',
    'RNF53'],
   'ensembl': {'gene': 'ENSG00000012048',
    'protein': ['ENSP00000312236',
     'ENSP00000326002',
     'ENSP00000350283',
     'ENSP00000397145',
     'ENSP00000417148',
     'ENSP00000417241',
     'ENSP00000417554',
     'ENSP00000417988',
     'ENSP00000418212',
     'ENSP00000418548',
     'ENSP00000418775',
     'ENSP00000418819',
     'ENSP00000418960',
     'ENSP00000418986',
     'ENSP00000419103',
     'ENSP00000419274',
     'ENSP00000419481',
     'ENSP00000419988',
     'ENSP00000420201',
     'ENSP00000420253',
     'ENSP00000420412',
     'ENSP00000420705',
     'ENSP00000420781',
     'ENSP00000465347',
     'ENSP00000465818',
     'ENSP00000467329',
     'ENSP00000478114',
     'ENSP00000489431',
     'ENSP00000494614',
     'ENSP00000495897',
     'ENSP00000496570'],
    'transcript': ['ENST00000352993',
     'ENST00000354071',
     'ENST00000357654',
     'ENST00000412061',
     'ENST00000461221',
     'ENST00000461574',
     'ENST00000461798',
     'ENST00000468300',
     'ENST00000470026',
     'ENST00000471181',
     'ENST00000472490',
     'ENST00000473961',
     'ENST00000476777',
     'ENST00000477152',
     'ENST00000478531',
     'ENST00000484087',
     'ENST00000487825',
     'ENST00000489037',
     'ENST00000491747',
     'ENST00000492859',
     'ENST00000493795',
     'ENST00000493919',
     'ENST00000494123',
     'ENST00000497488',
     'ENST00000586385',
     'ENST00000591534',
     'ENST00000591849',
     'ENST00000618469',
     'ENST00000621897',
     'ENST00000634433',
     'ENST00000642945',
     'ENST00000644379',
     'ENST00000644555'],
    'translation': [{'protein': 'ENSP00000312236', 'rna': 'ENST00000352993'},
     {'protein': 'ENSP00000350283', 'rna': 'ENST00000357654'},
     {'protein': 'ENSP00000418960', 'rna': 'ENST00000471181'},
     {'protein': 'ENSP00000417148', 'rna': 'ENST00000468300'},
     {'protein': 'ENSP00000496570', 'rna': 'ENST00000644379'},
     {'protein': 'ENSP00000465818', 'rna': 'ENST00000586385'},
     {'protein': 'ENSP00000467329', 'rna': 'ENST00000591534'},
     {'protein': 'ENSP00000465347', 'rna': 'ENST00000591849'},
     {'protein': 'ENSP00000418775', 'rna': 'ENST00000493795'},
     {'protein': 'ENSP00000418548', 'rna': 'ENST00000461221'},
     {'protein': 'ENSP00000420705', 'rna': 'ENST00000491747'},
     {'protein': 'ENSP00000419481', 'rna': 'ENST00000484087'},
     {'protein': 'ENSP00000420412', 'rna': 'ENST00000478531'},
     {'protein': 'ENSP00000418819', 'rna': 'ENST00000493919'},
     {'protein': 'ENSP00000418212', 'rna': 'ENST00000487825'},
     {'protein': 'ENSP00000417241', 'rna': 'ENST00000461574'},
     {'protein': 'ENSP00000326002', 'rna': 'ENST00000354071'},
     {'protein': 'ENSP00000489431', 'rna': 'ENST00000634433'},
     {'protein': 'ENSP00000397145', 'rna': 'ENST00000412061'},
     {'protein': 'ENSP00000419274', 'rna': 'ENST00000470026'},
     {'protein': 'ENSP00000419988', 'rna': 'ENST00000477152'},
     {'protein': 'ENSP00000420253', 'rna': 'ENST00000492859'},
     {'protein': 'ENSP00000418986', 'rna': 'ENST00000497488'},
     {'protein': 'ENSP00000419103', 'rna': 'ENST00000494123'},
     {'protein': 'ENSP00000420201', 'rna': 'ENST00000473961'},
     {'protein': 'ENSP00000495897', 'rna': 'ENST00000642945'},
     {'protein': 'ENSP00000417554', 'rna': 'ENST00000476777'},
     {'protein': 'ENSP00000417988', 'rna': 'ENST00000461798'},
     {'protein': 'ENSP00000420781', 'rna': 'ENST00000489037'},
     {'protein': 'ENSP00000494614', 'rna': 'ENST00000644555'},
     {'protein': 'ENSP00000478114', 'rna': 'ENST00000618469'}],
    'type_of_gene': 'protein_coding'},
   'symbol': 'BRCA1'},
  {'query': 'BRCA1',
   '_id': '394269',
   '_score': 3.1628551,
   'alias': ['LBRCA1', 'PsiBRCA1', 'pseudo-BRCA1'],
   'symbol': 'BRCA1P1'}],
 'dup': [('BRCA1', 2)],
 'missing': []}
mg.querymany("BRCA1", scopes="symbol,alias", returnall=True)
querying 1-1...done.
Finished.
1 input query terms found dup hits:
	[('BRCA1', 10)]





{'out': [{'query': 'BRCA1',
   '_id': '672',
   '_score': 85.42936,
   'entrezgene': 672,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9606},
  {'query': 'BRCA1',
   '_id': '12189',
   '_score': 73.24706,
   'entrezgene': 12189,
   'name': 'breast cancer 1, early onset',
   'symbol': 'Brca1',
   'taxid': 10090},
  {'query': 'BRCA1',
   '_id': '497672',
   '_score': 61.91373,
   'entrezgene': 497672,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'Brca1',
   'taxid': 10116},
  {'query': 'BRCA1',
   '_id': '101814437',
   '_score': 58.15771,
   'entrezgene': 101814437,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 59894},
  {'query': 'BRCA1',
   '_id': '109626726',
   '_score': 58.15771,
   'entrezgene': 109626726,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'brca1',
   'taxid': 8255},
  {'query': 'BRCA1',
   '_id': '100347269',
   '_score': 58.15771,
   'entrezgene': 100347269,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9986},
  {'query': 'BRCA1',
   '_id': '101429125',
   '_score': 58.15771,
   'entrezgene': 101429125,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9361},
  {'query': 'BRCA1',
   '_id': '106858689',
   '_score': 58.15771,
   'entrezgene': 106858689,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 9172},
  {'query': 'BRCA1',
   '_id': '110388719',
   '_score': 58.15771,
   'entrezgene': 110388719,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'BRCA1',
   'taxid': 8996},
  {'query': 'BRCA1',
   '_id': '102289404',
   '_score': 58.15771,
   'entrezgene': 102289404,
   'name': 'BRCA1, DNA repair associated',
   'symbol': 'brca1',
   'taxid': 8153}],
 'dup': [('BRCA1', 10)],
 'missing': []}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment