diff --git a/modules/nf-scil/denoising/mppca/environment.yml b/modules/nf-scil/denoising/mppca/environment.yml new file mode 100644 index 00000000..7226aaee --- /dev/null +++ b/modules/nf-scil/denoising/mppca/environment.yml @@ -0,0 +1,9 @@ +name: denoising_mppca + +channels: + - Docker + - Apptainer + +dependencies: + - FSL + - Mrtrix diff --git a/modules/nf-scil/denoising/mppca/main.nf b/modules/nf-scil/denoising/mppca/main.nf index 15b6b125..b7b22fe8 100755 --- a/modules/nf-scil/denoising/mppca/main.nf +++ b/modules/nf-scil/denoising/mppca/main.nf @@ -4,8 +4,8 @@ process DENOISING_MPPCA { label 'process_single' container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://scil.usherbrooke.ca/containers/scilus_1.6.0.sif': - 'scilus/scilus:1.6.0' }" + 'https://scil.usherbrooke.ca/containers/scilus_2.0.0.sif': + 'scilus/scilus:2.0.0' }" input: tuple val(meta), path(dwi) diff --git a/modules/nf-scil/denoising/mppca/tests/main.nf.test b/modules/nf-scil/denoising/mppca/tests/main.nf.test new file mode 100644 index 00000000..40f3a22c --- /dev/null +++ b/modules/nf-scil/denoising/mppca/tests/main.nf.test @@ -0,0 +1,52 @@ +nextflow_process { + + name "Test Process DENOISING_MPPCA" + script "../main.nf" + process "DENOISING_MPPCA" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "denoising" + tag "denoising/mppca" + + tag "subworkflows" + tag "subworkflows/load_test_data" + + test("denoising - mppca") { + + setup { + run("LOAD_TEST_DATA", alias: "LOAD_DATA") { + script "../../../../../subworkflows/nf-scil/load_test_data/main.nf" + process { + """ + input[0] = Channel.from( [ "heavy.zip" ] ) + input[1] = "test.load-test-data" + """ + } + } + } + + 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") + ] + } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-scil/denoising/mppca/tests/main.nf.test.snap b/modules/nf-scil/denoising/mppca/tests/main.nf.test.snap new file mode 100644 index 00000000..c599bfe7 --- /dev/null +++ b/modules/nf-scil/denoising/mppca/tests/main.nf.test.snap @@ -0,0 +1,37 @@ +{ + "denoising - mppca": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_dwi_denoised.nii.gz:md5,c949b91d96513cba506975c271e53596" + ] + ], + "1": [ + "versions.yml:md5,fb589ae27eb3edb1cd1a50b0e13d2714" + ], + "image": [ + [ + { + "id": "test", + "single_end": false + }, + "test_dwi_denoised.nii.gz:md5,c949b91d96513cba506975c271e53596" + ] + ], + "versions": [ + "versions.yml:md5,fb589ae27eb3edb1cd1a50b0e13d2714" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-25T11:07:06.152814" + } +} \ No newline at end of file diff --git a/modules/nf-scil/denoising/mppca/tests/nextflow.config b/modules/nf-scil/denoising/mppca/tests/nextflow.config new file mode 100644 index 00000000..a6361aa8 --- /dev/null +++ b/modules/nf-scil/denoising/mppca/tests/nextflow.config @@ -0,0 +1,6 @@ +process { + withNAME: "DENOISING_MPPCA" { + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + ext.extent = 3 + } +} diff --git a/modules/nf-scil/denoising/mppca/tests/tags.yml b/modules/nf-scil/denoising/mppca/tests/tags.yml new file mode 100644 index 00000000..04ebd03e --- /dev/null +++ b/modules/nf-scil/denoising/mppca/tests/tags.yml @@ -0,0 +1,2 @@ +denoising/mppca: + - "modules/nf-scil/denoising/mppca/**" diff --git a/modules/nf-scil/denoising/nlmeans/environment.yml b/modules/nf-scil/denoising/nlmeans/environment.yml new file mode 100644 index 00000000..d85e3dbb --- /dev/null +++ b/modules/nf-scil/denoising/nlmeans/environment.yml @@ -0,0 +1,7 @@ +--- +name: "denoising_nlmeans" +channels: + - Docker + - Apptainer +dependencies: + - "Scilpy" diff --git a/modules/nf-scil/denoising/nlmeans/main.nf b/modules/nf-scil/denoising/nlmeans/main.nf index 097ba09b..4021a255 100755 --- a/modules/nf-scil/denoising/nlmeans/main.nf +++ b/modules/nf-scil/denoising/nlmeans/main.nf @@ -4,8 +4,8 @@ process DENOISING_NLMEANS { label 'process_single' container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://scil.usherbrooke.ca/containers/scilus_1.6.0.sif': - 'scilus/scilus:1.6.0' }" + 'https://scil.usherbrooke.ca/containers/scilus_2.0.0.sif': + 'scilus/scilus:2.0.0' }" input: tuple val(meta), path(image), path(mask) @@ -27,11 +27,11 @@ process DENOISING_NLMEANS { export OMP_NUM_THREADS=1 export OPENBLAS_NUM_THREADS=1 - scil_run_nlmeans.py $image ${prefix}_denoised.nii.gz 1 ${args.join(" ")} + scil_denoising_nlmeans.py $image ${prefix}_denoised.nii.gz 1 ${args.join(" ")} cat <<-END_VERSIONS > versions.yml "${task.process}": - scilpy: 1.6.0 + scilpy: 2.0.0 END_VERSIONS """ @@ -39,13 +39,13 @@ process DENOISING_NLMEANS { def prefix = task.ext.prefix ?: "${meta.id}" """ - scil_run_nlmeans.py -h + scil_denoising_nlmeans.py -h touch ${prefix}_denoised.nii.gz cat <<-END_VERSIONS > versions.yml "${task.process}": - scilpy: 1.6.0 + scilpy: 2.0.0 END_VERSIONS """ } diff --git a/modules/nf-scil/denoising/nlmeans/tests/main.nf.test b/modules/nf-scil/denoising/nlmeans/tests/main.nf.test new file mode 100644 index 00000000..2c6f401c --- /dev/null +++ b/modules/nf-scil/denoising/nlmeans/tests/main.nf.test @@ -0,0 +1,78 @@ +nextflow_process { + + name "Test Process DENOISING_NLMEANS" + script "../main.nf" + process "DENOISING_NLMEANS" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "denoising" + tag "denoising/nlmeans" + + tag "subworkflows" + tag "subworkflows/load_test_data" + + setup { + run("LOAD_TEST_DATA", alias: "LOAD_DATA") { + script "../../../../../subworkflows/nf-scil/load_test_data/main.nf" + process { + """ + input[0] = Channel.from( [ "heavy.zip" ] ) + input[1] = "test.load-test-data" + """ + } + } + } + + test("denoising - nlmeans") { + + 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}/anat/anat_image.nii.gz"), + [] + ] + } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("denoising - nlmeans - withmask") { + + 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}/anat/anat_image.nii.gz"), + file("\${test_data_directory}/anat/anat_mask.nii.gz") + ] + } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-scil/denoising/nlmeans/tests/main.nf.test.snap b/modules/nf-scil/denoising/nlmeans/tests/main.nf.test.snap new file mode 100644 index 00000000..ec65ed8b --- /dev/null +++ b/modules/nf-scil/denoising/nlmeans/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "denoising - nlmeans": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_denoised.nii.gz:md5,4a4eaa8956682b97589682c62c3226e5" + ] + ], + "1": [ + "versions.yml:md5,e5c9936e9d01b8503f706aecd0a39027" + ], + "image": [ + [ + { + "id": "test", + "single_end": false + }, + "test_denoised.nii.gz:md5,4a4eaa8956682b97589682c62c3226e5" + ] + ], + "versions": [ + "versions.yml:md5,e5c9936e9d01b8503f706aecd0a39027" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-23T21:07:32.369936" + }, + "denoising - nlmeans - withmask": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_denoised.nii.gz:md5,a4925934f71fc40c2182e8c1d3bc6687" + ] + ], + "1": [ + "versions.yml:md5,e5c9936e9d01b8503f706aecd0a39027" + ], + "image": [ + [ + { + "id": "test", + "single_end": false + }, + "test_denoised.nii.gz:md5,a4925934f71fc40c2182e8c1d3bc6687" + ] + ], + "versions": [ + "versions.yml:md5,e5c9936e9d01b8503f706aecd0a39027" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-04-23T21:09:03.715606" + } +} diff --git a/tests/modules/nf-scil/denoising/nlmeans/nextflow.config b/modules/nf-scil/denoising/nlmeans/tests/nextflow.config similarity index 98% rename from tests/modules/nf-scil/denoising/nlmeans/nextflow.config rename to modules/nf-scil/denoising/nlmeans/tests/nextflow.config index 8730f1c4..0293c16f 100755 --- a/tests/modules/nf-scil/denoising/nlmeans/nextflow.config +++ b/modules/nf-scil/denoising/nlmeans/tests/nextflow.config @@ -1,5 +1,3 @@ process { - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - } diff --git a/modules/nf-scil/denoising/nlmeans/tests/tags.yml b/modules/nf-scil/denoising/nlmeans/tests/tags.yml new file mode 100644 index 00000000..1aafdbf9 --- /dev/null +++ b/modules/nf-scil/denoising/nlmeans/tests/tags.yml @@ -0,0 +1,2 @@ +denoising/nlmeans: + - "modules/nf-scil/denoising/nlmeans/**" diff --git a/subworkflows/nf-scil/preproc_t1/tests/main.nf.test.snap b/subworkflows/nf-scil/preproc_t1/tests/main.nf.test.snap index 1452ad36..c662839c 100644 --- a/subworkflows/nf-scil/preproc_t1/tests/main.nf.test.snap +++ b/subworkflows/nf-scil/preproc_t1/tests/main.nf.test.snap @@ -78,9 +78,9 @@ "versions.yml:md5,15044237a18a642d172b2bdb3abcad78", "versions.yml:md5,209daf2d60de195845dedbdf80c98afd", "versions.yml:md5,2c0a6f978891003ebdf35c1ba060aa90", - "versions.yml:md5,37327d900785469fe8aba4e90c045be3", "versions.yml:md5,6aecd5fc2de479eaa81fb30b248c647c", - "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f" + "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f", + "versions.yml:md5,97b6b9457caf964b9f20549672f692f0" ], "crop_box": [ [ @@ -158,9 +158,9 @@ "versions.yml:md5,15044237a18a642d172b2bdb3abcad78", "versions.yml:md5,209daf2d60de195845dedbdf80c98afd", "versions.yml:md5,2c0a6f978891003ebdf35c1ba060aa90", - "versions.yml:md5,37327d900785469fe8aba4e90c045be3", "versions.yml:md5,6aecd5fc2de479eaa81fb30b248c647c", - "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f" + "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f", + "versions.yml:md5,97b6b9457caf964b9f20549672f692f0" ] } ], @@ -168,7 +168,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-04-23T22:49:49.052741" + "timestamp": "2024-04-30T15:37:59.429278" }, "preproc_t1_classic": { "content": [ @@ -249,9 +249,9 @@ "versions.yml:md5,15044237a18a642d172b2bdb3abcad78", "versions.yml:md5,209daf2d60de195845dedbdf80c98afd", "versions.yml:md5,2c0a6f978891003ebdf35c1ba060aa90", - "versions.yml:md5,37327d900785469fe8aba4e90c045be3", "versions.yml:md5,6aecd5fc2de479eaa81fb30b248c647c", - "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f" + "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f", + "versions.yml:md5,97b6b9457caf964b9f20549672f692f0" ], "crop_box": [ [ @@ -329,9 +329,9 @@ "versions.yml:md5,15044237a18a642d172b2bdb3abcad78", "versions.yml:md5,209daf2d60de195845dedbdf80c98afd", "versions.yml:md5,2c0a6f978891003ebdf35c1ba060aa90", - "versions.yml:md5,37327d900785469fe8aba4e90c045be3", "versions.yml:md5,6aecd5fc2de479eaa81fb30b248c647c", - "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f" + "versions.yml:md5,792251134d89d9f82a5c75d6d323ae0f", + "versions.yml:md5,97b6b9457caf964b9f20549672f692f0" ] } ], @@ -339,6 +339,6 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-04-23T22:20:50.469644" + "timestamp": "2024-04-30T15:06:27.336343" } } \ No newline at end of file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 5d14caca..fa7142de 100755 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1,9 +1,3 @@ -denoising/mppca: - - modules/nf-scil/denoising/mppca/** - - tests/modules/nf-scil/denoising/mppca/** -denoising/nlmeans: - - modules/nf-scil/denoising/nlmeans/** - - tests/modules/nf-scil/denoising/nlmeans/** image/resample: - modules/nf-scil/image/resample/** - tests/modules/nf-scil/image/resample/** diff --git a/tests/modules/nf-scil/denoising/mppca/main.nf b/tests/modules/nf-scil/denoising/mppca/main.nf deleted file mode 100755 index 3424e330..00000000 --- a/tests/modules/nf-scil/denoising/mppca/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { DENOISING_MPPCA } from '../../../../../modules/nf-scil/denoising/mppca/main.nf' - -workflow test_denoising_mppca { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['denoising']['mppca']['dwi'], checkIfExists: true) - ] - - DENOISING_MPPCA ( input ) -} diff --git a/tests/modules/nf-scil/denoising/mppca/nextflow.config b/tests/modules/nf-scil/denoising/mppca/nextflow.config deleted file mode 100755 index 90fbc34b..00000000 --- a/tests/modules/nf-scil/denoising/mppca/nextflow.config +++ /dev/null @@ -1,8 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withNAME: "DENOISING_MPPCA" { - ext.extent = 3 - } -} diff --git a/tests/modules/nf-scil/denoising/mppca/test.yml b/tests/modules/nf-scil/denoising/mppca/test.yml deleted file mode 100755 index b0a4918f..00000000 --- a/tests/modules/nf-scil/denoising/mppca/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: denoising mppca test_denoising_mppca - command: nextflow run ./tests/modules/nf-scil/denoising/mppca -entry test_denoising_mppca -c ./tests/config/nextflow.config - tags: - - denoising/mppca - - denoising - files: - - path: output/denoising/test_dwi_denoised.nii.gz - md5sum: 0cfa480f702173a047f076bbba9fe25e - - path: output/denoising/versions.yml diff --git a/tests/modules/nf-scil/denoising/nlmeans/main.nf b/tests/modules/nf-scil/denoising/nlmeans/main.nf deleted file mode 100755 index d3ddc274..00000000 --- a/tests/modules/nf-scil/denoising/nlmeans/main.nf +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { DENOISING_NLMEANS } from '../../../../../modules/nf-scil/denoising/nlmeans/main.nf' - -workflow test_denoising_nlmeans { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['denoising']['nlmeans']['image'], checkIfExists: true), - [] -] - - DENOISING_NLMEANS ( input ) -} - - -workflow test_denoising_nlmeans_with_mask { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['denoising']['nlmeans']['image'], checkIfExists: true), - file(params.test_data['denoising']['nlmeans']['mask'], checkIfExists: true) -] - - DENOISING_NLMEANS ( input ) -} diff --git a/tests/modules/nf-scil/denoising/nlmeans/test.yml b/tests/modules/nf-scil/denoising/nlmeans/test.yml deleted file mode 100755 index e5e8a732..00000000 --- a/tests/modules/nf-scil/denoising/nlmeans/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: denoising nlmeans test_denoising_nlmeans - command: nextflow run ./tests/modules/nf-scil/denoising/nlmeans -entry test_denoising_nlmeans -c ./tests/config/nextflow.config - tags: - - denoising - - denoising/nlmeans - files: - - path: output/denoising/test_denoised.nii.gz - md5sum: 749692b736eceee98403467d145ab3e2 - - path: output/denoising/versions.yml - -- name: denoising nlmeans test_denoising_nlmeans_with_mask - command: nextflow run ./tests/modules/nf-scil/denoising/nlmeans -entry test_denoising_nlmeans_with_mask -c ./tests/config/nextflow.config - tags: - - denoising - - denoising/nlmeans - files: - - path: output/denoising/test_denoised.nii.gz - md5sum: 6a8a98d93aea1bafcd1471ce189f1196 - - path: output/denoising/versions.yml