From 608991fe9e0ba7410c539249fe2a347e3b152e6d Mon Sep 17 00:00:00 2001 From: Arnaud Bore Date: Thu, 15 Apr 2021 21:35:39 -0400 Subject: [PATCH 1/4] add cbrain profile + update profiles usage --- USAGE | 16 +++++++++++++--- nextflow.config | 6 ++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/USAGE b/USAGE index 7d44c52..5660ecb 100755 --- a/USAGE +++ b/USAGE @@ -20,9 +20,8 @@ DESCRIPTION --atlas_anat Path to reference anatomy of the atlas --atlas_directory Path of the folder containing all atlases - NOTES - OPTIONAL ARGUMENTS (current value) + --atlas_centroids Folder containing centroids (trk) for future tractometry (Must have the same filename as in the atlas_config) --multi_parameters Number of executions for the multi-parameters ($multi_parameters) @@ -36,7 +35,18 @@ DESCRIPTION --processes The number of parallel processes to launch ($cpu_count). Only affects the local scheduler. +AVAILABLE PROFILES (using -profile option (e.g. -profile large_dataset,cbrain)) + +large_dataset When this profile is used, rbx_flow will be asking for 16 GB instead of 8 GB. + +fully_reproducible When this profile is used, all the parameters will be set to have 100% reproducible results. + +macos When this profile is used, rbx_flow will modify a parameter (scratch) for MacOS users. + +cbrain When this profile is used, Nextflow will copy all the output files in publishDir and not use symlinks. + +NOTES + Use '-C config_file.config' to specify a non-default configuration file. The '-C config_file.config' must be inserted after the nextflow call like 'nextflow -C config_file.config run ...'. - diff --git a/nextflow.config b/nextflow.config index c8e0992..6bb993b 100644 --- a/nextflow.config +++ b/nextflow.config @@ -56,4 +56,10 @@ profiles { macos { process.scratch="/tmp" } + + cbrain { + process{ + publishDir = [path: {"./results_rbx/$sid/$task.process"}, mode: 'copy'] + } + } } From 7ddc7874902ae7983824c84c0194f6e5185107e3 Mon Sep 17 00:00:00 2001 From: Arnaud Bore Date: Thu, 15 Apr 2021 22:00:16 -0400 Subject: [PATCH 2/4] Add output dir option --- USAGE | 4 ++++ nextflow.config | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/USAGE b/USAGE index 5660ecb..6ffdc4e 100755 --- a/USAGE +++ b/USAGE @@ -35,6 +35,10 @@ DESCRIPTION --processes The number of parallel processes to launch ($cpu_count). Only affects the local scheduler. + --output_dir Directory where to write the final results. + By default, will be in "./results_rbx" + + AVAILABLE PROFILES (using -profile option (e.g. -profile large_dataset,cbrain)) large_dataset When this profile is used, rbx_flow will be asking for 16 GB instead of 8 GB. diff --git a/nextflow.config b/nextflow.config index 6bb993b..9c57744 100644 --- a/nextflow.config +++ b/nextflow.config @@ -26,6 +26,10 @@ params { register_processes=4 rbx_processes=4 params.rbx_memory_limit='8 GB' + + + //**Output directory**// + output_dir=false } if(params.processes) { @@ -59,7 +63,12 @@ profiles { cbrain { process{ + if(params.output_dir) { + publishDir = [path: {"$params.output_dir/$sid/$task.process"}, mode: 'copy'] + } + else{ publishDir = [path: {"./results_rbx/$sid/$task.process"}, mode: 'copy'] + } } } } From e92b69d506c0cbd84b22f8923797b23665bd6453 Mon Sep 17 00:00:00 2001 From: Arnaud Bore Date: Fri, 16 Apr 2021 07:37:53 -0400 Subject: [PATCH 3/4] fix issues --- main.nf | 15 ++++++++------- nextflow.config | 2 ++ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/main.nf b/main.nf index 75c48b5..1f17857 100644 --- a/main.nf +++ b/main.nf @@ -13,7 +13,8 @@ if(params.help) { "seeds":"$params.seeds", "outlier_alpha":"$params.outlier_alpha", "register_processes":"$params.register_processes", - "rbx_processes":"$params.rbx_processes"] + "rbx_processes":"$params.rbx_processes", + "cpu_count":"$cpu_count"] engine = new groovy.text.SimpleTemplateEngine() template = engine.createTemplate(usage.text).make(bindings) @@ -108,7 +109,7 @@ process Register_Anat { script: """ antsRegistrationSyNQuick.sh -d 3 -f ${native_anat} -m ${atlas} -n ${params.register_processes} -o ${sid}__output -t a - """ + """ } @@ -124,7 +125,7 @@ process Transform_Centroids { script: """ scil_apply_transform_to_tractogram.py ${centroid} ${anat} ${transfo} ${sid}__${centroid.baseName}.trk --inverse --cut_invalid - """ + """ } @@ -153,7 +154,7 @@ process Recognize_Bundles { --tractogram_clustering_thr $params.wb_clustering_thr --seeds $params.seeds --processes $params.rbx_processes rm tractogram_ic.trk mv tmp/* ./ - """ + """ } bundles_for_cleaning @@ -168,7 +169,7 @@ process Clean_Bundles { bname = bundle.name.take(bundle.name.lastIndexOf('.')) """ scil_outlier_rejection.py ${bundle} "${sid}__${bname}_cleaned.trk" --alpha $params.outlier_alpha - """ + """ } bundle_for_density @@ -185,7 +186,7 @@ process Compute_Density_Bundles { scil_apply_transform_to_tractogram.py $bundle $atlas $transfo tmp.trk --remove_invalid scil_compute_streamlines_density_map.py tmp.trk "${sid}__${bname}_density.nii.gz" scil_image_math.py lower_threshold "${sid}__${bname}_density.nii.gz" 1 "${sid}__${bname}_binary.nii.gz" - """ + """ } @@ -204,5 +205,5 @@ process Average_Bundles { """ scil_image_math.py addition *_density.nii.gz 0 ${bname}_density.nii.gz scil_image_math.py addition *_binary.nii.gz 0 ${bname}_binary.nii.gz - """ + """ } diff --git a/nextflow.config b/nextflow.config index 9c57744..f59fecf 100644 --- a/nextflow.config +++ b/nextflow.config @@ -27,6 +27,8 @@ params { rbx_processes=4 params.rbx_memory_limit='8 GB' + //**Process control**// + processes = false //**Output directory**// output_dir=false From 82ce5decc6d5b1f11509792310b02beb836e5f2e Mon Sep 17 00:00:00 2001 From: Arnaud Bore Date: Fri, 16 Apr 2021 10:15:28 -0400 Subject: [PATCH 4/4] add ants var --- main.nf | 1 + 1 file changed, 1 insertion(+) diff --git a/main.nf b/main.nf index 1f17857..4797268 100644 --- a/main.nf +++ b/main.nf @@ -108,6 +108,7 @@ process Register_Anat { file "${sid}__outputWarped.nii.gz" script: """ + export ANTS_RANDOM_SEED=1234 antsRegistrationSyNQuick.sh -d 3 -f ${native_anat} -m ${atlas} -n ${params.register_processes} -o ${sid}__output -t a """ }