Code that attempts to reproduce "A Reproducible MEG/EEG Group Study With the MNE Software" by Jas et al., 2018 (link)
- Download the files in this project.
- Select a folder where you will store the data and set an environment variable
reproduction_data
to its path. - Create a folder
bids/derivatives/freesurfer_lk/
and download the contents of thefreesurfer_lk
component into it. - In a terminal, navigate to the repository root.
- Create and activate the conda environment:
conda env create -n reproduction -f environment.yml conda activate reproduction
- Run the full analysis with
Where
snakemake all --cores <n_cores> --keep-going
n_cores
is the number of processing cores you have available for the analysis.
In case of errors when running Snakemake, look through the output in the terminal to see which rule caused the error.
Sometimes downloading data from openeuro does not work on the first attempt and then we have to try again. There are two workaround:
- Download the data from the openneuro dataset manually and put it in the
bids
folder you created earlier. You will need the following files/folders:- All
sub-*
folder in the root. - The
derivatives/meg_derivatives/
folder.
- All
- Run Snakemake telling it to try again if a job fails. There is currently no way to do this at the rule level, so we will run only the
download_from_openneuro
rule:Once done, run the full workflow again (the downloaded files will not be downloaded again).snakemake --until download_from_openneuro --cores <n_cores> --restart-times 5
These rules run linear filtering at some point which may create issues when another job is running at the same time.
In Snakefile, we told Snakemake that if the filtering_process
resource is set during Snakemake invocation, then those
two rules will require as much of this resource as there are cores available and thus these rules can't be run in
parallel with each other job (see resources
nodes of these rules).
This setting does not change anything unless we run Snakemake with the --resources
flag and set filtering_process
resource capacity to the total number of cores.
To avoid these rules running in parallel with other rules we also set the default amount of this resource to 1
for all
the rules that do not have this resource specified with the default-resources
flag.
snakemake --cores <n_cores> --resources filtering_process=<n_cores> --default-resources filtering_process=1 --keep-going