Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
cmungall committed Jun 16, 2017
1 parent 61d3292 commit 9f21edb
Showing 1 changed file with 153 additions and 0 deletions.
153 changes: 153 additions & 0 deletions notebooks/Lookup_KEGG_Genes_by_Pathway_Name.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Looking up genes by KEGG\n",
"\n",
"V quick query for JP, not well documented!\n",
"https://github.com/monarch-initiative/operations/issues/91#issuecomment-308893761"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from ontobio.ontol_factory import OntologyFactory\n",
"ofactory= OntologyFactory()"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<ontobio.config.Config at 0x108c61a90>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# For SciGraph we need to use a config file that maps the SciGraph\n",
"# handle onto a URL\n",
"from ontobio.config import set_config\n",
"set_config('../conf/config.yaml')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"source": [
"sgo = ofactory.create('scigraph:data')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['KEGG-path:map00061']"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"matches = sgo.search('Fatty acid biosynthesis')\n",
"matches"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [],
"source": [
"from ontobio.golr.golr_query import GolrAssociationQuery"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"q = GolrAssociationQuery(subject_category='gene', object=matches[0], subject_taxon='NCBITaxon:9606')"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [],
"source": [
"assocs = q.exec()['associations']"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"NCBIGene:31 ACACA\n",
"NCBIGene:27349 MCAT\n",
"NCBIGene:2194 FASN\n",
"NCBIGene:55301 OLAH\n",
"NCBIGene:54995 OXSM\n",
"NCBIGene:32 ACACB\n"
]
}
],
"source": [
"for a in assocs:\n",
" gene = a['subject']\n",
" print(\"{} {}\".format(gene['id'], gene['label']))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}

0 comments on commit 9f21edb

Please sign in to comment.