Fmriprep: error: positional arguments not recognized (singularity)

Hey all,
hoping this is me just missing something really easy. I keep trying to submit a slurm script but get the error “fmriprep: error: the following arguments are required: bids_dir, output_dir, analysis_level
What I see is:
bids_dir == /base_dir/experiments/bromocriptine/data/bids/bids
output_dir == /base_dir/experiments/bromocriptine/data/fmriprep
analysis_level == participant

Any help is much appreciated!
All the best,
Grace


#!/bin/bash
#SBATCH --job-name=fMRIbro
#SBATCH -t 96:00:00
#SBATCH --mem-per-cpu 80000
# %A == SLURM_ARRAY_JOB_ID
# %a == SLURM_ARRAY_TASK_ID
#SBATCH -o /projects/niblab/scripts/BRO/job_files/error/ges_asym_%a_fprep_out.txt
#SBATCH -e /projects/niblab/scripts/BRO/job_files/error/ges_asym_%a_fprep_err.txt



if [ ${SLURM_ARRAY_TASK_ID} -lt 10 ]; then
    id="00${SLURM_ARRAY_TASK_ID}"
elif [ ${SLURM_ARRAY_TASK_ID} -lt 100 ]; then
    id="0${SLURM_ARRAY_TASK_ID}"
else
    id="${SLURM_ARRAY_TASK_ID}"
fi


unset PYTHONPATH; singularity run --cleanenv -B /projects/niblab:/base_dir \
-B /projects/niblab/singularity_images/mytemplateflowdir:/opt/templateflow \
/projects/niblab/singularity_images/fmriprep_v2_2019.simg \
/base_dir/experiments/bromocriptine/data/bids/bids \
/base_dir/experiments/bromocriptine/data/fmriprep \
participant  \
    --participant-label sub-018 \
    --skip_bids_validation \
    --fs-license-file /base_dir/freesurfer/license.txt \
    --fs-no-reconall \
    --longitudinal \
    --output-spaces MNI152NLin2009cAsym \
    --omp-nthreads 16 --n_cpus 16 \
    --ignore slicetiming \
    --bold2t1w-dof 12 --fd-spike-threshold 0.9 \
    -w /base_dir/experiments/bromocriptine/data/fmriprep/fp_wf \
    --resource-monitor --stop-on-first-crash

Hello,

A couple things:
1)

Any version of fMRIPrep from 2019 is going to be very outdated, it is recommended that you update to the most recent version.

Lets confirm that these folders are being bound correctly. Can you run

singularity shell -e -B /projects/niblab:/base_dir /projects/niblab/singularity_images/fmriprep_v2_2019.simg

and then cd /base_dir and see if it looks okay there?

Best,
Steven

Hi Steven,
thanks! Yes I realize it is an older version, but I am trying to reproduce an analysis thus using the older version is needed. I am able to cd to the base_dir and it all looks alright.
All the best,
Grace

Just to be clear, are you able to cd to the base dir while in the singulairty shell?

Could you also see if it works on a more recent version of fmriprep? I’m wondering if the command line syntax has gone through considerable changes since 2019.

You can also try putting the positional arguments at the end of the fmriprep call instead of the beginning, though I doubt that would change much.

Hi Steven,
yes I am able to cd to the base_dir. In fact I can run the fmriprep command in the singularity shell.

singularity shell -e -B /projects/niblab:/base_dir /projects/niblab/singularity_images/fmriprep_v2_2019.simg

singularity> fmriprep -v --participant-label sub-018 --skip_bids_validation --fs-license-file /base_dir/freesurfer/license.txt --fs-no-reconall --longitudinal --output-spaces MNI152NLin2009cAsym --omp-nthreads 16 --n_cpus 16 --ignore slicetiming --bold2t1w-dof 12 --fd-spike-threshold 0.9 -w /base_dir/experiments/bromocriptine/data/fmriprep/fp_wf --resource-monitor --stop-on-first-crash /base_dir/experiments/bromocriptine/data/bids/bids /base_dir/data/BRO participant

But when I use the same call in my slurm job script I get the same “fmriprep: error: the following arguments are required: bids_dir, output_dir, analysis_level”

slurm job file

unset PYTHONPATH; singularity run --cleanenv -B /projects/niblab:/base_dir \
-B /projects/niblab/singularity_images/mytemplateflowdir:/opt/templateflow \
/projects/niblab/singularity_images/fmriprep_v2_2019.simg \
fmriprep -v \
--participant-label sub-18 \
--skip_bids_validation \
--fs-license-file /base_dir/freesurfer/license.txt \
--fs-no-reconall \
--longitudinal \
--output-spaces MNI152NLin2009cAsym \
--omp-nthreads 16 \
--n_cpus 16 \
--ignore slicetiming \
--bold2t1w-dof 12 \
--fd-spike-threshold 0.9 \
-w /base_dir/experiments/bromocriptine/data/fmriprep/fp_wf \
--resource-monitor \
--stop-on-first-crash \
/base_dir/experiments/bromocriptine/data/bids/bids \
/base_dir/data/BRO \
participant

Well I might have found the error:
The slurm file needs to say “exec” NOT “run”
The process could still crash for other reasons, but at least it is launching now :smiley:

currently working SLURM file:

unset PYTHONPATH; singularity exec --cleanenv -B /projects/niblab:/base_dir \
-B /projects/niblab/singularity_images/mytemplateflowdir:/opt/templateflow \
/projects/niblab/singularity_images/fmriprep_v2_2019.simg \
fmriprep -v \
--participant-label sub-18 \
--skip_bids_validation \
--fs-license-file /base_dir/freesurfer/license.txt \
--fs-no-reconall \
--longitudinal \
--output-spaces MNI152NLin2009cAsym \
--omp-nthreads 16 \
--n_cpus 16 \
--ignore slicetiming \
--bold2t1w-dof 12 \
--fd-spike-threshold 0.9 \
-w /base_dir/experiments/bromocriptine/data/fmriprep/fp_wf \
--resource-monitor \
--stop-on-first-crash \
/base_dir/experiments/bromocriptine/data/bids/bids \
/base_dir/data/BRO \
participant

oh whoops yes I did not catch that!

You can also keep at as singularity run and remove the fmriprep part, as the default run for the fmriprep container is to run fmriprep, but operationally they are the same!