Skip to content

Commit e138434

Browse files
committed
add static version of notebooks
1 parent 5742924 commit e138434

File tree

11 files changed

+1258
-403
lines changed

11 files changed

+1258
-403
lines changed
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
},
2424
{
2525
"cell_type": "code",
26-
"execution_count": null,
26+
"execution_count": 1,
2727
"metadata": {},
2828
"outputs": [],
2929
"source": [
@@ -43,7 +43,7 @@
4343
},
4444
{
4545
"cell_type": "code",
46-
"execution_count": null,
46+
"execution_count": 2,
4747
"metadata": {},
4848
"outputs": [],
4949
"source": [
@@ -66,12 +66,12 @@
6666
},
6767
{
6868
"cell_type": "code",
69-
"execution_count": null,
69+
"execution_count": 3,
7070
"metadata": {},
7171
"outputs": [],
7272
"source": [
7373
"# Generate a new auth_token in your profile and post it here\n",
74-
"auth_token = 'AseyaNLLhqv9jAm0joMkq2oqB0bw3GKxTclkT2NtG340RF6CfdM2UC3j8Fv4RpbQ'"
74+
"auth_token = 'R2skRbpBD3Rsf5dNHoQxDZevdEE74T5lCKMFyBhBwwPFH4ZfTrxDz7TZ0kbFLtEZ'"
7575
]
7676
},
7777
{
@@ -83,7 +83,7 @@
8383
},
8484
{
8585
"cell_type": "code",
86-
"execution_count": null,
86+
"execution_count": 4,
8787
"metadata": {},
8888
"outputs": [],
8989
"source": [
@@ -106,7 +106,7 @@
106106
},
107107
{
108108
"cell_type": "code",
109-
"execution_count": null,
109+
"execution_count": 5,
110110
"metadata": {},
111111
"outputs": [],
112112
"source": [
@@ -123,7 +123,7 @@
123123
},
124124
{
125125
"cell_type": "code",
126-
"execution_count": null,
126+
"execution_count": 6,
127127
"metadata": {},
128128
"outputs": [],
129129
"source": [
@@ -139,7 +139,7 @@
139139
},
140140
{
141141
"cell_type": "code",
142-
"execution_count": null,
142+
"execution_count": 7,
143143
"metadata": {},
144144
"outputs": [],
145145
"source": [
@@ -173,7 +173,7 @@
173173
},
174174
{
175175
"cell_type": "code",
176-
"execution_count": null,
176+
"execution_count": 8,
177177
"metadata": {},
178178
"outputs": [],
179179
"source": [
@@ -204,7 +204,7 @@
204204
"name": "python",
205205
"nbconvert_exporter": "python",
206206
"pygments_lexer": "ipython3",
207-
"version": "3.9.7"
207+
"version": "3.9.9"
208208
}
209209
},
210210
"nbformat": 4,
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# GET experiment"
8+
]
9+
},
10+
{
11+
"cell_type": "markdown",
12+
"metadata": {},
13+
"source": [
14+
"## get an experiment from MaveDB via the API"
15+
]
16+
},
17+
{
18+
"cell_type": "markdown",
19+
"metadata": {},
20+
"source": [
21+
"To begin, import the modeules below."
22+
]
23+
},
24+
{
25+
"cell_type": "code",
26+
"execution_count": 1,
27+
"metadata": {},
28+
"outputs": [],
29+
"source": [
30+
"import attr, os\n",
31+
"from pprint import PrettyPrinter\n",
32+
"from mavetools.client.client import Client\n",
33+
"from mavetools.models.experiment import Experiment"
34+
]
35+
},
36+
{
37+
"cell_type": "markdown",
38+
"metadata": {},
39+
"source": [
40+
"Pretty printer is used to format the output nicely. "
41+
]
42+
},
43+
{
44+
"cell_type": "code",
45+
"execution_count": 2,
46+
"metadata": {},
47+
"outputs": [],
48+
"source": [
49+
"pp = PrettyPrinter(indent=2) # displayes results in readable format"
50+
]
51+
},
52+
{
53+
"cell_type": "markdown",
54+
"metadata": {},
55+
"source": [
56+
"Here your base_url is set to localhost, http://127.0.0.1:8000/api/. This default funcionality is what you would want to use when working with a local instance of MaveDB (e.g., a development branch). If working with production mavedb you would set base url to https://www.mavedb.org/api/.\n",
57+
"\n",
58+
"In the cell below, comment out the base_url you will not be using."
59+
]
60+
},
61+
{
62+
"cell_type": "code",
63+
"execution_count": 3,
64+
"metadata": {},
65+
"outputs": [],
66+
"source": [
67+
"base_url = 'http://127.0.0.1:8000/api/'\n",
68+
"#base_url = 'https://www.mavedb.org/api/'"
69+
]
70+
},
71+
{
72+
"cell_type": "markdown",
73+
"metadata": {},
74+
"source": [
75+
"Set experiment_urn to match the experiment you want to get."
76+
]
77+
},
78+
{
79+
"cell_type": "code",
80+
"execution_count": 4,
81+
"metadata": {},
82+
"outputs": [],
83+
"source": [
84+
"experiment_urn = 'urn:mavedb:00000001-a'"
85+
]
86+
},
87+
{
88+
"cell_type": "markdown",
89+
"metadata": {},
90+
"source": [
91+
"Next, you will need an auth_token to make POST requests to MaveDB. If you have one, substitute it in the example provided below. If you need one, please follow these instructions:\n",
92+
"\n",
93+
" 1. go to https://www.mavedb.org\n",
94+
" 2. login using your ORCID ID\n",
95+
" 3. go to settings\n",
96+
" 4. generate new auth token\n",
97+
" 5. copy auth token and pase it in the auth_token field below"
98+
]
99+
},
100+
{
101+
"cell_type": "code",
102+
"execution_count": 5,
103+
"metadata": {},
104+
"outputs": [],
105+
"source": [
106+
"# Generate a new auth_token in your profile and post it here\n",
107+
"auth_token = 'R2skRbpBD3Rsf5dNHoQxDZevdEE74T5lCKMFyBhBwwPFH4ZfTrxDz7TZ0kbFLtEZ'"
108+
]
109+
},
110+
{
111+
"cell_type": "markdown",
112+
"metadata": {},
113+
"source": [
114+
"Here you instantiate the Client object. The Client object is the object by which the POST request is performed. The client object is instantiated with the value of base_url provided earlier, so make sure that is up-to-date. If base_url does not exist, base_url is defaulted to localhost, http://127.0.0.1:8000/api/."
115+
]
116+
},
117+
{
118+
"cell_type": "code",
119+
"execution_count": 6,
120+
"metadata": {},
121+
"outputs": [],
122+
"source": [
123+
"client = Client(base_url, auth_token=auth_token) if base_url else Client(auth_token=auth_token)"
124+
]
125+
},
126+
{
127+
"cell_type": "markdown",
128+
"metadata": {},
129+
"source": [
130+
"GET the model instance by passing the model type (Experiment, in this instance) and the experiment_urn as arguments to the get_model_istance funtion that operates on the Client object. This will GET the model instance (resource) from the server via the approprate API endpoint."
131+
]
132+
},
133+
{
134+
"cell_type": "code",
135+
"execution_count": 7,
136+
"metadata": {},
137+
"outputs": [],
138+
"source": [
139+
"experiment = client.get_model_instance(Experiment, experiment_urn)"
140+
]
141+
},
142+
{
143+
"cell_type": "markdown",
144+
"metadata": {},
145+
"source": [
146+
"Now, display the results!"
147+
]
148+
},
149+
{
150+
"cell_type": "code",
151+
"execution_count": 8,
152+
"metadata": {},
153+
"outputs": [
154+
{
155+
"name": "stdout",
156+
"output_type": "stream",
157+
"text": [
158+
"{ 'abstract_text': 'Although we now routinely sequence human genomes, we can '\n",
159+
" 'confidently identify only a fraction of the sequence '\n",
160+
" 'variants that have a functional impact. Here, we developed '\n",
161+
" 'a deep mutational scanning framework that produces '\n",
162+
" 'exhaustive maps for human missense variants by combining '\n",
163+
" 'random codon mutagenesis and multiplexed functional '\n",
164+
" 'variation assays with computational imputation and '\n",
165+
" 'refinement. We applied this framework to four proteins '\n",
166+
" 'corresponding to six human genes: UBE2I (encoding SUMO E2 '\n",
167+
" 'conjugase), SUMO1 (small ubiquitin-like modifier), TPK1 '\n",
168+
" '(thiamin pyrophosphokinase), and CALM1/2/3 (three genes '\n",
169+
" 'encoding the protein calmodulin). The resulting maps '\n",
170+
" 'recapitulate known protein features and confidently '\n",
171+
" 'identify pathogenic variation. Assays potentially amenable '\n",
172+
" 'to deep mutational scanning are already available for 57% '\n",
173+
" 'of human disease genes, suggesting that DMS could '\n",
174+
" 'ultimately map functional variation for all human disease '\n",
175+
" 'genes.',\n",
176+
" 'approved': None,\n",
177+
" 'contributors': ['0000-0003-1628-9390'],\n",
178+
" 'created_by': '0000-0003-1628-9390',\n",
179+
" 'creation_date': '2018-06-26',\n",
180+
" 'doi_ids': [],\n",
181+
" 'experimentset': 'urn:mavedb:00000001',\n",
182+
" 'extra_metadata': {},\n",
183+
" 'keywords': [ {'text': 'E2'},\n",
184+
" {'text': 'sumoylation'},\n",
185+
" {'text': 'imputation'},\n",
186+
" {'text': 'complementation'}],\n",
187+
" 'last_child_value': None,\n",
188+
" 'method_text': 'A Deep Mutational Scan of UBE2I using functional '\n",
189+
" 'complementation in yeast was performed using two different '\n",
190+
" 'methods: DMS-BarSeq and DMS-TileSeq, both datasets were '\n",
191+
" 'combined and a machine-learning method was used to impute '\n",
192+
" 'the effects of missing variants and refine measurements of '\n",
193+
" 'lower confidence. See [**Weile *et al.* '\n",
194+
" '2017**](http://msb.embopress.org/content/13/12/957) for '\n",
195+
" 'details.',\n",
196+
" 'modification_date': '2019-08-08',\n",
197+
" 'modified_by': '0000-0003-1628-9390',\n",
198+
" 'private': None,\n",
199+
" 'publish_date': '2018-06-26',\n",
200+
" 'pubmed_ids': [ { 'dbname': 'PubMed',\n",
201+
" 'dbversion': None,\n",
202+
" 'identifier': '29269382',\n",
203+
" 'url': 'http://www.ncbi.nlm.nih.gov/pubmed/29269382'}],\n",
204+
" 'scoresets': [ 'urn:mavedb:00000001-a-2',\n",
205+
" 'urn:mavedb:00000001-a-3',\n",
206+
" 'urn:mavedb:00000001-a-4',\n",
207+
" 'urn:mavedb:00000001-a-1'],\n",
208+
" 'short_description': 'A Deep Mutational Scan of the human SUMO E2 conjugase '\n",
209+
" 'UBE2I using functional complementation in yeast.',\n",
210+
" 'sra_ids': [ { 'dbname': 'SRA',\n",
211+
" 'dbversion': None,\n",
212+
" 'identifier': 'SRP109101',\n",
213+
" 'url': 'http://www.ebi.ac.uk/ena/data/view/SRP109101'},\n",
214+
" { 'dbname': 'SRA',\n",
215+
" 'dbversion': None,\n",
216+
" 'identifier': 'SRP109119',\n",
217+
" 'url': 'http://www.ebi.ac.uk/ena/data/view/SRP109119'}],\n",
218+
" 'title': 'UBE2I yeast complementation',\n",
219+
" 'urn': 'urn:mavedb:00000001-a'}\n"
220+
]
221+
}
222+
],
223+
"source": [
224+
"pp.pprint(attr.asdict(experiment))"
225+
]
226+
},
227+
{
228+
"cell_type": "code",
229+
"execution_count": null,
230+
"metadata": {},
231+
"outputs": [],
232+
"source": []
233+
}
234+
],
235+
"metadata": {
236+
"kernelspec": {
237+
"display_name": "Python 3 (ipykernel)",
238+
"language": "python",
239+
"name": "python3"
240+
},
241+
"language_info": {
242+
"codemirror_mode": {
243+
"name": "ipython",
244+
"version": 3
245+
},
246+
"file_extension": ".py",
247+
"mimetype": "text/x-python",
248+
"name": "python",
249+
"nbconvert_exporter": "python",
250+
"pygments_lexer": "ipython3",
251+
"version": "3.9.9"
252+
}
253+
},
254+
"nbformat": 4,
255+
"nbformat_minor": 4
256+
}

0 commit comments

Comments
 (0)