diff --git a/modules/nf-core/ashlar/environment.yml b/modules/nf-core/ashlar/environment.yml index 8b3e771ac01..502f7177299 100644 --- a/modules/nf-core/ashlar/environment.yml +++ b/modules/nf-core/ashlar/environment.yml @@ -3,3 +3,4 @@ channels: - bioconda dependencies: - bioconda::ashlar=1.18.0 + - tifffile=2024.1.30 diff --git a/modules/nf-core/ashlar/main.nf b/modules/nf-core/ashlar/main.nf index 2ddc710feb5..86120b8de58 100644 --- a/modules/nf-core/ashlar/main.nf +++ b/modules/nf-core/ashlar/main.nf @@ -49,4 +49,24 @@ process ASHLAR { ashlar: \$(ashlar --version | sed 's/^.*ashlar //' ) END_VERSIONS """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + def num_files = images instanceof List ? images.size() : 1 + def opt_dfp_size = opt_dfp instanceof List ? opt_dfp.size() : 1 + def opt_ffp_size = opt_ffp instanceof List ? opt_ffp.size() : 1 + def dfp_validated = (opt_dfp_size == 0 || opt_dfp_size == 1 || opt_dfp_size == num_files) ? true : false + def ffp_validated = (opt_ffp_size == 0 || opt_ffp_size == 1 || opt_ffp_size == num_files) ? true : false + + if ( !dfp_validated ) { error "Please input only zero, one, or N dfp files, where N is the number of input images" } + if ( !ffp_validated ) { error "Please input only zero, one, or N ffp files, where N is the number of input images" } + + """ + touch ${prefix}.ome.tif + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ashlar: \$(ashlar --version | sed 's/^.*ashlar //' ) + END_VERSIONS + """ } diff --git a/modules/nf-core/ashlar/tests/main.nf.test b/modules/nf-core/ashlar/tests/main.nf.test new file mode 100644 index 00000000000..fd69ebd500d --- /dev/null +++ b/modules/nf-core/ashlar/tests/main.nf.test @@ -0,0 +1,155 @@ +nextflow_process { + + name "Test Process ASHLAR" + script "../main.nf" + process "ASHLAR" + + tag "modules" + tag "modules_nfcore" + tag "ashlar" + + test("ashlar - with fields") { + + when { + process { + """ + input[0] = [ + [ id:'test_all' ], + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle1.ome.tif', checkIfExists: true) + ] + input[1] = [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-dfp.ome.tif', checkIfExists: true) + ] + input[2] = [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-ffp.ome.tif', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("ashlar - 1 cycle - ome-tif") { + + when { + process { + """ + input[0] = [ + [ id:'test_1' ], + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle1.ome.tif', checkIfExists: true) + ] + input[1] = [] + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("ashlar - all cycles - ome-tif") { + + when { + process { + """ + input[0] = [ + [ id:'test_1' ], + [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle1.ome.tif', checkIfExists: true), + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle2.ome.tif', checkIfExists: true), + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle3.ome.tif', checkIfExists: true) + + ] + ] + input[1] = [] + input[2] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("ashlar - all cycles - with fields - ome-tif") { + + when { + process { + """ + input[0] = [ + [ id:'test_1' ], + [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle1.ome.tif', checkIfExists: true), + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle2.ome.tif', checkIfExists: true), + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle3.ome.tif', checkIfExists: true) + + ] + ] + input[1] = [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-dfp.ome.tif', checkIfExists: true) + ] + input[2] = [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-ffp.ome.tif', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("ashlar - with fields - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test_all' ], + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-cycle1.ome.tif', checkIfExists: true) + ] + input[1] = [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-dfp.ome.tif', checkIfExists: true) + ] + input[2] = [ + file(params.modules_testdata_base_path + 'imaging/ome-tiff/cycif-tonsil-ffp.ome.tif', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/ashlar/tests/main.nf.test.snap b/modules/nf-core/ashlar/tests/main.nf.test.snap new file mode 100644 index 00000000000..7c41f5b6d3e --- /dev/null +++ b/modules/nf-core/ashlar/tests/main.nf.test.snap @@ -0,0 +1,167 @@ +{ + "ashlar - with fields - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_all" + }, + "test_all.ome.tif:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ], + "tif": [ + [ + { + "id": "test_all" + }, + "test_all.ome.tif:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-04T13:32:44.241620025" + }, + "ashlar - 1 cycle - ome-tif": { + "content": [ + { + "0": [ + [ + { + "id": "test_1" + }, + "test_1.ome.tif:md5,988bbb2c74d47dc22a9f3ac348f53ef5" + ] + ], + "1": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ], + "tif": [ + [ + { + "id": "test_1" + }, + "test_1.ome.tif:md5,988bbb2c74d47dc22a9f3ac348f53ef5" + ] + ], + "versions": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-06T11:13:49.614970275" + }, + "ashlar - with fields": { + "content": [ + { + "0": [ + [ + { + "id": "test_all" + }, + "test_all.ome.tif:md5,988bbb2c74d47dc22a9f3ac348f53ef5" + ] + ], + "1": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ], + "tif": [ + [ + { + "id": "test_all" + }, + "test_all.ome.tif:md5,988bbb2c74d47dc22a9f3ac348f53ef5" + ] + ], + "versions": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-04T13:28:26.923837754" + }, + "ashlar - all cycles - ome-tif": { + "content": [ + { + "0": [ + [ + { + "id": "test_1" + }, + "test_1.ome.tif:md5,c01dda923325588ea34a4fe341b17e6e" + ] + ], + "1": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ], + "tif": [ + [ + { + "id": "test_1" + }, + "test_1.ome.tif:md5,c01dda923325588ea34a4fe341b17e6e" + ] + ], + "versions": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-06T11:14:14.530220621" + }, + "ashlar - all cycles - with fields - ome-tif": { + "content": [ + { + "0": [ + [ + { + "id": "test_1" + }, + "test_1.ome.tif:md5,c01dda923325588ea34a4fe341b17e6e" + ] + ], + "1": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ], + "tif": [ + [ + { + "id": "test_1" + }, + "test_1.ome.tif:md5,c01dda923325588ea34a4fe341b17e6e" + ] + ], + "versions": [ + "versions.yml:md5,d5b1baeee01093ff65d37e155c9ce462" + ] + } + ], + "meta": { + "nf-test": "0.9.1", + "nextflow": "24.10.0" + }, + "timestamp": "2024-11-06T11:14:56.268009236" + } +} \ No newline at end of file diff --git a/modules/nf-core/ashlar/tests/nextflow.config b/modules/nf-core/ashlar/tests/nextflow.config new file mode 100644 index 00000000000..f7f07fcb6fb --- /dev/null +++ b/modules/nf-core/ashlar/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: ASHLAR_TILE { + ext.args = "--tile-size 512" + } +} diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 2e0e6420c33..887e215cbe8 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -22,9 +22,6 @@ artic/minion: ascat: - modules/nf-core/ascat/** - tests/modules/nf-core/ascat/** -ashlar: - - modules/nf-core/ashlar/** - - tests/modules/nf-core/ashlar/** ataqv/ataqv: - modules/nf-core/ataqv/ataqv/** - tests/modules/nf-core/ataqv/ataqv/** diff --git a/tests/modules/nf-core/ashlar/main.nf b/tests/modules/nf-core/ashlar/main.nf deleted file mode 100644 index 278bc3195c7..00000000000 --- a/tests/modules/nf-core/ashlar/main.nf +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { ASHLAR } from '../../../../modules/nf-core/ashlar/main.nf' -include { ASHLAR as ASHLAR_TILE } from '../../../../modules/nf-core/ashlar/main.nf' - -workflow test_ashlar_1_file { - - input_list = [ [ id:'test_all' ], - [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle1'], checkIfExists: true)] ] - - ASHLAR ( input_list, [], [] ) - -} - -workflow test_ashlar_all_files { - - input_list = [ [ id:'test_all' ], - [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle1'], checkIfExists: true), - file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle2'], checkIfExists: true), - file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle3'], checkIfExists: true)] ] - - ASHLAR ( input_list, [], [] ) - -} - -workflow test_ashlar_all_files_tile_size { - - input_list = [ [ id:'test_all' ], - [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle1'], checkIfExists: true), - file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle2'], checkIfExists: true), - file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle3'], checkIfExists: true)] ] - - ASHLAR_TILE ( input_list, [], [] ) - -} - -workflow test_ashlar_all_files_dfp_ffp { - - input_list = [ [ id:'test_all' ], - [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle1'], checkIfExists: true), - file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle2'], checkIfExists: true), - file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle3'], checkIfExists: true)] ] - - ASHLAR ( input_list, [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_dfp'], checkIfExists: true)], - [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_ffp'], checkIfExists: true)] ) - -} - -workflow test_ashlar_1_file_dfp_ffp { - - input_list = [ [ id:'test_all' ], - [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_cycle1'], checkIfExists: true)] ] - - ASHLAR ( input_list, [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_dfp'], checkIfExists: true)], - [file(params.test_data['imaging'] - ['ome-tiff'] - ['cycif_tonsil_ffp'], checkIfExists: true)] ) - -} - diff --git a/tests/modules/nf-core/ashlar/nextflow.config b/tests/modules/nf-core/ashlar/nextflow.config deleted file mode 100644 index 9b566dd3953..00000000000 --- a/tests/modules/nf-core/ashlar/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: ASHLAR_TILE { - ext.args = "--tile-size 512" - } - -} diff --git a/tests/modules/nf-core/ashlar/test.yml b/tests/modules/nf-core/ashlar/test.yml deleted file mode 100644 index 0dad0fdd990..00000000000 --- a/tests/modules/nf-core/ashlar/test.yml +++ /dev/null @@ -1,44 +0,0 @@ -- name: ashlar test_ashlar_1_file - command: nextflow run ./tests/modules/nf-core/ashlar -entry test_ashlar_1_file -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ashlar/nextflow.config - tags: - - ashlar - files: - - path: output/ashlar/test_all.ome.tif - md5sum: 988bbb2c74d47dc22a9f3ac348f53ef5 - - path: output/ashlar/versions.yml - -- name: ashlar test_ashlar_all_files - command: nextflow run ./tests/modules/nf-core/ashlar -entry test_ashlar_all_files -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ashlar/nextflow.config - tags: - - ashlar - files: - - path: output/ashlar/test_all.ome.tif - md5sum: c01dda923325588ea34a4fe341b17e6e - - path: output/ashlar/versions.yml - -- name: ashlar test_ashlar_all_files_tile_size - command: nextflow run ./tests/modules/nf-core/ashlar -entry test_ashlar_all_files_tile_size -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ashlar/nextflow.config - tags: - - ashlar - files: - - path: output/ashlar/test_all.ome.tif - md5sum: 6d9573d40a93e38356ebc8b257f8dfb9 - - path: output/ashlar/versions.yml - -- name: ashlar test_ashlar_all_files_dfp_ffp - command: nextflow run ./tests/modules/nf-core/ashlar -entry test_ashlar_all_files_dfp_ffp -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ashlar/nextflow.config - tags: - - ashlar - files: - - path: output/ashlar/test_all.ome.tif - md5sum: c01dda923325588ea34a4fe341b17e6e - - path: output/ashlar/versions.yml - -- name: ashlar test_ashlar_1_file_dfp_ffp - command: nextflow run ./tests/modules/nf-core/ashlar -entry test_ashlar_1_file_dfp_ffp -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/ashlar/nextflow.config - tags: - - ashlar - files: - - path: output/ashlar/test_all.ome.tif - md5sum: 988bbb2c74d47dc22a9f3ac348f53ef5 - - path: output/ashlar/versions.yml