-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.template.sh
153 lines (153 loc) · 7.17 KB
/
settings.template.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#!/bin/bash
# ============================================================================
# FMRI Preprocessing Configuration Settings
# ============================================================================
#
# This file contains all configurable parameters for the fMRI preprocessing
# pipeline, including paths, scan parameters, and data validation settings.
#
# USAGE:
# 1. Copy this template to 'settings.sh'
# 2. Modify the variables below according to your study's requirements
# 3. Source this file in your preprocessing scripts: source ./settings.sh
# (Note: the default behavior in all scripts here is already configured to source
# ./settings.sh for you, so no need to make any edits to source file headers.)
#
# IMPORTANT NOTES (PLEASE READ):
# - All paths should be absolute paths
# - Do not use spaces in path names
# - Validate all parameters before running the pipeline
# - Keep this file in version control but exclude any files with sensitive info
#
# FIELDMAP <-> TASK BOLD MAPPING ARRAY INSTRUCTIONS:
# The fmap_mapping array defines which fieldmap corresponds to which BOLD runs.
# In the example below, fieldmap 01 covers BOLD runs 01 and 02, fieldmap 02 covers
# runs 03 and 04, etc. Modify according to your acquisition sequence.
#
# ============================================================================
#
# ============================================================================
# (1) SETUP DIRECTORIES
# ============================================================================
BASE_DIR="/my/project/dir" # ROOT DIR FOR THE STUDY
SCRIPTS_DIR="${BASE_DIR}/scripts" # PATH OF CLONED FMRI REPO
RAW_DIR="${BASE_DIR}/bids" # RAW BIDS-COMPLIANT DATA LOCATION
TRIM_DIR="${BASE_DIR}/bids_trimmed" # DESIRED DESTINATION FOR PROCESSED DATA
WORKFLOW_LOG_DIR="${BASE_DIR}/logs/workflows"
TEMPLATEFLOW_HOST_HOME="${HOME}/.cache/templateflow"
FMRIPREP_HOST_CACHE="${HOME}/.cache/fmriprep"
FREESURFER_LICENSE="${HOME}/freesurfer.txt"
#
# ============================================================================
# (2) USER EMAIL (for slurm report updates)
# ============================================================================
USER_EMAIL="[email protected]"
USER="johndoe"
FW_GROUP_ID="pi"
FW_PROJECT_ID="amass"
#
# ============================================================================
# (3) TASK/SCAN PARAMETERS
# ============================================================================
FW_CLI_API_KEY_FILE="path/to/flywheel_api_key.txt"
FW_URL="cni.flywheel.io"
CONFIG_FILE="scan-config.json"
EXPERIMENT_TYPE="advanced" # CHOOSE BETWEEN 'basic' AND 'advanced' within `scan-config.json`
task_id="SomeTaskName" # ORIGINAL TASK NAME IN BIDS FORMAT
new_task_id="cleanname" # NEW TASK NAME (IF RENAMING IS NEEDED), OTHERWISE SET SAME VALUE AS $task_id
n_dummy=5 # NUMBER OF "DUMMY" TRs to remove
run_numbers=("01" "02" "03" "04" "05" "06" "07" "08") # ALL TASK BOLD RUN NUMBERS
#
# ============================================================================
# (4) DATA VALIDATION VALUES FOR UNIT TESTS
# ============================================================================
EXPECTED_FMAP_VOLS=12 # EXPECTED NUMBER OF VOLUMES IN ORIGINAL FIELDMAP SCANS
EXPECTED_BOLD_VOLS=220 # EXPECTED NUMBER OF VOLUMES IN BOLD SCANS
#
# ============================================================================
# (5) FIELDMAP <-> TASK BOLD MAPPING
# ============================================================================
# example: here, each fmap covers two runs,
# so define the mapping as such:
declare -A fmap_mapping=(
["01"]="01" # TASK BOLD RUN 01 USES FMAP 01
["02"]="01" # TASK BOLD RUN 02 USES FMAP 01
["03"]="02" # TASK BOLD RUN 03 USES FMAP 02
["04"]="02" # TASK BOLD RUN 04 USES FMAP 02
["05"]="03" # ...
["06"]="03"
["07"]="04"
["08"]="04"
)
#
# ============================================================================
# (6) SUBJECT IDS <-> PER PREPROC STEP MAPPING
# ============================================================================
# by default, subjects will be pulled from the master `all-subjects.txt` file
# however, if you want to specify different subject lists per pipeline step,
# you may do so here by following this general template:
#
# declare -A subjects_mapping=(
# ["01-prepare"]="01-subjects.txt" # PREPROC STEP 01 USES "01-subjects.txt"
# ["02-fmriprep"]="02-subjects.txt"
# )
#
# note: keep in mind that we've built in checks at the beginning of each pipeline
# step that skip a subject if there's already a record of them being preprocessed;
# thus, you shouldn't necessarily need separate 0x-subjects.txt files per step
# unless this extra layer of control is useful for your needs.
#
# ============================================================================
# (7) DEFAULT PERMISSIONS
# ============================================================================
DIR_PERMISSIONS=775 # DIRECTORY LEVEL
FILE_PERMISSIONS=775 # FILE LEVEL
#
# ============================================================================
# (8) SLURM JOB HEADER CONFIGURATOR (FOR GENERAL TASKS)
# ============================================================================
num_subjects=$(wc -l < "all-subjects.txt") # count number of subjects
echo "($(date)) [INFO] Found ${num_subjects} total subjects in dataset"
array_range="0-$((num_subjects-1))" # compute array size (0 to num_subjects-1 since array indices start at 0)
export SLURM_EMAIL="${USER_EMAIL}"
export SLURM_TIME="2:00:00"
export SLURM_MEM="8G" # memory alloc per cpu
export SLURM_CPUS="8"
export SLURM_ARRAY_SIZE="${array_range}" # use computed range
export SLURM_ARRAY_THROTTLE="10" # number of subjects to run concurrently
export SLURM_LOG_DIR="${BASE_DIR}/logs/slurm" # use BASE_DIR from main settings file
export SLURM_PARTITION="hns,normal" # compute resource preferences order
#
# ============================================================================
# (9) PIPELINE SETTINGS
# ============================================================================
FMRIPREP_VERSION="24.0.1"
DERIVS_DIR="${TRIM_DIR}/derivatives/fmriprep-${FMRIPREP_VERSION}"
SINGULARITY_IMAGE_DIR="${BASE_DIR}/singularity_images"
SINGULARITY_IMAGE="fmriprep-${FMRIPREP_VERSION}.simg"
#
# ============================================================================
# (10) FMRIPREP SPECIFIC SLURM SETTINGS
# ============================================================================
FMRIPREP_SLURM_JOB_NAME="fmriprep${FMRIPREP_VERSION//.}_${new_task_id}"
FMRIPREP_SLURM_ARRAY_SIZE=1
FMRIPREP_SLURM_TIME="12:00:00"
FMRIPREP_SLURM_CPUS_PER_TASK="16"
FMRIPREP_SLURM_MEM_PER_CPU="4G"
#
# ============================================================================
# (11) FMRIPREP SETTINGS
# ============================================================================
FMRIPREP_OMP_THREADS=8
FMRIPREP_NTHREADS=12
FMRIPREP_MEM_MB=30000
FMRIPREP_FD_SPIKE_THRESHOLD=0.9
FMRIPREP_DVARS_SPIKE_THRESHOLD=3.0
FMRIPREP_OUTPUT_SPACES="MNI152NLin2009cAsym:res-2 anat fsnative fsaverage5"
#
# ============================================================================
# (12) MISC SETTINGS
# ============================================================================
# Debug mode (0=off, 1=on)
DEBUG=0
#