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

Run CBMA Workflow

The CBMA workflow function runs the following steps:

  1. Runs a meta-analysis using the specified method (default: ALE)

  2. Applies a corrector to the meta-analysis results (default: FWECorrector, montecarlo)

  3. 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()
10 plot cbma workflow

Clusters table

result.tables["z_corr-FDR_method-indep_clust"]
Cluster ID X Y Z Peak Stat Cluster Size (mm3)
0 PositiveTail 1 38.0 4.0 2.0 4.837038 6912
1 PositiveTail 1a 38.0 14.0 -6.0 4.138394
2 PositiveTail 1b 34.0 20.0 0.0 3.978528
3 PositiveTail 1c 38.0 -10.0 -6.0 2.873938
4 PositiveTail 2 54.0 -28.0 20.0 4.309257 1736
5 PositiveTail 3 -34.0 14.0 0.0 4.138394 1280
6 PositiveTail 4 2.0 4.0 52.0 3.719572 5760
7 PositiveTail 4a -6.0 8.0 42.0 3.428444
8 PositiveTail 4b 2.0 -4.0 64.0 2.994763
9 PositiveTail 4c -8.0 14.0 34.0 2.952426
10 PositiveTail 5 -32.0 -60.0 -34.0 3.470566 2880
11 PositiveTail 5a -26.0 -66.0 -38.0 2.693224
12 PositiveTail 5b -28.0 -58.0 -46.0 2.268818
13 PositiveTail 6 -62.0 -22.0 20.0 2.968374 1832
14 PositiveTail 6a -54.0 -32.0 22.0 2.840638
15 PositiveTail 6b -64.0 -22.0 28.0 2.299591
16 PositiveTail 7 -36.0 4.0 -16.0 2.809475 552
17 PositiveTail 8 20.0 -102.0 -4.0 2.716632 496
18 PositiveTail 9 -6.0 -48.0 54.0 2.462465 576
19 PositiveTail 10 -36.0 -22.0 10.0 2.228337 208
20 PositiveTail 11 -4.0 -70.0 50.0 2.228337 168
21 PositiveTail 12 -46.0 -58.0 -54.0 2.213906 128
22 PositiveTail 13 36.0 -18.0 12.0 2.205878 112
23 PositiveTail 14 -34.0 -90.0 -12.0 2.194827 152
24 PositiveTail 15 -54.0 -66.0 2.0 2.135190 248
25 PositiveTail 16 -52.0 -8.0 6.0 2.106963 88
26 PositiveTail 17 10.0 -68.0 36.0 2.087058 176
27 PositiveTail 18 36.0 40.0 30.0 1.973495 88


Contribution table

result.tables["z_corr-FDR_method-indep_Jackknife"]
id PositiveTail 1 PositiveTail 2 PositiveTail 3 PositiveTail 4 PositiveTail 5 PositiveTail 6 PositiveTail 7 PositiveTail 8 PositiveTail 9 PositiveTail 10 PositiveTail 11 PositiveTail 12 PositiveTail 13 PositiveTail 14 PositiveTail 15 PositiveTail 16 PositiveTail 17 PositiveTail 18
0 pain_01.nidm-1 0.034983 0.0 0.0 0.0 0.071489 0.0 0.0 0.062549 0.0 0.0 0.0 0.000003 0.000075 0.0 0.117396 0.0 0.0 0.0
1 pain_02.nidm-1 0.000005 0.141261 0.00003 0.0 0.0 0.0 0.317441 0.000014 0.0 0.0 0.0 0.0 0.526 0.0 0.0 0.0 0.0 0.548724
2 pain_03.nidm-1 0.025369 0.0 0.0 0.137756 0.1153 0.0 0.0 0.383157 0.0 0.0 0.0 0.0 0.0 0.488295 0.0 0.000005 0.0 0.0
3 pain_04.nidm-1 0.08195 0.231971 0.194216 0.112993 0.079311 0.0 0.276962 0.396489 0.0 0.0 0.0 0.0 0.470476 0.445865 0.0 0.0 0.0 0.0
4 pain_05.nidm-1 0.093247 0.0 0.038346 0.084423 0.123392 0.0 0.087439 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
5 pain_06.nidm-1 0.0 0.0 0.000068 0.038829 0.0 0.0 0.01977 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.01921
6 pain_07.nidm-1 0.0 0.0 0.0 0.0 0.016125 0.0 0.0 0.0 0.000017 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
7 pain_08.nidm-1 0.000006 0.148582 0.0 0.043043 0.111489 0.0 0.0 0.0 0.206307 0.000097 0.48905 0.50184 0.0 0.0 0.0 0.0 0.015779 0.14146
8 pain_09.nidm-1 0.001841 0.0 0.0 0.0 0.06279 0.0 0.0 0.0 0.129468 0.0 0.000042 0.494551 0.0 0.0 0.0 0.0 0.0 0.28749
9 pain_10.nidm-1 0.076135 0.141862 0.0 0.021402 0.116449 0.055756 0.0 0.0 0.000088 0.0 0.364769 0.000654 0.000001 0.0 0.0 0.0 0.000003 0.0
10 pain_11.nidm-1 0.0 0.0 0.0 0.0 0.0 0.000001 0.0 0.0 0.303851 0.41431 0.0 0.0 0.0 0.0 0.0 0.000002 0.0 0.0
11 pain_12.nidm-1 0.052411 0.120187 0.193765 0.0 0.0 0.0 0.000093 0.0 0.0 0.0 0.142476 0.0 0.0 0.0 0.0 0.0 0.488879 0.0
12 pain_13.nidm-1 0.118661 0.0 0.173124 0.0 0.0 0.168279 0.000378 0.0 0.0 0.0 0.0 0.0 0.000016 0.0 0.0 0.0 0.0 0.0
13 pain_14.nidm-1 0.070428 0.0 0.0 0.0 0.114381 0.0 0.0 0.153891 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
14 pain_15.nidm-1 0.03615 0.0 0.0 0.056854 0.0 0.128406 0.0 0.0 0.0 0.0 0.0 0.0 0.000002 0.0 0.0 0.000003 0.0 0.0
15 pain_16.nidm-1 0.052685 0.099472 0.186338 0.055696 0.000342 0.111119 0.001262 0.0 0.356352 0.000019 0.000281 0.0 0.000527 0.0 0.13379 0.0 0.492489 0.0
16 pain_17.nidm-1 0.0 0.0 0.0 0.0 0.080154 0.216049 0.0 0.0 0.0 0.171132 0.0 0.000065 0.0 0.0 0.32642 0.438329 0.0 0.0
17 pain_18.nidm-1 0.091356 0.110608 0.000316 0.0 0.0 0.206111 0.0 0.0 0.0 0.411024 0.0 0.0 0.0 0.0 0.0 0.000132 0.0 0.0
18 pain_19.nidm-1 0.129286 0.0 0.0 0.152358 0.103874 0.0 0.0 0.0 0.0 0.000002 0.0 0.0 0.0 0.000102 0.0 0.558612 0.0 0.0
19 pain_20.nidm-1 0.084771 0.0 0.0 0.114932 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.001997 0.418881 0.0 0.0 0.0
20 pain_21.nidm-1 0.044402 0.0 0.208044 0.176658 0.0 0.109986 0.292581 0.0 0.0 0.0 0.0 0.0 0.0 0.060755 0.0 0.0 0.0 0.0


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)

Gallery generated by Sphinx-Gallery