Note
Click here to download the full example code
Run a coordinate-based meta-analysis (CBMA) workflow
NiMARE provides a plethora of tools for performing meta-analyses on neuroimaging data. Sometimes it’s difficult to know where to start, especially if you’re new to meta-analysis. This tutorial will walk you through using a CBMA workflow function which puts together the fundamental steps of a CBMA meta-analysis.
import os
from pprint import pprint
import matplotlib.pyplot as plt
from nilearn.plotting import plot_stat_map
from nimare.dataset import Dataset
from nimare.utils import get_resource_path
from nimare.workflows import cbma_workflow
Load Dataset
dset_file = os.path.join(get_resource_path(), "nidm_pain_dset.json")
dset = Dataset(dset_file)
Run CBMA Workflow
The CBMA workflow function runs the following steps:
Runs a meta-analysis using the specified method (default: ALE)
Applies a corrector to the meta-analysis results (default: FWECorrector, montecarlo)
Generates cluster tables and runs diagnostics on the corrected results (default: Jackknife)
All in one function call!
result = cbma_workflow(dset)
For this example, we use an FDR correction because the default corrector (FWE correction with Monte Carlo simulation) takes a long time to run due to the high number of iterations that are required
result = cbma_workflow(dset, corrector="fdr")
Out:
0%| | 0/21 [00:00<?, ?it/s]
5%|4 | 1/21 [00:02<00:40, 2.03s/it]
10%|9 | 2/21 [00:04<00:38, 2.03s/it]
14%|#4 | 3/21 [00:06<00:36, 2.03s/it]
19%|#9 | 4/21 [00:08<00:34, 2.03s/it]
24%|##3 | 5/21 [00:10<00:32, 2.03s/it]
29%|##8 | 6/21 [00:12<00:30, 2.05s/it]
33%|###3 | 7/21 [00:14<00:28, 2.04s/it]
38%|###8 | 8/21 [00:16<00:26, 2.04s/it]
43%|####2 | 9/21 [00:18<00:24, 2.04s/it]
48%|####7 | 10/21 [00:20<00:22, 2.03s/it]
52%|#####2 | 11/21 [00:22<00:20, 2.03s/it]
57%|#####7 | 12/21 [00:24<00:18, 2.03s/it]
62%|######1 | 13/21 [00:26<00:16, 2.03s/it]
67%|######6 | 14/21 [00:28<00:14, 2.03s/it]
71%|#######1 | 15/21 [00:30<00:12, 2.03s/it]
76%|#######6 | 16/21 [00:32<00:10, 2.02s/it]
81%|######## | 17/21 [00:34<00:08, 2.02s/it]
86%|########5 | 18/21 [00:36<00:06, 2.02s/it]
90%|######### | 19/21 [00:38<00:04, 2.02s/it]
95%|#########5| 20/21 [00:40<00:02, 2.02s/it]
100%|##########| 21/21 [00:42<00:00, 2.02s/it]
100%|##########| 21/21 [00:42<00:00, 2.03s/it]
Plot Results
The CBMA workflow function returns a MetaResult
object,
where you can access the corrected results of the meta-analysis and diagnostics tables.
Corrected map:
img = result.get_map("z_corr-FDR_method-indep")
plot_stat_map(
img,
cut_coords=4,
display_mode="z",
threshold=1.65, # voxel_thresh p < .05, one-tailed
cmap="RdBu_r",
vmax=4,
)
plt.show()
Clusters table
result.tables["z_corr-FDR_method-indep_clust"]
Contribution table
result.tables["z_corr-FDR_method-indep_Jackknife"]
Methods
The MetaResult object also provides boilerplate text automatically generated by NiMARE, which is released under the CC0 license.
print("Description:")
pprint(result.description_)
Out:
Description:
('An activation likelihood estimation (ALE) meta-analysis '
'\\citep{turkeltaub2002meta,turkeltaub2012minimizing,eickhoff2012activation} '
'was performed with NiMARE 0.0.14+0.g17ea335.dirty (RRID:SCR_017398; '
'\\citealt{Salo2022}), using a(n) ALE kernel. An ALE kernel '
'\\citep{eickhoff2012activation} was used to generate study-wise modeled '
'activation maps from coordinates. In this kernel method, each coordinate is '
'convolved with a Gaussian kernel with full-width at half max values '
'determined on a study-wise basis based on the study sample sizes according '
'to the formulae provided in \\cite{eickhoff2012activation}. For voxels with '
'overlapping kernels, the maximum value was retained. ALE values were '
'converted to p-values using an approximate null distribution '
'\\citep{eickhoff2012activation}. The input dataset included 267 foci from 21 '
'experiments, with a total of 334 participants. False discovery rate '
'correction was performed with the Benjamini-Hochberg procedure '
'\\citep{benjamini1995controlling}.')
References
print("References:")
pprint(result.bibtex_)
Out:
References:
('@article{Salo2022,\n'
' doi = {10.55458/neurolibre.00007},\n'
' url = {https://doi.org/10.55458/neurolibre.00007},\n'
' year = {2022},\n'
' publisher = {The Open Journal},\n'
' volume = {1},\n'
' number = {1},\n'
' pages = {7},\n'
' author = {Taylor Salo and Tal Yarkoni and Thomas E. Nichols and '
'Jean-Baptiste Poline and Murat Bilgel and Katherine L. Bottenhorn and Dorota '
'Jarecka and James D. Kent and Adam Kimbler and Dylan M. Nielson and Kendra '
'M. Oudyk and Julio A. Peraza and Alexandre Pérez and Puck C. Reeders and '
'Julio A. Yanes and Angela R. Laird},\n'
' title = {NiMARE: Neuroimaging Meta-Analysis Research Environment},\n'
' journal = {NeuroLibre}\n'
'}\n'
'@article{benjamini1995controlling,\n'
' title={Controlling the false discovery rate: a practical and powerful '
'approach to multiple testing},\n'
' author={Benjamini, Yoav and Hochberg, Yosef},\n'
' journal={Journal of the Royal statistical society: series B '
'(Methodological)},\n'
' volume={57},\n'
' number={1},\n'
' pages={289--300},\n'
' year={1995},\n'
' publisher={Wiley Online Library},\n'
' url={https://doi.org/10.1111/j.2517-6161.1995.tb02031.x},\n'
' doi={10.1111/j.2517-6161.1995.tb02031.x}\n'
'}\n'
'@article{eickhoff2012activation,\n'
' title={Activation likelihood estimation meta-analysis revisited},\n'
' author={Eickhoff, Simon B and Bzdok, Danilo and Laird, Angela R and Kurth, '
'Florian and Fox, Peter T},\n'
' journal={Neuroimage},\n'
' volume={59},\n'
' number={3},\n'
' pages={2349--2361},\n'
' year={2012},\n'
' publisher={Elsevier},\n'
' url={https://doi.org/10.1016/j.neuroimage.2011.09.017},\n'
' doi={10.1016/j.neuroimage.2011.09.017}\n'
'}\n'
'@article{turkeltaub2002meta,\n'
' title={Meta-analysis of the functional neuroanatomy of single-word '
'reading: method and validation},\n'
' author={Turkeltaub, Peter E and Eden, Guinevere F and Jones, Karen M and '
'Zeffiro, Thomas A},\n'
' journal={Neuroimage},\n'
' volume={16},\n'
' number={3},\n'
' pages={765--780},\n'
' year={2002},\n'
' publisher={Elsevier},\n'
' url={https://doi.org/10.1006/nimg.2002.1131},\n'
' doi={10.1006/nimg.2002.1131}\n'
'}\n'
'@article{turkeltaub2012minimizing,\n'
' title={Minimizing within-experiment and within-group effects in activation '
'likelihood estimation meta-analyses},\n'
' author={Turkeltaub, Peter E and Eickhoff, Simon B and Laird, Angela R and '
'Fox, Mick and Wiener, Martin and Fox, Peter},\n'
' journal={Human brain mapping},\n'
' volume={33},\n'
' number={1},\n'
' pages={1--13},\n'
' year={2012},\n'
' publisher={Wiley Online Library},\n'
' url={https://doi.org/10.1002/hbm.21186},\n'
' doi={10.1002/hbm.21186}\n'
'}')
Total running time of the script: ( 0 minutes 51.364 seconds)