#!/usr/bin/env python # coding: utf-8 # ## 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') # In[7]: sgo = ofactory.create('scigraph:data') # In[9]: matches = sgo.search('Fatty acid biosynthesis') matches # 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']))