Run coordinate-based subtraction and conjunction analyses

The (coordinate-based) ALE subtraction method tests at which voxels the meta-analytic results from two groups of studies differ reliably from one another. 1, 2

import os

from nilearn.image import math_img
from nilearn.plotting import plot_stat_map

from nimare.correct import FWECorrector
from nimare.io import convert_sleuth_to_dataset
from nimare.meta.cbma import ALE, ALESubtraction
from nimare.tests.utils import get_test_data_path

Load Sleuth text files into Datasets

The data for this example are a subset of studies from a meta-analysis on semantic cognition in children. 3 A first group of studies probed childrens semantic world knowledge (e.g., correctly naming an object after hearing its auditory description) while a second group of studies asked children to decide if two (or more) words were semantically related to one another or not.

sleuth_file = os.path.join(get_test_data_path(), "semantic_knowledge_children.txt")
sleuth_file2 = os.path.join(get_test_data_path(), "semantic_relatedness_children.txt")

dset = convert_sleuth_to_dataset(sleuth_file)
dset2 = convert_sleuth_to_dataset(sleuth_file2)

Individual group ALEs

Computing seperate ALE analyses for each group is not strictly necessary for performing the subtraction analysis but will help to appreciate the similarities and differences between the groups.

ale = ALE(null_method="approximate")
res = ale.fit(dset)
res2 = ale.fit(dset2)

corr = FWECorrector(method="montecarlo", voxel_thresh=0.001, n_iters=100, n_cores=1)
cres = corr.transform(res)
cres2 = corr.transform(res2)

img = cres.get_map("z_level-cluster_corr-FWE_method-montecarlo")
plot_stat_map(
    img,
    cut_coords=4,
    display_mode="z",
    title="Semantic knowledge",
    threshold=2.326,  # cluster-level p < .01, one-tailed
    cmap="RdBu_r",
    vmax=4,
)

img2 = cres2.get_map("z_level-cluster_corr-FWE_method-montecarlo")
plot_stat_map(
    img2,
    cut_coords=4,
    display_mode="z",
    title="Semantic relatedness",
    threshold=2.326,  # cluster-level p < .01, one-tailed
    cmap="RdBu_r",
    vmax=4,
)
  • plot cbma subtraction conjunction
  • plot cbma subtraction conjunction

Out:

  0%|          | 0/100 [00:00<?, ?it/s]
  1%|1         | 1/100 [00:00<00:30,  3.28it/s]
  2%|2         | 2/100 [00:00<00:29,  3.29it/s]
  3%|3         | 3/100 [00:00<00:29,  3.34it/s]
  4%|4         | 4/100 [00:01<00:28,  3.36it/s]
  5%|5         | 5/100 [00:01<00:28,  3.37it/s]
  6%|6         | 6/100 [00:01<00:27,  3.37it/s]
  7%|7         | 7/100 [00:02<00:27,  3.38it/s]
  8%|8         | 8/100 [00:02<00:27,  3.38it/s]
  9%|9         | 9/100 [00:02<00:26,  3.40it/s]
 10%|#         | 10/100 [00:02<00:26,  3.40it/s]
 11%|#1        | 11/100 [00:03<00:26,  3.39it/s]
 12%|#2        | 12/100 [00:03<00:26,  3.38it/s]
 13%|#3        | 13/100 [00:03<00:25,  3.39it/s]
 14%|#4        | 14/100 [00:04<00:25,  3.39it/s]
 15%|#5        | 15/100 [00:04<00:25,  3.38it/s]
 16%|#6        | 16/100 [00:04<00:24,  3.37it/s]
 17%|#7        | 17/100 [00:05<00:24,  3.36it/s]
 18%|#8        | 18/100 [00:05<00:24,  3.36it/s]
 19%|#9        | 19/100 [00:05<00:24,  3.37it/s]
 20%|##        | 20/100 [00:05<00:23,  3.37it/s]
 21%|##1       | 21/100 [00:06<00:23,  3.38it/s]
 22%|##2       | 22/100 [00:06<00:23,  3.38it/s]
 23%|##3       | 23/100 [00:06<00:22,  3.38it/s]
 24%|##4       | 24/100 [00:07<00:22,  3.39it/s]
 25%|##5       | 25/100 [00:07<00:22,  3.38it/s]
 26%|##6       | 26/100 [00:07<00:21,  3.38it/s]
 27%|##7       | 27/100 [00:08<00:21,  3.37it/s]
 28%|##8       | 28/100 [00:08<00:21,  3.38it/s]
 29%|##9       | 29/100 [00:08<00:20,  3.38it/s]
 30%|###       | 30/100 [00:08<00:20,  3.39it/s]
 31%|###1      | 31/100 [00:09<00:20,  3.38it/s]
 32%|###2      | 32/100 [00:09<00:20,  3.38it/s]
 33%|###3      | 33/100 [00:09<00:19,  3.38it/s]
 34%|###4      | 34/100 [00:10<00:19,  3.36it/s]
 35%|###5      | 35/100 [00:10<00:19,  3.37it/s]
 36%|###6      | 36/100 [00:10<00:18,  3.38it/s]
 37%|###7      | 37/100 [00:10<00:18,  3.39it/s]
 38%|###8      | 38/100 [00:11<00:18,  3.39it/s]
 39%|###9      | 39/100 [00:11<00:17,  3.40it/s]
 40%|####      | 40/100 [00:11<00:17,  3.38it/s]
 41%|####1     | 41/100 [00:12<00:17,  3.39it/s]
 42%|####2     | 42/100 [00:12<00:17,  3.39it/s]
 43%|####3     | 43/100 [00:12<00:16,  3.40it/s]
 44%|####4     | 44/100 [00:13<00:16,  3.40it/s]
 45%|####5     | 45/100 [00:13<00:16,  3.39it/s]
 46%|####6     | 46/100 [00:13<00:16,  3.37it/s]
 47%|####6     | 47/100 [00:13<00:15,  3.38it/s]
 48%|####8     | 48/100 [00:14<00:15,  3.39it/s]
 49%|####9     | 49/100 [00:14<00:15,  3.38it/s]
 50%|#####     | 50/100 [00:14<00:14,  3.39it/s]
 51%|#####1    | 51/100 [00:15<00:14,  3.38it/s]
 52%|#####2    | 52/100 [00:15<00:14,  3.37it/s]
 53%|#####3    | 53/100 [00:15<00:13,  3.38it/s]
 54%|#####4    | 54/100 [00:15<00:13,  3.39it/s]
 55%|#####5    | 55/100 [00:16<00:13,  3.40it/s]
 56%|#####6    | 56/100 [00:16<00:12,  3.40it/s]
 57%|#####6    | 57/100 [00:16<00:12,  3.40it/s]
 58%|#####8    | 58/100 [00:17<00:12,  3.41it/s]
 59%|#####8    | 59/100 [00:17<00:12,  3.40it/s]
 60%|######    | 60/100 [00:17<00:11,  3.39it/s]
 61%|######1   | 61/100 [00:18<00:11,  3.39it/s]
 62%|######2   | 62/100 [00:18<00:11,  3.39it/s]
 63%|######3   | 63/100 [00:18<00:10,  3.39it/s]
 64%|######4   | 64/100 [00:18<00:10,  3.39it/s]
 65%|######5   | 65/100 [00:19<00:10,  3.40it/s]
 66%|######6   | 66/100 [00:19<00:10,  3.39it/s]
 67%|######7   | 67/100 [00:19<00:09,  3.39it/s]
 68%|######8   | 68/100 [00:20<00:09,  3.37it/s]
 69%|######9   | 69/100 [00:20<00:09,  3.36it/s]
 70%|#######   | 70/100 [00:20<00:08,  3.39it/s]
 71%|#######1  | 71/100 [00:20<00:08,  3.39it/s]
 72%|#######2  | 72/100 [00:21<00:08,  3.40it/s]
 73%|#######3  | 73/100 [00:21<00:07,  3.41it/s]
 74%|#######4  | 74/100 [00:21<00:07,  3.40it/s]
 75%|#######5  | 75/100 [00:22<00:07,  3.39it/s]
 76%|#######6  | 76/100 [00:22<00:07,  3.38it/s]
 77%|#######7  | 77/100 [00:22<00:06,  3.38it/s]
 78%|#######8  | 78/100 [00:23<00:06,  3.38it/s]
 79%|#######9  | 79/100 [00:23<00:06,  3.38it/s]
 80%|########  | 80/100 [00:23<00:05,  3.38it/s]
 81%|########1 | 81/100 [00:23<00:05,  3.39it/s]
 82%|########2 | 82/100 [00:24<00:05,  3.38it/s]
 83%|########2 | 83/100 [00:24<00:05,  3.38it/s]
 84%|########4 | 84/100 [00:24<00:04,  3.36it/s]
 85%|########5 | 85/100 [00:25<00:04,  3.38it/s]
 86%|########6 | 86/100 [00:25<00:04,  3.37it/s]
 87%|########7 | 87/100 [00:25<00:03,  3.38it/s]
 88%|########8 | 88/100 [00:26<00:03,  3.39it/s]
 89%|########9 | 89/100 [00:26<00:03,  3.40it/s]
 90%|######### | 90/100 [00:26<00:02,  3.39it/s]
 91%|#########1| 91/100 [00:26<00:02,  3.38it/s]
 92%|#########2| 92/100 [00:27<00:02,  3.37it/s]
 93%|#########3| 93/100 [00:27<00:02,  3.38it/s]
 94%|#########3| 94/100 [00:27<00:01,  3.38it/s]
 95%|#########5| 95/100 [00:28<00:01,  3.38it/s]
 96%|#########6| 96/100 [00:28<00:01,  3.38it/s]
 97%|#########7| 97/100 [00:28<00:00,  3.37it/s]
 98%|#########8| 98/100 [00:28<00:00,  3.36it/s]
 99%|#########9| 99/100 [00:29<00:00,  3.35it/s]
100%|##########| 100/100 [00:29<00:00,  3.35it/s]
100%|##########| 100/100 [00:29<00:00,  3.38it/s]

  0%|          | 0/100 [00:00<?, ?it/s]
  1%|1         | 1/100 [00:00<00:30,  3.28it/s]
  2%|2         | 2/100 [00:00<00:29,  3.27it/s]
  3%|3         | 3/100 [00:00<00:29,  3.29it/s]
  4%|4         | 4/100 [00:01<00:29,  3.27it/s]
  5%|5         | 5/100 [00:01<00:28,  3.30it/s]
  6%|6         | 6/100 [00:01<00:28,  3.31it/s]
  7%|7         | 7/100 [00:02<00:27,  3.32it/s]
  8%|8         | 8/100 [00:02<00:27,  3.31it/s]
  9%|9         | 9/100 [00:02<00:27,  3.31it/s]
 10%|#         | 10/100 [00:03<00:27,  3.31it/s]
 11%|#1        | 11/100 [00:03<00:27,  3.29it/s]
 12%|#2        | 12/100 [00:03<00:26,  3.29it/s]
 13%|#3        | 13/100 [00:03<00:26,  3.31it/s]
 14%|#4        | 14/100 [00:04<00:25,  3.32it/s]
 15%|#5        | 15/100 [00:04<00:25,  3.33it/s]
 16%|#6        | 16/100 [00:04<00:25,  3.33it/s]
 17%|#7        | 17/100 [00:05<00:24,  3.32it/s]
 18%|#8        | 18/100 [00:05<00:24,  3.30it/s]
 19%|#9        | 19/100 [00:05<00:24,  3.30it/s]
 20%|##        | 20/100 [00:06<00:24,  3.31it/s]
 21%|##1       | 21/100 [00:06<00:23,  3.33it/s]
 22%|##2       | 22/100 [00:06<00:23,  3.33it/s]
 23%|##3       | 23/100 [00:06<00:23,  3.31it/s]
 24%|##4       | 24/100 [00:07<00:22,  3.31it/s]
 25%|##5       | 25/100 [00:07<00:22,  3.33it/s]
 26%|##6       | 26/100 [00:07<00:22,  3.32it/s]
 27%|##7       | 27/100 [00:08<00:21,  3.32it/s]
 28%|##8       | 28/100 [00:08<00:21,  3.34it/s]
 29%|##9       | 29/100 [00:08<00:21,  3.32it/s]
 30%|###       | 30/100 [00:09<00:21,  3.31it/s]
 31%|###1      | 31/100 [00:09<00:20,  3.32it/s]
 32%|###2      | 32/100 [00:09<00:20,  3.32it/s]
 33%|###3      | 33/100 [00:09<00:20,  3.30it/s]
 34%|###4      | 34/100 [00:10<00:20,  3.29it/s]
 35%|###5      | 35/100 [00:10<00:19,  3.29it/s]
 36%|###6      | 36/100 [00:10<00:19,  3.28it/s]
 37%|###7      | 37/100 [00:11<00:19,  3.29it/s]
 38%|###8      | 38/100 [00:11<00:18,  3.28it/s]
 39%|###9      | 39/100 [00:11<00:18,  3.29it/s]
 40%|####      | 40/100 [00:12<00:18,  3.29it/s]
 41%|####1     | 41/100 [00:12<00:17,  3.30it/s]
 42%|####2     | 42/100 [00:12<00:17,  3.30it/s]
 43%|####3     | 43/100 [00:13<00:17,  3.31it/s]
 44%|####4     | 44/100 [00:13<00:16,  3.30it/s]
 45%|####5     | 45/100 [00:13<00:16,  3.31it/s]
 46%|####6     | 46/100 [00:13<00:16,  3.30it/s]
 47%|####6     | 47/100 [00:14<00:16,  3.30it/s]
 48%|####8     | 48/100 [00:14<00:15,  3.31it/s]
 49%|####9     | 49/100 [00:14<00:15,  3.31it/s]
 50%|#####     | 50/100 [00:15<00:15,  3.30it/s]
 51%|#####1    | 51/100 [00:15<00:14,  3.29it/s]
 52%|#####2    | 52/100 [00:15<00:14,  3.30it/s]
 53%|#####3    | 53/100 [00:16<00:14,  3.31it/s]
 54%|#####4    | 54/100 [00:16<00:13,  3.32it/s]
 55%|#####5    | 55/100 [00:16<00:13,  3.32it/s]
 56%|#####6    | 56/100 [00:16<00:13,  3.31it/s]
 57%|#####6    | 57/100 [00:17<00:13,  3.28it/s]
 58%|#####8    | 58/100 [00:17<00:12,  3.28it/s]
 59%|#####8    | 59/100 [00:17<00:12,  3.28it/s]
 60%|######    | 60/100 [00:18<00:12,  3.28it/s]
 61%|######1   | 61/100 [00:18<00:11,  3.29it/s]
 62%|######2   | 62/100 [00:18<00:11,  3.30it/s]
 63%|######3   | 63/100 [00:19<00:11,  3.31it/s]
 64%|######4   | 64/100 [00:19<00:10,  3.31it/s]
 65%|######5   | 65/100 [00:19<00:10,  3.31it/s]
 66%|######6   | 66/100 [00:19<00:10,  3.31it/s]
 67%|######7   | 67/100 [00:20<00:09,  3.32it/s]
 68%|######8   | 68/100 [00:20<00:09,  3.31it/s]
 69%|######9   | 69/100 [00:20<00:09,  3.32it/s]
 70%|#######   | 70/100 [00:21<00:09,  3.32it/s]
 71%|#######1  | 71/100 [00:21<00:08,  3.33it/s]
 72%|#######2  | 72/100 [00:21<00:08,  3.32it/s]
 73%|#######3  | 73/100 [00:22<00:08,  3.33it/s]
 74%|#######4  | 74/100 [00:22<00:07,  3.32it/s]
 75%|#######5  | 75/100 [00:22<00:07,  3.32it/s]
 76%|#######6  | 76/100 [00:22<00:07,  3.33it/s]
 77%|#######7  | 77/100 [00:23<00:06,  3.32it/s]
 78%|#######8  | 78/100 [00:23<00:06,  3.31it/s]
 79%|#######9  | 79/100 [00:23<00:06,  3.31it/s]
 80%|########  | 80/100 [00:24<00:06,  3.31it/s]
 81%|########1 | 81/100 [00:24<00:05,  3.33it/s]
 82%|########2 | 82/100 [00:24<00:05,  3.32it/s]
 83%|########2 | 83/100 [00:25<00:05,  3.31it/s]
 84%|########4 | 84/100 [00:25<00:04,  3.31it/s]
 85%|########5 | 85/100 [00:25<00:04,  3.32it/s]
 86%|########6 | 86/100 [00:25<00:04,  3.32it/s]
 87%|########7 | 87/100 [00:26<00:03,  3.31it/s]
 88%|########8 | 88/100 [00:26<00:03,  3.30it/s]
 89%|########9 | 89/100 [00:26<00:03,  3.29it/s]
 90%|######### | 90/100 [00:27<00:03,  3.28it/s]
 91%|#########1| 91/100 [00:27<00:02,  3.28it/s]
 92%|#########2| 92/100 [00:27<00:02,  3.30it/s]
 93%|#########3| 93/100 [00:28<00:02,  3.30it/s]
 94%|#########3| 94/100 [00:28<00:01,  3.31it/s]
 95%|#########5| 95/100 [00:28<00:01,  3.31it/s]
 96%|#########6| 96/100 [00:29<00:01,  3.31it/s]
 97%|#########7| 97/100 [00:29<00:00,  3.32it/s]
 98%|#########8| 98/100 [00:29<00:00,  3.31it/s]
 99%|#########9| 99/100 [00:29<00:00,  3.29it/s]
100%|##########| 100/100 [00:30<00:00,  3.28it/s]
100%|##########| 100/100 [00:30<00:00,  3.31it/s]

<nilearn.plotting.displays.ZSlicer object at 0x7f188a466790>

Subtraction analysis

sub = ALESubtraction(n_iters=100, memory_limit=None)
res_sub = sub.fit(dset, dset2)
img_sub = res_sub.get_map("z_desc-group1MinusGroup2")

plot_stat_map(
    img_sub,
    cut_coords=4,
    display_mode="z",
    title="Subtraction",
    cmap="RdBu_r",
    vmax=4,
)
plot cbma subtraction conjunction

Out:

<nilearn.plotting.displays.ZSlicer object at 0x7f188ae358d0>

Conjunction analysis

To determine the overlap of the meta-analytic results, a conjunction image can be computed by (a) identifying voxels that were statistically significant in both individual group maps and (b) selecting, for each of these voxels, the smaller of the two group-specific z values. 4 Since this is simple arithmetic on images, conjunction is not implemented as a seperate method in NiMARE but can easily be achieved with the math_img() function from nilearn.image.

formula = "np.where(img * img2 > 0, np.minimum(img, img2), 0)"
img_conj = math_img(formula, img=img, img2=img2)

plot_stat_map(
    img_conj,
    cut_coords=4,
    display_mode="z",
    title="Conjunction",
    threshold=2.326,  # cluster-level p < .01, one-tailed
    cmap="RdBu_r",
    vmax=4,
)
plot cbma subtraction conjunction

Out:

<nilearn.plotting.displays.ZSlicer object at 0x7f188ac96550>

References

1

Laird, Angela R., et al. “ALE meta‐analysis: Controlling the false discovery rate and performing statistical contrasts.” Human brain mapping 25.1 (2005): 155-164. https://doi.org/10.1002/hbm.20136

2

Eickhoff, Simon B., et al. “Activation likelihood estimation meta-analysis revisited.” Neuroimage 59.3 (2012): 2349-2361. https://doi.org/10.1016/j.neuroimage.2011.09.017

3

Enge, Alexander, et al. “A meta-analysis of fMRI studies of semantic cognition in children.” Neuroimage 241 (2021): 118436. https://doi.org/10.1016/j.neuroimage.2021.118436

4

Nichols, Thomas, et al. “Valid conjunction inference with the minimum statistic.” Neuroimage 25.3 (2005): 653-660. https://doi.org/10.1016/j.neuroimage.2004.12.005

Total running time of the script: ( 1 minutes 22.727 seconds)

Gallery generated by Sphinx-Gallery