diff --git a/modules/nf-core/ashlar/main.nf b/modules/nf-core/ashlar/main.nf new file mode 100644 index 00000000000..2316b024391 --- /dev/null +++ b/modules/nf-core/ashlar/main.nf @@ -0,0 +1,52 @@ +process ASHLAR { + tag '$meta.id' + label 'process_single' + + conda "bioconda::ashlar=1.17.0" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ashlar:1.17.0--pyh5e36f6f_0' : + 'biocontainers/ashlar:1.17.0--pyh5e36f6f_0' }" + + input: + tuple val(meta), path(images) + path(opt_dfp) + path(opt_ffp) + + output: + tuple val(meta), path("*.ome.tif"), emit: tif + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def dfp = opt_dfp ? "--dfp $opt_dfp" : "" + def ffp = opt_ffp ? "--ffp $opt_ffp" : "" + 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" } + + """ + + ashlar \\ + -o ${prefix}.ome.tif \\ + $images \\ + $args \\ + $dfp \\ + $ffp + + sed -i -E 's/UUID="urn:uuid:[[:xdigit:]]{8}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{4}-[[:xdigit:]]{12}"/ /g' ${prefix}.ome.tif + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ashlar: \$(ashlar --version 2>&1 | sed 's/^.*ashlar //; s/Using.*\$//' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/ashlar/meta.yml b/modules/nf-core/ashlar/meta.yml new file mode 100644 index 00000000000..244e9726616 --- /dev/null +++ b/modules/nf-core/ashlar/meta.yml @@ -0,0 +1,42 @@ +name: "ashlar" +description: Alignment by Simultaneous Harmonization of Layer/Adjacency Registration +keywords: + - image_processing + - alignment + - registration +tools: + - "ashlar": + description: "Alignment by Simultaneous Harmonization of Layer/Adjacency Registration" + homepage: "https://labsyspharm.github.io/ashlar/" + documentation: "https://labsyspharm.github.io/ashlar/" + doi: "10.1093/bioinformatics/btac544" + licence: ["MIT"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - images: + type: file + description: Overlapping tile image data in formats from most commercial microscopes + pattern: "*.{ome.tiff,ome.tif,rcpnl,btf,nd2,tiff,tif,czi}" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test' ] + - tif: + type: file + description: A pyramidal, tiled OME-TIFF file created from input images. + pattern: "*.ome.tif" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@RobJY" + - "@jmuhlich" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 78874595b36..7a4308fb1d4 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -134,6 +134,10 @@ ascat: - modules/nf-core/ascat/** - tests/modules/nf-core/ascat/** +ashlar: + - modules/nf-core/ashlar/** + - tests/modules/nf-core/ashlar/** + assemblyscan: - modules/nf-core/assemblyscan/** - tests/modules/nf-core/assemblyscan/** diff --git a/tests/config/test_data.config b/tests/config/test_data.config index 5887ad5fe46..fa5d826cb12 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -671,6 +671,8 @@ params { cycif_tonsil_cycle1 = "${params.test_data_base}/data/imaging/ome-tiff/cycif-tonsil-cycle1.ome.tif" cycif_tonsil_cycle2 = "${params.test_data_base}/data/imaging/ome-tiff/cycif-tonsil-cycle2.ome.tif" cycif_tonsil_cycle3 = "${params.test_data_base}/data/imaging/ome-tiff/cycif-tonsil-cycle3.ome.tif" + cycif_tonsil_dfp = "${params.test_data_base}/data/imaging/ome-tiff/cycif-tonsil-dfp.ome.tif" + cycif_tonsil_ffp = "${params.test_data_base}/data/imaging/ome-tiff/cycif-tonsil-ffp.ome.tif" } 'registration' { markers = "${params.test_data_base}/data/imaging/registration/markers.csv" diff --git a/tests/modules/nf-core/ashlar/main.nf b/tests/modules/nf-core/ashlar/main.nf new file mode 100644 index 00000000000..278bc3195c7 --- /dev/null +++ b/tests/modules/nf-core/ashlar/main.nf @@ -0,0 +1,90 @@ +#!/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 new file mode 100644 index 00000000000..9b566dd3953 --- /dev/null +++ b/tests/modules/nf-core/ashlar/nextflow.config @@ -0,0 +1,9 @@ +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 new file mode 100644 index 00000000000..be9450cc22d --- /dev/null +++ b/tests/modules/nf-core/ashlar/test.yml @@ -0,0 +1,44 @@ +- 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: ae98ac74e3c818bb26c99ba4b9c2dd51 + - 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: 5f4165203545b7efe04ed5f4a6d5ac9d + - 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: acee3aeaf7ea088062b2c15eff72dfb4 + - 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: 5f4165203545b7efe04ed5f4a6d5ac9d + - 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: ae98ac74e3c818bb26c99ba4b9c2dd51 + - path: output/ashlar/versions.yml