Skip to content

Commit

Permalink
Merge pull request #8 from arnaudbore/add_cbrain_profile
Browse files Browse the repository at this point in the history
add cbrain profile
  • Loading branch information
GuillaumeTh authored May 3, 2021
2 parents 36b293b + 82ce5de commit bd81d31
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 10 deletions.
20 changes: 17 additions & 3 deletions USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -36,7 +35,22 @@ 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.

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 ...'.

16 changes: 9 additions & 7 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -107,8 +108,9 @@ 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
"""
"""
}


Expand All @@ -124,7 +126,7 @@ process Transform_Centroids {
script:
"""
scil_apply_transform_to_tractogram.py ${centroid} ${anat} ${transfo} ${sid}__${centroid.baseName}.trk --inverse --cut_invalid
"""
"""
}


Expand Down Expand Up @@ -153,7 +155,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
Expand All @@ -168,7 +170,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
Expand All @@ -185,7 +187,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"
"""
"""
}


Expand All @@ -204,5 +206,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
"""
"""
}
17 changes: 17 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ params {
register_processes=4
rbx_processes=4
params.rbx_memory_limit='8 GB'

//**Process control**//
processes = false

//**Output directory**//
output_dir=false
}

if(params.processes) {
Expand Down Expand Up @@ -56,4 +62,15 @@ profiles {
macos {
process.scratch="/tmp"
}

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']
}
}
}
}

0 comments on commit bd81d31

Please sign in to comment.