-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from GhazalehManj/main
SCanD-updates
- Loading branch information
Showing
43 changed files
with
1,960 additions
and
305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# unnecessary directories | ||
logs/* | ||
data/* | ||
work/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Automated Pipeline Coordination and Code Integration for Efficient Workflow Execution | ||
|
||
In this project, we have devised a streamlined solution for managing multiple pipelines with a focus on seamless coordination and code integration. Our approach involves the creation of an automated system that orchestrates the execution of diverse pipelines each stage. By combining and organizing the necessary codes for each stage's tasks, we aim to optimize workflow efficiency. | ||
|
||
After setting up the scinet environment and organizing your bids folder and participants.csv file, you can run the codes for each stage. | ||
|
||
## stage 1 (mriqc, fmriprep_anat, qsiprep): | ||
```sh | ||
# note step one is to make sure you are on one of the login nodes | ||
ssh nia-login07 | ||
|
||
## go to the repo and pull new changes | ||
cd ${SCRATCH}/SCanD_project_GMANJ | ||
git pull #in case you need to pull new code | ||
|
||
source ./stage_1.sh | ||
``` | ||
|
||
|
||
## stage 2 (fmriprep_func, qsirecon1): | ||
|
||
```sh | ||
# note step one is to make sure you are on one of the login nodes | ||
ssh nia-login07 | ||
|
||
## go to the repo and pull new changes | ||
cd ${SCRATCH}/SCanD_project_GMANJ | ||
git pull #in case you need to pull new code | ||
|
||
source ./stage_2.sh | ||
``` | ||
|
||
## stage 3 (ciftify_anat, xcp_scinet, enigma extract, enigma_dti, tractography, qsirecon2): | ||
|
||
```sh | ||
# note step one is to make sure you are on one of the login nodes | ||
ssh nia-login07 | ||
|
||
## go to the repo and pull new changes | ||
cd ${SCRATCH}/SCanD_project_GMANJ | ||
git pull #in case you need to pull new code | ||
|
||
source ./stage_3.sh | ||
``` | ||
|
||
## stage 4 (parcellation): | ||
|
||
```sh | ||
# note step one is to make sure you are on one of the login nodes | ||
ssh nia-login07 | ||
|
||
## go to the repo and pull new changes | ||
cd ${SCRATCH}/SCanD_project_GMANJ | ||
git pull #in case you need to pull new code | ||
|
||
source ./stage_4.sh | ||
``` | ||
## stage 5 (extract data to share folder): | ||
|
||
```sh | ||
# note step one is to make sure you are on one of the login nodes | ||
ssh nia-login07 | ||
|
||
## go to the repo and pull new changes | ||
cd ${SCRATCH}/SCanD_project_GMANJ | ||
git pull #in case you need to pull new code | ||
|
||
source ./stage_5.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/bin/bash | ||
#SBATCH --job-name=qsirecon1 | ||
#SBATCH --output=logs/%x_%j.out | ||
#SBATCH --nodes=1 | ||
#SBATCH --cpus-per-task=40 | ||
#SBATCH --time=0:20:00 | ||
|
||
|
||
SUB_SIZE=1 ## number of subjects to run is 1 because there are multiple tasks/run that will run in parallel | ||
CORES=40 | ||
export THREADS_PER_COMMAND=2 | ||
|
||
####----### the next bit only works IF this script is submitted from the $BASEDIR/$OPENNEURO_DS folder... | ||
|
||
## set the second environment variable to get the base directory | ||
BASEDIR=${SLURM_SUBMIT_DIR} | ||
|
||
## set up a trap that will clear the ramdisk if it is not cleared | ||
function cleanup_ramdisk { | ||
echo -n "Cleaning up ramdisk directory /$SLURM_TMPDIR/ on " | ||
date | ||
rm -rf /$SLURM_TMPDIR | ||
echo -n "done at " | ||
date | ||
} | ||
|
||
#trap the termination signal, and call the function 'trap_term' when | ||
# that happens, so results may be saved. | ||
trap "cleanup_ramdisk" TERM | ||
|
||
# input is BIDS_DIR this is where the data downloaded from openneuro went | ||
export BIDS_DIR=${BASEDIR}/data/local/bids | ||
|
||
## these folders envs need to be set up for this script to run properly | ||
## see notebooks/00_setting_up_envs.md for the set up instructions | ||
export QSIPREP_HOME=${BASEDIR}/templates | ||
export SING_CONTAINER=${BASEDIR}/containers/qsiprep_0.16.0RC3.simg | ||
|
||
## setting up the output folders | ||
export OUTPUT_DIR=${BASEDIR}/data/local # use if version of fmriprep >=20.2 | ||
export QSIPREP_DIR=${BASEDIR}/data/local/qsiprep # use if version of fmriprep <=20.1 | ||
|
||
# export LOCAL_FREESURFER_DIR=${SCRATCH}/${STUDY}/data/derived/freesurfer-6.0.1 | ||
export WORK_DIR=${BBUFFER}/SCanD/qsiprep | ||
export LOGS_DIR=${BASEDIR}/logs | ||
mkdir -vp ${OUTPUT_DIR} ${WORK_DIR} # ${LOCAL_FREESURFER_DIR} | ||
|
||
bigger_bit=`echo "($SLURM_ARRAY_TASK_ID + 1) * ${SUB_SIZE}" | bc` | ||
|
||
N_SUBJECTS=$(( $( wc -l ${BIDS_DIR}/participants.tsv | cut -f1 -d' ' ) - 1 )) | ||
array_job_length=$(echo "$N_SUBJECTS/${SUB_SIZE}" | bc) | ||
Tail=$((N_SUBJECTS-(array_job_length*SUB_SIZE))) | ||
|
||
if [ "$SLURM_ARRAY_TASK_ID" -eq "$array_job_length" ]; then | ||
SUBJECTS=`sed -n -E "s/sub-(\S*)\>.*/\1/gp" ${BIDS_DIR}/participants.tsv | head -n ${N_SUBJECTS} | tail -n ${Tail}` | ||
else | ||
SUBJECTS=`sed -n -E "s/sub-(\S*)\>.*/\1/gp" ${BIDS_DIR}/participants.tsv | head -n ${bigger_bit} | tail -n ${SUB_SIZE}` | ||
fi | ||
|
||
## set singularity environment variables that will point to the freesurfer license and the templateflow bits | ||
# Make sure FS_LICENSE is defined in the container. | ||
|
||
export fs_license=${BASEDIR}/templates/.freesurfer.txt | ||
|
||
for subject in $SUBJECTS; do | ||
|
||
echo "sub-$subject ${SLURM_ARRAY_TASK_ID} 0" \ | ||
>> ${LOGS_DIR}/${SLURM_JOB_NAME}.${SLURM_ARRAY_JOB_ID}.tsv | ||
done | ||
|
||
singularity run --cleanenv \ | ||
-B ${BASEDIR}/templates:/home/qsiprep --home /home/qsiprep \ | ||
-B ${BIDS_DIR}:/bids \ | ||
-B ${QSIPREP_DIR}:/derived \ | ||
-B ${WORK_DIR}:/work \ | ||
-B ${OUTPUT_DIR}:/out \ | ||
-B ${fs_license}:/li \ | ||
${SING_CONTAINER} \ | ||
/bids /out participant \ | ||
--skip-bids-validation \ | ||
--participant_label ${SUBJECTS} \ | ||
-w /work \ | ||
--skip-bids-validation \ | ||
--omp-nthreads 8 \ | ||
--nthreads 40 \ | ||
--recon_only \ | ||
--recon-spec reorient_fslstd \ | ||
--recon-input /derived \ | ||
--output-resolution 2.0 \ | ||
--fs-license-file /li \ | ||
--notrack | ||
|
||
|
Oops, something went wrong.