-
Notifications
You must be signed in to change notification settings - Fork 6
Running fmriprep with singularity
First, get the version you want to use, for example, 1.4.1:
> singularity build fmriprep-1.4.1.simg docker://poldracklab/fmriprep:1.4.1
Next, you need a output and working directory:
> mkdir -p path/to/save/outputs/and/working
fmriprep uses freesurfer interally, which uses a licence file, we need to have a copy of the licence inside the working directory:
> cp /opt/quarantine/freesurfer/6.0/build/freesurfer/license.txt path/to/save/outputs/and/working
The main difficult concept to understand is that containers have a limited view of the filesystem they're attached to, and that its your responsibility to define it, we achieve this, by "binding" a path on the host system to a path inside the container with -B localpath:containerpath
Full run example:
> singularity run --cleanenv -B path/to/save/outputs/and/working:/work -B path/to/my/raw/bids-data:/rawdata fmriprep-1.4.1.simg /rawdata /work participant --fs-license-file /work/license.txt -w /work
fMRIprep mostly decides what to do based on the files present inside the BIDS directory. You should read https://fmriprep.readthedocs.io/en/stable/usage.html to determine if you may want to set addition options, for example --participant_label sub-01
to limit the run to a single subject.
Example of running subjects in parallel:
for subject in path/to/my/raw/bids-data/sub-*; do
echo singularity run --cleanenv -B path/to/my/raw/bids-data:/rawdata fmriprep-1.4.1.simg /rawdata /work participant --fs-license-file /work/license.txt -w /work --participant_label $(basename ${subject})
done | parallel