Skip to content

Commit 89a237a

Browse files
committed
add notebook
1 parent cf23142 commit 89a237a

File tree

1 file changed

+160
-0
lines changed

1 file changed

+160
-0
lines changed

run_and_explore.ipynb

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "28d0e8b6-9bbd-4256-a19a-ff36eeca5cfd",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"%%bash\n",
11+
"pip install -r requirements.txt"
12+
]
13+
},
14+
{
15+
"cell_type": "markdown",
16+
"id": "37860b1b-5031-4bd7-8e86-c668f545126b",
17+
"metadata": {},
18+
"source": [
19+
"## INSERT YOUR META-ANALYSIS ID HERE"
20+
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": null,
25+
"id": "178c5406-2625-4048-af3c-c01bdb5e1b56",
26+
"metadata": {},
27+
"outputs": [],
28+
"source": [
29+
"META_ID = \"3SD2A7LGuQTm\""
30+
]
31+
},
32+
{
33+
"cell_type": "code",
34+
"execution_count": null,
35+
"id": "8aee063b-9a03-4cd0-8de5-46b66cdf19c4",
36+
"metadata": {},
37+
"outputs": [],
38+
"source": [
39+
"from nimare.workflows import compose_run\n",
40+
"from nilearn.plotting import plot_stat_map"
41+
]
42+
},
43+
{
44+
"cell_type": "code",
45+
"execution_count": null,
46+
"id": "51a1e194-af1a-461c-a73f-3e79a31db95f",
47+
"metadata": {},
48+
"outputs": [],
49+
"source": [
50+
"if META_ID is not None:\n",
51+
" meta_result = compose_run(META_ID)\n",
52+
"else:\n",
53+
" print(\"UPDATE META_ID VARIABLE TO YOUR META-ANALYSIS\")"
54+
]
55+
},
56+
{
57+
"cell_type": "markdown",
58+
"id": "36d13a9a-b29c-48b3-87d3-4b37cf14cf63",
59+
"metadata": {
60+
"tags": []
61+
},
62+
"source": [
63+
"## Choose which statistical map to investigate\n",
64+
"default is z map, but each estimator/corrector combination may generate corrected/more appropriate statistical maps for summary/investigation"
65+
]
66+
},
67+
{
68+
"cell_type": "code",
69+
"execution_count": null,
70+
"id": "090cc2f6-9c74-4b53-bdd5-c815d35853f1",
71+
"metadata": {},
72+
"outputs": [],
73+
"source": [
74+
"# here are your choices\n",
75+
"print(\"\\n\".join(list(meta_result.maps.keys())))"
76+
]
77+
},
78+
{
79+
"cell_type": "code",
80+
"execution_count": null,
81+
"id": "b8b279c8-b4eb-45bb-9b7b-21d8bf0a06d0",
82+
"metadata": {},
83+
"outputs": [],
84+
"source": [
85+
"STAT_NAME = \"z\"\n",
86+
"stat_map = meta_result.get_map(STAT_NAME)"
87+
]
88+
},
89+
{
90+
"cell_type": "code",
91+
"execution_count": null,
92+
"id": "a70307bd-8b99-4f77-a2d9-95373dd94a7b",
93+
"metadata": {},
94+
"outputs": [],
95+
"source": [
96+
"plot_stat_map(stat_map)"
97+
]
98+
},
99+
{
100+
"cell_type": "markdown",
101+
"id": "b43d40b3-9c1d-490c-a3a2-173e04755932",
102+
"metadata": {},
103+
"source": [
104+
"## Investigate what studies contributed to which clusters"
105+
]
106+
},
107+
{
108+
"cell_type": "code",
109+
"execution_count": null,
110+
"id": "5732cece-ec55-44cb-996c-e56a26ba1639",
111+
"metadata": {},
112+
"outputs": [],
113+
"source": [
114+
"from nimare.diagnostics import FocusCounter # Only works for coordinate-based meta-analyses\n",
115+
"fc = FocusCounter(target_image=STAT_NAME)"
116+
]
117+
},
118+
{
119+
"cell_type": "code",
120+
"execution_count": null,
121+
"id": "2908b852-a2c4-4f8e-92ce-436ab79ce5f9",
122+
"metadata": {},
123+
"outputs": [],
124+
"source": [
125+
"contribution_table, cluster_img = fc.transform(meta_result)"
126+
]
127+
},
128+
{
129+
"cell_type": "code",
130+
"execution_count": null,
131+
"id": "eaa9b534-d3ac-4b02-bc90-2aa60fec62c1",
132+
"metadata": {},
133+
"outputs": [],
134+
"source": [
135+
"contribution_table"
136+
]
137+
}
138+
],
139+
"metadata": {
140+
"kernelspec": {
141+
"display_name": "Python 3 (ipykernel)",
142+
"language": "python",
143+
"name": "python3"
144+
},
145+
"language_info": {
146+
"codemirror_mode": {
147+
"name": "ipython",
148+
"version": 3
149+
},
150+
"file_extension": ".py",
151+
"mimetype": "text/x-python",
152+
"name": "python",
153+
"nbconvert_exporter": "python",
154+
"pygments_lexer": "ipython3",
155+
"version": "3.8.10"
156+
}
157+
},
158+
"nbformat": 4,
159+
"nbformat_minor": 5
160+
}

0 commit comments

Comments
 (0)