a b/notebooks/plot_reactome.ipynb
1
{
2
 "cells": [
3
  {
4
   "cell_type": "code",
5
   "execution_count": 1,
6
   "metadata": {},
7
   "outputs": [],
8
   "source": [
9
    "%load_ext autoreload\n",
10
    "%autoreload 2\n",
11
    "\n",
12
    "%matplotlib inline"
13
   ]
14
  },
15
  {
16
   "cell_type": "code",
17
   "execution_count": 2,
18
   "metadata": {},
19
   "outputs": [],
20
   "source": [
21
    "import sys"
22
   ]
23
  },
24
  {
25
   "cell_type": "code",
26
   "execution_count": 3,
27
   "metadata": {},
28
   "outputs": [],
29
   "source": [
30
    "sys.path.append('..')\n",
31
    "\n",
32
    "from pyMultiOmics.plots import download_reactome_diagram\n",
33
    "from pyMultiOmics.constants import HOMO_SAPIENS"
34
   ]
35
  },
36
  {
37
   "cell_type": "code",
38
   "execution_count": 4,
39
   "metadata": {},
40
   "outputs": [
41
    {
42
     "name": "stderr",
43
     "output_type": "stream",
44
     "text": [
45
      "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",
46
      "2022-03-24 14:49:07.812 | DEBUG    | pyMultiOmics.plots:send_reactome_expression_data:90 - Received HTTP status code: 200\n",
47
      "2022-03-24 14:49:07.817 | DEBUG    | pyMultiOmics.plots:parse_reactome_json:115 - Received expression analysis token: MjAyMjAzMjQxMDIxMjdfNDExOTA%3D\n",
48
      "2022-03-24 14:49:08.834 | DEBUG    | pyMultiOmics.plots:download_reactome_diagram:67 - Image saved to reactome.png\n"
49
     ]
50
    }
51
   ],
52
   "source": [
53
    "stId = 'R-HSA-70921'\n",
54
    "out_file = 'reactome.png'\n",
55
    "exp_dict = {\n",
56
    "    'C00135': 1.0,           # kegg\n",
57
    "    'C01342': 2.0,           # kegg\n",
58
    "    '30817': 3.0,            # ChEBI\n",
59
    "    'HAL': 4.0,              # gene name\n",
60
    "    'ENSG00000172508': 5.0,  # ensembl\n",
61
    "    'Q96NU7': 6.0            # uniprot\n",
62
    "}\n",
63
    "\n",
64
    "download_reactome_diagram(stId, out_file, species=HOMO_SAPIENS, expression_dict=exp_dict)"
65
   ]
66
  },
67
  {
68
   "cell_type": "markdown",
69
   "metadata": {},
70
   "source": [
71
    "![title](reactome.png)"
72
   ]
73
  }
74
 ],
75
 "metadata": {
76
  "kernelspec": {
77
   "display_name": "Python 3 (ipykernel)",
78
   "language": "python",
79
   "name": "python3"
80
  },
81
  "language_info": {
82
   "codemirror_mode": {
83
    "name": "ipython",
84
    "version": 3
85
   },
86
   "file_extension": ".py",
87
   "mimetype": "text/x-python",
88
   "name": "python",
89
   "nbconvert_exporter": "python",
90
   "pygments_lexer": "ipython3",
91
   "version": "3.10.1"
92
  }
93
 },
94
 "nbformat": 4,
95
 "nbformat_minor": 4
96
}