Skip to content

Commit b25acb2

Browse files
committed
Added some examples in the notebook.
1 parent 7b08e61 commit b25acb2

File tree

3 files changed

+61
-14
lines changed

3 files changed

+61
-14
lines changed

malariagen_data/anoph/gplt_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Parameters for genome plotting functions. N.B., genome plots are always
22
plotted with bokeh."""
33

4-
from typing import Literal, Mapping, Optional, Union, Final
4+
from typing import Literal, Mapping, Optional, Union, Final, Sequence
55

66
import bokeh.models
77
from typing_extensions import Annotated, TypeAlias
@@ -118,3 +118,5 @@
118118
]
119119

120120
contig_colors_default: Final[contig_colors] = list(bokeh.palettes.d3["Category20b"][5])
121+
122+
colors: TypeAlias = Annotated[Sequence[str], "List of colors."]

malariagen_data/anoph/h12.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ def plot_h12_gwss_multi_overlay_track(
587587
)
588588

589589
# Determine X axis range.
590-
x, _ = res[list(cohort_queries.keys())[0]]
590+
x, _, _ = res[list(cohort_queries.keys())[0]]
591591
x_min = x[0]
592592
x_max = x[-1]
593593
if x_range is None:
@@ -622,7 +622,7 @@ def plot_h12_gwss_multi_overlay_track(
622622
)
623623

624624
# Plot H12.
625-
for i, (cohort_label, (x, h12)) in enumerate(res.items()):
625+
for i, (cohort_label, (x, h12, contig)) in enumerate(res.items()):
626626
fig.scatter(
627627
x=x,
628628
y=h12,

notebooks/plot_h12_h1x.ipynb

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@
7575
"coh2 = \"ML-2_Kati_gamb_2014\"\n",
7676
"coh1_query = f\"cohort_admin2_year == '{coh1}'\"\n",
7777
"coh2_query = f\"cohort_admin2_year == '{coh2}'\"\n",
78-
"contig = \"2L\""
78+
"contig = \"2L\"\n",
79+
"contigs = \"2RL\""
7980
]
8081
},
8182
{
@@ -114,6 +115,23 @@
114115
")"
115116
]
116117
},
118+
{
119+
"cell_type": "code",
120+
"execution_count": null,
121+
"id": "4470d24c-8cf1-4d22-b774-0121b4560e27",
122+
"metadata": {},
123+
"outputs": [],
124+
"source": [
125+
"ag3.plot_h12_gwss(\n",
126+
" contig=contigs,\n",
127+
" analysis=\"gamb_colu\",\n",
128+
" window_size=2000,\n",
129+
" sample_query=coh1_query,\n",
130+
" sample_sets=\"3.0\",\n",
131+
" cohort_size=20,\n",
132+
")"
133+
]
134+
},
117135
{
118136
"cell_type": "code",
119137
"execution_count": null,
@@ -173,6 +191,25 @@
173191
")"
174192
]
175193
},
194+
{
195+
"cell_type": "code",
196+
"execution_count": null,
197+
"id": "b4b7a8d2-95d0-48dc-a32f-3bc96aacfb9f",
198+
"metadata": {},
199+
"outputs": [],
200+
"source": [
201+
"ag3.plot_h1x_gwss(\n",
202+
" contig=contigs,\n",
203+
" window_size=2000,\n",
204+
" cohort1_query=coh1_query,\n",
205+
" cohort2_query=coh2_query,\n",
206+
" sample_sets=\"3.0\",\n",
207+
" analysis=\"gamb_colu\",\n",
208+
" cohort_size=20,\n",
209+
" contig_colors=[\"red\", \"green\"]\n",
210+
")"
211+
]
212+
},
176213
{
177214
"cell_type": "code",
178215
"execution_count": null,
@@ -261,6 +298,22 @@
261298
"contig = \"2RL\""
262299
]
263300
},
301+
{
302+
"cell_type": "code",
303+
"execution_count": null,
304+
"id": "1aaa0573-723c-43b1-baea-750172c4dabc",
305+
"metadata": {},
306+
"outputs": [],
307+
"source": []
308+
},
309+
{
310+
"cell_type": "code",
311+
"execution_count": null,
312+
"id": "ffc7dc06-6bdb-42d2-a1fb-878612d10dd1",
313+
"metadata": {},
314+
"outputs": [],
315+
"source": []
316+
},
264317
{
265318
"cell_type": "code",
266319
"execution_count": null,
@@ -364,14 +417,6 @@
364417
" cohort_size=20,\n",
365418
")"
366419
]
367-
},
368-
{
369-
"cell_type": "code",
370-
"execution_count": null,
371-
"id": "67e3bfcc",
372-
"metadata": {},
373-
"outputs": [],
374-
"source": []
375420
}
376421
],
377422
"metadata": {
@@ -382,7 +427,7 @@
382427
"uri": "us-docker.pkg.dev/deeplearning-platform-release/gcr.io/workbench-notebooks:m125"
383428
},
384429
"kernelspec": {
385-
"display_name": "malariagen-data-python",
430+
"display_name": "Python 3 (ipykernel)",
386431
"language": "python",
387432
"name": "python3"
388433
},
@@ -396,7 +441,7 @@
396441
"name": "python",
397442
"nbconvert_exporter": "python",
398443
"pygments_lexer": "ipython3",
399-
"version": "3.10.15"
444+
"version": "3.10.11"
400445
},
401446
"vscode": {
402447
"interpreter": {

0 commit comments

Comments
 (0)