--- a +++ b/notebooks/plot_reactome.ipynb @@ -0,0 +1,96 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [], + "source": [ + "%load_ext autoreload\n", + "%autoreload 2\n", + "\n", + "%matplotlib inline" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [], + "source": [ + "import sys" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [], + "source": [ + "sys.path.append('..')\n", + "\n", + "from pyMultiOmics.plots import download_reactome_diagram\n", + "from pyMultiOmics.constants import HOMO_SAPIENS" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": {}, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "2022-03-24 14:49:06.061 | DEBUG | pyMultiOmics.plots:send_reactome_expression_data:86 - POSTing expression data to Reactome Analysis Service: https://reactome.org/AnalysisService/identifiers/?interactors=false&species=Homo%20sapiens&sortBy=ENTITIES_PVALUE&order=ASC&resource=TOTAL&pValue=1&includeDisease=true\n", + "2022-03-24 14:49:07.812 | DEBUG | pyMultiOmics.plots:send_reactome_expression_data:90 - Received HTTP status code: 200\n", + "2022-03-24 14:49:07.817 | DEBUG | pyMultiOmics.plots:parse_reactome_json:115 - Received expression analysis token: MjAyMjAzMjQxMDIxMjdfNDExOTA%3D\n", + "2022-03-24 14:49:08.834 | DEBUG | pyMultiOmics.plots:download_reactome_diagram:67 - Image saved to reactome.png\n" + ] + } + ], + "source": [ + "stId = 'R-HSA-70921'\n", + "out_file = 'reactome.png'\n", + "exp_dict = {\n", + " 'C00135': 1.0, # kegg\n", + " 'C01342': 2.0, # kegg\n", + " '30817': 3.0, # ChEBI\n", + " 'HAL': 4.0, # gene name\n", + " 'ENSG00000172508': 5.0, # ensembl\n", + " 'Q96NU7': 6.0 # uniprot\n", + "}\n", + "\n", + "download_reactome_diagram(stId, out_file, species=HOMO_SAPIENS, expression_dict=exp_dict)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3 (ipykernel)", + "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.10.1" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}