From 6704412d1a035151a43104dfa987dc5b09ae05b5 Mon Sep 17 00:00:00 2001 From: Thoumyre Stanislas Date: Thu, 31 Oct 2024 15:49:09 +0000 Subject: [PATCH] add test eddy full --- .../nf-neuro/preproc/eddy/tests/main.nf.test | 44 +++++++++++++++++-- .../preproc/eddy/tests/main.nf.test.snap | 32 ++++++++++++++ 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/modules/nf-neuro/preproc/eddy/tests/main.nf.test b/modules/nf-neuro/preproc/eddy/tests/main.nf.test index 61ce4ad..a4812a7 100644 --- a/modules/nf-neuro/preproc/eddy/tests/main.nf.test +++ b/modules/nf-neuro/preproc/eddy/tests/main.nf.test @@ -19,14 +19,14 @@ nextflow_process { script "../../../../../subworkflows/nf-neuro/load_test_data/main.nf" process { """ - input[0] = Channel.from( [ "raw_DWIss1000-dir32.zip", "TOPUP.zip" ] ) + input[0] = Channel.from( [ "raw_DWIss1000-dir32.zip", "TOPUP.zip", "topup_eddy_light.zip" ] ) input[1] = "test.load-test-data" """ } } } - test("eddy") { + test("eddy_light") { when { process { """ @@ -34,6 +34,7 @@ nextflow_process { .branch{ raw_dwi: it.simpleName == "raw_DWIss1000-dir32" topup_results: it.SimpleName == "TOPUP" + rev_dwi: it.simpleName == "topup_eddy_light.zip" } ch_raw_dwi = ch_split_test_data.raw_dwi .map{ test_data_directory -> [ @@ -50,12 +51,49 @@ nextflow_process { file("\${test_data_directory}/topup_corrected_b0s.nii.gz", checkIfExists: true), file("\${test_data_directory}/topup_fieldcoef.nii.gz", checkIfExists: true), file("\${test_data_directory}/topup_movpar.txt", checkIfExists: true)]} - input[0] = ch_raw_dwi.join(ch_topup) """ } } + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.dwi_corrected.get(0).get(1)).name, + process.out.bval_corrected, + file(process.out.bvec_corrected.get(0).get(1)).name, + process.out.b0_mask, + process.out.versions + ).match() } + ) + } + } + test("eddy_full") { + when { + process { + """ + ch_split_test_data = LOAD_DATA.out.test_data_directory + .branch{ + raw_dwi: it.simpleName == "raw_DWIss1000-dir32" + topup_results: it.SimpleName == "TOPUP" + rev_dwi: it.simpleName == "topup_eddy_light.zip" + } + input[0] = ch_split_test_data.rev_dwi + .map{ test_data_directory -> [ + [ id:'test', single_end:false ], // meta map + file("\${test_data_directory}/sub-01_dir-AP_dwi.nii.gz", checkIfExists: true), + file("\${test_data_directory}/sub-01_dir-AP_dwi.bval", checkIfExists: true), + file("\${test_data_directory}/sub-01_dir-AP_dwi.bvec", checkIfExists: true), + file("\${test_data_directory}/sub-01_dir-PA_dwi.nii.gz", checkIfExists: true), + file("\${test_data_directory}/sub-01_dir-PA_dwi.bval", checkIfExists: true), + file("\${test_data_directory}/sub-01_dir-PA_dwi.bvec", checkIfExists: true), + file("\${test_data_directory}/sub-01__corrected_b0s.nii.gz", checkIfExists: true), + file("\${test_data_directory}/topup_results_fieldcoef.nii.gz", checkIfExists: true), + file("\${test_data_directory}/topup_results_movpar.txt", checkIfExists: true)]} + """ + } + } then { assertAll( { assert process.success }, diff --git a/modules/nf-neuro/preproc/eddy/tests/main.nf.test.snap b/modules/nf-neuro/preproc/eddy/tests/main.nf.test.snap index 61a68cb..e267aec 100644 --- a/modules/nf-neuro/preproc/eddy/tests/main.nf.test.snap +++ b/modules/nf-neuro/preproc/eddy/tests/main.nf.test.snap @@ -1,4 +1,36 @@ { + "eddy_light": { + "content": [ + "test__dwi_corrected.nii.gz", + [ + [ + { + "id": "test", + "single_end": false + }, + "test__bval_eddy:md5,7995daabbd74fcf7c365a39a779f67e9" + ] + ], + "test__dwi_eddy_corrected.bvec", + [ + [ + { + "id": "test", + "single_end": false + }, + "test__b0_bet_mask.nii.gz:md5,2dd16e0c664c910f1970b96056866fea" + ] + ], + [ + "versions.yml:md5,137e3ce0fd25e5b16de2d8cc5a5aefca" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-31T13:17:58.524376706" + }, "eddy": { "content": [ "test__dwi_corrected.nii.gz",