EDIT: This was resolved by including --cleanenv in my singularity call.
Describe the bug
I was trying to run seedconnectivity via Singularity, which has worked previously. When it checks if the input and output exist and calls FSL, it says, “no such file or directory.” Perhaps relatedly, I now get an info message telling me that SINGULARITY_TMPDIR is set, but APPTAINER_TMPDIR is preferred.
The script I ran:
#!/bin/bash
# Seed example: RAmygdala
fullseed=${1}
extstrip=".nii.gz"
seed=${fullseed//$extstrip/} # if the seed name contains .nii.gz, remove the file extension
maskdir=../../../rois
maskfile=${maskdir}/${seed}.nii.gz
outdir_base=~/analysis/data/resting/seed_connectivity/scan_level_maps
xcp_dir=~/data/derivatives/xcp-rest
xcp_utils=~/software/xcp/xcpEngine/utils
for scandir in ${xcp_dir}/sub-*/ses-*/task-*; do
sub=$(echo ${scandir} | awk -F '/' '{print $(NF-2)}')
ses=$(echo ${scandir} | awk -F '/' '{print $(NF-1)}')
scan=$(basename ${scandir})
echo
echo "${sub} - ${ses} - ${scan}"
echo
if [ ! -f ${outdir_base}/${sub}/${ses}/${scan}/seed/${seed}/_connectivity_${seed}Z_sm0.nii.gz ]; then
if [ -f ${scandir}/regress/${sub}_${ses}_${scan}_img_sm6.nii.gz ]; then
singularity exec ~/software/singularity/xcpEngine-1.1.0.simg ${xcp_utils}/seedconnectivity \
-i ${scandir}/regress/${sub}_${ses}_${scan}_img_sm6.nii.gz \
-s ${maskfile} \
-o ${outdir_base}/${sub}/${ses}/${scan} \
-n ${seed}
fi
else
echo "The ${sub}-${ses}-${scan} scan was already processed by the seedconnectivity XCP utility for the ${seed}"
fi
done
#!/usr/bin/env bash
###################################################################
# b b b b b b b b b b b b b b b b b b b b b #
###################################################################
###################################################################
# An exact copy of the fc-36pdespike.dsn design file from BBL's
# github page, with two exceptions:
# (1) rerun set to 0 for all modules
# (2) norm module has been cut
###################################################################
###################################################################
# ANALYSIS VARIABLES
###################################################################
analysis=fc_$(whoami)
design=/data/scripts/preproc/xcp-rest/designs/fc-36p_despike.dsn
sequence=anatomical
standard=MNI%2x2x2
###################################################################
# PIPELINE
###################################################################
pipeline=prestats,confound2,regress,fcon,reho,alff,roiquant,qcfc
###################################################################
# 1 PRESTATS
###################################################################
prestats_rerun[1]=1
prestats_cleanup[1]=1
prestats_process[1]=FMP
###################################################################
# 2 CONFOUND2
###################################################################
confound2_rps[2]=1
confound2_rms[2]=0
confound2_wm[2]=1
confound2_csf[2]=1
confound2_gsr[2]=1
confound2_acompcor[2]=0
confound2_tcompcor[2]=0
confound2_aroma[2]=0
confound2_past[2]=0
confound2_dx[2]=1
confound2_sq[2]=2
confound2_custom[2]=
confound2_censor[2]=0
confound2_censor_contig[2]=0
confound2_framewise[2]=fds:0.167,dv:2
confound2_rerun[2]=1
confound2_cleanup[2]=1
###################################################################
# 3 REGRESS
###################################################################
regress_tmpf[3]=butterworth
regress_hipass[3]=0.01
regress_lopass[3]=0.08
regress_tmpf_order[3]=1
regress_tmpf_pass[3]=2
regress_tmpf_ripple[3]=0.5
regress_tmpf_ripple2[3]=20
regress_dmdt[3]=2
regress_1ddt[3]=1
regress_smo[3]=6
regress_sptf[3]=susan
regress_usan[3]=default
regress_usan_space[3]=
regress_rerun[3]=1
regress_cleanup[3]=1
regress_process[3]=DMT-DSP-TMP-REG
###################################################################
# 4 FCON
###################################################################
fcon_atlas[4]=all
fcon_metric[4]=corrcoef
fcon_thr[4]=N
fcon_rerun[4]=0
fcon_cleanup[4]=1
###################################################################
# 5 REHO
###################################################################
reho_nhood[5]=vertices
reho_roikw[5]=0 # does nothing at the moment
reho_sptf[5]=susan
reho_smo[5]=6
reho_rerun[5]=0
reho_cleanup[5]=1
###################################################################
# 6 ALFF
###################################################################
alff_hipass[6]=0.01
alff_lopass[6]=0.08
alff_sptf[6]=susan
alff_smo[6]=6
alff_rerun[6]=0
alff_cleanup[6]=1
###################################################################
# 7 ROIQUANT
###################################################################
roiquant_atlas[7]=all
roiquant_globals[7]=1
roiquant_vol[7]=0
roiquant_rerun[7]=0
roiquant_cleanup[7]=1
##################################################################
# 8 QCFC
###################################################################
qcfc_atlas[8]=all
qcfc_sig[8]=fdr
qcfc_rerun[8]=0
qcfc_cleanup[8]=1
Error message
sub-018 - ses-01 - task-rest_dir-PA_run-002
INFO: Environment variable SINGULARITY_TMPDIR is set, but APPTAINER_TMPDIR is preferred
· check if the input and output exist
/xcpEngine/core/functions/exec_fsl: line 4: /cbica/software/external/fsl/centos7/5.0.11/bin/fslnvols: No such file or directory
/cbica/projects/tmsbp/software/xcp/xcpEngine/utils/seedconnectivity: line 145: / 2: syntax error: operand expected (error token is "/ 2")
/xcpEngine/core/functions/exec_fsl: line 4: /cbica/software/external/fsl/centos7/5.0.11/bin/fslroi: No such file or directory
/xcpEngine/core/functions/exec_fsl: line 4: /cbica/software/external/fsl/centos7/5.0.11/bin/fslmaths: No such file or directory
../../../rois/RAmygdala.nii.gz
· Transforming coordinates to image
/xcpEngine/core/functions/is_image: line 2: /cbica/software/external/fsl/centos7/5.0.11/bin/imtest: No such file or directory
/xcpEngine/core/functions/is_image: line 2: ((: == 1 : syntax error: operand expected (error token is "== 1 ")
___________________________________________________________________
Usage: coor2niffti -i <input> -o <output> <options>
coor2nifti receives an octothorpe-delimited seed index
as input and creates a network map image as an output.
Compulsory arguments:
-i : Input cordinates
-o : Output network
The path to the file where the output network will
be written.
Optional arguments:
-r : Override radius. If this argument is passed to the
conversion script, then this radius will take the place
of any voxel radii defined in the seed library.
-t : Template image [default MNI 2mm]
The path to an image file that defines the coordinate
space used in the seed library.
-x : Trace
If this flag is set, then any commands called by the
coor2map routine will be explicitly printed to the
console or log.
-m : mm coordinates
If this flag is toggled, then input coordinates will be
treated as mm coordinates rather than voxel coordinates, and
the image qform and sform will be used to convert them to
voxel coordinates for seed generation.
· ants registration
· smoothing
· Extracting mean timeseries
Error in readNifti(roipath) :
Failed to read image from path /cbica/projects/tmsbp/analysis/data/resting/seed_connectivity/scan_level_maps/sub-018/ses-01/task-rest_dir-PA_run-002/seed/RAmygdala/_connectivity_RAmygdala_seed.nii.gz
Calls: readNifti -> .Call
In addition: Warning message:
In readNifti(roipath) :
nifti_image_read: failed to find header file for '/cbica/projects/tmsbp/analysis/data/resting/seed_connectivity/scan_level_maps/sub-018/ses-01/task-rest_dir-PA_run-002/seed/RAmygdala/_connectivity_RAmygdala_seed.nii.gz'
Execution halted
· compute correlation
· fisher transformation
EDIT: This was resolved by including
--cleanenv
in my singularity call.Describe the bug
I was trying to run seedconnectivity via Singularity, which has worked previously. When it checks if the input and output exist and calls FSL, it says, “no such file or directory.” Perhaps relatedly, I now get an info message telling me that SINGULARITY_TMPDIR is set, but APPTAINER_TMPDIR is preferred.
The script I ran:
Cohort file
Design File
fc-36p_despike.dsn
Error message
Runtime Information
Singularity.
Additional context
N/A