Download and convert the Neurosynth database

Download and convert the Neurosynth database (with abstracts) for analysis with NiMARE.


This will likely change as we work to shift database querying to a remote database, rather than handling it locally with NiMARE.

Start with the necessary imports

import os

from neurosynth.base.dataset import download

import nimare

Download Neurosynth

out_dir = os.path.abspath('../example_data/')
if not os.path.isdir(out_dir):

if not os.path.isfile(os.path.join(out_dir, 'database.txt')):
    download(out_dir, unpack=True)

Convert Neurosynth database to NiMARE dataset file

dset =
    os.path.join(out_dir, 'database.txt'),
    os.path.join(out_dir, 'features.txt')), 'neurosynth_dataset.pkl.gz'))

Add article abstracts to dataset

dset = nimare.extract.download_abstracts(dset, ''), 'neurosynth_nimare_with_abstracts.pkl.gz'))

Total running time of the script: ( 0 minutes 0.000 seconds)

Gallery generated by Sphinx-Gallery