diff --git a/modules/nf-neuro/betcrop/fslbetcrop/main.nf b/modules/nf-neuro/betcrop/fslbetcrop/main.nf index 1da42ed9..54fc9ddf 100755 --- a/modules/nf-neuro/betcrop/fslbetcrop/main.nf +++ b/modules/nf-neuro/betcrop/fslbetcrop/main.nf @@ -69,16 +69,9 @@ process BETCROP_FSLBETCROP { """ stub: - def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ - scil_dwi_extract_b0.py -h - bet -h - scil_volume_math.py -h - mrcalc -h - scil_volume_crop.py -h - touch ${prefix}__image_bet.nii.gz touch ${prefix}__image_bet_mask.nii.gz touch ${prefix}__image_boundingBox.pkl @@ -89,5 +82,18 @@ process BETCROP_FSLBETCROP { mrtrix: \$(mrcalc -version 2>&1 | sed -n 's/== mrcalc \\([0-9.]\\+\\).*/\\1/p') fsl: \$(flirt -version 2>&1 | sed -n 's/FLIRT version \\([0-9.]\\+\\)/\\1/p') END_VERSIONS + + function handle_code () { + local code=\$? + ignore=( 1 ) + exit \$([[ " \${ignore[@]} " =~ " \$code " ]] && echo 0 || echo \$code) + } + trap 'handle_code' ERR + + bet + scil_dwi_extract_b0.py -h + scil_volume_math.py -h + mrcalc -h + scil_volume_crop.py -h """ } diff --git a/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test b/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test index d24c8b08..c89409da 100644 --- a/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test +++ b/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test @@ -108,4 +108,32 @@ nextflow_process { } + test("betcrop - fslbetcrop - stub-run") { + + options "-stub-run" + + when { + process { + """ + input[0] = LOAD_DATA.out.test_data_directory.map{ + test_data_directory -> [ + [ id:'test', single_end:false ], // meta map + file("\${test_data_directory}/dwi/dwi.nii.gz"), + file("\${test_data_directory}/dwi/dwi.bval"), + file("\${test_data_directory}/dwi/dwi.bvec") + ] + } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match() } + ) + } + + } + } diff --git a/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test.snap b/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test.snap index 8d1977ef..47640ecb 100644 --- a/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test.snap +++ b/modules/nf-neuro/betcrop/fslbetcrop/tests/main.nf.test.snap @@ -1,4 +1,16 @@ { + "betcrop - fslbetcrop - stub-run": { + "content": [ + [ + "versions.yml:md5,cc45ab23921525536874337c1c88e5cf" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.10.1" + }, + "timestamp": "2024-12-12T10:33:04.50811" + }, "betcrop - fslbetcrop - dwi": { "content": [ {