Looking up genes by KEGG

V quick query for JP, not well documented! https://github.com/monarch-initiative/operations/issues/91#issuecomment-308893761


In [1]:
from ontobio.ontol_factory import OntologyFactory
ofactory= OntologyFactory()

In [4]:
# For SciGraph we need to use a config file that maps the SciGraph
# handle onto a URL
from ontobio.config import set_config
set_config('../conf/config.yaml')


Out[4]:
<ontobio.config.Config at 0x108c61a90>

In [7]:
sgo = ofactory.create('scigraph:data')

In [9]:
matches = sgo.search('Fatty acid biosynthesis')
matches


Out[9]:
['KEGG-path:map00061']

In [16]:
from ontobio.golr.golr_query import GolrAssociationQuery

In [22]:
q = GolrAssociationQuery(subject_category='gene', object=matches[0], subject_taxon='NCBITaxon:9606')

In [23]:
assocs = q.exec()['associations']

In [24]:
for a in assocs:
    gene = a['subject']
    print("{} {}".format(gene['id'], gene['label']))


NCBIGene:31 ACACA
NCBIGene:27349 MCAT
NCBIGene:2194 FASN
NCBIGene:55301 OLAH
NCBIGene:54995 OXSM
NCBIGene:32 ACACB