neurostuff / NiMARE

Coordinate- and image-based meta-analysis in Python
https://nimare.readthedocs.io
MIT License
178 stars 57 forks source link

IBMA - Multiple sample sizes in Neurovault collection #583

Open gnbattist opened 2 years ago

gnbattist commented 2 years ago

Summary

Hi everyone,

I'm trying to run an IBMA meta-analysis and, when I run my script, it's indicated that multiple sample sizes were detected in the Neurovault collection https://neurovault.org/collections/6150/ So, in my output folder "/Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta/dyad synchrony", I have two /study-XXX file:

Anyone know where does it come from?

My script:

from nimare.io import convert_neurovault_to_dataset

# The specific collections I would like to download group level
# statistical maps from

##Collection_ids with direct images in the collection 
#collection_ids = (48858, 48859, 48860, 48861, 48862, 48863, 48864, 48865, 48866, 48867, 48868, 48869, 453291, 64897, 64898, 64899, 64900, 65068, 65066, 65067, 306480, 306481, 306482, 306483, 306484, 306485, 306486, 306487, 306488)
## collection_ids with only collection link 
collection_ids = (2525, 3935, 3952, 6150)

# A mapping between what I want the contrast(s) to be
# named in the dataset and what their respective group
# statistical maps are named on neurovault
contrasts = {
    "dyad synchrony": (
        "Auditory|"
        "Cerebellum|"
        "DMN1|"
        "DMN2|"
        "FPNL|"
        "FPNR|"
        "Limbic|"
        "Salience|"
        "Somatosensory|"
        "VentralStream|"
        "Visual1|"
        "Visual2|"
        "Visual3|"
        "General ISC|"
        "HC vs LC ISC|"
        "General ISPS|"
        "HC vs LC ISPS|"
        "children's brain self-family contrast negatively correlated with the relationship quality|"
        "children's brain self-family contrast negatively correlated with the perceptual similarity (ffa rsa value)|"
        "Parents' response to feedback, no errors|"
        "Adolescents' response to feedback, no errors|"
        "Parent vs adolescent response to feedback, no errors|"
        "Parents' response to adolescent error feedback|"
        "Adolescents' response to parent error feedback|"
        "Parent vs adolescent response to dyadic error feedback|"
        "Parents' response to adolescent error feedback vs Parents' response to feedback, no errors|"
        "Adolescents' response to parent error feedback vs Adolescents' response to feedback, no errors|"
        "Parent vs adolescent response to dyadic error feedback vs feedback, no errors"
    )
}

# Convert how the statistical maps on neurovault are represented
# in a NiMARE dataset.
map_type_conversion = {"Z map": "z", "T map": "t"}

dset = convert_neurovault_to_dataset(
    collection_ids,
    contrasts,
    img_dir="/Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta",
    map_type_conversion=None,
)

from nimare.transforms import ImageTransformer

# Not all studies have Z maps!
#print(dset.images["z"])

z_transformer = ImageTransformer(target="z")
dset = z_transformer.transform(dset)

# All studies now have Z maps!
#print(dset.images["z"])

from nilearn.plotting import plot_stat_map

from nimare.meta.ibma import Fishers

meta = Fishers()

meta_res = meta.fit(dset)

plot_stat_map(meta_res.get_map("z"), threshold=0.0001)
# The result may look questionable, but this code provides
# a template on how to use neurovault in your meta analysis.

Terminal output:

INFO:nimare.extract.utils:Dataset found in /Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta/dyad synchrony

WARNING:nimare.io:Multiple sample sizes were found for neurovault collection: 6150for contrast: dyad synchrony, sample sizes: {25, 27, 52}, selecting modal sample size: 25
INFO:nimare.utils:Shared path detected: '/Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta/dyad synchrony/'
INFO:nimare.utils:Shared path detected: '/Users/ginodiez/Desktop/Cogmaster/M1/LNC2/meta/dyad synchrony/'
WARNING:nimare.base:Masking out 30559 additional voxels. The updated masker is available in the Estimator.masker attribute.
/Users/ginodiez/opt/anaconda3/lib/python3.8/site-packages/nilearn/_utils/niimg.py:61: UserWarning: Non-finite values detected. These values will be replaced with zeros.
  warn(

Best, Gino

tsalo commented 2 years ago

I don't do much with the Neurovault tools in NiMARE, but it looks like collection 6150 has 9 group-level T maps, drawn from different contrasts of three groups: parents (n=25), adolescents (n=27), and parents vs. adolescents (n=52). Your criteria seem to identify all 9 images in the collection as falling under the "dyad synchrony" contrast, so NiMARE is trying to figure out how 9 different T-maps are all the same contrast for the same study (i.e., one map). I think it's just grabbing one of the maps with the most common (modal) sample size (25).

@jdkent does this sound right?

jdkent commented 2 years ago

yes, that is correct, I have not considered that multiple analyses in a collection would fall under the same contrast, this use case should be supported since the original experimenter's idea of a contrast may be different from a person reanalyzing the data.