nimare.io.convert_neurosynth_to_dict

convert_neurosynth_to_dict(coordinates_file, metadata_file, annotations_files=None, feature_groups=None)[source]

Convert Neurosynth/NeuroQuery database files to a dictionary.

Changed in version 0.0.10:

  • Use new format for Neurosynth and NeuroQuery files.

Changed in version 0.0.9:

  • Support annotations files organized in a dictionary.

Parameters:
  • coordinates_file (str) – TSV.GZ file with Neurosynth/NeuroQuery’s coordinates.

  • metadata_file (str) – TSV.GZ file with Neurosynth/NeuroQuery’s metadata.

  • annotations_files (dict, list of dict, or None, optional) – Optional file(s) with Neurosynth/NeuroQuery’s annotations. This should consist of a dictionary with two keys: “features” and “vocabulary”. “features” should have an NPZ file containing a sparse matrix of feature values. “vocabulary” should have a TXT file containing labels. The vocabulary corresponds to the columns of the feature matrix, while study IDs are inferred from the metadata file, which MUST be in the same order as the features matrix. Multiple sets of annotations may be provided, in which case “annotations_files” should be a list of dictionaries. The appropriate name of each annotation set will be inferred from the “features” filename, but this can be overwritten by using the “feature_groups” parameter. Default is None.

  • feature_groups (list of str, or None, optional) – An optional list of names of annotation sets defined in “annotations_files”. This should only be used if “annotations_files” is used and the users wants to override the automatically-extracted annotation set names. Default is None.

Returns:

dset_dict – NiMARE-organized dictionary containing experiment information from text files.

Return type:

dict

Warning

Starting in version 0.0.10, this function operates on the new Neurosynth/NeuroQuery file format. Old code using this function will not work with the new version.