From a5377837fe9013bde89de8689829e83e84086536 Mon Sep 17 00:00:00 2001 From: vlebars <104759956+vlebars@users.noreply.github.com> Date: Tue, 19 Mar 2024 02:19:40 +0100 Subject: [PATCH 01/46] add nf-test to bedtools/merge - #3936 (#5203) Co-authored-by: LE BARS Victor --- .../nf-core/bedtools/merge/tests/main.nf.test | 34 ++++++++++++++++++ .../bedtools/merge/tests/main.nf.test.snap | 35 +++++++++++++++++++ .../bedtools/merge/tests/nextflow.config | 7 ++++ modules/nf-core/bedtools/merge/tests/tags.yml | 2 ++ tests/config/pytest_modules.yml | 3 -- tests/modules/nf-core/bedtools/merge/main.nf | 14 -------- .../nf-core/bedtools/merge/nextflow.config | 9 ----- tests/modules/nf-core/bedtools/merge/test.yml | 8 ----- 8 files changed, 78 insertions(+), 34 deletions(-) create mode 100644 modules/nf-core/bedtools/merge/tests/main.nf.test create mode 100644 modules/nf-core/bedtools/merge/tests/main.nf.test.snap create mode 100644 modules/nf-core/bedtools/merge/tests/nextflow.config create mode 100644 modules/nf-core/bedtools/merge/tests/tags.yml delete mode 100644 tests/modules/nf-core/bedtools/merge/main.nf delete mode 100644 tests/modules/nf-core/bedtools/merge/nextflow.config delete mode 100644 tests/modules/nf-core/bedtools/merge/test.yml diff --git a/modules/nf-core/bedtools/merge/tests/main.nf.test b/modules/nf-core/bedtools/merge/tests/main.nf.test new file mode 100644 index 00000000000..95dba8e5497 --- /dev/null +++ b/modules/nf-core/bedtools/merge/tests/main.nf.test @@ -0,0 +1,34 @@ +nextflow_process { + + name "Test Process BEDTOOLS_MERGE" + script "../main.nf" + config "./nextflow.config" + process "BEDTOOLS_MERGE" + + tag "modules" + tag "modules_nfcore" + tag "bedtools" + tag "bedtools/merge" + + test("test_bedtools_merge") { + + when { + process { + """ + input[0] = [ [ id:'test'], + file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/bedtools/merge/tests/main.nf.test.snap b/modules/nf-core/bedtools/merge/tests/main.nf.test.snap new file mode 100644 index 00000000000..ee6c4e6344d --- /dev/null +++ b/modules/nf-core/bedtools/merge/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "test_bedtools_merge": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_out.bed:md5,0cf6ed2b6f470cd44a247da74ca4fe4e" + ] + ], + "1": [ + "versions.yml:md5,2d134badb4cd1e4e903696c7967f28d6" + ], + "bed": [ + [ + { + "id": "test" + }, + "test_out.bed:md5,0cf6ed2b6f470cd44a247da74ca4fe4e" + ] + ], + "versions": [ + "versions.yml:md5,2d134badb4cd1e4e903696c7967f28d6" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:07:09.721153" + } +} \ No newline at end of file diff --git a/modules/nf-core/bedtools/merge/tests/nextflow.config b/modules/nf-core/bedtools/merge/tests/nextflow.config new file mode 100644 index 00000000000..16444e982fe --- /dev/null +++ b/modules/nf-core/bedtools/merge/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: BEDTOOLS_MERGE { + ext.prefix = { "${meta.id}_out" } + } + +} diff --git a/modules/nf-core/bedtools/merge/tests/tags.yml b/modules/nf-core/bedtools/merge/tests/tags.yml new file mode 100644 index 00000000000..60c8cad1cd9 --- /dev/null +++ b/modules/nf-core/bedtools/merge/tests/tags.yml @@ -0,0 +1,2 @@ +bedtools/merge: + - "modules/nf-core/bedtools/merge/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index b2e810ff689..4f9637b251e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -185,9 +185,6 @@ bedtools/makewindows: bedtools/maskfasta: - modules/nf-core/bedtools/maskfasta/** - tests/modules/nf-core/bedtools/maskfasta/** -bedtools/merge: - - modules/nf-core/bedtools/merge/** - - tests/modules/nf-core/bedtools/merge/** bedtools/multiinter: - modules/nf-core/bedtools/multiinter/** - tests/modules/nf-core/bedtools/multiinter/** diff --git a/tests/modules/nf-core/bedtools/merge/main.nf b/tests/modules/nf-core/bedtools/merge/main.nf deleted file mode 100644 index a1a84527fd3..00000000000 --- a/tests/modules/nf-core/bedtools/merge/main.nf +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BEDTOOLS_MERGE } from '../../../../../modules/nf-core/bedtools/merge/main.nf' - -workflow test_bedtools_merge { - input = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) - ] - - BEDTOOLS_MERGE ( input ) -} - diff --git a/tests/modules/nf-core/bedtools/merge/nextflow.config b/tests/modules/nf-core/bedtools/merge/nextflow.config deleted file mode 100644 index 545a523d0c9..00000000000 --- a/tests/modules/nf-core/bedtools/merge/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: BEDTOOLS_MERGE { - ext.prefix = { "${meta.id}_out" } - } - -} diff --git a/tests/modules/nf-core/bedtools/merge/test.yml b/tests/modules/nf-core/bedtools/merge/test.yml deleted file mode 100644 index bee9b75ba5f..00000000000 --- a/tests/modules/nf-core/bedtools/merge/test.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: bedtools merge - command: nextflow run ./tests/modules/nf-core/bedtools/merge -entry test_bedtools_merge -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bedtools/merge/nextflow.config - tags: - - bedtools - - bedtools/merge - files: - - path: ./output/bedtools/test_out.bed - md5sum: 0cf6ed2b6f470cd44a247da74ca4fe4e From dec4aaf3940d1df7acc7f6d01553eaac683d2994 Mon Sep 17 00:00:00 2001 From: Alexander Ramos Date: Tue, 19 Mar 2024 01:47:47 -0600 Subject: [PATCH 02/46] rename taxonomy files in kraken2/add module (#5214) rename taxonomy files --- modules/nf-core/kraken2/add/main.nf | 4 ++-- modules/nf-core/kraken2/add/tests/main.nf.test.snap | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/nf-core/kraken2/add/main.nf b/modules/nf-core/kraken2/add/main.nf index f011246d1ae..3a2ffed87d2 100644 --- a/modules/nf-core/kraken2/add/main.nf +++ b/modules/nf-core/kraken2/add/main.nf @@ -9,8 +9,8 @@ process KRAKEN2_ADD { input: tuple val(meta), path(fasta) - path taxonomy_names, stageAs: 'taxonomy/*' - path taxonomy_nodes, stageAs: 'taxonomy/*' + path taxonomy_names, stageAs: 'taxonomy/names.dmp' + path taxonomy_nodes, stageAs: 'taxonomy/nodes.dmp' path accession2taxid, stageAs: 'taxonomy/*' output: diff --git a/modules/nf-core/kraken2/add/tests/main.nf.test.snap b/modules/nf-core/kraken2/add/tests/main.nf.test.snap index a0b073bc8b0..5050d6968cb 100644 --- a/modules/nf-core/kraken2/add/tests/main.nf.test.snap +++ b/modules/nf-core/kraken2/add/tests/main.nf.test.snap @@ -3,16 +3,16 @@ "content": [ 6, [ - "prot.accession2taxid:md5,c0f96ba5dbb00150b4b805ba6dab7bea", - "prot_names.dmp:md5,130f9132095562e09c732679c562f5e9", - "prot_nodes.dmp:md5,c471c27a4ce85ae74d2c63633c9ce1e3" + "names.dmp:md5,130f9132095562e09c732679c562f5e9", + "nodes.dmp:md5,c471c27a4ce85ae74d2c63633c9ce1e3", + "prot.accession2taxid:md5,c0f96ba5dbb00150b4b805ba6dab7bea" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-20T08:57:27.555707212" + "timestamp": "2024-03-18T20:20:05.09765" }, "sarscov2 protein_db stub": { "content": [ From e2a94ca2043db537013aead193e7e681865a24f7 Mon Sep 17 00:00:00 2001 From: Jose Nimo <30318135+josenimo@users.noreply.github.com> Date: Tue, 19 Mar 2024 09:02:16 +0100 Subject: [PATCH 03/46] Cellpose: updated to 3.0.1 (#5193) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * updated to 3.0.1 * Update modules/nf-core/cellpose/meta.yml Co-authored-by: Krešimir Beštak <86408271+kbestak@users.noreply.github.com> --------- Co-authored-by: Krešimir Beštak <86408271+kbestak@users.noreply.github.com> --- modules/nf-core/cellpose/main.nf | 7 ++- modules/nf-core/cellpose/tests/main.nf.test | 25 ---------- .../nf-core/cellpose/tests/main.nf.test.snap | 46 +++++++++++++------ 3 files changed, 34 insertions(+), 44 deletions(-) diff --git a/modules/nf-core/cellpose/main.nf b/modules/nf-core/cellpose/main.nf index 66f20dc69a7..f100904f953 100644 --- a/modules/nf-core/cellpose/main.nf +++ b/modules/nf-core/cellpose/main.nf @@ -2,7 +2,7 @@ process CELLPOSE { tag "$meta.id" label 'process_medium' - container "docker.io/biocontainers/cellpose:2.2.2_cv2" + container "docker.io/biocontainers/cellpose:3.0.1_cv1" input: tuple val(meta), path(image) @@ -24,12 +24,11 @@ process CELLPOSE { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def model_command = model ? "--pretrained_model $model" : "" - def VERSION = '2.2.2' + def VERSION = '3.0.1' """ cellpose \\ --image_path $image \\ --save_tif \\ - --verbose \\ $model_command \\ $args @@ -44,7 +43,7 @@ process CELLPOSE { error "I did not manage to create a cellpose module in Conda that works in all OSes. Please use Docker / Singularity / Podman instead." } def prefix = task.ext.prefix ?: "${meta.id}" - def VERSION = "2.2.2" // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + def VERSION = "3.0.1" // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. def name = image.name def base = name.lastIndexOf('.') != -1 ? name[0..name.lastIndexOf('.') - 1] : name """ diff --git a/modules/nf-core/cellpose/tests/main.nf.test b/modules/nf-core/cellpose/tests/main.nf.test index 98f91e477c1..1b6698d1d7e 100644 --- a/modules/nf-core/cellpose/tests/main.nf.test +++ b/modules/nf-core/cellpose/tests/main.nf.test @@ -8,31 +8,6 @@ nextflow_process { tag "modules_nfcore" tag "cellpose" - test("cellpose - no flows, no model") { - - when { - config "./nextflow.config" - process { - """ - input[0] = [ - [ id:'test' ], - file(params.test_data['imaging']['segmentation']['image'], checkIfExists: true) - ] - input[1] = [] - """ - } - } - - then { - assertAll ( - { assert process.success }, - { assert snapshot(process.out.mask).match("mask") }, - { assert snapshot(process.out.versions).match("versions") } - ) - } - - } - test("cellpose - with flows, no model") { when { diff --git a/modules/nf-core/cellpose/tests/main.nf.test.snap b/modules/nf-core/cellpose/tests/main.nf.test.snap index b1493ff7acb..03b4dbfc122 100644 --- a/modules/nf-core/cellpose/tests/main.nf.test.snap +++ b/modules/nf-core/cellpose/tests/main.nf.test.snap @@ -1,12 +1,4 @@ { - "versions": { - "content": [ - [ - "versions.yml:md5,a7431408162669eb1306e8431c026f23" - ] - ], - "timestamp": "2024-01-25T16:21:34.156662581" - }, "flows": { "content": [ [ @@ -14,11 +6,27 @@ { "id": "test" }, - "cycif_tonsil_registered.ome_flows.tif:md5,11452ee411ec7ad9c498637c7f1735ce" + "cycif_tonsil_registered.ome_flows.tif:md5,de79a792d4bebd2f9753ceb47a0de5f7" ] ] ], - "timestamp": "2024-01-25T16:23:08.747183847" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:16.855256249" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,ce42208b574084f390cf58b4c19b5717" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:16.875087557" }, "cellpose - stub": { "content": [ @@ -35,7 +43,7 @@ ], "2": [ - "versions.yml:md5,a7431408162669eb1306e8431c026f23" + "versions.yml:md5,ce42208b574084f390cf58b4c19b5717" ], "flows": [ @@ -49,11 +57,15 @@ ] ], "versions": [ - "versions.yml:md5,a7431408162669eb1306e8431c026f23" + "versions.yml:md5,ce42208b574084f390cf58b4c19b5717" ] } ], - "timestamp": "2024-01-25T16:23:29.044881966" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:39.339792992" }, "mask": { "content": [ @@ -62,10 +74,14 @@ { "id": "test" }, - "cycif_tonsil_registered.ome_cp_masks.tif:md5,1e35e4dc39d1f6ca6e9394675bf688a8" + "cycif_tonsil_registered.ome_cp_masks.tif:md5,001ad312413f18bc2615741bd3ad12cf" ] ] ], - "timestamp": "2024-01-25T16:21:34.136667882" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T14:22:16.8369758" } } \ No newline at end of file From 6b5178c2d19b6a91687781f49ec4e978c5bfe183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Ciurka?= <38040237+pawelciurkaardigen@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:13:03 +0100 Subject: [PATCH 04/46] remove pytest files for `bcftools sort` (#5218) --- tests/modules/nf-core/bcftools/sort/main.nf | 15 --------------- .../modules/nf-core/bcftools/sort/nextflow.config | 5 ----- tests/modules/nf-core/bcftools/sort/test.yml | 9 --------- 3 files changed, 29 deletions(-) delete mode 100644 tests/modules/nf-core/bcftools/sort/main.nf delete mode 100644 tests/modules/nf-core/bcftools/sort/nextflow.config delete mode 100644 tests/modules/nf-core/bcftools/sort/test.yml diff --git a/tests/modules/nf-core/bcftools/sort/main.nf b/tests/modules/nf-core/bcftools/sort/main.nf deleted file mode 100644 index d4960fccd97..00000000000 --- a/tests/modules/nf-core/bcftools/sort/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BCFTOOLS_SORT } from '../../../../../modules/nf-core/bcftools/sort/main.nf' - -workflow test_bcftools_sort { - - input = [ - [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) - ] - - BCFTOOLS_SORT ( input ) -} diff --git a/tests/modules/nf-core/bcftools/sort/nextflow.config b/tests/modules/nf-core/bcftools/sort/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/bcftools/sort/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/bcftools/sort/test.yml b/tests/modules/nf-core/bcftools/sort/test.yml deleted file mode 100644 index 1e197765467..00000000000 --- a/tests/modules/nf-core/bcftools/sort/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: bcftools sort test_bcftools_sort - command: nextflow run ./tests/modules/nf-core/bcftools/sort -entry test_bcftools_sort -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bcftools/sort/nextflow.config - tags: - - bcftools - - bcftools/sort - files: - - path: output/bcftools/test.vcf.gz - md5sum: a1e45fe6d2b386fc2611766e5d2937ee - - path: output/bcftools/versions.yml From 435433b1744aaa953f04897831ef0420721c15b2 Mon Sep 17 00:00:00 2001 From: lgrochowalski Date: Tue, 19 Mar 2024 10:23:57 +0100 Subject: [PATCH 05/46] Nftest htseq (#5220) * port htseq count pytest to nf-test * rename yml file * add extra line * fix tag.yml * fix meta.yml * fix meta.yml * remove old pytest for htseq --------- Co-authored-by: zxBIB Grochowalski,Lukasz (GCBDS) EXTERNAL Co-authored-by: Mauro Saporita <64437596+mauro-saporita@users.noreply.github.com> --- tests/modules/nf-core/htseq/count/main.nf | 40 ------------------- .../nf-core/htseq/count/nextflow.config | 6 --- tests/modules/nf-core/htseq/count/test.yml | 19 --------- 3 files changed, 65 deletions(-) delete mode 100644 tests/modules/nf-core/htseq/count/main.nf delete mode 100644 tests/modules/nf-core/htseq/count/nextflow.config delete mode 100644 tests/modules/nf-core/htseq/count/test.yml diff --git a/tests/modules/nf-core/htseq/count/main.nf b/tests/modules/nf-core/htseq/count/main.nf deleted file mode 100644 index 9b653cbce29..00000000000 --- a/tests/modules/nf-core/htseq/count/main.nf +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { HTSEQ_COUNT } from '../../../../../modules/nf-core/htseq/count/main.nf' - -workflow test_htseq_count_bam { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) - - ] - gtf = [ - [ id:'test2'], // meta map - file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true) - ] - - - HTSEQ_COUNT (input,gtf) -} - -workflow test_htseq_count_cram { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true) - - ] - gtf = [ - [ id:'test2'], // meta map - file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true) - ] - - - HTSEQ_COUNT (input,gtf) -} - diff --git a/tests/modules/nf-core/htseq/count/nextflow.config b/tests/modules/nf-core/htseq/count/nextflow.config deleted file mode 100644 index 153c686dc53..00000000000 --- a/tests/modules/nf-core/htseq/count/nextflow.config +++ /dev/null @@ -1,6 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - docker.registry = 'quay.io' - -} diff --git a/tests/modules/nf-core/htseq/count/test.yml b/tests/modules/nf-core/htseq/count/test.yml deleted file mode 100644 index 9d45ed672fb..00000000000 --- a/tests/modules/nf-core/htseq/count/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: htseq count test_htseq_count_bam - command: nextflow run ./tests/modules/nf-core/htseq/count -entry test_htseq_count_bam -c ./tests/config/nextflow.config - tags: - - htseq - - htseq/count - files: - - path: output/htseq/test.txt - md5sum: 5e37b2292f1d21945acb532afa5eb615 - - path: output/htseq/versions.yml - -- name: htseq count test_htseq_count_cram - command: nextflow run ./tests/modules/nf-core/htseq/count -entry test_htseq_count_cram -c ./tests/config/nextflow.config - tags: - - htseq - - htseq/count - files: - - path: output/htseq/test.txt - md5sum: 53f9b007bd72115e8b72a40f859bc896 - - path: output/htseq/versions.yml From 5f4e755fdc22c6e40d740ab27ea9b1004e806cb5 Mon Sep 17 00:00:00 2001 From: Igor Trujnara <53370556+itrujnara@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:25:33 +0100 Subject: [PATCH 06/46] Added meta map to module and tests (#5191) * Added meta map to module and tests * Update formatting in main.nf Co-authored-by: Jose Espinosa-Carrasco * Changes to the bootstrap test * Added stub test * Bootstrap test correction Co-authored-by: Joon Klaps <61584065+Joon-Klaps@users.noreply.github.com> * Fixed minor issue in stats test --------- Co-authored-by: Jose Espinosa-Carrasco Co-authored-by: Joon Klaps <61584065+Joon-Klaps@users.noreply.github.com> --- modules/nf-core/fastme/main.nf | 11 +- modules/nf-core/fastme/meta.yml | 5 + modules/nf-core/fastme/tests/main.nf.test | 45 ++++- .../nf-core/fastme/tests/main.nf.test.snap | 169 ++++++++++++++++-- 4 files changed, 199 insertions(+), 31 deletions(-) diff --git a/modules/nf-core/fastme/main.nf b/modules/nf-core/fastme/main.nf index e18fbef374a..cd5ae8c33c1 100644 --- a/modules/nf-core/fastme/main.nf +++ b/modules/nf-core/fastme/main.nf @@ -8,15 +8,14 @@ process FASTME { 'biocontainers/fastme:2.1.6.1--hec16e2b_1' }" input: - path infile - path initial_tree + tuple val(meta), path(infile), path(initial_tree) output: - path "*.nwk" , emit: nwk - path "*_stat.txt" , emit: stats + tuple val(meta), path("*.nwk") , emit: nwk + tuple val(meta), path("*_stat.txt") , emit: stats + tuple val(meta), path("*.matrix.phy"), emit: matrix , optional: true + tuple val(meta), path("*.bootstrap") , emit: bootstrap , optional: true path "versions.yml" , emit: versions - path "*.matrix.phy" , emit: matrix , optional: true - path "*.bootstrap" , emit: bootstrap , optional: true when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/fastme/meta.yml b/modules/nf-core/fastme/meta.yml index 2ba78477af0..93e1dc671f6 100644 --- a/modules/nf-core/fastme/meta.yml +++ b/modules/nf-core/fastme/meta.yml @@ -18,6 +18,11 @@ tools: args_id: "$args" input: + - meta: + type: map + description: | + A Groovy map containing sample information, + e.g. [ id: "test" ] - infile: type: file description: MSA or distance matrix in Phylip format diff --git a/modules/nf-core/fastme/tests/main.nf.test b/modules/nf-core/fastme/tests/main.nf.test index 9dd026110e5..3dcbf10714b 100644 --- a/modules/nf-core/fastme/tests/main.nf.test +++ b/modules/nf-core/fastme/tests/main.nf.test @@ -30,8 +30,8 @@ nextflow_process { when { process { """ - input[0] = TCOFFEE_SEQREFORMAT.out.formatted_file.collect{ meta, aln -> aln } - input[1] = [] + input[0] = TCOFFEE_SEQREFORMAT.out.formatted_file + .map { meta, aln -> [meta, aln, []] } """ } } @@ -75,8 +75,9 @@ nextflow_process { when { process { """ - input[0] = TCOFFEE_SEQREFORMAT.out.formatted_file.collect{ meta, aln -> aln } - input[1] = FAMSA_GUIDETREE.out.tree.collect{ meta, tree -> tree } + input[0] = TCOFFEE_SEQREFORMAT.out.formatted_file + .join(FAMSA_GUIDETREE.out.tree, by: 0) + .map { meta, aln, tree -> [meta, aln, tree] } """ } } @@ -110,8 +111,8 @@ nextflow_process { when { process { """ - input[0] = TCOFFEE_SEQREFORMAT.out.formatted_file.collect{ meta, aln -> aln } - input[1] = [] + input[0] = TCOFFEE_SEQREFORMAT.out.formatted_file + .map { meta, aln -> [meta, aln, []] } """ } } @@ -119,9 +120,35 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert process.out.nwk }, - { assert process.out.matrix }, - { assert process.out.bootstrap } + { assert path(process.out.nwk[0][1]).text.contains("1atx:") }, + { assert path(process.out.matrix[0][1]).text.contains("1apf") }, + { assert path(process.out.bootstrap[0][1]).text.contains("1atx:") }, + { assert snapshot(path(process.out.stats[0][1]).readLines()[0..12]).match("stats_boot") }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + } + + test("setoxin - phylip - stub") { + + config "./main.config" + options "-stub" + + when { + process { + """ + input[0] = [ [ id: "test" ], + file("https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/setoxin.ref", checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } ) } } diff --git a/modules/nf-core/fastme/tests/main.nf.test.snap b/modules/nf-core/fastme/tests/main.nf.test.snap index c87500598a3..e892b351eae 100644 --- a/modules/nf-core/fastme/tests/main.nf.test.snap +++ b/modules/nf-core/fastme/tests/main.nf.test.snap @@ -1,21 +1,128 @@ { - "setoxin - phylip - with_tree": { + "setoxin - phylip - stub": { "content": [ { "0": [ - "test.txt.nwk:md5,cbd6a41704951c56512f2f755dc13d4e" + [ + { + "id": "test" + }, + "setoxin.ref.nwk:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "1": [ - "test.txt_fastme_stat.txt:md5,de3629be9e561cd78286bc565036a1d9" + [ + { + "id": "test" + }, + "setoxin.ref_stat.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] ], "2": [ - "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" + ], "3": [ ], "4": [ + "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" + ], + "bootstrap": [ + + ], + "matrix": [ + + ], + "nwk": [ + [ + { + "id": "test" + }, + "setoxin.ref.nwk:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "stats": [ + [ + { + "id": "test" + }, + "setoxin.ref_stat.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-19T10:03:04.842045" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-19T10:02:58.72899" + }, + "stats_boot": { + "content": [ + [ + "", + " - FastME 2.1.6.1 - ", + "", + "", + "Papers to be cited:", + "", + "FastME 2.0 - A comprehensive, accurate and fast distance-based phylogeny inference program.", + "\tVincent Lefort, Richard Desper and Olivier Gascuel,", + "\tMolecular Biology and Evolution 32(10), 2798-800, 2015.", + "BIONJ algorithm:", + "\tGascuel O. 1997. BIONJ: an improved version of the NJ algorithm based on a simple model of sequence data.", + "\tMolecular Biology and Evolution, 14(7):685-695", + "" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-19T10:09:35.813028" + }, + "setoxin - phylip - with_tree": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.txt.nwk:md5,cbd6a41704951c56512f2f755dc13d4e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.txt_fastme_stat.txt:md5,de3629be9e561cd78286bc565036a1d9" + ] + ], + "2": [ + ], + "3": [ + + ], + "4": [ + "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" ], "bootstrap": [ @@ -24,10 +131,20 @@ ], "nwk": [ - "test.txt.nwk:md5,cbd6a41704951c56512f2f755dc13d4e" + [ + { + "id": "test" + }, + "test.txt.nwk:md5,cbd6a41704951c56512f2f755dc13d4e" + ] ], "stats": [ - "test.txt_fastme_stat.txt:md5,de3629be9e561cd78286bc565036a1d9" + [ + { + "id": "test" + }, + "test.txt_fastme_stat.txt:md5,de3629be9e561cd78286bc565036a1d9" + ] ], "versions": [ "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" @@ -36,27 +153,37 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "23.10.0" }, - "timestamp": "2024-02-15T15:42:34.44649128" + "timestamp": "2024-03-19T10:02:51.77025" }, "setoxin - phylip - basic": { "content": [ { "0": [ - "test.txt.nwk:md5,72ef94af973b93bec264149ae4abafb3" + [ + { + "id": "test" + }, + "test.txt.nwk:md5,72ef94af973b93bec264149ae4abafb3" + ] ], "1": [ - "test.txt_fastme_stat.txt:md5,b8cfaff0c62868a8dea2614f09d0e5af" + [ + { + "id": "test" + }, + "test.txt_fastme_stat.txt:md5,b8cfaff0c62868a8dea2614f09d0e5af" + ] ], "2": [ - "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" + ], "3": [ ], "4": [ - + "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" ], "bootstrap": [ @@ -65,10 +192,20 @@ ], "nwk": [ - "test.txt.nwk:md5,72ef94af973b93bec264149ae4abafb3" + [ + { + "id": "test" + }, + "test.txt.nwk:md5,72ef94af973b93bec264149ae4abafb3" + ] ], "stats": [ - "test.txt_fastme_stat.txt:md5,b8cfaff0c62868a8dea2614f09d0e5af" + [ + { + "id": "test" + }, + "test.txt_fastme_stat.txt:md5,b8cfaff0c62868a8dea2614f09d0e5af" + ] ], "versions": [ "versions.yml:md5,0e7f28ae349efffa1ef75c2279e975b6" @@ -77,8 +214,8 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nextflow": "23.10.0" }, - "timestamp": "2024-02-15T15:42:18.077191235" + "timestamp": "2024-03-19T10:02:44.598308" } } \ No newline at end of file From 7c1543a730197e2f0b8ca5141f851c4a2b08bed6 Mon Sep 17 00:00:00 2001 From: Jose Nimo <30318135+josenimo@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:36:23 +0100 Subject: [PATCH 07/46] del extra info from config, passed sing and docker tests (#5217) --- modules/nf-core/cellpose/tests/nextflow.config | 11 ----------- modules/nf-core/cellpose/tests/nextflow_wflows.config | 6 ------ 2 files changed, 17 deletions(-) delete mode 100644 modules/nf-core/cellpose/tests/nextflow.config diff --git a/modules/nf-core/cellpose/tests/nextflow.config b/modules/nf-core/cellpose/tests/nextflow.config deleted file mode 100644 index 7ac30d5dcfb..00000000000 --- a/modules/nf-core/cellpose/tests/nextflow.config +++ /dev/null @@ -1,11 +0,0 @@ -process { - withName: "CELLPOSE" { - ext.args = '--pretrained_model nuclei --diameter 9 --channel_axis 0 --no_npy' - } -} -singularity { - runOptions = "--bind $HOME:$HOME" -} -docker { - runOptions = '--entrypoint ""' -} diff --git a/modules/nf-core/cellpose/tests/nextflow_wflows.config b/modules/nf-core/cellpose/tests/nextflow_wflows.config index 9bd169ec4d2..773c97bd959 100644 --- a/modules/nf-core/cellpose/tests/nextflow_wflows.config +++ b/modules/nf-core/cellpose/tests/nextflow_wflows.config @@ -3,9 +3,3 @@ process { ext.args = '--pretrained_model nuclei --diameter 9 --channel_axis 0 --no_npy --save_flows' } } -singularity { - runOptions = "--bind $HOME:$HOME" -} -docker { - runOptions = '--entrypoint ""' -} From 2f3db6f45147ebbb56b371536e31bdf622b5bfee Mon Sep 17 00:00:00 2001 From: Maxime U Garcia Date: Tue, 19 Mar 2024 11:14:45 +0100 Subject: [PATCH 08/46] SNPEFF_SNPEFF with nf-test tests (#5204) * add meta to output * add tests * update snapshots * remove old pytest tests --- modules/nf-core/snpeff/snpeff/main.nf | 10 ++-- .../nf-core/snpeff/snpeff/tests/main.nf.test | 50 +++++++++++++++++++ .../snpeff/snpeff/tests/main.nf.test.snap | 31 ++++++++++++ .../snpeff/snpeff/tests/nextflow.config | 4 ++ modules/nf-core/snpeff/snpeff/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 -- tests/modules/nf-core/snpeff/snpeff/main.nf | 23 --------- .../nf-core/snpeff/snpeff/nextflow.config | 5 -- tests/modules/nf-core/snpeff/snpeff/test.yml | 12 ----- 9 files changed, 92 insertions(+), 48 deletions(-) create mode 100644 modules/nf-core/snpeff/snpeff/tests/main.nf.test create mode 100644 modules/nf-core/snpeff/snpeff/tests/main.nf.test.snap create mode 100644 modules/nf-core/snpeff/snpeff/tests/nextflow.config create mode 100644 modules/nf-core/snpeff/snpeff/tests/tags.yml delete mode 100644 tests/modules/nf-core/snpeff/snpeff/main.nf delete mode 100644 tests/modules/nf-core/snpeff/snpeff/nextflow.config delete mode 100644 tests/modules/nf-core/snpeff/snpeff/test.yml diff --git a/modules/nf-core/snpeff/snpeff/main.nf b/modules/nf-core/snpeff/snpeff/main.nf index cc4f2ccb364..28d13826662 100644 --- a/modules/nf-core/snpeff/snpeff/main.nf +++ b/modules/nf-core/snpeff/snpeff/main.nf @@ -13,11 +13,11 @@ process SNPEFF_SNPEFF { tuple val(meta2), path(cache) output: - tuple val(meta), path("*.ann.vcf"), emit: vcf - path "*.csv" , emit: report - path "*.html" , emit: summary_html - path "*.genes.txt" , emit: genes_txt - path "versions.yml" , emit: versions + tuple val(meta), path("*.ann.vcf"), emit: vcf + tuple val(meta), path("*.csv"), emit: report + tuple val(meta), path("*.html"), emit: summary_html + tuple val(meta), path("*.genes.txt"), emit: genes_txt + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/snpeff/snpeff/tests/main.nf.test b/modules/nf-core/snpeff/snpeff/tests/main.nf.test new file mode 100644 index 00000000000..dd37f275ad5 --- /dev/null +++ b/modules/nf-core/snpeff/snpeff/tests/main.nf.test @@ -0,0 +1,50 @@ +nextflow_process { + + name "Test Process SNPEFF_SNPEFF" + script "../main.nf" + process "SNPEFF_SNPEFF" + config "./nextflow.config" + tag "modules" + tag "modules_nfcore" + tag "snpeff" + tag "snpeff/download" + tag "snpeff/snpeff" + + test("test_SNPEFF_SNPEFF") { + + setup { + run("SNPEFF_DOWNLOAD") { + script "../../download/main.nf" + process { + """ + input[0] = Channel.of([[id:params.snpeff_genome + '.' + params.snpeff_cache_version], params.snpeff_genome, params.snpeff_cache_version]) + """ + } + } + } + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true) + ]) + input[1] = params.snpeff_genome + '.' + params.snpeff_cache_version + input[2] = SNPEFF_DOWNLOAD.out.cache + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.report[0][1]).exists() }, + { assert path(process.out.summary_html[0][1]).exists() }, + { assert path(process.out.vcf[0][1]).exists() }, + { assert snapshot(process.out.genes_txt).match("genes_txt") }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + } +} diff --git a/modules/nf-core/snpeff/snpeff/tests/main.nf.test.snap b/modules/nf-core/snpeff/snpeff/tests/main.nf.test.snap new file mode 100644 index 00000000000..0891b844ca0 --- /dev/null +++ b/modules/nf-core/snpeff/snpeff/tests/main.nf.test.snap @@ -0,0 +1,31 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,25d44a118d558b331d51ec00be0d997c" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-18T17:37:18.879477" + }, + "genes_txt": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.genes.txt:md5,130536bf0237d7f3f746d32aaa32840a" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-18T17:37:18.874822" + } +} \ No newline at end of file diff --git a/modules/nf-core/snpeff/snpeff/tests/nextflow.config b/modules/nf-core/snpeff/snpeff/tests/nextflow.config new file mode 100644 index 00000000000..d31ebf6b7c6 --- /dev/null +++ b/modules/nf-core/snpeff/snpeff/tests/nextflow.config @@ -0,0 +1,4 @@ +params { + snpeff_cache_version = "105" + snpeff_genome = "WBcel235" +} diff --git a/modules/nf-core/snpeff/snpeff/tests/tags.yml b/modules/nf-core/snpeff/snpeff/tests/tags.yml new file mode 100644 index 00000000000..427b588dfe7 --- /dev/null +++ b/modules/nf-core/snpeff/snpeff/tests/tags.yml @@ -0,0 +1,2 @@ +snpeff/snpeff: + - "modules/nf-core/snpeff/snpeff/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4f9637b251e..d91677f373c 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2025,9 +2025,6 @@ snpdists: snpeff/download: - modules/nf-core/snpeff/download/** - tests/modules/nf-core/snpeff/download/** -snpeff/snpeff: - - modules/nf-core/snpeff/snpeff/** - - tests/modules/nf-core/snpeff/snpeff/** snpsift/annotate: - modules/nf-core/snpsift/annotate/** - tests/modules/nf-core/snpsift/annotate/** diff --git a/tests/modules/nf-core/snpeff/snpeff/main.nf b/tests/modules/nf-core/snpeff/snpeff/main.nf deleted file mode 100644 index 68150677abb..00000000000 --- a/tests/modules/nf-core/snpeff/snpeff/main.nf +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SNPEFF_DOWNLOAD } from '../../../../../modules/nf-core/snpeff/download/main' -include { SNPEFF_SNPEFF } from '../../../../../modules/nf-core/snpeff/snpeff/main' - -snpeff_cache_version = "105" -snpeff_genome = "WBcel235" -snpeff_cache_input = Channel.of([[id:"${snpeff_genome}.${snpeff_cache_version}"], snpeff_genome, snpeff_cache_version]) - -workflow test_snpeff_snpeff { - input = Channel.of([ - [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) - ]) - - SNPEFF_DOWNLOAD(snpeff_cache_input) - - snpeff_cache = SNPEFF_DOWNLOAD.out.cache.first() - - SNPEFF_SNPEFF(input, "${snpeff_genome}.${snpeff_cache_version}", snpeff_cache) -} diff --git a/tests/modules/nf-core/snpeff/snpeff/nextflow.config b/tests/modules/nf-core/snpeff/snpeff/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/snpeff/snpeff/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/snpeff/snpeff/test.yml b/tests/modules/nf-core/snpeff/snpeff/test.yml deleted file mode 100644 index 62d3b78dc7a..00000000000 --- a/tests/modules/nf-core/snpeff/snpeff/test.yml +++ /dev/null @@ -1,12 +0,0 @@ -- name: snpeff test_snpeff_snpeff - command: nextflow run ./tests/modules/nf-core/snpeff/snpeff -entry test_snpeff_snpeff -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/snpeff/snpeff/nextflow.config - tags: - - snpeff - - snpeff/snpeff - files: - - path: output/snpeff/test.ann.vcf - md5sum: 9dc12cf54c78516abf3558672d3746d0 - - path: output/snpeff/test.csv - - path: output/snpeff/test.genes.txt - md5sum: 130536bf0237d7f3f746d32aaa32840a - - path: output/snpeff/snpEff_summary.html From 95cf5fe0194c7bf5cb0e3027a2eb7e7c89385080 Mon Sep 17 00:00:00 2001 From: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com> Date: Tue, 19 Mar 2024 10:32:19 +0000 Subject: [PATCH 09/46] More tests for FASTQ_FASTQC_UMITOOLS_FASTP (#5179) * More tests for fastq_fastqc_umitools_etc * FASTQ_FASTQC_UMITOOLS_FASTP increased test coverage * tags * update snap * FASTP saves failed reads correctly fixes https://github.com/nf-core/modules/issues/5202 * Finish up tests --- modules/nf-core/fastp/main.nf | 2 +- modules/nf-core/fastp/tests/main.nf.test | 18 +- modules/nf-core/fastp/tests/main.nf.test.snap | 10 +- .../fastp/tests/nextflow.interleaved.config | 5 + ...low.config => nextflow.save_failed.config} | 3 +- .../tests/main.nf.test | 516 +++++++++++++++++- .../tests/main.nf.test.snap | 464 +++++++++++++++- .../tests/nextflow.config | 11 + .../tests/nextflow.save_trimmed.config | 6 + 9 files changed, 988 insertions(+), 47 deletions(-) create mode 100644 modules/nf-core/fastp/tests/nextflow.interleaved.config rename modules/nf-core/fastp/tests/{nextflow.config => nextflow.save_failed.config} (50%) create mode 100644 subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.config create mode 100644 subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.save_trimmed.config diff --git a/modules/nf-core/fastp/main.nf b/modules/nf-core/fastp/main.nf index 2a3b679e34e..4fc19b7443d 100644 --- a/modules/nf-core/fastp/main.nf +++ b/modules/nf-core/fastp/main.nf @@ -29,7 +29,7 @@ process FASTP { def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def adapter_list = adapter_fasta ? "--adapter_fasta ${adapter_fasta}" : "" - def fail_fastq = save_trimmed_fail && meta.single_end ? "--failed_out ${prefix}.fail.fastq.gz" : save_trimmed_fail && !meta.single_end ? "--unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : '' + def fail_fastq = save_trimmed_fail && meta.single_end ? "--failed_out ${prefix}.fail.fastq.gz" : save_trimmed_fail && !meta.single_end ? "--failed_out ${prefix}.paired.fail.fastq.gz --unpaired1 ${prefix}_1.fail.fastq.gz --unpaired2 ${prefix}_2.fail.fastq.gz" : '' // Added soft-links to original fastqs for consistent naming in MultiQC // Use single ended for interleaved. Add --interleaved_in in config. if ( task.ext.args?.contains('--interleaved_in') ) { diff --git a/modules/nf-core/fastp/tests/main.nf.test b/modules/nf-core/fastp/tests/main.nf.test index 9b3f9a38ced..6f1f4897850 100644 --- a/modules/nf-core/fastp/tests/main.nf.test +++ b/modules/nf-core/fastp/tests/main.nf.test @@ -251,7 +251,8 @@ nextflow_process { } test("fastp test_fastp_interleaved") { - config './nextflow.config' + + config './nextflow.interleaved.config' when { params { outdir = "$outputDir" @@ -277,7 +278,7 @@ nextflow_process { def html_text = [ "Q20 bases:25.719000 K (93.033098%)", "paired end (151 cycles + 151 cycles)"] def log_text = [ "Q20 bases: 12922(92.9841%)", - "reads passed filter: 198"] + "reads passed filter: 162"] def read_lines = [ "@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads_fail.get(0).get(1).get(1)).linesGzip.contains(failed_read2_line) } + { assert path(process.out.reads_fail.get(0).get(1).get(2)).linesGzip.contains(failed_read2_line) } } }, { html_text.each { html_part -> diff --git a/modules/nf-core/fastp/tests/main.nf.test.snap b/modules/nf-core/fastp/tests/main.nf.test.snap index b4c0e1dd874..3e876288982 100644 --- a/modules/nf-core/fastp/tests/main.nf.test.snap +++ b/modules/nf-core/fastp/tests/main.nf.test.snap @@ -7,7 +7,7 @@ "id": "test", "single_end": true }, - "test.fastp.json:md5,168f516f7bd4b7b6c32da7cba87299a4" + "test.fastp.json:md5,b24e0624df5cc0b11cd5ba21b726fb22" ] ] ], @@ -15,7 +15,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-17T18:08:06.123035" + "timestamp": "2024-03-18T16:19:15.063001" }, "test_fastp_paired_end_merged-for_stub_match": { "content": [ @@ -65,7 +65,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-17T18:06:00.223817" + "timestamp": "2024-03-18T16:18:43.526412" }, "versions_paired_end": { "content": [ @@ -112,7 +112,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-01T12:03:37.827323085" + "timestamp": "2024-03-18T16:19:15.111894" }, "test_fastp_paired_end_merged_match": { "content": [ @@ -283,7 +283,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-01T11:57:30.791982648" + "timestamp": "2024-03-18T16:18:43.580336" }, "versions_paired_end_merged_adapterlist": { "content": [ diff --git a/modules/nf-core/fastp/tests/nextflow.interleaved.config b/modules/nf-core/fastp/tests/nextflow.interleaved.config new file mode 100644 index 00000000000..4be8dbd2c84 --- /dev/null +++ b/modules/nf-core/fastp/tests/nextflow.interleaved.config @@ -0,0 +1,5 @@ +process { + withName: FASTP { + ext.args = "--interleaved_in -e 30" + } +} diff --git a/modules/nf-core/fastp/tests/nextflow.config b/modules/nf-core/fastp/tests/nextflow.save_failed.config similarity index 50% rename from modules/nf-core/fastp/tests/nextflow.config rename to modules/nf-core/fastp/tests/nextflow.save_failed.config index 0f7849ad96d..53b61b0c15a 100644 --- a/modules/nf-core/fastp/tests/nextflow.config +++ b/modules/nf-core/fastp/tests/nextflow.save_failed.config @@ -1,6 +1,5 @@ process { - withName: FASTP { - ext.args = "--interleaved_in" + ext.args = "-e 30" } } diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test index 8f1d82d39de..85747415327 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test @@ -3,6 +3,8 @@ nextflow_workflow { name "Test Workflow FASTQ_FASTQC_UMITOOLS_FASTP" script "../main.nf" workflow "FASTQ_FASTQC_UMITOOLS_FASTP" + config './nextflow.config' + tag "subworkflows" tag "subworkflows_nfcore" tag "subworkflows/fastq_fastqc_umitools_fastp" @@ -29,8 +31,10 @@ nextflow_workflow { input[0] = Channel.of([ [ id:'test', single_end:false ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true)] + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] ]) input[1] = skip_fastqc input[2] = with_umi @@ -48,17 +52,503 @@ nextflow_workflow { then { assertAll( { assert workflow.success }, - { assert snapshot(workflow.out.reads).match("reads") }, - { assert snapshot(workflow.out.umi_log).match("umi_log") }, - { assert snapshot(workflow.out.trim_json).match("trim_json") }, - { assert snapshot(workflow.out.trim_reads_fail).match("trim_reads_fail") }, - { assert snapshot(workflow.out.trim_reads_merged).match("trim_reads_merged") }, - { assert snapshot(workflow.out.adapter_seq).match("adapter_seq") }, - { assert snapshot(workflow.out.trim_read_count).match("trim_read_count") }, - { assert snapshot(workflow.out.versions).match("versions") }, - - { assert workflow.out.fastqc_raw_html }, - { assert workflow.out.fastqc_raw_zip }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert workflow.out.fastqc_trim_html }, + { assert workflow.out.fastqc_trim_zip } + ) + } + } + + test("skip_fastqc") { + + when { + workflow { + """ + skip_fastqc = true + with_umi = false + skip_umi_extract = false + umi_discard_read = 1 + skip_trimming = false + adapter_fasta = [] + save_trimmed_fail = false + save_merged = false + min_trimmed_reads = 1 + + input[0] = Channel.of([ + [ id:'test', single_end: false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert !workflow.out.fastqc_raw_html}, + { assert !workflow.out.fastqc_raw_zip}, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert !workflow.out.fastqc_trim_html }, + { assert !workflow.out.fastqc_trim_zip } + ) + } + } + + test("with_umi") { + + when { + workflow { + """ + skip_fastqc = false + with_umi = true + skip_umi_extract = false + umi_discard_read = 1 + skip_trimming = false + adapter_fasta = [] + save_trimmed_fail = false + save_merged = false + min_trimmed_reads = 1 + + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert workflow.out.fastqc_trim_html }, + { assert workflow.out.fastqc_trim_zip } + ) + } + } + + + test("skip_umi_extract") { + + when { + workflow { + """ + skip_fastqc = false + with_umi = true + skip_umi_extract = true + umi_discard_read = 1 + skip_trimming = false + adapter_fasta = [] + save_trimmed_fail = false + save_merged = false + min_trimmed_reads = 1 + + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert workflow.out.fastqc_trim_html }, + { assert workflow.out.fastqc_trim_zip } + ) + } + } + + test("umi_discard_read = 2") { + + when { + workflow { + """ + skip_fastqc = false + with_umi = true + skip_umi_extract = true + umi_discard_read = 2 + skip_trimming = false + adapter_fasta = [] + save_trimmed_fail = false + save_merged = false + min_trimmed_reads = 1 + + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert workflow.out.fastqc_trim_html }, + { assert workflow.out.fastqc_trim_zip } + ) + } + } + + test("skip_trimming") { + + when { + workflow { + """ + skip_fastqc = false + with_umi = false + skip_umi_extract = false + umi_discard_read = 1 + skip_trimming = true + adapter_fasta = [] + save_trimmed_fail = false + save_merged = false + min_trimmed_reads = 1 + + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, + { assert !workflow.out.trim_html }, + { assert !workflow.out.trim_log }, + { assert !workflow.out.fastqc_trim_html }, + { assert !workflow.out.fastqc_trim_zip } + ) + } + } + + test("save_trimmed_fail") { + + config './nextflow.save_trimmed.config' + + when { + workflow { + """ + skip_fastqc = false + with_umi = false + skip_umi_extract = false + umi_discard_read = 1 + skip_trimming = false + adapter_fasta = [] + save_trimmed_fail = true + save_merged = false + min_trimmed_reads = 1 + + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert workflow.out.fastqc_trim_html }, + { assert workflow.out.fastqc_trim_zip } + ) + } + } + + test("save_merged") { + + when { + workflow { + """ + skip_fastqc = false + with_umi = false + skip_umi_extract = false + umi_discard_read = 1 + skip_trimming = false + adapter_fasta = [] + save_trimmed_fail = false + save_merged = true + min_trimmed_reads = 1 + + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert workflow.out.fastqc_trim_html }, + { assert workflow.out.fastqc_trim_zip } + ) + } + } + + test("min_trimmed_reads = 26") { + // Subworkflow should stop after FASTP which trims down to 25 reads + + when { + workflow { + """ + skip_fastqc = false + with_umi = false + skip_umi_extract = false + umi_discard_read = 1 + skip_trimming = false + adapter_fasta = [] + save_trimmed_fail = false + save_merged = true + min_trimmed_reads = 26 + + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_2.fastq.gz', checkIfExists: true) + ] + ]) + input[1] = skip_fastqc + input[2] = with_umi + input[3] = skip_umi_extract + input[4] = umi_discard_read + input[5] = skip_trimming + input[6] = adapter_fasta + input[7] = save_trimmed_fail + input[8] = save_merged + input[9] = min_trimmed_reads + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.reads, + workflow.out.umi_log, + workflow.out.trim_json, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.adapter_seq, + workflow.out.trim_read_count, + workflow.out.versions + ).match() + }, + + { assert workflow.out.fastqc_raw_html}, + { assert workflow.out.fastqc_raw_zip}, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap index 89ba8da1999..1be6597ecf3 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap @@ -1,30 +1,186 @@ { - "trim_reads_merged": { + "skip_fastqc": { "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7", + "test_2.fastp.fastq.gz:md5,25cbdca08e2083dbd4f0502de6b62f39" + ] + ] + ], [ + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,1e0f8e27e71728e2b63fc64086be95cd" + ] + ], + [ + + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "unspecified" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + 198 + ] + ], + [ + "versions.yml:md5,85bd0117e5778fff18e3920972a296ad" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:50.041635573" + "timestamp": "2024-03-18T16:53:49.315194" }, - "trim_reads_fail": { + "save_trimmed_fail": { "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,6ff32a64c5188b9a9192be1398c262c7", + "test_2.fastp.fastq.gz:md5,db0cb7c9977e94ac2b4b446ebd017a8a" + ] + ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,4c3268ddb50ea5b33125984776aa3519" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.paired.fail.fastq.gz:md5,409b687c734cedd7a1fec14d316e1366", + "test_1.fail.fastq.gz:md5,4f273cf3159c13f79e8ffae12f5661f6", + "test_2.fail.fastq.gz:md5,f97b9edefb5649aab661fbc9e71fc995" + ] + ] + ], [ + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "unspecified" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + 162 + ] + ], + [ + "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", + "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:50.033284693" + "timestamp": "2024-03-18T16:51:45.34934" }, - "versions": { + "skip_umi_extract": { "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7", + "test_2.fastp.fastq.gz:md5,25cbdca08e2083dbd4f0502de6b62f39" + ] + ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,1e0f8e27e71728e2b63fc64086be95cd" + ] + ], + [ + + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "unspecified" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + 198 + ] + ], [ "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", @@ -35,10 +191,25 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:50.121510557" + "timestamp": "2024-03-18T12:07:40.34249" }, - "trim_json": { + "umi_discard_read = 2": { "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7", + "test_2.fastp.fastq.gz:md5,25cbdca08e2083dbd4f0502de6b62f39" + ] + ] + ], + [ + + ], [ [ { @@ -47,16 +218,81 @@ }, "test.fastp.json:md5,1e0f8e27e71728e2b63fc64086be95cd" ] + ], + [ + + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "unspecified" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + 198 + ] + ], + [ + "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", + "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:50.024410724" + "timestamp": "2024-03-18T12:08:24.141938" }, - "adapter_seq": { + "save_merged": { "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,54b726a55e992a869fd3fa778afe1672", + "test_2.fastp.fastq.gz:md5,29d3b33b869f7b63417b8ff07bb128ba" + ] + ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,b712fd68ed0322f4bec49ff2a5237fcc" + ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.merged.fastq.gz:md5,c873bb1ab3fa859dcc47306465e749d5" + ] + ], [ [ { @@ -65,15 +301,71 @@ }, "unspecified" ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + 75 + ] + ], + [ + "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", + "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:50.08674429" + "timestamp": "2024-03-18T12:10:18.546963" }, - "reads": { + "skip_trimming": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/fastq/test_1.fastq.gz", + "/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/fastq/test_2.fastq.gz" + ] + ] + ], + [ + + ], + [ + + ], + [ + + ], + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T12:08:51.217937" + }, + "sarscov2 paired-end [fastq]": { "content": [ [ [ @@ -86,42 +378,178 @@ "test_2.fastp.fastq.gz:md5,25cbdca08e2083dbd4f0502de6b62f39" ] ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,1e0f8e27e71728e2b63fc64086be95cd" + ] + ], + [ + + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "unspecified" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + 198 + ] + ], + [ + "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", + "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:49.994419936" + "timestamp": "2024-03-18T16:53:39.139038" }, - "umi_log": { + "min_trimmed_reads = 26": { "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,54b726a55e992a869fd3fa778afe1672", + "test_2.fastp.fastq.gz:md5,29d3b33b869f7b63417b8ff07bb128ba" + ] + ] + ], [ + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,b712fd68ed0322f4bec49ff2a5237fcc" + ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.merged.fastq.gz:md5,c873bb1ab3fa859dcc47306465e749d5" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "unspecified" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + 75 + ] + ], + [ + "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", + "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:50.017720214" + "timestamp": "2024-03-18T11:52:23.849945" }, - "trim_read_count": { + "with_umi": { "content": [ [ [ { "id": "test", - "single_end": false + "single_end": true }, - 198 + "test.fastp.fastq.gz:md5,ba8c6c3a7ce718d9a2c5857e2edf53bc" + ] + ], + [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d39c5c6d9a2e35fb60d26ced46569af6" + ] + ], + [ + + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": true + }, + "" ] + ], + [ + [ + { + "id": "test", + "single_end": true + }, + 99 + ] + ], + [ + "versions.yml:md5,01f264f78de3c6d893c449cc6d3cd721", + "versions.yml:md5,85bd0117e5778fff18e3920972a296ad", + "versions.yml:md5,c50aa59475ab901bc6f9a2cf7b1a14e0", + "versions.yml:md5,f3dcaae948e8eed92b4a5557b4c6668e" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-01-12T08:38:50.102326089" + "timestamp": "2024-03-18T17:31:09.193212" } } \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.config b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.config new file mode 100644 index 00000000000..12f7b2573a5 --- /dev/null +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.config @@ -0,0 +1,11 @@ +process { + + withName: UMITOOLS_EXTRACT { + ext.args = '--bc-pattern="NNNN" --bc-pattern2="NNNN"' + } + + withName: UMICOLLAPSE { + ext.prefix = { "${meta.id}.dedup" } + } + +} \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.save_trimmed.config b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.save_trimmed.config new file mode 100644 index 00000000000..2430e9d5f8d --- /dev/null +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/nextflow.save_trimmed.config @@ -0,0 +1,6 @@ +process { + // Make filtering more aggressive to make more reads fail + withName: FASTP { + ext.args = "-e 30" + } +} \ No newline at end of file From 1e15ad71d9022293985dd02e24186e5e496a0b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Pe=C3=B1a-P=C3=A9rez?= Date: Tue, 19 Mar 2024 11:44:14 +0100 Subject: [PATCH 10/46] splitncigarreads added meta for references (#5224) feat added meta for references Co-authored-by: lucia.pena.perez@scilifelab.se --- modules/nf-core/gatk4/splitncigarreads/main.nf | 6 +++--- .../nf-core/gatk4/splitncigarreads/meta.yml | 15 +++++++++++++++ .../gatk4/splitncigarreads/tests/main.nf.test | 18 +++++++++--------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/modules/nf-core/gatk4/splitncigarreads/main.nf b/modules/nf-core/gatk4/splitncigarreads/main.nf index e017a62edfd..e2c287a02b1 100644 --- a/modules/nf-core/gatk4/splitncigarreads/main.nf +++ b/modules/nf-core/gatk4/splitncigarreads/main.nf @@ -9,9 +9,9 @@ process GATK4_SPLITNCIGARREADS { input: tuple val(meta), path(bam), path(bai), path(intervals) - path fasta - path fai - path dict + tuple val(meta2), path(fasta) + tuple val(meta3), path(fai) + tuple val(meta4), path(dict) output: tuple val(meta), path('*.bam'), emit: bam diff --git a/modules/nf-core/gatk4/splitncigarreads/meta.yml b/modules/nf-core/gatk4/splitncigarreads/meta.yml index e1efde0cb50..f813274671e 100644 --- a/modules/nf-core/gatk4/splitncigarreads/meta.yml +++ b/modules/nf-core/gatk4/splitncigarreads/meta.yml @@ -31,14 +31,29 @@ input: - intervals: type: file description: Bed file with the genomic regions included in the library (optional) + - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'reference' ] - fasta: type: file description: The reference fasta file pattern: "*.fasta" + - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'reference' ] - fai: type: file description: Index of reference fasta file pattern: "*.fasta.fai" + - meta4: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'reference' ] - dict: type: file description: GATK sequence dictionary diff --git a/modules/nf-core/gatk4/splitncigarreads/tests/main.nf.test b/modules/nf-core/gatk4/splitncigarreads/tests/main.nf.test index 85acfd4ccda..b49101263aa 100644 --- a/modules/nf-core/gatk4/splitncigarreads/tests/main.nf.test +++ b/modules/nf-core/gatk4/splitncigarreads/tests/main.nf.test @@ -15,9 +15,9 @@ nextflow_process { process { """ input[0] = [ [ id:'test' ], file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists:true), []] - input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - input[2] = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - input[3] = file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) + input[1] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + input[2] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) ] + input[3] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) ] """ } } @@ -37,9 +37,9 @@ nextflow_process { process { """ input[0] = [ [ id:'test' ], file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists:true), file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true)] - input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - input[2] = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - input[3] = file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) + input[1] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + input[2] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) ] + input[3] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) ] """ } } @@ -61,9 +61,9 @@ nextflow_process { process { """ input[0] = [ [ id:'test' ], file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true), [], []] - input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - input[2] = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - input[3] = file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) + input[1] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) ] + input[2] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) ] + input[3] = [ [ id:'reference' ], file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) ] """ } } From 624e8cdc9f416fa7221edb1354374a7e69780e55 Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:57:26 +0100 Subject: [PATCH 11/46] nf-test all wisecondorx modules (#5219) * migrate convert * nf-test gender * nf-test newref * nf-test predict * prettier * fix linting * fix linting again * third time's the charm? --- modules/nf-core/wisecondorx/convert/meta.yml | 2 +- .../wisecondorx/convert/tests/main.nf.test | 97 ++++++++++++++++ .../convert/tests/main.nf.test.snap | 107 ++++++++++++++++++ .../wisecondorx/convert/tests/tags.yml | 2 + modules/nf-core/wisecondorx/gender/meta.yml | 2 +- .../wisecondorx/gender/tests/main.nf.test | 56 +++++++++ .../gender/tests/main.nf.test.snap | 37 ++++++ .../nf-core/wisecondorx/gender/tests/tags.yml | 2 + modules/nf-core/wisecondorx/newref/meta.yml | 2 +- .../wisecondorx/newref/tests/main.nf.test | 65 +++++++++++ .../newref/tests/main.nf.test.snap | 22 ++++ .../wisecondorx/newref/tests/nextflow.config | 4 + .../nf-core/wisecondorx/newref/tests/tags.yml | 2 + modules/nf-core/wisecondorx/predict/meta.yml | 4 +- .../wisecondorx/predict/tests/main.nf.test | 65 +++++++++++ .../predict/tests/main.nf.test.snap | 65 +++++++++++ .../wisecondorx/predict/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 9 -- .../nf-core/wisecondorx/convert/main.nf | 45 -------- .../wisecondorx/convert/nextflow.config | 5 - .../nf-core/wisecondorx/convert/test.yml | 19 ---- .../nf-core/wisecondorx/gender/main.nf | 31 ----- .../wisecondorx/gender/nextflow.config | 5 - .../nf-core/wisecondorx/gender/test.yml | 7 -- .../nf-core/wisecondorx/newref/main.nf | 36 ------ .../wisecondorx/newref/nextflow.config | 9 -- .../nf-core/wisecondorx/newref/test.yml | 8 -- .../nf-core/wisecondorx/predict/main.nf | 32 ------ .../wisecondorx/predict/nextflow.config | 5 - .../nf-core/wisecondorx/predict/test.yml | 14 --- 30 files changed, 531 insertions(+), 230 deletions(-) create mode 100644 modules/nf-core/wisecondorx/convert/tests/main.nf.test create mode 100644 modules/nf-core/wisecondorx/convert/tests/main.nf.test.snap create mode 100644 modules/nf-core/wisecondorx/convert/tests/tags.yml create mode 100644 modules/nf-core/wisecondorx/gender/tests/main.nf.test create mode 100644 modules/nf-core/wisecondorx/gender/tests/main.nf.test.snap create mode 100644 modules/nf-core/wisecondorx/gender/tests/tags.yml create mode 100644 modules/nf-core/wisecondorx/newref/tests/main.nf.test create mode 100644 modules/nf-core/wisecondorx/newref/tests/main.nf.test.snap create mode 100644 modules/nf-core/wisecondorx/newref/tests/nextflow.config create mode 100644 modules/nf-core/wisecondorx/newref/tests/tags.yml create mode 100644 modules/nf-core/wisecondorx/predict/tests/main.nf.test create mode 100644 modules/nf-core/wisecondorx/predict/tests/main.nf.test.snap create mode 100644 modules/nf-core/wisecondorx/predict/tests/tags.yml delete mode 100644 tests/modules/nf-core/wisecondorx/convert/main.nf delete mode 100644 tests/modules/nf-core/wisecondorx/convert/nextflow.config delete mode 100644 tests/modules/nf-core/wisecondorx/convert/test.yml delete mode 100644 tests/modules/nf-core/wisecondorx/gender/main.nf delete mode 100644 tests/modules/nf-core/wisecondorx/gender/nextflow.config delete mode 100644 tests/modules/nf-core/wisecondorx/gender/test.yml delete mode 100644 tests/modules/nf-core/wisecondorx/newref/main.nf delete mode 100644 tests/modules/nf-core/wisecondorx/newref/nextflow.config delete mode 100644 tests/modules/nf-core/wisecondorx/newref/test.yml delete mode 100644 tests/modules/nf-core/wisecondorx/predict/main.nf delete mode 100644 tests/modules/nf-core/wisecondorx/predict/nextflow.config delete mode 100644 tests/modules/nf-core/wisecondorx/predict/test.yml diff --git a/modules/nf-core/wisecondorx/convert/meta.yml b/modules/nf-core/wisecondorx/convert/meta.yml index b6d0b457460..d70d9d69ab2 100644 --- a/modules/nf-core/wisecondorx/convert/meta.yml +++ b/modules/nf-core/wisecondorx/convert/meta.yml @@ -11,7 +11,7 @@ tools: documentation: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" tool_dev_url: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" doi: "10.1093/nar/gky1263" - licence: "['Attribution-NonCommercial-ShareAlike CC BY-NC-SA']" + licence: ["Attribution-NonCommercial-ShareAlike CC BY-NC-SA"] input: - meta: type: map diff --git a/modules/nf-core/wisecondorx/convert/tests/main.nf.test b/modules/nf-core/wisecondorx/convert/tests/main.nf.test new file mode 100644 index 00000000000..1e093e9a255 --- /dev/null +++ b/modules/nf-core/wisecondorx/convert/tests/main.nf.test @@ -0,0 +1,97 @@ +nextflow_process { + + name "Test Process WISECONDORX_CONVERT" + script "../main.nf" + process "WISECONDORX_CONVERT" + + tag "modules" + tag "modules_nfcore" + tag "wisecondorx" + tag "wisecondorx/convert" + + test("sarscov2 - bam, bai, [], []") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) + ] + input[1] = [[], []] + input[2] = [[], []] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - cram, crai, fasta, fai") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true) + ] + + input[1] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) + ] + + input[2] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - bam, bai - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) + ] + input[1] = [[], []] + input[2] = [[], []] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/wisecondorx/convert/tests/main.nf.test.snap b/modules/nf-core/wisecondorx/convert/tests/main.nf.test.snap new file mode 100644 index 00000000000..ac252a1c8ee --- /dev/null +++ b/modules/nf-core/wisecondorx/convert/tests/main.nf.test.snap @@ -0,0 +1,107 @@ +{ + "sarscov2 - cram, crai, fasta, fai": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.npz:md5,154337aa93ceddf15ea7382969588524" + ] + ], + "1": [ + "versions.yml:md5,917a47772d6f722fe520f900827fae01" + ], + "npz": [ + [ + { + "id": "test", + "single_end": false + }, + "test.npz:md5,154337aa93ceddf15ea7382969588524" + ] + ], + "versions": [ + "versions.yml:md5,917a47772d6f722fe520f900827fae01" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-18T16:57:23.88568683" + }, + "sarscov2 - bam, bai, [], []": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.npz:md5,00c8acf1727e9eb78e56bce28b09ee3b" + ] + ], + "1": [ + "versions.yml:md5,917a47772d6f722fe520f900827fae01" + ], + "npz": [ + [ + { + "id": "test", + "single_end": false + }, + "test.npz:md5,00c8acf1727e9eb78e56bce28b09ee3b" + ] + ], + "versions": [ + "versions.yml:md5,917a47772d6f722fe520f900827fae01" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-18T16:58:57.092145603" + }, + "sarscov2 - bam, bai - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.npz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,917a47772d6f722fe520f900827fae01" + ], + "npz": [ + [ + { + "id": "test", + "single_end": false + }, + "test.npz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,917a47772d6f722fe520f900827fae01" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-18T16:59:20.717480551" + } +} \ No newline at end of file diff --git a/modules/nf-core/wisecondorx/convert/tests/tags.yml b/modules/nf-core/wisecondorx/convert/tests/tags.yml new file mode 100644 index 00000000000..0c3526e8358 --- /dev/null +++ b/modules/nf-core/wisecondorx/convert/tests/tags.yml @@ -0,0 +1,2 @@ +wisecondorx/convert: + - "modules/nf-core/wisecondorx/convert/**" diff --git a/modules/nf-core/wisecondorx/gender/meta.yml b/modules/nf-core/wisecondorx/gender/meta.yml index 0ffd2bea4cf..cd4da24f7bc 100644 --- a/modules/nf-core/wisecondorx/gender/meta.yml +++ b/modules/nf-core/wisecondorx/gender/meta.yml @@ -11,7 +11,7 @@ tools: documentation: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" tool_dev_url: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" doi: "10.1093/nar/gky1263" - licence: "['Attribution-NonCommercial-ShareAlike CC BY-NC-SA']" + licence: ["Attribution-NonCommercial-ShareAlike CC BY-NC-SA"] input: - meta: type: map diff --git a/modules/nf-core/wisecondorx/gender/tests/main.nf.test b/modules/nf-core/wisecondorx/gender/tests/main.nf.test new file mode 100644 index 00000000000..2dbb609e0ed --- /dev/null +++ b/modules/nf-core/wisecondorx/gender/tests/main.nf.test @@ -0,0 +1,56 @@ +nextflow_process { + + name "Test Process WISECONDORX_GENDER" + script "../main.nf" + process "WISECONDORX_GENDER" + + tag "modules" + tag "modules_nfcore" + tag "wisecondorx" + tag "wisecondorx/gender" + tag "wisecondorx/convert" + + test("sarscov2 - bam, bai, reference") { + + options "-stub" + // Stub tests because the reference needs to be made of 30 full CRAMs, which gets too big + + setup { + run("WISECONDORX_CONVERT") { + script "../../convert/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) + ]) + input[1] = [[], []] + input[2] = [[], []] + """ + } + } + } + + when { + process { + """ + input[0] = WISECONDORX_CONVERT.out.npz + input[1] = [ + [ id: "reference" ], + file("reference.npz") + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/wisecondorx/gender/tests/main.nf.test.snap b/modules/nf-core/wisecondorx/gender/tests/main.nf.test.snap new file mode 100644 index 00000000000..62cbe9a14a6 --- /dev/null +++ b/modules/nf-core/wisecondorx/gender/tests/main.nf.test.snap @@ -0,0 +1,37 @@ +{ + "sarscov2 - bam, bai, reference": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "male\n" + ] + ], + "1": [ + "versions.yml:md5,ee69f2b69802dc591fe3cb26e94a17bc" + ], + "gender": [ + [ + { + "id": "test", + "single_end": false + }, + "male\n" + ] + ], + "versions": [ + "versions.yml:md5,ee69f2b69802dc591fe3cb26e94a17bc" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-19T11:09:38.223832474" + } +} \ No newline at end of file diff --git a/modules/nf-core/wisecondorx/gender/tests/tags.yml b/modules/nf-core/wisecondorx/gender/tests/tags.yml new file mode 100644 index 00000000000..a2aaf0acbd5 --- /dev/null +++ b/modules/nf-core/wisecondorx/gender/tests/tags.yml @@ -0,0 +1,2 @@ +wisecondorx/gender: + - "modules/nf-core/wisecondorx/gender/**" diff --git a/modules/nf-core/wisecondorx/newref/meta.yml b/modules/nf-core/wisecondorx/newref/meta.yml index 8229904596b..d5efefeb53f 100644 --- a/modules/nf-core/wisecondorx/newref/meta.yml +++ b/modules/nf-core/wisecondorx/newref/meta.yml @@ -11,7 +11,7 @@ tools: documentation: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" tool_dev_url: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" doi: "10.1093/nar/gky1263" - licence: "['Attribution-NonCommercial-ShareAlike CC BY-NC-SA']" + licence: ["Attribution-NonCommercial-ShareAlike CC BY-NC-SA"] input: - meta: type: map diff --git a/modules/nf-core/wisecondorx/newref/tests/main.nf.test b/modules/nf-core/wisecondorx/newref/tests/main.nf.test new file mode 100644 index 00000000000..4ce93700d04 --- /dev/null +++ b/modules/nf-core/wisecondorx/newref/tests/main.nf.test @@ -0,0 +1,65 @@ +nextflow_process { + + name "Test Process WISECONDORX_NEWREF" + script "../main.nf" + process "WISECONDORX_NEWREF" + + tag "modules" + tag "modules_nfcore" + tag "wisecondorx" + tag "wisecondorx/newref" + tag "wisecondorx/convert" + + test("homo_sapiens - [npz]") { + + // Stub run because this process needs at least 30 samples to succesfully run + options "-stub" + + setup { + run("WISECONDORX_CONVERT") { + script "../../convert/main.nf" + process { + """ + input[0] = Channel.of([ + [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) + ], + [ + [ id: 'test2' ], + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam_bai'], checkIfExists: true) + ]) + input[1] = [[],[]] + input[2] = [[],[]] + """ + } + } + } + + when { + process { + """ + input[0] = WISECONDORX_CONVERT.out.npz + .map { meta, npz -> + new_meta = meta + [id:"combined"] + [new_meta, npz] + } + .groupTuple() + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.npz.collect { it.collect { it instanceof Map ? it : file(it).name }} + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/wisecondorx/newref/tests/main.nf.test.snap b/modules/nf-core/wisecondorx/newref/tests/main.nf.test.snap new file mode 100644 index 00000000000..911cf7a983c --- /dev/null +++ b/modules/nf-core/wisecondorx/newref/tests/main.nf.test.snap @@ -0,0 +1,22 @@ +{ + "homo_sapiens - [npz]": { + "content": [ + [ + "versions.yml:md5,76cc7a445641380597ca00dfb5722c92" + ], + [ + [ + { + "id": "combined" + }, + "combined.npz" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-19T10:39:17.199036914" + } +} \ No newline at end of file diff --git a/modules/nf-core/wisecondorx/newref/tests/nextflow.config b/modules/nf-core/wisecondorx/newref/tests/nextflow.config new file mode 100644 index 00000000000..ddbf6b7aed6 --- /dev/null +++ b/modules/nf-core/wisecondorx/newref/tests/nextflow.config @@ -0,0 +1,4 @@ +process { + withName: WISECONDORX_CONVERT { + } +} \ No newline at end of file diff --git a/modules/nf-core/wisecondorx/newref/tests/tags.yml b/modules/nf-core/wisecondorx/newref/tests/tags.yml new file mode 100644 index 00000000000..cbe819213aa --- /dev/null +++ b/modules/nf-core/wisecondorx/newref/tests/tags.yml @@ -0,0 +1,2 @@ +wisecondorx/newref: + - "modules/nf-core/wisecondorx/newref/**" diff --git a/modules/nf-core/wisecondorx/predict/meta.yml b/modules/nf-core/wisecondorx/predict/meta.yml index bb2313e0dba..0f347ee36d4 100644 --- a/modules/nf-core/wisecondorx/predict/meta.yml +++ b/modules/nf-core/wisecondorx/predict/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" tool_dev_url: "https://github.com/CenterForMedicalGeneticsGhent/WisecondorX" doi: "10.1093/nar/gky1263" - licence: "['Attribution-NonCommercial-ShareAlike CC BY-NC-SA']" + licence: ["Attribution-NonCommercial-ShareAlike CC BY-NC-SA"] input: - meta: type: map @@ -51,7 +51,7 @@ output: type: file description: File containing software versions pattern: "versions.yml" - - abberations_bed: + - aberrations_bed: type: file description: OPTIONAL - Output abberations in BED format. This gets created with the `--bed` option pattern: "*_aberrations.bed" diff --git a/modules/nf-core/wisecondorx/predict/tests/main.nf.test b/modules/nf-core/wisecondorx/predict/tests/main.nf.test new file mode 100644 index 00000000000..27b47525633 --- /dev/null +++ b/modules/nf-core/wisecondorx/predict/tests/main.nf.test @@ -0,0 +1,65 @@ +nextflow_process { + + name "Test Process WISECONDORX_PREDICT" + script "../main.nf" + process "WISECONDORX_PREDICT" + + tag "modules" + tag "modules_nfcore" + tag "wisecondorx" + tag "wisecondorx/predict" + tag "wisecondorx/convert" + + test("sarscov2 - npz, reference, []") { + + // Stub because the reference is too large + options "-stub" + + setup { + run("WISECONDORX_CONVERT") { + script "../../convert/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) + ] + input[1] = [[], []] + input[2] = [[], []] + """ + } + } + } + + when { + process { + """ + input[0] = WISECONDORX_CONVERT.out.npz + input[1] = [ + [ id:'reference' ], + file("reference.npz") + ] + input[2] = [[], []] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.aberrations_bed.collect { it.collect { it instanceof Map ? it : file(it).name }}, + process.out.bins_bed.collect { it.collect { it instanceof Map ? it : file(it).name }}, + process.out.segments_bed.collect { it.collect { it instanceof Map ? it : file(it).name }}, + process.out.chr_statistics.collect { it.collect { it instanceof Map ? it : file(it).name }}, + process.out.chr_plots.collect { it.collect { it instanceof Map ? it : it.collect { file(it).name } }}, + process.out.genome_plot.collect { it.collect { it instanceof Map ? it : file(it).name }} + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/wisecondorx/predict/tests/main.nf.test.snap b/modules/nf-core/wisecondorx/predict/tests/main.nf.test.snap new file mode 100644 index 00000000000..eefd97eb2cd --- /dev/null +++ b/modules/nf-core/wisecondorx/predict/tests/main.nf.test.snap @@ -0,0 +1,65 @@ +{ + "sarscov2 - npz, reference, []": { + "content": [ + [ + "versions.yml:md5,b23cede31804c7e833df43254983c387" + ], + [ + [ + { + "id": "test" + }, + "test_aberrations.bed" + ] + ], + [ + [ + { + "id": "test" + }, + "test_bins.bed" + ] + ], + [ + [ + { + "id": "test" + }, + "test_segments.bed" + ] + ], + [ + [ + { + "id": "test" + }, + "test_chr_statistics.txt" + ] + ], + [ + [ + { + "id": "test" + }, + [ + "chr1.png", + "chr22.png" + ] + ] + ], + [ + [ + { + "id": "test" + }, + "genome_wide.png" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "24.02.0" + }, + "timestamp": "2024-03-19T11:20:04.150585302" + } +} \ No newline at end of file diff --git a/modules/nf-core/wisecondorx/predict/tests/tags.yml b/modules/nf-core/wisecondorx/predict/tests/tags.yml new file mode 100644 index 00000000000..e65cbf96d0c --- /dev/null +++ b/modules/nf-core/wisecondorx/predict/tests/tags.yml @@ -0,0 +1,2 @@ +wisecondorx/predict: + - "modules/nf-core/wisecondorx/predict/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index d91677f373c..85ec8d8253d 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -2394,15 +2394,6 @@ wgsim: whamg: - modules/nf-core/whamg/** - tests/modules/nf-core/whamg/** -wisecondorx/convert: - - modules/nf-core/wisecondorx/convert/** - - tests/modules/nf-core/wisecondorx/convert/** -wisecondorx/newref: - - modules/nf-core/wisecondorx/newref/** - - tests/modules/nf-core/wisecondorx/newref/** -wisecondorx/predict: - - modules/nf-core/wisecondorx/predict/** - - tests/modules/nf-core/wisecondorx/predict/** yahs: - modules/nf-core/yahs/** - tests/modules/nf-core/yahs/** diff --git a/tests/modules/nf-core/wisecondorx/convert/main.nf b/tests/modules/nf-core/wisecondorx/convert/main.nf deleted file mode 100644 index 732318aa36f..00000000000 --- a/tests/modules/nf-core/wisecondorx/convert/main.nf +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { WISECONDORX_CONVERT } from '../../../../../modules/nf-core/wisecondorx/convert/main.nf' - -workflow test_wisecondorx_convert_bam { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) - ] - - WISECONDORX_CONVERT ( - input, - [[],[]], - [[],[]] - ) -} - -workflow test_wisecondorx_convert_cram { - - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_cram_crai'], checkIfExists: true) - ] - - fasta = [ - [ id:'test' ], - file(params.test_data['homo_sapiens']['genome']['genome_fasta'], checkIfExists: true) - ] - - fasta_fai = [ - [ id:'test' ], - file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) - ] - - WISECONDORX_CONVERT ( - input, - fasta, - fasta_fai - ) -} diff --git a/tests/modules/nf-core/wisecondorx/convert/nextflow.config b/tests/modules/nf-core/wisecondorx/convert/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/wisecondorx/convert/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/wisecondorx/convert/test.yml b/tests/modules/nf-core/wisecondorx/convert/test.yml deleted file mode 100644 index 4be8fcbe287..00000000000 --- a/tests/modules/nf-core/wisecondorx/convert/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: wisecondorx convert test_wisecondorx_convert_bam - command: nextflow run ./tests/modules/nf-core/wisecondorx/convert -entry test_wisecondorx_convert_bam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/wisecondorx/convert/nextflow.config - tags: - - wisecondorx/convert - - wisecondorx - files: - - path: output/wisecondorx/test.npz - md5sum: 00c8acf1727e9eb78e56bce28b09ee3b - - path: output/wisecondorx/versions.yml - -- name: wisecondorx convert test_wisecondorx_convert_cram - command: nextflow run ./tests/modules/nf-core/wisecondorx/convert -entry test_wisecondorx_convert_cram -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/wisecondorx/convert/nextflow.config - tags: - - wisecondorx/convert - - wisecondorx - files: - - path: output/wisecondorx/test.npz - md5sum: 154337aa93ceddf15ea7382969588524 - - path: output/wisecondorx/versions.yml diff --git a/tests/modules/nf-core/wisecondorx/gender/main.nf b/tests/modules/nf-core/wisecondorx/gender/main.nf deleted file mode 100644 index 7a690fc5023..00000000000 --- a/tests/modules/nf-core/wisecondorx/gender/main.nf +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { WISECONDORX_GENDER } from '../../../../../modules/nf-core/wisecondorx/gender/main.nf' -include { WISECONDORX_CONVERT } from '../../../../../modules/nf-core/wisecondorx/convert/main.nf' - -workflow test_wisecondorx_gender { - - input = Channel.of([ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) - ]) - - WISECONDORX_CONVERT( - input, - [[], []], - [[], []] - ) - - reference = [ - [ id: "reference" ], - file("reference.npz") - ] - - WISECONDORX_GENDER( - WISECONDORX_CONVERT.out.npz, - reference - ) -} diff --git a/tests/modules/nf-core/wisecondorx/gender/nextflow.config b/tests/modules/nf-core/wisecondorx/gender/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/wisecondorx/gender/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/wisecondorx/gender/test.yml b/tests/modules/nf-core/wisecondorx/gender/test.yml deleted file mode 100644 index 74a7765f430..00000000000 --- a/tests/modules/nf-core/wisecondorx/gender/test.yml +++ /dev/null @@ -1,7 +0,0 @@ -- name: "wisecondorx gender" - command: nextflow run ./tests/modules/nf-core/wisecondorx/gender -entry test_wisecondorx_gender -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/wisecondorx/gender/nextflow.config -stub - tags: - - "wisecondorx" - - "wisecondorx/gender" - files: - - path: "output/wisecondorx/versions.yml" diff --git a/tests/modules/nf-core/wisecondorx/newref/main.nf b/tests/modules/nf-core/wisecondorx/newref/main.nf deleted file mode 100644 index d2a05fb20dd..00000000000 --- a/tests/modules/nf-core/wisecondorx/newref/main.nf +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { WISECONDORX_NEWREF } from '../../../../../modules/nf-core/wisecondorx/newref/main.nf' -include { WISECONDORX_CONVERT } from '../../../../../modules/nf-core/wisecondorx/convert/main.nf' - -workflow test_wisecondorx_newref { - - input = Channel.of([ - [ id:'test' ], // meta map - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) - ], - [ - [ id: 'test2' ], - file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['homo_sapiens']['illumina']['test2_paired_end_sorted_bam_bai'], checkIfExists: true) - ]) - - WISECONDORX_CONVERT( - input, - [[],[]], - [[],[]] - ) - - WISECONDORX_CONVERT.out.npz - .map { meta, npz -> - new_meta = meta + [id:"combined"] - [new_meta, npz] - } - .groupTuple() - .set { newref_input } - - WISECONDORX_NEWREF ( newref_input ) -} diff --git a/tests/modules/nf-core/wisecondorx/newref/nextflow.config b/tests/modules/nf-core/wisecondorx/newref/nextflow.config deleted file mode 100644 index da1e4521ee6..00000000000 --- a/tests/modules/nf-core/wisecondorx/newref/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: WISECONDORX_CONVERT { - publishDir = [enabled:false] - } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/wisecondorx/newref/test.yml b/tests/modules/nf-core/wisecondorx/newref/test.yml deleted file mode 100644 index 1b801d03b4c..00000000000 --- a/tests/modules/nf-core/wisecondorx/newref/test.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: "wisecondorx newref" - command: nextflow run ./tests/modules/nf-core/wisecondorx/newref -entry test_wisecondorx_newref -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/wisecondorx/newref/nextflow.config -stub - tags: - - "wisecondorx" - - "wisecondorx/newref" - files: - - path: "output/wisecondorx/combined.npz" - - path: "output/wisecondorx/versions.yml" diff --git a/tests/modules/nf-core/wisecondorx/predict/main.nf b/tests/modules/nf-core/wisecondorx/predict/main.nf deleted file mode 100644 index dfbbbf17b62..00000000000 --- a/tests/modules/nf-core/wisecondorx/predict/main.nf +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { WISECONDORX_PREDICT } from '../../../../../modules/nf-core/wisecondorx/predict/main.nf' -include { WISECONDORX_CONVERT } from '../../../../../modules/nf-core/wisecondorx/convert/main.nf' - -workflow test_wisecondorx_predict { - - sample = [ - [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_single_end_sorted_bam_bai'], checkIfExists: true) - ] - - WISECONDORX_CONVERT ( - sample, - [[],[]], - [[],[]] - ) - - reference = [ - [ id:'reference' ], - file("reference.npz") - ] - - WISECONDORX_PREDICT ( - WISECONDORX_CONVERT.out.npz, - reference, - [[],[]] - ) -} diff --git a/tests/modules/nf-core/wisecondorx/predict/nextflow.config b/tests/modules/nf-core/wisecondorx/predict/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/wisecondorx/predict/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/wisecondorx/predict/test.yml b/tests/modules/nf-core/wisecondorx/predict/test.yml deleted file mode 100644 index 39941b150ca..00000000000 --- a/tests/modules/nf-core/wisecondorx/predict/test.yml +++ /dev/null @@ -1,14 +0,0 @@ -- name: "wisecondorx predict" - command: nextflow run ./tests/modules/nf-core/wisecondorx/predict -entry test_wisecondorx_predict -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/wisecondorx/predict/nextflow.config -stub - tags: - - "wisecondorx" - - "wisecondorx/predict" - files: - - path: "output/wisecondorx/test_aberrations.bed" - - path: "output/wisecondorx/test_bins.bed" - - path: "output/wisecondorx/test_chr_statistics.txt" - - path: "output/wisecondorx/test_segments.bed" - - path: "output/wisecondorx/chr22.png" - - path: "output/wisecondorx/chr1.png" - - path: "output/wisecondorx/genome_wide.png" - - path: "output/wisecondorx/versions.yml" From 176c11c82a322a6882d3c3529d3791e823b6976d Mon Sep 17 00:00:00 2001 From: Felix Lenner <52530259+fellen31@users.noreply.github.com> Date: Tue, 19 Mar 2024 13:00:18 +0100 Subject: [PATCH 12/46] Add nf-test to minimap2 index (#5189) * Add nf-test to minimap2 index * correct tags * remove pytest * remove quotation marks --- .../nf-core/minimap2/index/tests/main.nf.test | 32 +++++++++ .../minimap2/index/tests/main.nf.test.snap | 68 +++++++++++++++++++ modules/nf-core/minimap2/index/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/minimap2/index/main.nf | 12 ---- .../nf-core/minimap2/index/nextflow.config | 5 -- tests/modules/nf-core/minimap2/index/test.yml | 8 --- 7 files changed, 102 insertions(+), 28 deletions(-) create mode 100644 modules/nf-core/minimap2/index/tests/main.nf.test create mode 100644 modules/nf-core/minimap2/index/tests/main.nf.test.snap create mode 100644 modules/nf-core/minimap2/index/tests/tags.yml delete mode 100644 tests/modules/nf-core/minimap2/index/main.nf delete mode 100644 tests/modules/nf-core/minimap2/index/nextflow.config delete mode 100644 tests/modules/nf-core/minimap2/index/test.yml diff --git a/modules/nf-core/minimap2/index/tests/main.nf.test b/modules/nf-core/minimap2/index/tests/main.nf.test new file mode 100644 index 00000000000..97840ff75d0 --- /dev/null +++ b/modules/nf-core/minimap2/index/tests/main.nf.test @@ -0,0 +1,32 @@ +nextflow_process { + + name "Test Process MINIMAP2_INDEX" + script "../main.nf" + process "MINIMAP2_INDEX" + + tag "modules" + tag "modules_nfcore" + tag "minimap2" + tag "minimap2/index" + + test("minimap2 index") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assert process.success + assert snapshot(process.out).match() + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/minimap2/index/tests/main.nf.test.snap b/modules/nf-core/minimap2/index/tests/main.nf.test.snap new file mode 100644 index 00000000000..454c834f216 --- /dev/null +++ b/modules/nf-core/minimap2/index/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + [ + { + "id": "test_ref" + }, + "genome.mmi:md5,72e450f12dc691e763c697463bdb1571" + ] + ], + "1": [ + "versions.yml:md5,0fced0ee8015e7f50b82566e3db8f7b0" + ], + "index": [ + [ + { + "id": "test_ref" + }, + "genome.mmi:md5,72e450f12dc691e763c697463bdb1571" + ] + ], + "versions": [ + "versions.yml:md5,0fced0ee8015e7f50b82566e3db8f7b0" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T11:46:30.000058092" + }, + "minimap2 index": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "genome.mmi:md5,72e450f12dc691e763c697463bdb1571" + ] + ], + "1": [ + "versions.yml:md5,0fced0ee8015e7f50b82566e3db8f7b0" + ], + "index": [ + [ + { + "id": "test" + }, + "genome.mmi:md5,72e450f12dc691e763c697463bdb1571" + ] + ], + "versions": [ + "versions.yml:md5,0fced0ee8015e7f50b82566e3db8f7b0" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T13:41:53.865122291" + } +} \ No newline at end of file diff --git a/modules/nf-core/minimap2/index/tests/tags.yml b/modules/nf-core/minimap2/index/tests/tags.yml new file mode 100644 index 00000000000..e5ef8e19f3f --- /dev/null +++ b/modules/nf-core/minimap2/index/tests/tags.yml @@ -0,0 +1,2 @@ +minimap2/index: + - modules/nf-core/minimap2/index/** diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 85ec8d8253d..fa95fc6f07e 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1361,9 +1361,6 @@ minia: miniasm: - modules/nf-core/miniasm/** - tests/modules/nf-core/miniasm/** -minimap2/index: - - modules/nf-core/minimap2/index/** - - tests/modules/nf-core/minimap2/index/** miniprot/align: - modules/miniprot/align/** - tests/modules/miniprot/align/** diff --git a/tests/modules/nf-core/minimap2/index/main.nf b/tests/modules/nf-core/minimap2/index/main.nf deleted file mode 100644 index 212bb64e0ee..00000000000 --- a/tests/modules/nf-core/minimap2/index/main.nf +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { MINIMAP2_INDEX } from '../../../../../modules/nf-core/minimap2/index/main.nf' - -workflow test_minimap2_index { - - fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - - MINIMAP2_INDEX ( [ [id:'test'], fasta ] ) -} diff --git a/tests/modules/nf-core/minimap2/index/nextflow.config b/tests/modules/nf-core/minimap2/index/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/minimap2/index/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/minimap2/index/test.yml b/tests/modules/nf-core/minimap2/index/test.yml deleted file mode 100644 index a2e0199b8f0..00000000000 --- a/tests/modules/nf-core/minimap2/index/test.yml +++ /dev/null @@ -1,8 +0,0 @@ -- name: minimap2 index - command: nextflow run ./tests/modules/nf-core/minimap2/index -entry test_minimap2_index -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/minimap2/index/nextflow.config - tags: - - minimap2 - - minimap2/index - files: - - path: ./output/minimap2/genome.mmi - md5sum: 72e450f12dc691e763c697463bdb1571 From 0fe30831abbc2ed115e46e92330edf38f56edc3d Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Tue, 19 Mar 2024 13:01:20 +0100 Subject: [PATCH 13/46] add cram support to bowtie2 (#5180) * add cram support to bowtie2 * fix tests * fastq_align_bowtie2 > nf-test * fix tests * more robust test * fix cram tests --- modules/nf-core/bowtie2/align/main.nf | 26 ++- .../bowtie2/align/tests/cram_crai.config | 5 + .../nf-core/bowtie2/align/tests/main.nf.test | 162 +++++++++---- .../bowtie2/align/tests/main.nf.test.snap | 216 +++++++++++------- .../nf-core/fastq_align_bowtie2/main.nf | 6 +- .../fastq_align_bowtie2/tests/main.nf.test | 99 ++++++++ .../tests/main.nf.test.snap | 126 ++++++++++ .../tests}/nextflow.config | 9 - .../fastq_align_bowtie2/tests/tags.yml | 2 + subworkflows/nf-core/fastq_align_dna/main.nf | 12 +- tests/config/pytest_modules.yml | 3 - .../nf-core/fastq_align_bowtie2/main.nf | 44 ---- .../nf-core/fastq_align_bowtie2/test.yml | 63 ----- 13 files changed, 507 insertions(+), 266 deletions(-) create mode 100644 modules/nf-core/bowtie2/align/tests/cram_crai.config create mode 100644 subworkflows/nf-core/fastq_align_bowtie2/tests/main.nf.test create mode 100644 subworkflows/nf-core/fastq_align_bowtie2/tests/main.nf.test.snap rename {tests/subworkflows/nf-core/fastq_align_bowtie2 => subworkflows/nf-core/fastq_align_bowtie2/tests}/nextflow.config (56%) create mode 100644 subworkflows/nf-core/fastq_align_bowtie2/tests/tags.yml delete mode 100644 tests/subworkflows/nf-core/fastq_align_bowtie2/main.nf delete mode 100644 tests/subworkflows/nf-core/fastq_align_bowtie2/test.yml diff --git a/modules/nf-core/bowtie2/align/main.nf b/modules/nf-core/bowtie2/align/main.nf index 8c405ee386c..96a7027ddbe 100644 --- a/modules/nf-core/bowtie2/align/main.nf +++ b/modules/nf-core/bowtie2/align/main.nf @@ -10,13 +10,18 @@ process BOWTIE2_ALIGN { input: tuple val(meta) , path(reads) tuple val(meta2), path(index) + tuple val(meta3), path(fasta) val save_unaligned val sort_bam output: - tuple val(meta), path("*.{bam,sam}"), emit: aligned + tuple val(meta), path("*.sam") , emit: sam , optional:true + tuple val(meta), path("*.bam") , emit: bam , optional:true + tuple val(meta), path("*.cram") , emit: cram , optional:true + tuple val(meta), path("*.csi") , emit: csi , optional:true + tuple val(meta), path("*.crai") , emit: crai , optional:true tuple val(meta), path("*.log") , emit: log - tuple val(meta), path("*fastq.gz") , emit: fastq, optional:true + tuple val(meta), path("*fastq.gz") , emit: fastq , optional:true path "versions.yml" , emit: versions when: @@ -39,7 +44,10 @@ process BOWTIE2_ALIGN { def samtools_command = sort_bam ? 'sort' : 'view' def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/ - def extension = (args2 ==~ extension_pattern) ? (args2 =~ extension_pattern)[0][2].toLowerCase() : "bam" + def extension_matcher = (args2 =~ extension_pattern) + def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" """ INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/\\.rev.1.bt2\$//"` @@ -53,7 +61,7 @@ process BOWTIE2_ALIGN { $unaligned \\ $args \\ 2> >(tee ${prefix}.bowtie2.log >&2) \\ - | samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.${extension} - + | samtools $samtools_command $args2 --threads $task.cpus ${reference} -o ${prefix}.${extension} - if [ -f ${prefix}.unmapped.fastq.1.gz ]; then mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz @@ -82,9 +90,19 @@ process BOWTIE2_ALIGN { } else { create_unmapped = save_unaligned ? "touch ${prefix}.unmapped_1.fastq.gz && touch ${prefix}.unmapped_2.fastq.gz" : "" } + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" + + def create_index = "" + if (extension == "cram") { + create_index = "touch ${prefix}.crai" + } else if (extension == "bam") { + create_index = "touch ${prefix}.csi" + } """ touch ${prefix}.${extension} + ${create_index} touch ${prefix}.bowtie2.log ${create_unmapped} diff --git a/modules/nf-core/bowtie2/align/tests/cram_crai.config b/modules/nf-core/bowtie2/align/tests/cram_crai.config new file mode 100644 index 00000000000..03f1d5e511f --- /dev/null +++ b/modules/nf-core/bowtie2/align/tests/cram_crai.config @@ -0,0 +1,5 @@ +process { + withName: BOWTIE2_ALIGN { + ext.args2 = '--output-fmt cram --write-index' + } +} diff --git a/modules/nf-core/bowtie2/align/tests/main.nf.test b/modules/nf-core/bowtie2/align/tests/main.nf.test index a478d17b542..03aeaf9eef3 100644 --- a/modules/nf-core/bowtie2/align/tests/main.nf.test +++ b/modules/nf-core/bowtie2/align/tests/main.nf.test @@ -6,9 +6,10 @@ nextflow_process { tag "modules" tag "modules_nfcore" tag "bowtie2" + tag "bowtie2/build" tag "bowtie2/align" - test("sarscov2 - fastq, index, false, false - bam") { + test("sarscov2 - fastq, index, fasta, false, false - bam") { setup { run("BOWTIE2_BUILD") { @@ -32,8 +33,9 @@ nextflow_process { file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -42,7 +44,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -52,7 +54,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, false, false - sam") { + test("sarscov2 - fastq, index, fasta, false, false - sam") { config "./sam.config" setup { @@ -77,8 +79,9 @@ nextflow_process { file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -87,7 +90,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).readLines()[0..4], + file(process.out.sam[0][1]).readLines()[0..4], process.out.log, process.out.fastq, process.out.versions @@ -97,7 +100,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, false, false - sam2") { + test("sarscov2 - fastq, index, fasta, false, false - sam2") { config "./sam2.config" setup { @@ -122,8 +125,9 @@ nextflow_process { file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -132,7 +136,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).readLines()[0..4], + file(process.out.sam[0][1]).readLines()[0..4], process.out.log, process.out.fastq, process.out.versions @@ -142,7 +146,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, false, true - bam") { + test("sarscov2 - fastq, index, fasta, false, true - bam") { setup { run("BOWTIE2_BUILD") { @@ -166,8 +170,9 @@ nextflow_process { file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = true //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -176,7 +181,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -186,7 +191,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, false, false - bam") { + test("sarscov2 - [fastq1, fastq2], index, fasta, false, false - bam") { setup { run("BOWTIE2_BUILD") { @@ -213,8 +218,9 @@ nextflow_process { ] ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -223,7 +229,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -233,7 +239,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, false, true - bam") { + test("sarscov2 - [fastq1, fastq2], index, fasta, false, true - bam") { setup { run("BOWTIE2_BUILD") { @@ -260,8 +266,9 @@ nextflow_process { ] ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = true //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -270,7 +277,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -280,7 +287,7 @@ nextflow_process { } - test("sarscov2 - fastq, large_index, false, false - bam") { + test("sarscov2 - fastq, large_index, fasta, false, false - bam") { config "./large_index.config" setup { @@ -305,8 +312,9 @@ nextflow_process { file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -315,7 +323,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -325,7 +333,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], large_index, false, false - bam") { + test("sarscov2 - [fastq1, fastq2], large_index, fasta, false, false - bam") { config "./large_index.config" setup { @@ -353,8 +361,9 @@ nextflow_process { ] ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -363,7 +372,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -373,7 +382,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, true, false - bam") { + test("sarscov2 - [fastq1, fastq2], index, fasta, true, false - bam") { setup { run("BOWTIE2_BUILD") { @@ -400,8 +409,9 @@ nextflow_process { ] ] input[1] = BOWTIE2_BUILD.out.index - input[2] = true //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -410,7 +420,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -420,7 +430,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, true, false - bam") { + test("sarscov2 - fastq, index, fasta, true, false - bam") { setup { run("BOWTIE2_BUILD") { @@ -444,8 +454,9 @@ nextflow_process { file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] input[1] = BOWTIE2_BUILD.out.index - input[2] = true //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -454,7 +465,7 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, process.out.log, process.out.fastq, process.out.versions @@ -465,7 +476,54 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, false, false - stub") { + test("sarscov2 - [fastq1, fastq2], index, fasta, true, true - cram") { + + config "./cram_crai.config" + setup { + run("BOWTIE2_BUILD") { + script "../../build/main.nf" + process { + """ + input[0] = [ + [ id:'test'], + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_2_fastq_gz'], checkIfExists: true) + ] + ] + input[1] = BOWTIE2_BUILD.out.index + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = true //sort + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot( + file(process.out.cram[0][1]).name, + file(process.out.crai[0][1]).name + ).match() } + ) + } + + } + + test("sarscov2 - [fastq1, fastq2], index, fasta, false, false - stub") { options "-stub" setup { @@ -493,8 +551,9 @@ nextflow_process { ] ] input[1] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -503,7 +562,8 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, + file(process.out.csi[0][1]).name, file(process.out.log[0][1]).name, process.out.fastq, process.out.versions @@ -513,7 +573,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, true, false - stub") { + test("sarscov2 - fastq, index, fasta, true, false - stub") { options "-stub" setup { @@ -538,8 +598,9 @@ nextflow_process { file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ] input[1] = BOWTIE2_BUILD.out.index - input[2] = true //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + input[3] = false //save_unaligned + input[4] = false //sort """ } } @@ -548,14 +609,15 @@ nextflow_process { assertAll ( { assert process.success }, { assert snapshot( - file(process.out.aligned[0][1]).name, + file(process.out.bam[0][1]).name, + file(process.out.csi[0][1]).name, file(process.out.log[0][1]).name, - file(process.out.fastq[0][1]).name, + process.out.fastq, process.out.versions ).match() } ) } } - + } diff --git a/modules/nf-core/bowtie2/align/tests/main.nf.test.snap b/modules/nf-core/bowtie2/align/tests/main.nf.test.snap index 883dc7ecba1..028e7da6898 100644 --- a/modules/nf-core/bowtie2/align/tests/main.nf.test.snap +++ b/modules/nf-core/bowtie2/align/tests/main.nf.test.snap @@ -1,34 +1,38 @@ { - "sarscov2 - fastq, index, false, false - sam2": { + "sarscov2 - [fastq1, fastq2], large_index, fasta, false, false - bam": { "content": [ - [ - "ERR5069949.2151832\t16\tMT192765.1\t17453\t42\t150M\t*\t0\t0\tACGCACATTGCTAACTAAGGGCACACTAGAACCAGAATATTTCAATTCAGTGTGTAGACTTATGAAAACTATAGGTCCAGACATGTTCCTCGGAACTTGTCGGCGTTGTCCTGCTGAAATTGTTGACACTGTGAGTGCTTTGGTTTATGA\tAAAA Date: Tue, 19 Mar 2024 09:32:11 -0300 Subject: [PATCH 14/46] Added module ALE (#5211) * Added ale module * remove test specific config file * fix typo in meta yaml file * conda matplotlib package version fixed * corrections due PR suggestions --- modules/nf-core/ale/environment.yml | 10 ++ modules/nf-core/ale/main.nf | 50 +++++++ modules/nf-core/ale/meta.yml | 51 +++++++ modules/nf-core/ale/tests/main.nf.test | 108 +++++++++++++++ modules/nf-core/ale/tests/main.nf.test.snap | 142 ++++++++++++++++++++ modules/nf-core/ale/tests/tags.yml | 2 + 6 files changed, 363 insertions(+) create mode 100644 modules/nf-core/ale/environment.yml create mode 100644 modules/nf-core/ale/main.nf create mode 100644 modules/nf-core/ale/meta.yml create mode 100644 modules/nf-core/ale/tests/main.nf.test create mode 100644 modules/nf-core/ale/tests/main.nf.test.snap create mode 100644 modules/nf-core/ale/tests/tags.yml diff --git a/modules/nf-core/ale/environment.yml b/modules/nf-core/ale/environment.yml new file mode 100644 index 00000000000..c6e2efc2dba --- /dev/null +++ b/modules/nf-core/ale/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "ale" +channels: + - conda-forge + - bioconda + - defaults + - tanghaibao +dependencies: + - "bioconda::ale=20180904" diff --git a/modules/nf-core/ale/main.nf b/modules/nf-core/ale/main.nf new file mode 100644 index 00000000000..24c452040b1 --- /dev/null +++ b/modules/nf-core/ale/main.nf @@ -0,0 +1,50 @@ +process ALE { + tag "$meta.id" + label 'process_single' + + // WARN: Version information not provided by tool on CLI. Please update version string below when bumping container versions. + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/ale:20180904--py27ha92aebf_0': + 'biocontainers/ale:20180904--py27ha92aebf_0' }" + + input: + tuple val(meta), path(asm), path(bam) + + output: + tuple val(meta), path("*_ALEoutput.txt"), emit: ale + 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 VERSION = '20180904' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + """ + ALE \\ + $args \\ + $bam \\ + $asm \\ + ${prefix}_ALEoutput.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ale: $VERSION + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def VERSION = '20180904' // WARN: Version information not provided by tool on CLI. Please update this string when bumping container versions. + """ + touch ${prefix}_ALEoutput.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + ale: $VERSION + END_VERSIONS + """ +} diff --git a/modules/nf-core/ale/meta.yml b/modules/nf-core/ale/meta.yml new file mode 100644 index 00000000000..6191741e1ea --- /dev/null +++ b/modules/nf-core/ale/meta.yml @@ -0,0 +1,51 @@ +--- +name: "ale" +description: "ALE: assembly likelihood estimator." +keywords: + - reference-independent + - assembly + - evaluation +tools: + - "ale": + description: "ALE is a generic assembly likelihood evaluation framework for assessing the accuracy of genome and metagenome assemblies." + documentation: "https://portal.nersc.gov/dna/RD/Adv-Seq/ALE-doc/index.html#document-install" + tool_dev_url: "https://github.com/sc932/ALE" + doi: "10.1093/bioinformatics/bts723" + licence: ["NCSA"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - asm: + type: file + description: Assembly in FASTA format + pattern: "*.{fasta,fa}" + + - bam: + type: file + description: BAM file containing sorted read mappings + pattern: "*.{bam}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - ale: + type: file + description: Output TXT file containing ALE results + pattern: "*_ALEoutput.{txt}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@rodtheo" +maintainers: + - "@rodtheo" diff --git a/modules/nf-core/ale/tests/main.nf.test b/modules/nf-core/ale/tests/main.nf.test new file mode 100644 index 00000000000..97f1ce8275f --- /dev/null +++ b/modules/nf-core/ale/tests/main.nf.test @@ -0,0 +1,108 @@ +// nf-core modules test ale +nextflow_process { + + name "Test Process ALE" + script "../main.nf" + process "ALE" + + tag "modules" + tag "modules_nfcore" + tag "ale" + + test("sarscov2 [fasta] - paired-end sorted bam") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert path(process.out.ale[0][1]).readLines().first().contains("ALE_score") } + ) + } + + } + + test("sarscov2 [fasta_gz] - paired-end sorted bam") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert path(process.out.ale[0][1]).readLines().first().contains("ALE_score") } + ) + } + + } + + test("sarscov2 [fasta] - single-end sorted bam") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert path(process.out.ale[0][1]).readLines().first().contains("ALE_score") } + ) + } + + } + + test("sarscov2 [fasta_gz] - single-end sorted bam") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:true ], // meta map + file(params.test_data['sarscov2']['genome']['genome_fasta_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert path(process.out.ale[0][1]).readLines().first().contains("ALE_score") } + ) + } + + } + +} diff --git a/modules/nf-core/ale/tests/main.nf.test.snap b/modules/nf-core/ale/tests/main.nf.test.snap new file mode 100644 index 00000000000..64b3e2c7735 --- /dev/null +++ b/modules/nf-core/ale/tests/main.nf.test.snap @@ -0,0 +1,142 @@ +{ + "sarscov2 [fasta_gz] - paired-end sorted bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_ALEoutput.txt:md5,4abcbd60ae1dbf78138c97e5fed97f3e" + ] + ], + "1": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ], + "ale": [ + [ + { + "id": "test", + "single_end": false + }, + "test_ALEoutput.txt:md5,4abcbd60ae1dbf78138c97e5fed97f3e" + ] + ], + "versions": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T09:06:19.589167" + }, + "sarscov2 [fasta] - paired-end sorted bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_ALEoutput.txt:md5,4abcbd60ae1dbf78138c97e5fed97f3e" + ] + ], + "1": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ], + "ale": [ + [ + { + "id": "test", + "single_end": false + }, + "test_ALEoutput.txt:md5,4abcbd60ae1dbf78138c97e5fed97f3e" + ] + ], + "versions": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T09:06:11.683035" + }, + "sarscov2 [fasta_gz] - single-end sorted bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_ALEoutput.txt:md5,fc2e4c521d61c35d69f74ed8294493fb" + ] + ], + "1": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ], + "ale": [ + [ + { + "id": "test", + "single_end": true + }, + "test_ALEoutput.txt:md5,fc2e4c521d61c35d69f74ed8294493fb" + ] + ], + "versions": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T09:06:35.914024" + }, + "sarscov2 [fasta] - single-end sorted bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_ALEoutput.txt:md5,fc2e4c521d61c35d69f74ed8294493fb" + ] + ], + "1": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ], + "ale": [ + [ + { + "id": "test", + "single_end": true + }, + "test_ALEoutput.txt:md5,fc2e4c521d61c35d69f74ed8294493fb" + ] + ], + "versions": [ + "versions.yml:md5,949da9c6297b613b50e24c421576f3f1" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T09:06:27.781196" + } +} \ No newline at end of file diff --git a/modules/nf-core/ale/tests/tags.yml b/modules/nf-core/ale/tests/tags.yml new file mode 100644 index 00000000000..05deeb0c828 --- /dev/null +++ b/modules/nf-core/ale/tests/tags.yml @@ -0,0 +1,2 @@ +ale: + - "modules/nf-core/ale/**" From 7c06e6820fa3918bc28a040e794f8a2b39fabadb Mon Sep 17 00:00:00 2001 From: Jasmin Frangenberg <73216762+jasmezz@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:46:35 +0000 Subject: [PATCH 15/46] Update bakta to 1.9.3 and optimize tests (#5229) Update bakta version and tests --- modules/nf-core/bakta/bakta/environment.yml | 2 +- modules/nf-core/bakta/bakta/main.nf | 4 ++-- .../bakta/bakta/tests/main.nf.test.snap | 10 +++++----- .../bakta/baktadbdownload/environment.yml | 2 +- modules/nf-core/bakta/baktadbdownload/main.nf | 4 ++-- .../bakta/baktadbdownload/tests/main.nf.test | 8 ++++++-- .../baktadbdownload/tests/main.nf.test.snap | 19 ++++++++++++++++--- 7 files changed, 33 insertions(+), 16 deletions(-) diff --git a/modules/nf-core/bakta/bakta/environment.yml b/modules/nf-core/bakta/bakta/environment.yml index a244a7f92d4..efb92265ae0 100644 --- a/modules/nf-core/bakta/bakta/environment.yml +++ b/modules/nf-core/bakta/bakta/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::bakta=1.9.2 + - bioconda::bakta=1.9.3 diff --git a/modules/nf-core/bakta/bakta/main.nf b/modules/nf-core/bakta/bakta/main.nf index 90d4c90774f..7c83d94bf19 100644 --- a/modules/nf-core/bakta/bakta/main.nf +++ b/modules/nf-core/bakta/bakta/main.nf @@ -4,8 +4,8 @@ process BAKTA_BAKTA { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bakta:1.9.2--pyhdfd78af_0' : - 'biocontainers/bakta:1.9.2--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/bakta:1.9.3--pyhdfd78af_0' : + 'biocontainers/bakta:1.9.3--pyhdfd78af_0' }" input: tuple val(meta), path(fasta) diff --git a/modules/nf-core/bakta/bakta/tests/main.nf.test.snap b/modules/nf-core/bakta/bakta/tests/main.nf.test.snap index ba4e2792a51..40e30c36783 100644 --- a/modules/nf-core/bakta/bakta/tests/main.nf.test.snap +++ b/modules/nf-core/bakta/bakta/tests/main.nf.test.snap @@ -2,14 +2,14 @@ "versions": { "content": [ [ - "versions.yml:md5,4b299fc4976606c2b553dab8f670cd42" + "versions.yml:md5,f8b70ceb2a328c25a190699384e6152d" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-27T12:34:11.256486043" + "timestamp": "2024-03-14T09:11:06.657602394" }, "Bakta - stub": { "content": [ @@ -31,7 +31,7 @@ ] ], "10": [ - "versions.yml:md5,4b299fc4976606c2b553dab8f670cd42" + "versions.yml:md5,f8b70ceb2a328c25a190699384e6152d" ], "2": [ [ @@ -178,7 +178,7 @@ ] ], "versions": [ - "versions.yml:md5,4b299fc4976606c2b553dab8f670cd42" + "versions.yml:md5,f8b70ceb2a328c25a190699384e6152d" ] } ], @@ -186,6 +186,6 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-05T13:16:46.663231397" + "timestamp": "2024-03-14T09:11:15.532858932" } } \ No newline at end of file diff --git a/modules/nf-core/bakta/baktadbdownload/environment.yml b/modules/nf-core/bakta/baktadbdownload/environment.yml index 4b108a6a5db..f6a53ff7f8a 100644 --- a/modules/nf-core/bakta/baktadbdownload/environment.yml +++ b/modules/nf-core/bakta/baktadbdownload/environment.yml @@ -4,4 +4,4 @@ channels: - bioconda - defaults dependencies: - - bioconda::bakta=1.9.2 + - bioconda::bakta=1.9.3 diff --git a/modules/nf-core/bakta/baktadbdownload/main.nf b/modules/nf-core/bakta/baktadbdownload/main.nf index 987c67baacb..e512d77df84 100644 --- a/modules/nf-core/bakta/baktadbdownload/main.nf +++ b/modules/nf-core/bakta/baktadbdownload/main.nf @@ -3,8 +3,8 @@ process BAKTA_BAKTADBDOWNLOAD { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/bakta:1.9.2--pyhdfd78af_0' : - 'biocontainers/bakta:1.9.2--pyhdfd78af_0' }" + 'https://depot.galaxyproject.org/singularity/bakta:1.9.3--pyhdfd78af_0' : + 'biocontainers/bakta:1.9.3--pyhdfd78af_0' }" output: path "db*" , emit: db diff --git a/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test index 3af07529034..a5f827f9850 100644 --- a/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test +++ b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test @@ -22,7 +22,8 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert path(process.out.db.get(0)).exists() } + { assert path(process.out.db.get(0)).exists() }, + { assert snapshot(process.out.versions).match() } ) } @@ -42,7 +43,10 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out.db).match("db*") } + { assert snapshot( + process.out.db + + process.out.versions + ).match() } ) } diff --git a/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test.snap b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test.snap index 95f0fcb73a1..b1c822670de 100644 --- a/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test.snap +++ b/modules/nf-core/bakta/baktadbdownload/tests/main.nf.test.snap @@ -1,16 +1,29 @@ { - "db*": { + "Bakta database download": { + "content": [ + [ + "versions.yml:md5,df9b091b08a41b7d5eef95727b7eac29" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T11:34:41.812416438" + }, + "Bakta database download - stub": { "content": [ [ [ - ] + ], + "versions.yml:md5,df9b091b08a41b7d5eef95727b7eac29" ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-02-02T17:02:01.81970378" + "timestamp": "2024-03-19T11:35:01.082923401" } } \ No newline at end of file From 8197aadb55cdd985a8045daa67ccbfc54285a863 Mon Sep 17 00:00:00 2001 From: Evangelos Karatzas <32259775+vagkaratzas@users.noreply.github.com> Date: Tue, 19 Mar 2024 12:57:05 +0000 Subject: [PATCH 16/46] port openms/peakpickerhires to nf-test hackathon march 2023 (#5226) * port openms/peakpickerhires to nf-test hackathon march 2023 * readlines test update * updated the way to call the test file --- .../openms/peakpickerhires/environment.yml | 9 +++ .../nf-core/openms/peakpickerhires/main.nf | 2 +- .../nf-core/openms/peakpickerhires/meta.yml | 2 +- .../openms/peakpickerhires/tests/main.nf.test | 59 +++++++++++++++++++ .../peakpickerhires/tests/main.nf.test.snap | 39 ++++++++++++ .../peakpickerhires/tests/nextflow.config | 5 ++ .../openms/peakpickerhires/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - .../nf-core/openms/peakpickerhires/main.nf | 15 ----- .../openms/peakpickerhires/nextflow.config | 8 --- .../nf-core/openms/peakpickerhires/test.yml | 11 ---- 11 files changed, 116 insertions(+), 39 deletions(-) create mode 100644 modules/nf-core/openms/peakpickerhires/environment.yml create mode 100644 modules/nf-core/openms/peakpickerhires/tests/main.nf.test create mode 100644 modules/nf-core/openms/peakpickerhires/tests/main.nf.test.snap create mode 100644 modules/nf-core/openms/peakpickerhires/tests/nextflow.config create mode 100644 modules/nf-core/openms/peakpickerhires/tests/tags.yml delete mode 100644 tests/modules/nf-core/openms/peakpickerhires/main.nf delete mode 100644 tests/modules/nf-core/openms/peakpickerhires/nextflow.config delete mode 100644 tests/modules/nf-core/openms/peakpickerhires/test.yml diff --git a/modules/nf-core/openms/peakpickerhires/environment.yml b/modules/nf-core/openms/peakpickerhires/environment.yml new file mode 100644 index 00000000000..0d986325418 --- /dev/null +++ b/modules/nf-core/openms/peakpickerhires/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "openms_peakpickerhires" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::openms=3.0.0" diff --git a/modules/nf-core/openms/peakpickerhires/main.nf b/modules/nf-core/openms/peakpickerhires/main.nf index 420c64c5922..9f2f985841b 100644 --- a/modules/nf-core/openms/peakpickerhires/main.nf +++ b/modules/nf-core/openms/peakpickerhires/main.nf @@ -2,7 +2,7 @@ process OPENMS_PEAKPICKERHIRES { tag "$meta.id" label 'process_low' - conda "bioconda::openms=3.0.0" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/openms:3.0.0--h8964181_1' : 'biocontainers/openms:3.0.0--h8964181_1' }" diff --git a/modules/nf-core/openms/peakpickerhires/meta.yml b/modules/nf-core/openms/peakpickerhires/meta.yml index 28765e09f00..0ff2f13afa2 100644 --- a/modules/nf-core/openms/peakpickerhires/meta.yml +++ b/modules/nf-core/openms/peakpickerhires/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://openms.readthedocs.io/en/latest/index.html" tool_dev_url: "https://github.com/OpenMS/OpenMS" doi: "10.1038/nmeth.3959" - licence: "['BSD']" + licence: ["BSD"] input: - meta: diff --git a/modules/nf-core/openms/peakpickerhires/tests/main.nf.test b/modules/nf-core/openms/peakpickerhires/tests/main.nf.test new file mode 100644 index 00000000000..df2071c4d7b --- /dev/null +++ b/modules/nf-core/openms/peakpickerhires/tests/main.nf.test @@ -0,0 +1,59 @@ +nextflow_process { + + name "Test Process OPENMS_PEAKPICKERHIRES" + script "../main.nf" + process "OPENMS_PEAKPICKERHIRES" + config "./nextflow.config" + tag "modules" + tag "modules_nfcore" + tag "openms" + tag "openms/peakpickerhires" + + test("proteomics - mzML") { + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'proteomics/msspectra/peakpicker_tutorial_1.mzML', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.mzml.get(0).get(1)).readLines().contains('\t\t\t') }, + { assert snapshot(process.out.versions).match() } + ) + } + + } + + test("proteomics - mzML - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test_stub'], // meta map + file(params.modules_testdata_base_path + 'proteomics/msspectra/peakpicker_tutorial_1.mzML', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/openms/peakpickerhires/tests/main.nf.test.snap b/modules/nf-core/openms/peakpickerhires/tests/main.nf.test.snap new file mode 100644 index 00000000000..91b5fce0751 --- /dev/null +++ b/modules/nf-core/openms/peakpickerhires/tests/main.nf.test.snap @@ -0,0 +1,39 @@ +{ + "proteomics - mzML": { + "content": [ + [ + "versions.yml:md5,1d28bc0d306794760f88ff1dadb42e63" + ] + ], + "timestamp": "2024-03-19T10:43:06.147602945" + }, + "proteomics - mzML - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_stub" + }, + "test_stub.mzML:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,1d28bc0d306794760f88ff1dadb42e63" + ], + "mzml": [ + [ + { + "id": "test_stub" + }, + "test_stub.mzML:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,1d28bc0d306794760f88ff1dadb42e63" + ] + } + ], + "timestamp": "2024-03-19T10:43:14.323062817" + } +} \ No newline at end of file diff --git a/modules/nf-core/openms/peakpickerhires/tests/nextflow.config b/modules/nf-core/openms/peakpickerhires/tests/nextflow.config new file mode 100644 index 00000000000..4fb73579418 --- /dev/null +++ b/modules/nf-core/openms/peakpickerhires/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: PEAKPICKERHIRES { + ext.args = '-algorithm:ms_levels 2' + } +} diff --git a/modules/nf-core/openms/peakpickerhires/tests/tags.yml b/modules/nf-core/openms/peakpickerhires/tests/tags.yml new file mode 100644 index 00000000000..a2a584aacd9 --- /dev/null +++ b/modules/nf-core/openms/peakpickerhires/tests/tags.yml @@ -0,0 +1,2 @@ +openms/peakpickerhires: + - "modules/nf-core/openms/peakpickerhires/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4011a5e99d2..453ce335106 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1487,9 +1487,6 @@ oncocnv: openms/idmerger: - modules/nf-core/openms/idmerger/** - tests/modules/nf-core/openms/idmerger/** -openms/peakpickerhires: - - modules/nf-core/openms/peakpickerhires/** - - tests/modules/nf-core/openms/peakpickerhires/** paftools/sam2paf: - modules/nf-core/paftools/sam2paf/** - test/modules/nf-core/paftools/sam2paf/** diff --git a/tests/modules/nf-core/openms/peakpickerhires/main.nf b/tests/modules/nf-core/openms/peakpickerhires/main.nf deleted file mode 100644 index d8db1158e46..00000000000 --- a/tests/modules/nf-core/openms/peakpickerhires/main.nf +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { OPENMS_PEAKPICKERHIRES } from '../../../../../modules/nf-core/openms/peakpickerhires/main.nf' - -workflow test_openms_peakpickerhires { - - input = [ - [ id:'test'], // meta map - file(params.test_data['proteomics']['msspectra']['profile_spectra'], checkIfExists: true) - ] - - OPENMS_PEAKPICKERHIRES ( input ) -} diff --git a/tests/modules/nf-core/openms/peakpickerhires/nextflow.config b/tests/modules/nf-core/openms/peakpickerhires/nextflow.config deleted file mode 100644 index 767368e49a8..00000000000 --- a/tests/modules/nf-core/openms/peakpickerhires/nextflow.config +++ /dev/null @@ -1,8 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: PEAKPICKERHIRES { - ext.args = '-algorithm:ms_levels 2' - } -} diff --git a/tests/modules/nf-core/openms/peakpickerhires/test.yml b/tests/modules/nf-core/openms/peakpickerhires/test.yml deleted file mode 100644 index 6b9dd17d940..00000000000 --- a/tests/modules/nf-core/openms/peakpickerhires/test.yml +++ /dev/null @@ -1,11 +0,0 @@ -- name: openms peakpickerhires test_openms_peakpickerhires - command: nextflow run ./tests/modules/nf-core/openms/peakpickerhires -entry test_openms_peakpickerhires -c ./tests/config/nextflow.config - tags: - - openms/peakpickerhires - - openms - files: - - path: output/openms/test.mzML - # md5sums are not reproducible because PeakPickerHiRes saves the time of execution in the file - contains: - - '' - - path: output/openms/versions.yml From ee7fee68281944b002bd27a8ff3f19200b4d3fad Mon Sep 17 00:00:00 2001 From: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> Date: Tue, 19 Mar 2024 14:05:40 +0100 Subject: [PATCH 17/46] Glimpse2 ligate nftest (#5175) * Move to nf-test * Glimpse2 ligate fix typos * Update lint * Delete old pytest * Update environment conda * Update assertion * Update snap * Update environment.yml --- modules/nf-core/glimpse2/ligate/meta.yml | 2 +- .../glimpse2/ligate/tests/main.nf.test | 76 +++++++++++++++++++ .../glimpse2/ligate/tests/main.nf.test.snap | 14 ++++ .../nf-core/glimpse2/ligate/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/glimpse2/ligate/main.nf | 43 ----------- .../nf-core/glimpse2/ligate/nextflow.config | 3 - .../modules/nf-core/glimpse2/ligate/test.yml | 11 --- tests/modules/nf-core/glimpse2/phase/main.nf | 69 ----------------- .../nf-core/glimpse2/phase/nextflow.config | 5 -- tests/modules/nf-core/glimpse2/phase/test.yml | 30 -------- 11 files changed, 93 insertions(+), 165 deletions(-) create mode 100644 modules/nf-core/glimpse2/ligate/tests/main.nf.test create mode 100644 modules/nf-core/glimpse2/ligate/tests/main.nf.test.snap create mode 100644 modules/nf-core/glimpse2/ligate/tests/tags.yml delete mode 100644 tests/modules/nf-core/glimpse2/ligate/main.nf delete mode 100644 tests/modules/nf-core/glimpse2/ligate/nextflow.config delete mode 100644 tests/modules/nf-core/glimpse2/ligate/test.yml delete mode 100644 tests/modules/nf-core/glimpse2/phase/main.nf delete mode 100644 tests/modules/nf-core/glimpse2/phase/nextflow.config delete mode 100644 tests/modules/nf-core/glimpse2/phase/test.yml diff --git a/modules/nf-core/glimpse2/ligate/meta.yml b/modules/nf-core/glimpse2/ligate/meta.yml index ffedb344896..7c07973f75b 100644 --- a/modules/nf-core/glimpse2/ligate/meta.yml +++ b/modules/nf-core/glimpse2/ligate/meta.yml @@ -14,7 +14,7 @@ tools: documentation: "https://odelaneau.github.io/GLIMPSE/commands.html" tool_dev_url: "https://github.com/odelaneau/GLIMPSE" doi: "10.1038/s41588-020-00756-0" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map diff --git a/modules/nf-core/glimpse2/ligate/tests/main.nf.test b/modules/nf-core/glimpse2/ligate/tests/main.nf.test new file mode 100644 index 00000000000..d45c448b4c8 --- /dev/null +++ b/modules/nf-core/glimpse2/ligate/tests/main.nf.test @@ -0,0 +1,76 @@ +nextflow_process { + + name "Test Process GLIMPSE2_LIGATE" + script "../main.nf" + + process "GLIMPSE2_LIGATE" + + tag "modules_nfcore" + tag "modules" + tag "glimpse2" + tag "glimpse2/ligate" + tag "bcftools/index" + tag "glimpse2/phase" + + test("Should run glimpse ligate") { + setup { + run("GLIMPSE2_PHASE") { + script "../../phase/main.nf" + process { + """ + input_vcf = Channel.of([ + [ id:'input' ], // meta map + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true), + [], + "chr21:16600000-16800000", + "chr21:16650000-16750000" + ]) + + ref_panel = Channel.of([ + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) + ]) + + map_file = Channel.of([ + file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true) + ]) + + // [meta, vcf, index, sample_infos, regionin, regionout,ref, index, map] [meta, fasta, fai] + input[0] = input_vcf + .combine(ref_panel) + .combine(map_file) + input[1] = Channel.of([[],[],[]]) + """ + } + } + run("BCFTOOLS_INDEX") { + script "../../../bcftools/index/main.nf" + process { + """ + input[0] = GLIMPSE2_PHASE.out.phased_variants + """ + } + } + } + + when { + process { + """ + input[0] = GLIMPSE2_PHASE.out.phased_variants + | groupTuple() + | join (BCFTOOLS_INDEX.out.csi.groupTuple()) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match("versions") }, + { assert file(process.out.merged_variants[0][1]).name == "input.vcf.gz" } + ) + } + + } +} diff --git a/modules/nf-core/glimpse2/ligate/tests/main.nf.test.snap b/modules/nf-core/glimpse2/ligate/tests/main.nf.test.snap new file mode 100644 index 00000000000..a1b0b8c8ee9 --- /dev/null +++ b/modules/nf-core/glimpse2/ligate/tests/main.nf.test.snap @@ -0,0 +1,14 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,44addcaef4965ff6409a8293c5bcad84" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T15:52:19.469961519" + } +} \ No newline at end of file diff --git a/modules/nf-core/glimpse2/ligate/tests/tags.yml b/modules/nf-core/glimpse2/ligate/tests/tags.yml new file mode 100644 index 00000000000..1613896f960 --- /dev/null +++ b/modules/nf-core/glimpse2/ligate/tests/tags.yml @@ -0,0 +1,2 @@ +glimpse2/ligate: + - modules/nf-core/glimpse2/ligate/** diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 453ce335106..61f69bc4240 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -902,9 +902,6 @@ gget/gget: glimpse2/concordance: - modules/nf-core/glimpse2/concordance/** - tests/modules/nf-core/glimpse2/concordance/** -glimpse2/ligate: - - modules/nf-core/glimpse2/ligate/** - - tests/modules/nf-core/glimpse2/ligate/** glnexus: - modules/nf-core/glnexus/** - tests/modules/nf-core/glnexus/** diff --git a/tests/modules/nf-core/glimpse2/ligate/main.nf b/tests/modules/nf-core/glimpse2/ligate/main.nf deleted file mode 100644 index 82e885243ac..00000000000 --- a/tests/modules/nf-core/glimpse2/ligate/main.nf +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GLIMPSE2_LIGATE } from '../../../../../modules/nf-core/glimpse2/ligate/main.nf' -include { GLIMPSE2_PHASE } from '../../../../../modules/nf-core/glimpse2/phase/main.nf' -include { BCFTOOLS_INDEX } from '../../../../../modules/nf-core/bcftools/index/main.nf' - -workflow test_glimpse2_ligate { - - samples_infos = Channel.of('NA12878 2').collectFile(name: 'sampleinfos.txt') - region = Channel.of(["chr21:16600000-16800000","chr21:16650000-16750000"]) - input_vcf = Channel.of([ - [ id:'input'], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) - ]) - - input_vcf_with_samples_infos = input_vcf.combine(samples_infos).combine(region) - - ref_panel = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) - ]) - - ch_map = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), - ]) - - GLIMPSE2_PHASE ( - input_vcf_with_samples_infos.combine( ref_panel ) - .combine( ch_map ), - Channel.of([[],[],[]]) - ) // [meta, vcf, index, sample_infos, regionin, regionout, regionindex, ref, ref_index, map] - - ligate_input = GLIMPSE2_PHASE.output.phased_variant - .groupTuple() - - BCFTOOLS_INDEX ( ligate_input ) - - GLIMPSE2_LIGATE ( ligate_input.join(BCFTOOLS_INDEX.out.csi.groupTuple()) ) - -} diff --git a/tests/modules/nf-core/glimpse2/ligate/nextflow.config b/tests/modules/nf-core/glimpse2/ligate/nextflow.config deleted file mode 100644 index 3d14887382a..00000000000 --- a/tests/modules/nf-core/glimpse2/ligate/nextflow.config +++ /dev/null @@ -1,3 +0,0 @@ -process { - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } -} \ No newline at end of file diff --git a/tests/modules/nf-core/glimpse2/ligate/test.yml b/tests/modules/nf-core/glimpse2/ligate/test.yml deleted file mode 100644 index c18143cd298..00000000000 --- a/tests/modules/nf-core/glimpse2/ligate/test.yml +++ /dev/null @@ -1,11 +0,0 @@ -- name: glimpse2 ligate test_glimpse2_ligate - command: nextflow run ./tests/modules/nf-core/glimpse2/ligate -entry test_glimpse2_ligate -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/ligate/nextflow.config - tags: - - glimpse2 - - glimpse2/ligate - files: - - path: output/bcftools/input_chr21_16650000-16750000.bcf.csi - - path: output/bcftools/versions.yml - - path: output/glimpse2/input.vcf.gz - - path: output/glimpse2/input_chr21_16650000-16750000.bcf - - path: output/glimpse2/versions.yml diff --git a/tests/modules/nf-core/glimpse2/phase/main.nf b/tests/modules/nf-core/glimpse2/phase/main.nf deleted file mode 100644 index 36219c4e92e..00000000000 --- a/tests/modules/nf-core/glimpse2/phase/main.nf +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GLIMPSE2_PHASE } from '../../../../../modules/nf-core/glimpse2/phase/main.nf' - - -input_vcf = Channel.of([ - [ id:'input' ], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true), - [], - "chr21:16600000-16800000", - "chr21:16650000-16750000" - ]) -input_bam = Channel.of([ - [id:'input'], - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.bam", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.bam.bai", checkIfExists: true), - [], - "chr21:16600000-16800000", - "chr21:16650000-16750000", -]) -input_cram = Channel.of([ - [id:'input'], - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.cram", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.cram.crai", checkIfExists: true), - [], - "chr21:16600000-16800000", - "chr21:16650000-16750000", -]) -ref_panel = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) - ]) - -map_file = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true) - ]) - -reference_genome = Channel.of([ - [id:'refHG38_chr21'], - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/hs38DH.chr21.fa.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/hs38DH.chr21.fa.gz.fai", checkIfExists: true) - ]) - -workflow test_glimpse2_phase_vcf { - GLIMPSE2_PHASE ( - input_vcf.combine(ref_panel) - .combine(map_file), - Channel.of([[],[],[]]) - ) // [meta, vcf, index, sample_infos, regionin, regionout,ref, index, map] [meta, fasta, fai] -} - -workflow test_glimpse2_phase_bam { - GLIMPSE2_PHASE ( - input_bam.combine(ref_panel) - .combine(map_file), - Channel.of([[],[],[]]) - ) // [meta, vcf, index, sample_infos, regionin, regionout,ref, index, map] [meta, fasta, fai] -} - -workflow test_glimpse2_phase_cram { - GLIMPSE2_PHASE ( - input_cram.combine(ref_panel) - .combine(map_file), - reference_genome - ) // [meta, vcf, index, sample_infos, regionin, regionout,ref, index, map] [meta, fasta, fai] -} diff --git a/tests/modules/nf-core/glimpse2/phase/nextflow.config b/tests/modules/nf-core/glimpse2/phase/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/glimpse2/phase/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/glimpse2/phase/test.yml b/tests/modules/nf-core/glimpse2/phase/test.yml deleted file mode 100644 index d23a02903db..00000000000 --- a/tests/modules/nf-core/glimpse2/phase/test.yml +++ /dev/null @@ -1,30 +0,0 @@ -- name: glimpse2 phase test_glimpse2_phase_vcf - command: nextflow run ./tests/modules/nf-core/glimpse2/phase -entry test_glimpse2_phase_vcf -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/phase/nextflow.config - tags: - - glimpse2 - - glimpse2/phase - files: - - path: output/glimpse2/input_chr21_16650000-16750000.bcf - - path: output/glimpse2/versions.yml - -- name: glimpse2 phase test_glimpse2_phase_bam - command: nextflow run ./tests/modules/nf-core/glimpse2/phase -entry test_glimpse2_phase_bam -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/phase/nextflow.config - tags: - - glimpse2 - - glimpse2/phase - files: - - path: output/glimpse2/input_chr21_16650000-16750000.bcf - - path: output/glimpse2/input_chr21_16650000-16750000_stats_coverage.txt.gz - md5sum: 632f4bf08bed0870192933a0a32b95c8 - - path: output/glimpse2/versions.yml - -- name: glimpse2 phase test_glimpse2_phase_cram - command: nextflow run ./tests/modules/nf-core/glimpse2/phase -entry test_glimpse2_phase_cram -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/glimpse2/phase/nextflow.config - tags: - - glimpse2 - - glimpse2/phase - files: - - path: output/glimpse2/input_chr21_16650000-16750000.bcf - - path: output/glimpse2/input_chr21_16650000-16750000_stats_coverage.txt.gz - md5sum: a2d58d6fcd1918f649a4eb19d0ee68c3 - - path: output/glimpse2/versions.yml From 8840ece9ee7528480dec95796e017be02ada0dc0 Mon Sep 17 00:00:00 2001 From: Merlin Szymanski Date: Tue, 19 Mar 2024 14:40:48 +0100 Subject: [PATCH 18/46] Maltextract: Add Meta-map and convert to nf-test (#5244) * MaltExtract: Add meta-map to channels * MaltExtract: Add nf-test files * MaltExtract: Remove old pytest-data * MaltExtract:Apply suggestions from review * MaltExtract: Remove empty file test from snap (lint error) --- modules/nf-core/maltextract/main.nf | 6 +-- modules/nf-core/maltextract/meta.yml | 5 ++ .../nf-core/maltextract/tests/main.nf.test | 47 +++++++++++++++++++ .../maltextract/tests/main.nf.test.snap | 24 ++++++++++ modules/nf-core/maltextract/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 -- tests/modules/nf-core/maltextract/main.nf | 30 ------------ .../nf-core/maltextract/nextflow.config | 13 ----- tests/modules/nf-core/maltextract/test.yml | 9 ---- 9 files changed, 81 insertions(+), 58 deletions(-) create mode 100644 modules/nf-core/maltextract/tests/main.nf.test create mode 100644 modules/nf-core/maltextract/tests/main.nf.test.snap create mode 100644 modules/nf-core/maltextract/tests/tags.yml delete mode 100644 tests/modules/nf-core/maltextract/main.nf delete mode 100644 tests/modules/nf-core/maltextract/nextflow.config delete mode 100644 tests/modules/nf-core/maltextract/test.yml diff --git a/modules/nf-core/maltextract/main.nf b/modules/nf-core/maltextract/main.nf index 0ea0a94994b..663cf638c92 100644 --- a/modules/nf-core/maltextract/main.nf +++ b/modules/nf-core/maltextract/main.nf @@ -8,13 +8,13 @@ process MALTEXTRACT { 'biocontainers/hops:0.35--hdfd78af_1' }" input: - path rma6 + tuple val(meta), path(rma6) path taxon_list path ncbi_dir output: - path "results" , emit: results - path "versions.yml" , emit: versions + tuple val(meta), path("results") , emit: results + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/maltextract/meta.yml b/modules/nf-core/maltextract/meta.yml index 8a91a6040de..f7648d807c1 100644 --- a/modules/nf-core/maltextract/meta.yml +++ b/modules/nf-core/maltextract/meta.yml @@ -23,6 +23,11 @@ tools: doi: "10.1186/s13059-019-1903-0" licence: ["GPL 3"] input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] - rma6: type: file description: RMA6 files from MALT diff --git a/modules/nf-core/maltextract/tests/main.nf.test b/modules/nf-core/maltextract/tests/main.nf.test new file mode 100644 index 00000000000..6d529ebb4f7 --- /dev/null +++ b/modules/nf-core/maltextract/tests/main.nf.test @@ -0,0 +1,47 @@ +nextflow_process { + + name "Test Process MALTEXTRACT" + script "../main.nf" + process "MALTEXTRACT" + + tag "modules" + tag "modules_nfcore" + tag "maltextract" + tag "unzip" + + test("test_maltextract") { + setup{ + run("UNZIP") { + script "../../unzip/main.nf" + process { + """ + input[0] = [[], file('https://github.com/nf-core/test-datasets/raw/modules/data/genomics/sarscov2/genome/db/maltextract/ncbi_taxmap.zip')] + """ + } + } + } + + when { + process { + """ + input[0] = [ [], // meta map + file('https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/malt/test.rma6') ] + input[1] = file('https://github.com/nf-core/test-datasets/raw/modules/data/genomics/sarscov2/genome/db/maltextract/taxon_list.txt') + input[2] = UNZIP.out.unzipped_archive.map { it[1] } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match('version') }, + // snapshots dont work, because the results channel contains a log file that changes with each run + { assert snapshot( + path("${process.out.results.get(0).get(1)}/ScanSummary.txt"), + ).match('results') + } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/maltextract/tests/main.nf.test.snap b/modules/nf-core/maltextract/tests/main.nf.test.snap new file mode 100644 index 00000000000..d4e5c37b6b1 --- /dev/null +++ b/modules/nf-core/maltextract/tests/main.nf.test.snap @@ -0,0 +1,24 @@ +{ + "version": { + "content": [ + [ + "versions.yml:md5,4d87de5def1287321effde6545901cf6" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-19T13:58:17.979106" + }, + "results": { + "content": [ + "ScanSummary.txt:md5,209fb35426f6a459db0f4af0dc544b10" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.0" + }, + "timestamp": "2024-03-19T14:03:56.643826" + } +} \ No newline at end of file diff --git a/modules/nf-core/maltextract/tests/tags.yml b/modules/nf-core/maltextract/tests/tags.yml new file mode 100644 index 00000000000..d634af7de88 --- /dev/null +++ b/modules/nf-core/maltextract/tests/tags.yml @@ -0,0 +1,2 @@ +maltextract: + - modules/nf-core/maltextract/** diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 61f69bc4240..1aa3f4b1083 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1235,9 +1235,6 @@ mageck/mle: mageck/test: - modules/nf-core/mageck/test/** - tests/modules/nf-core/mageck/test/** -maltextract: - - modules/nf-core/maltextract/** - - tests/modules/nf-core/maltextract/** manta/convertinversion: - modules/nf-core/manta/convertinversion/** - tests/modules/nf-core/manta/convertinversion/** diff --git a/tests/modules/nf-core/maltextract/main.nf b/tests/modules/nf-core/maltextract/main.nf deleted file mode 100644 index 2c7b5a21b83..00000000000 --- a/tests/modules/nf-core/maltextract/main.nf +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { UNZIP as UNZIP_MALT } from '../../../../modules/nf-core/unzip/main.nf' -include { UNZIP as UNZIP_MALTEXTRACT } from '../../../../modules/nf-core/unzip/main.nf' -include { MALT_BUILD } from '../../../../modules/nf-core/malt/build/main.nf' -include { MALT_RUN } from '../../../../modules/nf-core/malt/run/main.nf' -include { MALTEXTRACT } from '../../../../modules/nf-core/maltextract/main.nf' - -workflow test_maltextract { - - fastas = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - gff = [] - seq_type = "DNA" - mapping_db = [ [], file("s3://ngi-igenomes/test-data/createtaxdb/taxonomy/megan-nucl-Feb2022.db.zip", checkIfExists: true) ] - input = [ - [ id:'test', single_end:false ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) - ] - taxon_list = file(params.test_data['sarscov2']['genome']['taxon_list_txt'], checkIfExists: true) - ncbi_dir = [ [], file(params.test_data['sarscov2']['genome']['ncbi_taxmap_zip'], checkIfExists: true) ] - - UNZIP_MALT ( mapping_db ) - UNZIP_MALTEXTRACT ( ncbi_dir ) - MALT_BUILD ( fastas, gff, UNZIP_MALT.out.unzipped_archive.map { it[1] } ) - MALT_RUN ( input, MALT_BUILD.out.index ) - ch_input_to_maltextract = MALT_RUN.out.rma6.map{ it[1] } - MALTEXTRACT ( ch_input_to_maltextract, taxon_list, UNZIP_MALTEXTRACT.out.unzipped_archive.map{ it[1] }) -} diff --git a/tests/modules/nf-core/maltextract/nextflow.config b/tests/modules/nf-core/maltextract/nextflow.config deleted file mode 100644 index 2dbf32c70bb..00000000000 --- a/tests/modules/nf-core/maltextract/nextflow.config +++ /dev/null @@ -1,13 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: MALT_RUN { - ext.args = "-m BlastN -J-Xmx8G" - } - - withName: MALT_BUILD { - ext.args = "--sequenceType DNA" - } - -} diff --git a/tests/modules/nf-core/maltextract/test.yml b/tests/modules/nf-core/maltextract/test.yml deleted file mode 100644 index 51b8dcd0abe..00000000000 --- a/tests/modules/nf-core/maltextract/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: maltextract - command: nextflow run ./tests/modules/nf-core/maltextract -entry test_maltextract -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/maltextract/nextflow.config - tags: - - maltextract - files: - - path: output/maltextract/results/error.txt - - path: output/maltextract/results/log.txt - contains: - - "INFO: Peak memory" From 210e7c8f33f8ca0e35e027aa8889d03205a57b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Cavalcante?= Date: Tue, 19 Mar 2024 10:57:53 -0300 Subject: [PATCH 19/46] add module: Add fastx/collapser (#5250) * Add fastx_collapser module * docs: Specify it's a decompressed file * Update modules/nf-core/fastx/collapser/meta.yml Co-authored-by: Friederike Hanssen --------- Co-authored-by: Friederike Hanssen --- .../nf-core/fastx/collapser/environment.yml | 9 +++ modules/nf-core/fastx/collapser/main.nf | 46 +++++++++++++ modules/nf-core/fastx/collapser/meta.yml | 51 ++++++++++++++ .../fastx/collapser/tests/main.nf.test | 61 +++++++++++++++++ .../fastx/collapser/tests/main.nf.test.snap | 68 +++++++++++++++++++ .../nf-core/fastx/collapser/tests/tags.yml | 2 + 6 files changed, 237 insertions(+) create mode 100644 modules/nf-core/fastx/collapser/environment.yml create mode 100644 modules/nf-core/fastx/collapser/main.nf create mode 100644 modules/nf-core/fastx/collapser/meta.yml create mode 100644 modules/nf-core/fastx/collapser/tests/main.nf.test create mode 100644 modules/nf-core/fastx/collapser/tests/main.nf.test.snap create mode 100644 modules/nf-core/fastx/collapser/tests/tags.yml diff --git a/modules/nf-core/fastx/collapser/environment.yml b/modules/nf-core/fastx/collapser/environment.yml new file mode 100644 index 00000000000..b685bd71c96 --- /dev/null +++ b/modules/nf-core/fastx/collapser/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "fastx_collapser" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::fastx_toolkit=0.0.14" diff --git a/modules/nf-core/fastx/collapser/main.nf b/modules/nf-core/fastx/collapser/main.nf new file mode 100644 index 00000000000..8e400a26a31 --- /dev/null +++ b/modules/nf-core/fastx/collapser/main.nf @@ -0,0 +1,46 @@ +process FASTX_COLLAPSER { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/fastx_toolkit:0.0.14--hdbdd923_11': + 'biocontainers/fastx_toolkit:0.0.14--hdbdd923_11' }" + + input: + tuple val(meta), path(fastx) + + output: + tuple val(meta), path("${prefix}.fasta"), emit: fasta + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + fastx_collapser \\ + $args \\ + -i $fastx \\ + -o ${prefix}.fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fastx: \$(echo \$(fastx_collapser -h) | sed -nE 's/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/p' )) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fastx: \$(echo \$(fastx_collapser -h) | sed -nE 's/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/p' )) + END_VERSIONS + """ +} diff --git a/modules/nf-core/fastx/collapser/meta.yml b/modules/nf-core/fastx/collapser/meta.yml new file mode 100644 index 00000000000..ad36701142c --- /dev/null +++ b/modules/nf-core/fastx/collapser/meta.yml @@ -0,0 +1,51 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "fastx_collapser" +description: Collapses identical sequences in a FASTQ/A file into a single sequence (while maintaining reads counts) +keywords: + - collapse + - genomics + - fasta + - fastq +tools: + - "fastx": + description: "A collection of command line tools for Short-Reads FASTA/FASTQ files preprocessing" + homepage: "http://hannonlab.cshl.edu/fastx_toolkit/" + documentation: "http://hannonlab.cshl.edu/fastx_toolkit/commandline.html" + tool_dev_url: "https://github.com/agordon/fastx_toolkit" + licence: ["AGPL"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - fastx: + type: file + description: Decompressed FASTA/FASTQ input file + pattern: "*.{fastq,fasta}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + + - fasta: + type: file + description: Collapsed FASTA file + pattern: "*.fasta" + +authors: + - "@jvfe" +maintainers: + - "@jvfe" diff --git a/modules/nf-core/fastx/collapser/tests/main.nf.test b/modules/nf-core/fastx/collapser/tests/main.nf.test new file mode 100644 index 00000000000..c3a4f090653 --- /dev/null +++ b/modules/nf-core/fastx/collapser/tests/main.nf.test @@ -0,0 +1,61 @@ +// nf-core modules test fastx/collapser +nextflow_process { + + name "Test Process FASTX_COLLAPSER" + script "../main.nf" + process "FASTX_COLLAPSER" + + tag "modules" + tag "modules_nfcore" + tag "fastx" + tag "fastx/collapser" + + test("homo_sapiens - fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['pacbio']['ccs_fa'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.fasta[0][1]).text.contains(">1-1") }, + { assert process.out.fasta[0][1] ==~ ".*/test.fasta" }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("homo_sapiens - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.test_data['homo_sapiens']['pacbio']['ccs_fa'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/fastx/collapser/tests/main.nf.test.snap b/modules/nf-core/fastx/collapser/tests/main.nf.test.snap new file mode 100644 index 00000000000..3765b4788a3 --- /dev/null +++ b/modules/nf-core/fastx/collapser/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "homo_sapiens - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ], + "fasta": [ + [ + { + "id": "test" + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T10:14:28.765300067" + }, + "homo_sapiens - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fasta:md5,b6b46831557eab6fe7a51419823fb079" + ] + ], + "1": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ], + "fasta": [ + [ + { + "id": "test" + }, + "test.fasta:md5,b6b46831557eab6fe7a51419823fb079" + ] + ], + "versions": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T10:17:46.177654196" + } +} \ No newline at end of file diff --git a/modules/nf-core/fastx/collapser/tests/tags.yml b/modules/nf-core/fastx/collapser/tests/tags.yml new file mode 100644 index 00000000000..75f33bf2c19 --- /dev/null +++ b/modules/nf-core/fastx/collapser/tests/tags.yml @@ -0,0 +1,2 @@ +fastx/collapser: + - "modules/nf-core/fastx/collapser/**" From d3f215802f696f7993f25c759781d2db91232015 Mon Sep 17 00:00:00 2001 From: vlebars <104759956+vlebars@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:24:53 +0100 Subject: [PATCH 20/46] add nf-test to gatk4/bedtointervallist - #3936 (#5251) Co-authored-by: LE BARS Victor --- .../bedtointervallist/tests/main.nf.test | 38 +++++++++++++++++++ .../bedtointervallist/tests/main.nf.test.snap | 35 +++++++++++++++++ .../gatk4/bedtointervallist/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 -- .../nf-core/gatk4/bedtointervallist/main.nf | 16 -------- .../gatk4/bedtointervallist/nextflow.config | 5 --- .../nf-core/gatk4/bedtointervallist/test.yml | 9 ----- 7 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test create mode 100644 modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test.snap create mode 100644 modules/nf-core/gatk4/bedtointervallist/tests/tags.yml delete mode 100644 tests/modules/nf-core/gatk4/bedtointervallist/main.nf delete mode 100644 tests/modules/nf-core/gatk4/bedtointervallist/nextflow.config delete mode 100644 tests/modules/nf-core/gatk4/bedtointervallist/test.yml diff --git a/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test new file mode 100644 index 00000000000..2289f73fa42 --- /dev/null +++ b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test @@ -0,0 +1,38 @@ +nextflow_process { + + name "Test Process GATK4_BEDTOINTERVALLIST" + script "../main.nf" + process "GATK4_BEDTOINTERVALLIST" + + tag "modules" + tag "modules_nfcore" + tag "gatk4" + tag "gatk4/bedtointervallist" + + test("test_gatk4_bedtointervallist") { + + when { + process { + """ + input[0] = [ [ id:'test' ], // meta map + [file(params.modules_testdata_base_path + + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) ] + ] + input[1] = [ [ id:'dict' ], // meta map + [file(params.modules_testdata_base_path + + 'genomics/sarscov2/genome/genome.dict', checkIfExists: true) ] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test.snap b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test.snap new file mode 100644 index 00000000000..48c322fd001 --- /dev/null +++ b/modules/nf-core/gatk4/bedtointervallist/tests/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "test_gatk4_bedtointervallist": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.interval_list:md5,e51101c9357fb2d59fd30e370eefa39c" + ] + ], + "1": [ + "versions.yml:md5,29a18c36f27584eb5a5f2f5457088b3b" + ], + "interval_list": [ + [ + { + "id": "test" + }, + "test.interval_list:md5,e51101c9357fb2d59fd30e370eefa39c" + ] + ], + "versions": [ + "versions.yml:md5,29a18c36f27584eb5a5f2f5457088b3b" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T14:20:12.168775" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/bedtointervallist/tests/tags.yml b/modules/nf-core/gatk4/bedtointervallist/tests/tags.yml new file mode 100644 index 00000000000..b4d54f129c8 --- /dev/null +++ b/modules/nf-core/gatk4/bedtointervallist/tests/tags.yml @@ -0,0 +1,2 @@ +gatk4/bedtointervallist: + - "modules/nf-core/gatk4/bedtointervallist/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 1aa3f4b1083..62970e036bd 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -707,9 +707,6 @@ gatk4/applyvqsr: gatk4/asereadcounter: - modules/nf-core/gatk4/asereadcounter/** - tests/modules/nf-core/gatk4/asereadcounter/** -gatk4/bedtointervallist: - - modules/nf-core/gatk4/bedtointervallist/** - - tests/modules/nf-core/gatk4/bedtointervallist/** gatk4/calculatecontamination: - modules/nf-core/gatk4/calculatecontamination/** - tests/modules/nf-core/gatk4/calculatecontamination/** diff --git a/tests/modules/nf-core/gatk4/bedtointervallist/main.nf b/tests/modules/nf-core/gatk4/bedtointervallist/main.nf deleted file mode 100644 index 62e4e148f1b..00000000000 --- a/tests/modules/nf-core/gatk4/bedtointervallist/main.nf +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GATK4_BEDTOINTERVALLIST } from '../../../../../modules/nf-core/gatk4/bedtointervallist/main.nf' - -workflow test_gatk4_bedtointervallist { - input = [ [ id:'test' ], // meta map - [ file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) ] - ] - dict = [ [ id:'dict' ], // meta map - file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) - ] - - GATK4_BEDTOINTERVALLIST ( input, dict ) -} diff --git a/tests/modules/nf-core/gatk4/bedtointervallist/nextflow.config b/tests/modules/nf-core/gatk4/bedtointervallist/nextflow.config deleted file mode 100644 index 8730f1c4b93..00000000000 --- a/tests/modules/nf-core/gatk4/bedtointervallist/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} diff --git a/tests/modules/nf-core/gatk4/bedtointervallist/test.yml b/tests/modules/nf-core/gatk4/bedtointervallist/test.yml deleted file mode 100644 index e07ee44eaec..00000000000 --- a/tests/modules/nf-core/gatk4/bedtointervallist/test.yml +++ /dev/null @@ -1,9 +0,0 @@ -- name: gatk4 bedtointervallist test_gatk4_bedtointervallist - command: nextflow run ./tests/modules/nf-core/gatk4/bedtointervallist -entry test_gatk4_bedtointervallist -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gatk4/bedtointervallist/nextflow.config - tags: - - gatk4 - - gatk4/bedtointervallist - files: - - path: output/gatk4/test.interval_list - md5sum: e51101c9357fb2d59fd30e370eefa39c - - path: output/gatk4/versions.yml From c22aa6082716bd372cbb8f7ccf7c83220f180864 Mon Sep 17 00:00:00 2001 From: Alexander Peltzer Date: Tue, 19 Mar 2024 15:26:27 +0100 Subject: [PATCH 21/46] Add module: ANGSD_GL (#4835) * angsd gl start * Started improving input * Adding in main.nf * Start improving stuff * angsd_gl: update meta.yml * update angsd_gl module * do if else in nextflow instead of bash * bugfix * add test configs * update nf-tests * linting * remove unnecessary publishDir * pin conda htslib to version of containers * deactivate conda profile --------- Co-authored-by: Thiseas Christos Lamnidis --- .github/workflows/test.yml | 2 + modules/nf-core/angsd/gl/environment.yml | 10 + modules/nf-core/angsd/gl/main.nf | 112 +++++++ modules/nf-core/angsd/gl/meta.yml | 65 ++++ .../nf-core/angsd/gl/tests/config_gl_1.conf | 5 + .../nf-core/angsd/gl/tests/config_gl_2.conf | 6 + .../nf-core/angsd/gl/tests/config_gl_3.conf | 6 + .../nf-core/angsd/gl/tests/config_gl_4.conf | 5 + modules/nf-core/angsd/gl/tests/main.nf.test | 245 +++++++++++++++ .../nf-core/angsd/gl/tests/main.nf.test.snap | 282 ++++++++++++++++++ modules/nf-core/angsd/gl/tests/tags.yml | 2 + 11 files changed, 740 insertions(+) create mode 100644 modules/nf-core/angsd/gl/environment.yml create mode 100644 modules/nf-core/angsd/gl/main.nf create mode 100644 modules/nf-core/angsd/gl/meta.yml create mode 100644 modules/nf-core/angsd/gl/tests/config_gl_1.conf create mode 100644 modules/nf-core/angsd/gl/tests/config_gl_2.conf create mode 100644 modules/nf-core/angsd/gl/tests/config_gl_3.conf create mode 100644 modules/nf-core/angsd/gl/tests/config_gl_4.conf create mode 100644 modules/nf-core/angsd/gl/tests/main.nf.test create mode 100644 modules/nf-core/angsd/gl/tests/main.nf.test.snap create mode 100644 modules/nf-core/angsd/gl/tests/tags.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d2a616ca48c..fd2dbcf793e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -487,6 +487,8 @@ jobs: profile: [conda, docker, singularity] exclude: - tags: nf-test + - profile: conda + tags: angsd/gl - profile: conda tags: annotsv - profile: conda diff --git a/modules/nf-core/angsd/gl/environment.yml b/modules/nf-core/angsd/gl/environment.yml new file mode 100644 index 00000000000..aac5db41f82 --- /dev/null +++ b/modules/nf-core/angsd/gl/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "angsd_gl" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::angsd=0.940" + - "bioconda::htslib=1.17" diff --git a/modules/nf-core/angsd/gl/main.nf b/modules/nf-core/angsd/gl/main.nf new file mode 100644 index 00000000000..9a098b7e4a5 --- /dev/null +++ b/modules/nf-core/angsd/gl/main.nf @@ -0,0 +1,112 @@ +process ANGSD_GL { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/angsd:0.940--hce60e53_2': + 'biocontainers/angsd:0.940--hce60e53_2' }" + + input: + tuple val(meta), path(bam) + tuple val(meta2), path(fasta) //Optionally + tuple val(meta3), path(error_file) //Optionally. Used for SYK model only. + + output: + tuple val(meta), path("*.{glf,beagle}.gz"), emit: genotype_likelihood + 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 GL_model = args.contains("-GL 1") ? 1 : args.contains("-GL 2") ? 2 : args.contains("-GL 3") ? 3 : args.contains("-GL 4") ? 4 : 0 + def ref = fasta ? "-ref ${fasta}" : '' // Use reference fasta if provided + def errors = error_file ? "-errors ${error_file}" : '' // Only applies to SYK model + def output_mode = args.contains("-doGlf") ? "" : '-doGlf 1' // Default to outputting binary glf (10 log likelihoods) if not set in args + // NOTE: GL is specified within args, so is not provided as a separate argument + + if (GL_model != 3 && GL_model != 4) { + """ + ls -1 *.bam > bamlist.txt + + angsd \\ + -nThreads ${task.cpus} \\ + -bam bamlist.txt \\ + $args \\ + $ref \\ + $output_mode \\ + -out ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + angsd: \$(echo \$(angsd 2>&1) | grep 'angsd version' | head -n 1 | sed 's/.*version: //g;s/ .*//g') + END_VERSIONS + """ + } else if (GL_model == 3) { + // No args for this part. + // GL is hardcoded to 3 here to avoid passing all other arguments to the calibration step + """ + ls -1 *.bam > bamlist.txt + + ## SOAPsnp model + ## First get the calibration matrix. minQ MUST be 0 for this step. Will create the directory angsd_tmpdir/ with the required files for the next step. + angsd \\ + -nThreads ${task.cpus} \\ + -bam bamlist.txt \\ + -minQ 0 \\ + -GL 3 \\ + $ref \\ + -out ${prefix} + + ## Then run the model + angsd \\ + -nThreads ${task.cpus} \\ + -bam bamlist.txt \\ + $args \\ + $ref \\ + $output_mode \\ + -out ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + angsd: \$(echo \$(angsd 2>&1) | grep 'angsd version' | head -n 1 | sed 's/.*version: //g;s/ .*//g') + END_VERSIONS + """ + } else if (GL_model == 4) { + """ + ls -1 *.bam > bamlist.txt + + ## SYK model + angsd \\ + -nThreads ${task.cpus} \\ + -bam bamlist.txt \\ + $args \\ + $ref \\ + $output_mode \\ + $errors \\ + -doCounts 1 \\ + -out ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + angsd: \$(echo \$(angsd 2>&1) | grep 'angsd version' | head -n 1 | sed 's/.*version: //g;s/ .*//g') + END_VERSIONS + """ + } + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.glf + gzip ${prefix}.glf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + angsd: \$(echo \$(angsd 2>&1) | grep 'angsd version' | head -n 1 | sed 's/.*version: //g;s/ .*//g') + END_VERSIONS + """ +} diff --git a/modules/nf-core/angsd/gl/meta.yml b/modules/nf-core/angsd/gl/meta.yml new file mode 100644 index 00000000000..168f615d5a2 --- /dev/null +++ b/modules/nf-core/angsd/gl/meta.yml @@ -0,0 +1,65 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "angsd_gl" +description: Calculated genotype likelihoods from BAM files. +keywords: + - angsd + - genotype likelihood + - genomics +tools: + - "angsd": + description: "ANGSD: Analysis of next generation Sequencing Data" + homepage: "http://www.popgen.dk/angsd/" + documentation: "http://www.popgen.dk/angsd/" + tool_dev_url: "https://github.com/ANGSD/angsd" + doi: "10.1186/s12859-014-0356-4" + licence: ["GPL v3", "MIT"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: A list of BAM or CRAM files + pattern: "*.{bam,cram}" + - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test' ] + - fasta: + type: file + description: A reference genome in FASTA format + pattern: "*.fasta" + - meta3: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - error_file: + type: file + description: A file containing information about type specific errors. + pattern: "*.error.chunkunordered" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - genotype_likelihood: + type: file + description: File containing genotype likelihoods per sample + pattern: "*.{glf,beagle}.gz" + +authors: + - "@apeltzer" + - "@TCLamnidis" +maintainers: + - "@apeltzer" + - "@TCLamnidis" diff --git a/modules/nf-core/angsd/gl/tests/config_gl_1.conf b/modules/nf-core/angsd/gl/tests/config_gl_1.conf new file mode 100644 index 00000000000..f45e3a4a6b0 --- /dev/null +++ b/modules/nf-core/angsd/gl/tests/config_gl_1.conf @@ -0,0 +1,5 @@ +process { + withName: ANGSD_GL { + ext.args = '-GL 1 -doGlf 1' + } +} diff --git a/modules/nf-core/angsd/gl/tests/config_gl_2.conf b/modules/nf-core/angsd/gl/tests/config_gl_2.conf new file mode 100644 index 00000000000..f54bd748ebf --- /dev/null +++ b/modules/nf-core/angsd/gl/tests/config_gl_2.conf @@ -0,0 +1,6 @@ +process { + withName: ANGSD_GL { + // -doMajorMinor is needed for -doGlf 2 + ext.args = '-GL 2 -doGlf 2 -doMajorMinor 1' + } +} diff --git a/modules/nf-core/angsd/gl/tests/config_gl_3.conf b/modules/nf-core/angsd/gl/tests/config_gl_3.conf new file mode 100644 index 00000000000..ccfd5dcafae --- /dev/null +++ b/modules/nf-core/angsd/gl/tests/config_gl_3.conf @@ -0,0 +1,6 @@ +process { + withName: ANGSD_GL { + // -doMajorMinor is needed for -doGlf 3 + ext.args = '-GL 3 -doGlf 3 -doMajorMinor 1' + } +} diff --git a/modules/nf-core/angsd/gl/tests/config_gl_4.conf b/modules/nf-core/angsd/gl/tests/config_gl_4.conf new file mode 100644 index 00000000000..fc9622d5796 --- /dev/null +++ b/modules/nf-core/angsd/gl/tests/config_gl_4.conf @@ -0,0 +1,5 @@ +process { + withName: ANGSD_GL { + ext.args = '-GL 4 -doGlf 4' + } +} diff --git a/modules/nf-core/angsd/gl/tests/main.nf.test b/modules/nf-core/angsd/gl/tests/main.nf.test new file mode 100644 index 00000000000..412f46a53e8 --- /dev/null +++ b/modules/nf-core/angsd/gl/tests/main.nf.test @@ -0,0 +1,245 @@ +// nf-core modules test angsd/gl +nextflow_process { + + name "Test Process ANGSD_GL" + script "../main.nf" + process "ANGSD_GL" + + tag "modules" + tag "modules_nfcore" + tag "angsd" + tag "angsd/gl" + + test("angsd - gl_samtools - bam") { + + when { + config "./config_gl_1.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("angsd - gl_gatk - bam") { + + when { + config "./config_gl_2.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("angsd - gl_soapsnp - bam") { + + when { + config "./config_gl_3.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("angsd - gl_syk - bam") { + + when { + config "./config_gl_4.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("angsd - gl_samtools - bam - stub") { + + options "-stub" + + when { + config "./config_gl_1.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("angsd - gl_gatk - bam - stub") { + + options "-stub" + + when { + config "./config_gl_2.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("angsd - gl_soapsnp - bam - stub") { + + options "-stub" + + when { + config "./config_gl_3.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + + test("angsd - gl_syk - bam - stub") { + + options "-stub" + + when { + config "./config_gl_4.conf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['test_paired_end_markduplicates_sorted_bam'], checkIfExists: true), + ] + input[1] = [ + [ id:'test_fa' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[2] = [ [], [] ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/angsd/gl/tests/main.nf.test.snap b/modules/nf-core/angsd/gl/tests/main.nf.test.snap new file mode 100644 index 00000000000..9128813e11a --- /dev/null +++ b/modules/nf-core/angsd/gl/tests/main.nf.test.snap @@ -0,0 +1,282 @@ +{ + "angsd - gl_samtools - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,b1cafc93095fae26e476e6e253a7615c" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,b1cafc93095fae26e476e6e253a7615c" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:23:37.916689" + }, + "angsd - gl_gatk - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:26:28.489425" + }, + "angsd - gl_samtools - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:26:04.586755" + }, + "angsd - gl_soapsnp - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,6d5bc2aa4b5276781960813c12552600" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,6d5bc2aa4b5276781960813c12552600" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:25:09.666904" + }, + "angsd - gl_syk - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:27:16.099902" + }, + "angsd - gl_syk - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,ce3a9b56a2692316f2bd632980c53a7c" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,ce3a9b56a2692316f2bd632980c53a7c" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:25:39.786421" + }, + "angsd - gl_soapsnp - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.glf.gz:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:26:52.996405" + }, + "angsd - gl_gatk - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.beagle.gz:md5,424369dc4c67227624cb39f3cc96eb58" + ] + ], + "1": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ], + "genotype_likelihood": [ + [ + { + "id": "test", + "single_end": false + }, + "test.beagle.gz:md5,424369dc4c67227624cb39f3cc96eb58" + ] + ], + "versions": [ + "versions.yml:md5,bb85b4e15894438271413bb5dab17675" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T17:23:58.730987" + } +} \ No newline at end of file diff --git a/modules/nf-core/angsd/gl/tests/tags.yml b/modules/nf-core/angsd/gl/tests/tags.yml new file mode 100644 index 00000000000..137fda1c2b9 --- /dev/null +++ b/modules/nf-core/angsd/gl/tests/tags.yml @@ -0,0 +1,2 @@ +angsd/gl: + - "modules/nf-core/angsd/gl/**" From c65917d37cdaa9d6c26fccf8f7c313aab1a51d8a Mon Sep 17 00:00:00 2001 From: alessiovignoli <45239231+alessiovignoli@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:35:03 +0100 Subject: [PATCH 22/46] addedd optional output channel for lib files (#5257) * addedd optional output channel for lib files * added the output description for lin in meta.yml --- modules/nf-core/tcoffee/align/main.nf | 2 ++ modules/nf-core/tcoffee/align/meta.yml | 6 ++++ .../nf-core/tcoffee/align/tests/lib.config | 3 ++ .../nf-core/tcoffee/align/tests/main.nf.test | 27 +++++++++++++++++ .../tcoffee/align/tests/main.nf.test.snap | 29 +++++++++++++++++++ 5 files changed, 67 insertions(+) create mode 100644 modules/nf-core/tcoffee/align/tests/lib.config diff --git a/modules/nf-core/tcoffee/align/main.nf b/modules/nf-core/tcoffee/align/main.nf index 671aca8eacc..e159bb801e2 100644 --- a/modules/nf-core/tcoffee/align/main.nf +++ b/modules/nf-core/tcoffee/align/main.nf @@ -15,6 +15,8 @@ process TCOFFEE_ALIGN { output: tuple val(meta), path("*.aln{.gz,}"), emit: alignment + // in the args there might be the request to generate a lib file, so the following is an optional output + tuple val(meta), path("*.*lib") , emit: lib, optional : true path "versions.yml" , emit: versions when: diff --git a/modules/nf-core/tcoffee/align/meta.yml b/modules/nf-core/tcoffee/align/meta.yml index 6cfcc72d46a..4125d1ed2c2 100644 --- a/modules/nf-core/tcoffee/align/meta.yml +++ b/modules/nf-core/tcoffee/align/meta.yml @@ -61,6 +61,10 @@ output: type: file description: Alignment file in FASTA format. May be gzipped. pattern: "*.aln{.gz,}" + - lib: + type: file + description: optional output, the library generated from the MSA file. + pattern: "*.*lib" - versions: type: file description: File containing software versions @@ -68,7 +72,9 @@ output: authors: - "@luisas" - "@JoseEspinosa" + - "@alessiovignoli" maintainers: - "@luisas" - "@JoseEspinosa" - "@lrauschning" + - "@alessiovignoli" diff --git a/modules/nf-core/tcoffee/align/tests/lib.config b/modules/nf-core/tcoffee/align/tests/lib.config new file mode 100644 index 00000000000..2fc113efa0e --- /dev/null +++ b/modules/nf-core/tcoffee/align/tests/lib.config @@ -0,0 +1,3 @@ +process { + ext.args = { "-output fasta_aln -out_lib=sample_lib1.tc_lib" } +} \ No newline at end of file diff --git a/modules/nf-core/tcoffee/align/tests/main.nf.test b/modules/nf-core/tcoffee/align/tests/main.nf.test index 9d66f86bf39..307534fb55c 100644 --- a/modules/nf-core/tcoffee/align/tests/main.nf.test +++ b/modules/nf-core/tcoffee/align/tests/main.nf.test @@ -147,4 +147,31 @@ nextflow_process { } } + + test("fasta - align_with_lib") { + + config "./lib.config" + + when { + process { + """ + input[0] = [ [ id:'test' ], + file("https://raw.githubusercontent.com/nf-core/test-datasets/multiplesequencealign/testdata/setoxin-ref.fa", checkIfExists: true) + ] + input[1] = [[:],[]] + input[2] = [[:],[],[]] + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.alignment).match("alignment - lib") }, + { assert path(process.out.lib.get(0).get(1)).getText().contains("1ahl") }, + { assert snapshot(process.out.versions).match("versions_lib") } + ) + } + } } \ No newline at end of file diff --git a/modules/nf-core/tcoffee/align/tests/main.nf.test.snap b/modules/nf-core/tcoffee/align/tests/main.nf.test.snap index 9bdadbd4e42..dfef40a7352 100644 --- a/modules/nf-core/tcoffee/align/tests/main.nf.test.snap +++ b/modules/nf-core/tcoffee/align/tests/main.nf.test.snap @@ -11,6 +11,18 @@ }, "timestamp": "2024-02-28T19:00:28.712838" }, + "versions_lib": { + "content": [ + [ + "versions.yml:md5,fb187c9186b50a8076d08cd3be3c1b70" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T14:04:06.031557" + }, "alignment - uncompressed": { "content": [ [ @@ -52,6 +64,23 @@ }, "timestamp": "2024-02-28T19:00:10.618213" }, + "alignment - lib": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.aln.gz:md5,bd1db08ad04514cc6d1334598c1a6ef0" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:57:39.653762" + }, "alignment": { "content": [ [ From 571a5feac4c9ce0a8df0bc15b94230e7f3e8db47 Mon Sep 17 00:00:00 2001 From: vlebars <104759956+vlebars@users.noreply.github.com> Date: Tue, 19 Mar 2024 15:46:17 +0100 Subject: [PATCH 23/46] add nf-test to bedtools/sort - #3936 (#5221) * add nf-test to bedtools/sort - #3936 * Apply suggestions from code review Co-authored-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com> --------- Co-authored-by: LE BARS Victor Co-authored-by: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com> --- .../nf-core/bedtools/sort/tests/main.nf.test | 58 ++++++++++++++++ .../bedtools/sort/tests/main.nf.test.snap | 68 +++++++++++++++++++ .../bedtools/sort/tests/nextflow.config | 8 +++ modules/nf-core/bedtools/sort/tests/tags.yml | 2 + tests/config/pytest_modules.yml | 3 - tests/modules/nf-core/bedtools/sort/main.nf | 22 ------ .../nf-core/bedtools/sort/nextflow.config | 10 --- tests/modules/nf-core/bedtools/sort/test.yml | 19 ------ 8 files changed, 136 insertions(+), 54 deletions(-) create mode 100644 modules/nf-core/bedtools/sort/tests/main.nf.test create mode 100644 modules/nf-core/bedtools/sort/tests/main.nf.test.snap create mode 100644 modules/nf-core/bedtools/sort/tests/nextflow.config create mode 100644 modules/nf-core/bedtools/sort/tests/tags.yml delete mode 100644 tests/modules/nf-core/bedtools/sort/main.nf delete mode 100644 tests/modules/nf-core/bedtools/sort/nextflow.config delete mode 100644 tests/modules/nf-core/bedtools/sort/test.yml diff --git a/modules/nf-core/bedtools/sort/tests/main.nf.test b/modules/nf-core/bedtools/sort/tests/main.nf.test new file mode 100644 index 00000000000..b1f36dd9197 --- /dev/null +++ b/modules/nf-core/bedtools/sort/tests/main.nf.test @@ -0,0 +1,58 @@ +nextflow_process { + + name "Test Process BEDTOOLS_SORT" + script "../main.nf" + config "./nextflow.config" + process "BEDTOOLS_SORT" + + tag "modules" + tag "modules_nfcore" + tag "bedtools" + tag "bedtools/sort" + + test("test_bedtools_sort") { + + when { + process { + """ + input[0] = [ [ id:'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) + ] + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + + test("test_bedtools_sort_with_genome") { + + when { + process { + """ + input[0] = [ [ id:'test'], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/bed/test.bed', checkIfExists: true) + ] + input[1] = file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/bedtools/sort/tests/main.nf.test.snap b/modules/nf-core/bedtools/sort/tests/main.nf.test.snap new file mode 100644 index 00000000000..f10e8b984e0 --- /dev/null +++ b/modules/nf-core/bedtools/sort/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "test_bedtools_sort_with_genome": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_out.testtext:md5,fe4053cf4de3aebbdfc3be2efb125a74" + ] + ], + "1": [ + "versions.yml:md5,cdbae2c7ebc41e534aaf0835779061f8" + ], + "sorted": [ + [ + { + "id": "test" + }, + "test_out.testtext:md5,fe4053cf4de3aebbdfc3be2efb125a74" + ] + ], + "versions": [ + "versions.yml:md5,cdbae2c7ebc41e534aaf0835779061f8" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T10:13:11.830452" + }, + "test_bedtools_sort": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_out.testtext:md5,fe4053cf4de3aebbdfc3be2efb125a74" + ] + ], + "1": [ + "versions.yml:md5,cdbae2c7ebc41e534aaf0835779061f8" + ], + "sorted": [ + [ + { + "id": "test" + }, + "test_out.testtext:md5,fe4053cf4de3aebbdfc3be2efb125a74" + ] + ], + "versions": [ + "versions.yml:md5,cdbae2c7ebc41e534aaf0835779061f8" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T10:16:40.535947" + } +} \ No newline at end of file diff --git a/modules/nf-core/bedtools/sort/tests/nextflow.config b/modules/nf-core/bedtools/sort/tests/nextflow.config new file mode 100644 index 00000000000..f203c99c5ca --- /dev/null +++ b/modules/nf-core/bedtools/sort/tests/nextflow.config @@ -0,0 +1,8 @@ +process { + + withName: BEDTOOLS_SORT { + ext.prefix = { "${meta.id}_out" } + ext.suffix = "testtext" + } + +} \ No newline at end of file diff --git a/modules/nf-core/bedtools/sort/tests/tags.yml b/modules/nf-core/bedtools/sort/tests/tags.yml new file mode 100644 index 00000000000..47c85eead94 --- /dev/null +++ b/modules/nf-core/bedtools/sort/tests/tags.yml @@ -0,0 +1,2 @@ +bedtools/sort: + - "modules/nf-core/bedtools/sort/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 62970e036bd..3834021e04d 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -194,9 +194,6 @@ bedtools/shift: bedtools/slop: - modules/nf-core/bedtools/slop/** - tests/modules/nf-core/bedtools/slop/** -bedtools/sort: - - modules/nf-core/bedtools/sort/** - - tests/modules/nf-core/bedtools/sort/** bedtools/split: - modules/nf-core/bedtools/split/** - tests/modules/nf-core/bedtools/split/** diff --git a/tests/modules/nf-core/bedtools/sort/main.nf b/tests/modules/nf-core/bedtools/sort/main.nf deleted file mode 100644 index 1ae16beb0cb..00000000000 --- a/tests/modules/nf-core/bedtools/sort/main.nf +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BEDTOOLS_SORT } from '../../../../../modules/nf-core/bedtools/sort/main.nf' - -workflow test_bedtools_sort { - input = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) - ] - - BEDTOOLS_SORT ( input, [] ) -} - -workflow test_bedtools_sort_with_genome { - input = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) - ] - fai = Channel.of(file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true)) - - BEDTOOLS_SORT ( input, [] ) -} \ No newline at end of file diff --git a/tests/modules/nf-core/bedtools/sort/nextflow.config b/tests/modules/nf-core/bedtools/sort/nextflow.config deleted file mode 100644 index 27b09bae49e..00000000000 --- a/tests/modules/nf-core/bedtools/sort/nextflow.config +++ /dev/null @@ -1,10 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: BEDTOOLS_SORT { - ext.prefix = { "${meta.id}_out" } - ext.suffix = "testtext" - } - -} diff --git a/tests/modules/nf-core/bedtools/sort/test.yml b/tests/modules/nf-core/bedtools/sort/test.yml deleted file mode 100644 index 8a96bbb44ba..00000000000 --- a/tests/modules/nf-core/bedtools/sort/test.yml +++ /dev/null @@ -1,19 +0,0 @@ -- name: bedtools sort test_bedtools_sort - command: nextflow run ./tests/modules/nf-core/bedtools/sort -entry test_bedtools_sort -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bedtools/sort/nextflow.config - tags: - - bedtools - - bedtools/sort - files: - - path: output/bedtools/test_out.testtext - md5sum: fe4053cf4de3aebbdfc3be2efb125a74 - - path: output/bedtools/versions.yml - -- name: bedtools sort test_bedtools_sort_with_genome - command: nextflow run ./tests/modules/nf-core/bedtools/sort -entry test_bedtools_sort_with_genome -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bedtools/sort/nextflow.config - tags: - - bedtools - - bedtools/sort - files: - - path: output/bedtools/test_out.testtext - md5sum: fe4053cf4de3aebbdfc3be2efb125a74 - - path: output/bedtools/versions.yml From 9b14b5fceb0930b712e39f61597d422be4df5db2 Mon Sep 17 00:00:00 2001 From: Georgia Kesisoglou <73076971+georgiakes@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:58:15 +0200 Subject: [PATCH 24/46] Add module: GTFSORT (#5237) * Initial commit * Fix formatting --- modules/nf-core/gtfsort/environment.yml | 9 ++++ modules/nf-core/gtfsort/main.nf | 49 ++++++++++++++++++ modules/nf-core/gtfsort/meta.yml | 34 +++++++++++++ modules/nf-core/gtfsort/tests/main.nf.test | 51 +++++++++++++++++++ .../nf-core/gtfsort/tests/main.nf.test.snap | 48 +++++++++++++++++ modules/nf-core/gtfsort/tests/tags.yml | 2 + 6 files changed, 193 insertions(+) create mode 100644 modules/nf-core/gtfsort/environment.yml create mode 100644 modules/nf-core/gtfsort/main.nf create mode 100644 modules/nf-core/gtfsort/meta.yml create mode 100644 modules/nf-core/gtfsort/tests/main.nf.test create mode 100644 modules/nf-core/gtfsort/tests/main.nf.test.snap create mode 100644 modules/nf-core/gtfsort/tests/tags.yml diff --git a/modules/nf-core/gtfsort/environment.yml b/modules/nf-core/gtfsort/environment.yml new file mode 100644 index 00000000000..88233be343c --- /dev/null +++ b/modules/nf-core/gtfsort/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "gtfsort" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::gtfsort=0.2.2" diff --git a/modules/nf-core/gtfsort/main.nf b/modules/nf-core/gtfsort/main.nf new file mode 100644 index 00000000000..54cf8e8c69c --- /dev/null +++ b/modules/nf-core/gtfsort/main.nf @@ -0,0 +1,49 @@ +process GTFSORT { + tag "$gtf" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/gtfsort:0.2.2--h4ac6f70_0': + 'biocontainers/gtfsort:0.2.2--h4ac6f70_0' }" + + input: + + path gtf + + output: + path "*.sorted.gtf", emit: gtf + path "versions.yml", emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${gtf.baseName}" + + """ + gtfsort \\ + -i $gtf \\ + -o ${prefix}.sorted.gtf \\ + -t $task.cpus + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gtfsort: \$(gtfsort --version |& sed 's/gtfsort //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${gtf.baseName}" + + """ + touch ${prefix}.sorted.gtf + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + gtfsort: \$(gtfsort --version |& sed 's/gtfsort //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/gtfsort/meta.yml b/modules/nf-core/gtfsort/meta.yml new file mode 100644 index 00000000000..836b72e03d8 --- /dev/null +++ b/modules/nf-core/gtfsort/meta.yml @@ -0,0 +1,34 @@ +--- +name: "gtfsort" +description: Sort GTF files in chr/pos/feature order +keywords: + - sort + - example + - genomics +tools: + - "gtfsort": + description: "A chr/pos/feature GTF sorter that uses a lexicographically-based index ordering algorithm." + homepage: "https://github.com/alejandrogzi/gtfsort" + documentation: "https://github.com/alejandrogzi/gtfsort" + tool_dev_url: "https://github.com/alejandrogzi/gtfsort" + licence: ["MIT"] + +input: + - gtf: + type: file + description: Unsorted GTF/GFF file. + pattern: "*.gtf" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - gtf: + type: file + description: Sorted GTF file + pattern: "*.gtf" +authors: + - "@georgiakes" +maintainers: + - "@georgiakes" diff --git a/modules/nf-core/gtfsort/tests/main.nf.test b/modules/nf-core/gtfsort/tests/main.nf.test new file mode 100644 index 00000000000..31ccd0a80c1 --- /dev/null +++ b/modules/nf-core/gtfsort/tests/main.nf.test @@ -0,0 +1,51 @@ +nextflow_process { + + name "Test Process GTFSORT" + script "../main.nf" + process "GTFSORT" + + tag "modules" + tag "modules_nfcore" + tag "gtfsort" + + test("hsapiens - gtf") { + + when { + process { + """ + input[0] = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("hsapiens - gtf - stub") { + + options "-stub" + + when { + process { + """ + input[0] = file(params.test_data['homo_sapiens']['genome']['genome_gtf'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/gtfsort/tests/main.nf.test.snap b/modules/nf-core/gtfsort/tests/main.nf.test.snap new file mode 100644 index 00000000000..7e401ca3878 --- /dev/null +++ b/modules/nf-core/gtfsort/tests/main.nf.test.snap @@ -0,0 +1,48 @@ +{ + "hsapiens - gtf": { + "content": [ + { + "0": [ + "genome.sorted.gtf:md5,190a412d74c724707f662474170a04ed" + ], + "1": [ + "versions.yml:md5,1bc2af761f9d5e3d8b16f28ec92c6de8" + ], + "gtf": [ + "genome.sorted.gtf:md5,190a412d74c724707f662474170a04ed" + ], + "versions": [ + "versions.yml:md5,1bc2af761f9d5e3d8b16f28ec92c6de8" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T12:12:13.284741358" + }, + "hsapiens - gtf - stub": { + "content": [ + { + "0": [ + "genome.sorted.gtf:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "1": [ + "versions.yml:md5,1bc2af761f9d5e3d8b16f28ec92c6de8" + ], + "gtf": [ + "genome.sorted.gtf:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,1bc2af761f9d5e3d8b16f28ec92c6de8" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T12:12:22.076676452" + } +} \ No newline at end of file diff --git a/modules/nf-core/gtfsort/tests/tags.yml b/modules/nf-core/gtfsort/tests/tags.yml new file mode 100644 index 00000000000..6ba9060e209 --- /dev/null +++ b/modules/nf-core/gtfsort/tests/tags.yml @@ -0,0 +1,2 @@ +gtfsort: + - "modules/nf-core/gtfsort/**" From 7e56daae390ff896b292ddc70823447683a79936 Mon Sep 17 00:00:00 2001 From: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:00:47 +0100 Subject: [PATCH 25/46] Update glimpse/phase output channel to phased_variants #5172 (#5174) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update glimpse/phase output channel to phased_variants * Update nf-test * Update tags and meta.yml * Update tags in ligate * Fix typo * Delete non use argument * Update tags in sbwf * Update test data * Update tag nftest * Change extension individuals files * Update genetic map * Change map by chromosome * Update vcf_impute_glimpse nftest * Update to phased_variants * Update glimpse concordance * Update modules/nf-core/glimpse/ligate/meta.yml Co-authored-by: Matthias Hörtenhuber --------- Co-authored-by: Matthias Hörtenhuber --- modules/nf-core/glimpse/chunk/meta.yml | 2 +- modules/nf-core/glimpse/concordance/meta.yml | 2 +- .../glimpse/concordance/tests/main.nf.test | 29 ++--- .../concordance/tests/main.nf.test.snap | 26 +++-- modules/nf-core/glimpse/ligate/meta.yml | 2 +- .../nf-core/glimpse/ligate/tests/main.nf.test | 21 ++-- modules/nf-core/glimpse/phase/main.nf | 4 +- modules/nf-core/glimpse/phase/meta.yml | 2 +- .../nf-core/glimpse/phase/tests/main.nf.test | 14 +-- modules/nf-core/glimpse/sample/meta.yml | 8 +- .../nf-core/glimpse/sample/tests/main.nf.test | 18 +-- .../nf-core/vcf_impute_glimpse/main.nf | 4 +- .../nf-core/vcf_impute_glimpse/meta.yml | 14 +-- .../vcf_impute_glimpse/tests/main.nf.test | 47 +++----- .../tests/main.nf.test.snap | 108 ++++++++---------- .../nf-core/vcf_impute_glimpse/tests/tags.yml | 2 +- 16 files changed, 143 insertions(+), 160 deletions(-) diff --git a/modules/nf-core/glimpse/chunk/meta.yml b/modules/nf-core/glimpse/chunk/meta.yml index 65fa6218a4a..e500d9e9715 100644 --- a/modules/nf-core/glimpse/chunk/meta.yml +++ b/modules/nf-core/glimpse/chunk/meta.yml @@ -11,7 +11,7 @@ tools: documentation: "https://odelaneau.github.io/GLIMPSE/commands.html" tool_dev_url: "https://github.com/odelaneau/GLIMPSE" doi: "10.1038/s41588-020-00756-0" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map diff --git a/modules/nf-core/glimpse/concordance/meta.yml b/modules/nf-core/glimpse/concordance/meta.yml index c73948f4914..2b2d7195df8 100644 --- a/modules/nf-core/glimpse/concordance/meta.yml +++ b/modules/nf-core/glimpse/concordance/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://odelaneau.github.io/GLIMPSE/commands.html" tool_dev_url: "https://github.com/odelaneau/GLIMPSE" doi: "10.1038/s41588-020-00756-0" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map diff --git a/modules/nf-core/glimpse/concordance/tests/main.nf.test b/modules/nf-core/glimpse/concordance/tests/main.nf.test index d6236d35557..7e8505352c6 100644 --- a/modules/nf-core/glimpse/concordance/tests/main.nf.test +++ b/modules/nf-core/glimpse/concordance/tests/main.nf.test @@ -3,10 +3,13 @@ nextflow_process { name "Test Process GLIMPSE_CONCORDANCE" script "../main.nf" process "GLIMPSE_CONCORDANCE" - tag "glimpse" - tag "glimpse/concordance" + tag "modules" tag "modules_nfcore" + tag "glimpse" + tag "glimpse/concordance" + tag "glimpse/phase" + tag "bcftools/index" test("test_glimpse_concordance") { setup { @@ -20,15 +23,15 @@ nextflow_process { ]) input_vcf = Channel.of([ [ id:'input'], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) ]) ref_panel = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) ]) ch_map = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), ]) input[0] = input_vcf @@ -43,7 +46,7 @@ nextflow_process { script "../../../bcftools/index/main.nf" process { """ - input[0] = GLIMPSE_PHASE.out.phased_variant + input[0] = GLIMPSE_PHASE.out.phased_variants """ } } @@ -52,14 +55,14 @@ nextflow_process { process { """ allele_freq = Channel.fromList([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true) + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz",checkIfExists:true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.sites.vcf.gz.csi",checkIfExists:true) ]).collect() truth = Channel.fromList([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true) + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.bcf",checkIfExists:true), + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.bcf.csi",checkIfExists:true) ]).collect() - estimate = GLIMPSE_PHASE.out.phased_variant + estimate = GLIMPSE_PHASE.out.phased_variants | join (BCFTOOLS_INDEX.out.csi) input[0] = estimate | combine (allele_freq) diff --git a/modules/nf-core/glimpse/concordance/tests/main.nf.test.snap b/modules/nf-core/glimpse/concordance/tests/main.nf.test.snap index 239db1e48de..c0838446b5e 100644 --- a/modules/nf-core/glimpse/concordance/tests/main.nf.test.snap +++ b/modules/nf-core/glimpse/concordance/tests/main.nf.test.snap @@ -7,7 +7,7 @@ { "id": "input" }, - "input.error.cal.txt.gz:md5,3259370d3a6b16dc6518eb96e64afc8a" + "input.error.cal.txt.gz:md5,15c6a120d9fd3ac8c0ff6a6aedc76571" ] ], "1": [ @@ -15,7 +15,7 @@ { "id": "input" }, - "input.error.grp.txt.gz:md5,c40e24a68ad099285d3d0f84cefd721e" + "input.error.grp.txt.gz:md5,532bec52c03f16dcd6cc6d2b7c26673b" ] ], "2": [ @@ -23,7 +23,7 @@ { "id": "input" }, - "input.error.spl.txt.gz:md5,a5c4a09ab52790b33c839ecbbf3ff7ce" + "input.error.spl.txt.gz:md5,35cb463e8db41e2180f21941ab0324e0" ] ], "3": [ @@ -31,7 +31,7 @@ { "id": "input" }, - "input.rsquare.grp.txt.gz:md5,2139f7d680487379ef38e185d7e6f43d" + "input.rsquare.grp.txt.gz:md5,15bc7bf7980fd63e0f09bd267e548b57" ] ], "4": [ @@ -39,7 +39,7 @@ { "id": "input" }, - "input.rsquare.spl.txt.gz:md5,ea2beba9d4d0f68061176daa767bef95" + "input.rsquare.spl.txt.gz:md5,55659f466775d828ee1ba723464bb460" ] ], "5": [ @@ -50,7 +50,7 @@ { "id": "input" }, - "input.error.cal.txt.gz:md5,3259370d3a6b16dc6518eb96e64afc8a" + "input.error.cal.txt.gz:md5,15c6a120d9fd3ac8c0ff6a6aedc76571" ] ], "errors_grp": [ @@ -58,7 +58,7 @@ { "id": "input" }, - "input.error.grp.txt.gz:md5,c40e24a68ad099285d3d0f84cefd721e" + "input.error.grp.txt.gz:md5,532bec52c03f16dcd6cc6d2b7c26673b" ] ], "errors_spl": [ @@ -66,7 +66,7 @@ { "id": "input" }, - "input.error.spl.txt.gz:md5,a5c4a09ab52790b33c839ecbbf3ff7ce" + "input.error.spl.txt.gz:md5,35cb463e8db41e2180f21941ab0324e0" ] ], "rsquare_grp": [ @@ -74,7 +74,7 @@ { "id": "input" }, - "input.rsquare.grp.txt.gz:md5,2139f7d680487379ef38e185d7e6f43d" + "input.rsquare.grp.txt.gz:md5,15bc7bf7980fd63e0f09bd267e548b57" ] ], "rsquare_spl": [ @@ -82,7 +82,7 @@ { "id": "input" }, - "input.rsquare.spl.txt.gz:md5,ea2beba9d4d0f68061176daa767bef95" + "input.rsquare.spl.txt.gz:md5,55659f466775d828ee1ba723464bb460" ] ], "versions": [ @@ -90,6 +90,10 @@ ] } ], - "timestamp": "2023-10-17T17:05:45.177807376" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T23:37:00.537398654" } } \ No newline at end of file diff --git a/modules/nf-core/glimpse/ligate/meta.yml b/modules/nf-core/glimpse/ligate/meta.yml index da6066add2b..c3b1485c436 100644 --- a/modules/nf-core/glimpse/ligate/meta.yml +++ b/modules/nf-core/glimpse/ligate/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://odelaneau.github.io/GLIMPSE/commands.html" tool_dev_url: "https://github.com/odelaneau/GLIMPSE" doi: "10.1038/s41588-020-00756-0" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map diff --git a/modules/nf-core/glimpse/ligate/tests/main.nf.test b/modules/nf-core/glimpse/ligate/tests/main.nf.test index e86ff2317a0..7289fc91acc 100644 --- a/modules/nf-core/glimpse/ligate/tests/main.nf.test +++ b/modules/nf-core/glimpse/ligate/tests/main.nf.test @@ -3,10 +3,13 @@ nextflow_process { name "Test Process GLIMPSE_LIGATE" script "../main.nf" process "GLIMPSE_LIGATE" - tag "glimpse" - tag "glimpse/ligate" + tag "modules_nfcore" tag "modules" + tag "glimpse" + tag "glimpse/ligate" + tag "glimpse/phase" + tag "bcftools/index" test("test_glimpse_ligate") { setup { @@ -21,15 +24,15 @@ nextflow_process { ]) input_vcf = Channel.of([ [ id:'input'], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) ]) ref_panel = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) ]) ch_map = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), ]) input[0] = input_vcf @@ -44,7 +47,7 @@ nextflow_process { script "../../../bcftools/index/main.nf" process { """ - input[0] = GLIMPSE_PHASE.out.phased_variant + input[0] = GLIMPSE_PHASE.out.phased_variants """ } } @@ -53,7 +56,7 @@ nextflow_process { when { process { """ - input[0] = GLIMPSE_PHASE.out.phased_variant + input[0] = GLIMPSE_PHASE.out.phased_variants | groupTuple() | join (BCFTOOLS_INDEX.out.csi.groupTuple()) """ diff --git a/modules/nf-core/glimpse/phase/main.nf b/modules/nf-core/glimpse/phase/main.nf index a6f39d15866..41004e60789 100644 --- a/modules/nf-core/glimpse/phase/main.nf +++ b/modules/nf-core/glimpse/phase/main.nf @@ -4,14 +4,14 @@ process GLIMPSE_PHASE { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--h2ce4488_2': + 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--hce55b13_1': 'biocontainers/glimpse-bio:1.1.1--hce55b13_1' }" input: tuple val(meta) , path(input), path(input_index), path(samples_file), val(input_region), val(output_region), path(reference), path(reference_index), path(map) output: - tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: phased_variant + tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: phased_variants path "versions.yml" , emit: versions when: diff --git a/modules/nf-core/glimpse/phase/meta.yml b/modules/nf-core/glimpse/phase/meta.yml index 696616d37b1..862033b7f83 100644 --- a/modules/nf-core/glimpse/phase/meta.yml +++ b/modules/nf-core/glimpse/phase/meta.yml @@ -12,7 +12,7 @@ tools: documentation: "https://odelaneau.github.io/GLIMPSE/commands.html" tool_dev_url: "https://github.com/odelaneau/GLIMPSE" doi: "10.1038/s41588-020-00756-0" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map diff --git a/modules/nf-core/glimpse/phase/tests/main.nf.test b/modules/nf-core/glimpse/phase/tests/main.nf.test index 0009387f5a2..5c92cb1fc64 100644 --- a/modules/nf-core/glimpse/phase/tests/main.nf.test +++ b/modules/nf-core/glimpse/phase/tests/main.nf.test @@ -22,15 +22,15 @@ nextflow_process { ]) input_vcf = Channel.of([ [ id:'input'], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) ]) ref_panel = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) ]) ch_map = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), ]) input[0] = input_vcf @@ -47,7 +47,7 @@ nextflow_process { then { String targetFileName = "input_present_chr21_16650000-16800000.vcf.gz" - File selectedFile = process.out.phased_variant.stream() + File selectedFile = process.out.phased_variants.stream() .filter(vector -> vector.size() > 1) .map(vector -> new File(vector.get(1).toString())) .filter(file -> file.getName().equals(targetFileName)) @@ -58,7 +58,7 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out.versions).match("versions") }, - { assert process.out.phased_variant.size() == 4}, + { assert process.out.phased_variants.size() == 4}, { assert snapshot(lines).match("imputed") } ) } diff --git a/modules/nf-core/glimpse/sample/meta.yml b/modules/nf-core/glimpse/sample/meta.yml index 08e27b60c95..36937ec0c26 100644 --- a/modules/nf-core/glimpse/sample/meta.yml +++ b/modules/nf-core/glimpse/sample/meta.yml @@ -11,7 +11,7 @@ tools: documentation: "https://odelaneau.github.io/GLIMPSE/commands.html" tool_dev_url: "https://github.com/odelaneau/GLIMPSE" doi: "10.1038/s41588-020-00756-0" - licence: "['MIT']" + licence: ["MIT"] input: - meta: type: map @@ -22,12 +22,6 @@ input: type: file description: VCF/BCF file generated using GLIMPSE ligate pattern: "*.{vcf,bcf,vcf.gz,bcf.gz}" - - sample: - type: parameter - description: Samples a likely haplotype pair for each sample, use it in combination with --seed. Option not recommended for general usage, use --solve instead - - solve: - type: parameter - description: Get the most likely haplotype pair for each sample (the random number generator is not used) output: - meta: type: map diff --git a/modules/nf-core/glimpse/sample/tests/main.nf.test b/modules/nf-core/glimpse/sample/tests/main.nf.test index 9e6139d44bd..494c35296fe 100644 --- a/modules/nf-core/glimpse/sample/tests/main.nf.test +++ b/modules/nf-core/glimpse/sample/tests/main.nf.test @@ -3,10 +3,12 @@ nextflow_process { name "Test Process GLIMPSE_SAMPLE" script "../main.nf" process "GLIMPSE_SAMPLE" - tag "glimpse" - tag "glimpse/sample" + tag "modules" tag "modules_nfcore" + tag "glimpse" + tag "glimpse/sample" + tag "glimpse/phase" test("test_glimpse_sample") { config "./nextflow.config" @@ -21,15 +23,15 @@ nextflow_process { ]) input_vcf = Channel.of([ [ id:'input'], // meta map - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/NA12878.chr21.s.1x.vcf.gz.csi", checkIfExists: true) ]) ref_panel = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/1000GP.chr21.noNA12878.s.bcf.csi", checkIfExists: true) ]) ch_map = Channel.of([ - file("https://github.com/nf-core/test-datasets/raw/modules/data/delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), + file(params.modules_testdata_base_path + "delete_me/glimpse/chr21.b38.gmap.gz", checkIfExists: true), ]) input[0] = input_vcf @@ -44,7 +46,7 @@ nextflow_process { when { process { """ - input[0] = GLIMPSE_PHASE.out.phased_variant + input[0] = GLIMPSE_PHASE.out.phased_variants """ } } diff --git a/subworkflows/nf-core/vcf_impute_glimpse/main.nf b/subworkflows/nf-core/vcf_impute_glimpse/main.nf index 5fe265519c8..94262e34ae1 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/main.nf +++ b/subworkflows/nf-core/vcf_impute_glimpse/main.nf @@ -33,11 +33,11 @@ workflow VCF_IMPUTE_GLIMPSE { GLIMPSE_PHASE ( phase_input ) // [meta, vcf, index, sample_infos, regionin, regionout, ref, ref_index, map] ch_versions = ch_versions.mix(GLIMPSE_PHASE.out.versions ) - INDEX_PHASE ( GLIMPSE_PHASE.out.phased_variant ) + INDEX_PHASE ( GLIMPSE_PHASE.out.phased_variants ) ch_versions = ch_versions.mix( INDEX_PHASE.out.versions ) // Ligate all phased files in one and index it - ligate_input = GLIMPSE_PHASE.out.phased_variant + ligate_input = GLIMPSE_PHASE.out.phased_variants .groupTuple( by: 0 ) .combine( INDEX_PHASE.out.csi .groupTuple( by: 0 ), diff --git a/subworkflows/nf-core/vcf_impute_glimpse/meta.yml b/subworkflows/nf-core/vcf_impute_glimpse/meta.yml index 6c9fe2235ee..81b3b4d5814 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/meta.yml +++ b/subworkflows/nf-core/vcf_impute_glimpse/meta.yml @@ -30,19 +30,17 @@ output: description: | Tab delimited output txt file containing buffer and imputation regions. Structure: [meta, txt] - - phased_variants: - type: file - description: | - Output VCF/BCF file containing genotype probabilities (GP field), - imputed dosages (DS field), best guess genotypes (GT field), - sampled haplotypes in the last (max 16) main iterations (HS field) and info-score. - Structure: [ val(meta), bcf ] - merged_variants: type: file description: | - Output VCF/BCF file for the merged regions. + Output phased VCF/BCF file for the merged regions. Phased information (HS field) is updated accordingly for the full region. Structure: [ val(meta), bcf ] + - merged_variants_index: + type: file + description: | + Index output of phased VCF/BCF file for the merged regions. + Structure: [ val(meta), csi ] - versions: type: file description: File containing software versions diff --git a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test index 7931f706670..46db4244271 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test +++ b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test @@ -3,13 +3,14 @@ nextflow_workflow { name "Test Workflow VCF_IMPUTE_GLIMPSE" script "../main.nf" workflow "VCF_IMPUTE_GLIMPSE" - tag "glimpse" - tag "glimpse/chunk" - tag "glimpse/phase" - tag "glimpse/ligate" + tag "subworkflows" + tag "bcftools/index" tag "subworkflows_nfcore" - tag "vcf_impute_glimpse" + tag "subworkflows/vcf_impute_glimpse" + tag "glimpse/phase" + tag "glimpse/ligate" + tag "glimpse/chunk" test("Should run without failures") { config "./nextflow.config" @@ -24,14 +25,14 @@ nextflow_workflow { ch_panel = Channel.fromList([ [[ ref:'ref_panel'], - file("https://github.com/nf-core/test-datasets/raw/imputation/data/panel/both/1000GP.chr21_22.noNA12878.s.bcf", + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/panel/21_22/1000GP.chr21_22.s.norel.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/imputation/data/panel/both/1000GP.chr21_22.noNA12878.s.bcf.csi", + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/panel/21_22/1000GP.chr21_22.s.norel.bcf.csi", checkIfExists: true)], [[ ref:'ref_panel2'], - file("https://github.com/nf-core/test-datasets/raw/imputation/data/panel/both/1000GP.chr21_22.noNA12878.s.bcf", + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/panel/21_22/1000GP.chr21_22.s.norel.bcf", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/imputation/data/panel/both/1000GP.chr21_22.noNA12878.s.bcf.csi", + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/panel/21_22/1000GP.chr21_22.s.norel.bcf.csi", checkIfExists: true)] ]) region = Channel.fromList([ @@ -40,13 +41,13 @@ nextflow_workflow { ]) input_vcf = Channel.fromList([ - [[ id:'input'], // meta map - file("https://github.com/nf-core/test-datasets/raw/imputation/data/NA12878/both/NA12878.chr21_22.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/imputation/data/NA12878/both/NA12878.chr21_22.s.1x.vcf.gz.csi", checkIfExists: true), + [[ id:'NA12878'], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.1x.bcf", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA12878/NA12878.s.1x.bcf.csi", checkIfExists: true), ], - [[ id:'input2'], // meta map - file("https://github.com/nf-core/test-datasets/raw/imputation/data/NA12878/both/NA12878.chr21_22.s.1x.vcf.gz", checkIfExists: true), - file("https://github.com/nf-core/test-datasets/raw/imputation/data/NA12878/both/NA12878.chr21_22.s.1x.vcf.gz.csi", checkIfExists: true), + [[ id:'NA19401'], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA19401/NA19401.s.1x.bcf", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/individuals/NA19401/NA19401.s.1x.bcf.csi", checkIfExists: true), ] ]) input_vcf_multiple = input_vcf @@ -58,10 +59,10 @@ nextflow_workflow { ch_map = Channel.fromList([ [[ chr: "chr21"], - file("https://github.com/nf-core/test-datasets/raw/imputation/data/genetic_maps.b38/chr21.b38.gmap.gz", checkIfExists: true) + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/reference_genome/GRCh38.chr21.s.map", checkIfExists: true) ], [[ chr: "chr22"], - file("https://github.com/nf-core/test-datasets/raw/imputation/data/genetic_maps.b38/chr22.b38.gmap.gz", checkIfExists: true) + file("https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/reference_genome/GRCh38.chr22.s.map", checkIfExists: true) ] ]) @@ -85,17 +86,7 @@ nextflow_workflow { } then { - println(workflow.out.merged_variants) - String targetFileName = "input_chr21_ref_panel2_ligate.vcf.gz" - File selectedFile = workflow.out.merged_variants.stream() - .filter(vector -> vector.size() > 1) - .map(vector -> new File(vector.get(1).toString())) - .filter(file -> file.getName().equals(targetFileName)) - .findFirst() - .orElse(null) - String selectedFilename = selectedFile != null ? selectedFile.getPath() : null - def lines = path(selectedFilename).linesGzip.last() - print(lines) + def lines = path(workflow.out.merged_variants.get(0).get(1)).linesGzip.last() assertAll( { assert workflow.success }, { assert snapshot(workflow.out.versions).match("versions") }, diff --git a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap index 9265c429f2a..287930cdf35 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap +++ b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap @@ -4,79 +4,83 @@ [ [ { - "id": "input", + "id": "NA12878", "chr": "chr21", "region": "chr21:16600000-16800000", "ref": "ref_panel2" }, - "input_chr21:16600000-16800000_chunk.txt:md5,426f0f75efed96818656876116f73b06" + "NA12878_chr21:16600000-16800000_chunk.txt:md5,775240b195e782b3b83adf52e0d17089" ], [ { - "id": "input", + "id": "NA12878", "chr": "chr21", "region": "chr21:16600000-16800000", "ref": "ref_panel" }, - "input_chr21:16600000-16800000_chunk.txt:md5,426f0f75efed96818656876116f73b06" + "NA12878_chr21:16600000-16800000_chunk.txt:md5,775240b195e782b3b83adf52e0d17089" ], [ { - "id": "input", + "id": "NA12878", "chr": "chr22", "region": "chr22:16600000-16800000", "ref": "ref_panel2" }, - "input_chr22:16600000-16800000_chunk.txt:md5,4f48d33fd9c1e235ccfd25827a92ddd1" + "NA12878_chr22:16600000-16800000_chunk.txt:md5,f5270ed0faa4f9697618444b267442ce" ], [ { - "id": "input", + "id": "NA12878", "chr": "chr22", "region": "chr22:16600000-16800000", "ref": "ref_panel" }, - "input_chr22:16600000-16800000_chunk.txt:md5,4f48d33fd9c1e235ccfd25827a92ddd1" + "NA12878_chr22:16600000-16800000_chunk.txt:md5,f5270ed0faa4f9697618444b267442ce" ], [ { - "id": "input2", + "id": "NA19401", "chr": "chr21", "region": "chr21:16600000-16800000", "ref": "ref_panel2" }, - "input2_chr21:16600000-16800000_chunk.txt:md5,426f0f75efed96818656876116f73b06" + "NA19401_chr21:16600000-16800000_chunk.txt:md5,775240b195e782b3b83adf52e0d17089" ], [ { - "id": "input2", + "id": "NA19401", "chr": "chr21", "region": "chr21:16600000-16800000", "ref": "ref_panel" }, - "input2_chr21:16600000-16800000_chunk.txt:md5,426f0f75efed96818656876116f73b06" + "NA19401_chr21:16600000-16800000_chunk.txt:md5,775240b195e782b3b83adf52e0d17089" ], [ { - "id": "input2", + "id": "NA19401", "chr": "chr22", "region": "chr22:16600000-16800000", "ref": "ref_panel2" }, - "input2_chr22:16600000-16800000_chunk.txt:md5,4f48d33fd9c1e235ccfd25827a92ddd1" + "NA19401_chr22:16600000-16800000_chunk.txt:md5,f5270ed0faa4f9697618444b267442ce" ], [ { - "id": "input2", + "id": "NA19401", "chr": "chr22", "region": "chr22:16600000-16800000", "ref": "ref_panel" }, - "input2_chr22:16600000-16800000_chunk.txt:md5,4f48d33fd9c1e235ccfd25827a92ddd1" + "NA19401_chr22:16600000-16800000_chunk.txt:md5,f5270ed0faa4f9697618444b267442ce" ] ] ], - "timestamp": "2023-10-17T18:20:13.045340135" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T23:16:59.014613786" }, "versions": { "content": [ @@ -105,54 +109,38 @@ "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,7ae4d2b0252f9382dd08d783b7a234d2", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,86d1ec939ded96a4ed3fb73ff83c240b", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae", - "versions.yml:md5,a17a10f6eb5e140e388b92d5f19680ae" + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,a802158fea97c36620863658efb7ae68", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96", + "versions.yml:md5,e37bdea2d40f36ce8546f87c3e572c96" ] ], - "timestamp": "2023-10-17T18:20:06.846882518" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T23:16:58.336134471" }, "merged": { "content": [ - "chr21\t16799989\t21:16799989:T:C\tT\tC\t.\t.\tRAF=0.000468897;AF=0;INFO=1\tGT:DS:GP:HS\t0/0:0:1,0,0:0" + "chr21\t16609998\t21:16609998:A:G\tA\tG\t.\t.\tRAF=0.00125156;AF=0;INFO=1\tGT:DS:GP:HS\t0/0:0:1,0,0:0" ], - "timestamp": "2023-10-17T18:20:19.789038503" + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-18T23:16:59.786459305" } } \ No newline at end of file diff --git a/subworkflows/nf-core/vcf_impute_glimpse/tests/tags.yml b/subworkflows/nf-core/vcf_impute_glimpse/tests/tags.yml index 34d277258cb..24003ec0293 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/tests/tags.yml +++ b/subworkflows/nf-core/vcf_impute_glimpse/tests/tags.yml @@ -1,2 +1,2 @@ -vcf_impute_glimpse: +subworkflows/vcf_impute_glimpse: - subworkflows/nf-core/vcf_impute_glimpse/** From 26dc61f087ef47f79ddd724476596cfe31fa5ec7 Mon Sep 17 00:00:00 2001 From: MarieLataretu <52002068+MarieLataretu@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:51:47 +0100 Subject: [PATCH 26/46] added new module lofraq/viterbi; solves new module: lofreq/viterbi #5158 (#5197) * added new module lofraq/viterbi; solves new module: lofreq/viterbi #5158 * added new module lofraq/viterbi; solves new module: lofreq/viterbi #5158 * removed yml schema comments * added samtools as conda dependency; chnaged container build version to py310h47ef89e_10; updated test snapshot --- .../nf-core/lofreq/viterbi/environment.yml | 8 +++ modules/nf-core/lofreq/viterbi/main.nf | 54 ++++++++++++++ modules/nf-core/lofreq/viterbi/meta.yml | 50 +++++++++++++ .../nf-core/lofreq/viterbi/tests/main.nf.test | 64 +++++++++++++++++ .../lofreq/viterbi/tests/main.nf.test.snap | 72 +++++++++++++++++++ modules/nf-core/lofreq/viterbi/tests/tags.yml | 2 + 6 files changed, 250 insertions(+) create mode 100644 modules/nf-core/lofreq/viterbi/environment.yml create mode 100644 modules/nf-core/lofreq/viterbi/main.nf create mode 100644 modules/nf-core/lofreq/viterbi/meta.yml create mode 100644 modules/nf-core/lofreq/viterbi/tests/main.nf.test create mode 100644 modules/nf-core/lofreq/viterbi/tests/main.nf.test.snap create mode 100644 modules/nf-core/lofreq/viterbi/tests/tags.yml diff --git a/modules/nf-core/lofreq/viterbi/environment.yml b/modules/nf-core/lofreq/viterbi/environment.yml new file mode 100644 index 00000000000..d81bc229270 --- /dev/null +++ b/modules/nf-core/lofreq/viterbi/environment.yml @@ -0,0 +1,8 @@ +name: "lofreq_viterbi" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - bioconda::lofreq=2.1.5 + - bioconda::samtools=1.17 diff --git a/modules/nf-core/lofreq/viterbi/main.nf b/modules/nf-core/lofreq/viterbi/main.nf new file mode 100644 index 00000000000..e16bd4a4cc3 --- /dev/null +++ b/modules/nf-core/lofreq/viterbi/main.nf @@ -0,0 +1,54 @@ +process LOFREQ_VITERBI { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/lofreq:2.1.5--py310h47ef89e_10' : + 'biocontainers/lofreq:2.1.5--py310h47ef89e_10' }" + + input: + tuple val(meta), path(bam) + path(fasta) + + output: + tuple val(meta), path("*.bam"), emit: bam + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + lofreq \\ + viterbi \\ + $args \\ + -ref $fasta \\ + $bam | + samtools sort \\ + $args2 \\ + -T ${prefix} \\ + --threads $task.cpus \\ + -o ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + lofreq: \$(echo \$(lofreq version 2>&1) | sed 's/^version: //; s/ *commit.*\$//') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + lofreq: \$(echo \$(lofreq version 2>&1) | sed 's/^version: //; s/ *commit.*\$//') + END_VERSIONS + """ +} diff --git a/modules/nf-core/lofreq/viterbi/meta.yml b/modules/nf-core/lofreq/viterbi/meta.yml new file mode 100644 index 00000000000..3ae9844b429 --- /dev/null +++ b/modules/nf-core/lofreq/viterbi/meta.yml @@ -0,0 +1,50 @@ +name: "lofreq_viterbi" +description: Lofreq subcommand to call low frequency variants from alignments when tumor-normal paired samples are available +keywords: + - variant calling + - low frequency variant calling + - variants + - bam + - probabilistic realignment +tools: + - "lofreq": + description: "A fast and sensitive variant-caller for inferring SNVs and indels from next-generation sequencing data" + homepage: https://csb5.github.io/lofreq/ + documentation: https://csb5.github.io/lofreq/commands/ + doi: 10.1093/nar/gks918 + licence: ["MIT"] +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: Sorted BAM file + pattern: "*.{bam}" + - fasta: + type: file + description: Reference genome FASTA file + pattern: "*.{fasta}" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - bam: + type: file + description: Realignment and sorted BAM file + pattern: "*.{bam}" + +authors: + - "@MarieLataretu" +maintainers: + - "@MarieLataretu" diff --git a/modules/nf-core/lofreq/viterbi/tests/main.nf.test b/modules/nf-core/lofreq/viterbi/tests/main.nf.test new file mode 100644 index 00000000000..aa94635ec6c --- /dev/null +++ b/modules/nf-core/lofreq/viterbi/tests/main.nf.test @@ -0,0 +1,64 @@ +nextflow_process { + + name "Test Process LOFREQ_VITERBI" + script "../main.nf" + process "LOFREQ_VITERBI" + + tag "modules" + tag "modules_nfcore" + tag "lofreq" + tag "lofreq/viterbi" + + test("sarscov2 - bam, fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + input[1] = [ + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - bam, fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_paired_end_bam'], checkIfExists: true) + ] + input[1] = [ + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/lofreq/viterbi/tests/main.nf.test.snap b/modules/nf-core/lofreq/viterbi/tests/main.nf.test.snap new file mode 100644 index 00000000000..051374e384d --- /dev/null +++ b/modules/nf-core/lofreq/viterbi/tests/main.nf.test.snap @@ -0,0 +1,72 @@ +{ + "sarscov2 - bam, fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,714e906a0c1a4e3d4c7e5ac25ea0edec" + ] + ], + "1": [ + "versions.yml:md5,42875f148272abe6fcf2a179235e1ebc" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,714e906a0c1a4e3d4c7e5ac25ea0edec" + ] + ], + "versions": [ + "versions.yml:md5,42875f148272abe6fcf2a179235e1ebc" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.1" + }, + "timestamp": "2024-03-19T11:22:12.627457484" + }, + "sarscov2 - bam, fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,42875f148272abe6fcf2a179235e1ebc" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,42875f148272abe6fcf2a179235e1ebc" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.1" + }, + "timestamp": "2024-03-18T13:31:47.157939767" + } +} \ No newline at end of file diff --git a/modules/nf-core/lofreq/viterbi/tests/tags.yml b/modules/nf-core/lofreq/viterbi/tests/tags.yml new file mode 100644 index 00000000000..9c5b0876945 --- /dev/null +++ b/modules/nf-core/lofreq/viterbi/tests/tags.yml @@ -0,0 +1,2 @@ +lofreq/viterbi: + - "modules/nf-core/lofreq/viterbi/**" From cabcc0dadf8366aa7a9930066a7b3dd90d9825d5 Mon Sep 17 00:00:00 2001 From: Adam Talbot <12817534+adamrtalbot@users.noreply.github.com> Date: Tue, 19 Mar 2024 16:39:42 +0000 Subject: [PATCH 27/46] Fix test for FASTQ_FASTQC_UMITOOLS_FASTP which included an absolute path in the snapshot. (#5278) --- .../tests/main.nf.test | 41 ++++++++++--------- .../tests/main.nf.test.snap | 20 ++++----- 2 files changed, 29 insertions(+), 32 deletions(-) diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test index 85747415327..961b5b4ff61 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test @@ -64,8 +64,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, @@ -124,8 +124,8 @@ nextflow_workflow { ).match() }, - { assert !workflow.out.fastqc_raw_html}, - { assert !workflow.out.fastqc_raw_zip}, + { assert !workflow.out.fastqc_raw_html }, + { assert !workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert !workflow.out.fastqc_trim_html }, @@ -183,8 +183,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, @@ -244,8 +244,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, @@ -304,8 +304,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, @@ -353,7 +353,10 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out.reads, + workflow.out.reads.get(0).get(0), // Reads meta map + // Because the input file is passed to the output file, we have to do check the filename only + file(workflow.out.reads.get(0).get(1).get(0)).name, + file(workflow.out.reads.get(0).get(1).get(1)).name, workflow.out.umi_log, workflow.out.trim_json, workflow.out.trim_reads_fail, @@ -364,8 +367,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert !workflow.out.trim_html }, { assert !workflow.out.trim_log }, { assert !workflow.out.fastqc_trim_html }, @@ -426,8 +429,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, @@ -486,8 +489,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, @@ -547,8 +550,8 @@ nextflow_workflow { ).match() }, - { assert workflow.out.fastqc_raw_html}, - { assert workflow.out.fastqc_raw_zip}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, { assert workflow.out.trim_html }, { assert workflow.out.trim_log }, { assert workflow.out.fastqc_trim_html }, diff --git a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap index 1be6597ecf3..3e11d9ec370 100644 --- a/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap +++ b/subworkflows/nf-core/fastq_fastqc_umitools_fastp/tests/main.nf.test.snap @@ -325,18 +325,12 @@ }, "skip_trimming": { "content": [ - [ - [ - { - "id": "test", - "single_end": false - }, - [ - "/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/fastq/test_1.fastq.gz", - "/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/fastq/test_2.fastq.gz" - ] - ] - ], + { + "id": "test", + "single_end": false + }, + "test_1.fastq.gz", + "test_2.fastq.gz", [ ], @@ -363,7 +357,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-18T12:08:51.217937" + "timestamp": "2024-03-19T15:49:26.574759" }, "sarscov2 paired-end [fastq]": { "content": [ From 8ce34a40589137b75b65dfe8bb334c9b94f1d6c8 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Wed, 20 Mar 2024 10:28:29 +1300 Subject: [PATCH 28/46] Added liftoff (#5209) * Added liftoff * Added -db arg --- modules/nf-core/liftoff/environment.yml | 9 ++ modules/nf-core/liftoff/main.nf | 66 ++++++++++++ modules/nf-core/liftoff/meta.yml | 71 ++++++++++++ modules/nf-core/liftoff/tests/main.nf.test | 102 ++++++++++++++++++ .../nf-core/liftoff/tests/main.nf.test.snap | 96 +++++++++++++++++ modules/nf-core/liftoff/tests/nextflow.config | 5 + modules/nf-core/liftoff/tests/tags.yml | 2 + 7 files changed, 351 insertions(+) create mode 100644 modules/nf-core/liftoff/environment.yml create mode 100644 modules/nf-core/liftoff/main.nf create mode 100644 modules/nf-core/liftoff/meta.yml create mode 100644 modules/nf-core/liftoff/tests/main.nf.test create mode 100644 modules/nf-core/liftoff/tests/main.nf.test.snap create mode 100644 modules/nf-core/liftoff/tests/nextflow.config create mode 100644 modules/nf-core/liftoff/tests/tags.yml diff --git a/modules/nf-core/liftoff/environment.yml b/modules/nf-core/liftoff/environment.yml new file mode 100644 index 00000000000..8761c9bf73e --- /dev/null +++ b/modules/nf-core/liftoff/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "liftoff" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::liftoff=1.6.3" diff --git a/modules/nf-core/liftoff/main.nf b/modules/nf-core/liftoff/main.nf new file mode 100644 index 00000000000..4db5da2f462 --- /dev/null +++ b/modules/nf-core/liftoff/main.nf @@ -0,0 +1,66 @@ +process LIFTOFF { + tag "$meta.id" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/liftoff:1.6.3--pyhdfd78af_0': + 'biocontainers/liftoff:1.6.3--pyhdfd78af_0' }" + + input: + tuple val(meta), path(target_fa) + path ref_fa, name: 'ref_assembly.fa' + path ref_annotation + path ref_db + + output: + tuple val(meta), path("${prefix}.gff3") , emit: gff3 + tuple val(meta), path("*.polished.gff3") , emit: polished_gff3, optional: true + tuple val(meta), path("*.unmapped.txt") , emit: unmapped_txt + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def arg_g = ref_annotation ? "-g $ref_annotation" : '' + def arg_db = ref_db ? "-db $ref_db" : '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + liftoff \\ + $arg_g \\ + $arg_db \\ + -p $task.cpus \\ + -o "${prefix}.gff3" \\ + -u "${prefix}.unmapped.txt" \\ + $args \\ + $target_fa \\ + ref_assembly.fa + + mv \\ + "${prefix}.gff3_polished" \\ + "${prefix}.polished.gff3" \\ + || echo "-polish is absent" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + liftoff: \$(liftoff --version 2> /dev/null) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + def touch_polished = args.contains('-polish') ? "touch ${prefix}.polished.gff3" : '' + """ + touch "${prefix}.gff3" + touch "${prefix}.unmapped.txt" + $touch_polished + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + liftoff: \$(liftoff --version 2> /dev/null) + END_VERSIONS + """ +} diff --git a/modules/nf-core/liftoff/meta.yml b/modules/nf-core/liftoff/meta.yml new file mode 100644 index 00000000000..10e502c150b --- /dev/null +++ b/modules/nf-core/liftoff/meta.yml @@ -0,0 +1,71 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "liftoff" +description: | + Uses Liftoff to accurately map annotations in GFF or GTF between assemblies of the same, + or closely-related species +keywords: + - genome + - annotation + - gff3 + - gtf + - liftover +tools: + - "liftoff": + description: | + Liftoff is a tool that accurately maps annotations in GFF or GTF between assemblies of the same, + or closely-related species + homepage: "https://github.com/agshumate/Liftoff" + documentation: "https://github.com/agshumate/Liftoff" + tool_dev_url: "https://github.com/agshumate/Liftoff" + doi: "10.1093/bioinformatics/bty191" + licence: ["GPL v3 License"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - target_fa: + type: file + description: Target assembly in fasta format + pattern: "*.{fsa,fa,fasta}" + - ref_fa: + type: file + description: Reference assembly in fasta format + pattern: "*.{fsa,fa,fasta}" + - ref_annotation: + type: file + description: Reference assembly annotations in gtf or gff3 format + pattern: "*.{gtf,gff3}" + - ref_db: + type: file + description: | + Name of feature database; if not specified, the -g argument must + be provided and a database will be built automatically +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - gff3: + type: file + description: Lifted annotations for the target assembly in gff3 format + pattern: "*.gff3" + - polished_gff3: + type: file + description: Polished lifted annotations for the target assembly in gff3 format + pattern: "*.polished.gff3" + - unmapped_txt: + type: file + description: List of unmapped reference annotations + pattern: "*.unmapped.txt" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@GallVp" +maintainers: + - "@GallVp" diff --git a/modules/nf-core/liftoff/tests/main.nf.test b/modules/nf-core/liftoff/tests/main.nf.test new file mode 100644 index 00000000000..fc0f56719ae --- /dev/null +++ b/modules/nf-core/liftoff/tests/main.nf.test @@ -0,0 +1,102 @@ +nextflow_process { + + name "Test Process LIFTOFF" + script "../main.nf" + process "LIFTOFF" + config "./nextflow.config" + + tag "modules" + tag "modules_nfcore" + tag "nf-core/gunzip" + tag "liftoff" + tag "gunzip" + + test("homo_sapiens-genome_21_fasta-genome_1_fasta-genome_1_gtf") { + + setup { + run("GUNZIP") { + script "../../../nf-core/gunzip" + + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_1_fasta'], checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[1] = GUNZIP.out.gunzip.map { meta, file -> file } + input[2] = [ + file(params.test_data['homo_sapiens']['genome']['genome_1_gtf'], checkIfExists: true) + ] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.unmapped_txt).match("unmapped_txt") }, + { assert file(process.out.gff3[0][1]).text.contains("chr21\tLiftoff\texon\t34608061\t34608118\t.\t+\t.") }, + { assert file(process.out.polished_gff3[0][1]).text.contains("chr21\tLiftoff\texon\t34608061\t34608118\t.\t+\t.") }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + + test("homo_sapiens-genome_21_fasta-genome_1_fasta-genome_1_gtf-stub") { + options '-stub' + + setup { + run("GUNZIP") { + script "../../../nf-core/gunzip" + + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_1_fasta'], checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_21_fasta'], checkIfExists: true) + ] + input[1] = GUNZIP.out.gunzip.map { meta, file -> file } + input[2] = [ + file(params.test_data['homo_sapiens']['genome']['genome_1_gtf'], checkIfExists: true) + ] + input[3] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/liftoff/tests/main.nf.test.snap b/modules/nf-core/liftoff/tests/main.nf.test.snap new file mode 100644 index 00000000000..f6064467e33 --- /dev/null +++ b/modules/nf-core/liftoff/tests/main.nf.test.snap @@ -0,0 +1,96 @@ +{ + "unmapped_txt": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.unmapped.txt:md5,7391d10df6e15db356b084c9af5259e4" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2023-12-01T13:57:40.748507" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,205d9c609e7fe27d8199550d842bdce8" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2023-12-01T13:57:40.752414" + }, + "homo_sapiens-genome_21_fasta-genome_1_fasta-genome_1_gtf-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test" + }, + "test.polished.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test" + }, + "test.unmapped.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,205d9c609e7fe27d8199550d842bdce8" + ], + "gff3": [ + [ + { + "id": "test" + }, + "test.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "polished_gff3": [ + [ + { + "id": "test" + }, + "test.polished.gff3:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "unmapped_txt": [ + [ + { + "id": "test" + }, + "test.unmapped.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,205d9c609e7fe27d8199550d842bdce8" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T09:15:25.661428" + } +} \ No newline at end of file diff --git a/modules/nf-core/liftoff/tests/nextflow.config b/modules/nf-core/liftoff/tests/nextflow.config new file mode 100644 index 00000000000..f35ef801698 --- /dev/null +++ b/modules/nf-core/liftoff/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: LIFTOFF { + ext.args = '-polish' + } +} diff --git a/modules/nf-core/liftoff/tests/tags.yml b/modules/nf-core/liftoff/tests/tags.yml new file mode 100644 index 00000000000..4d0adb62c6c --- /dev/null +++ b/modules/nf-core/liftoff/tests/tags.yml @@ -0,0 +1,2 @@ +liftoff: + - "modules/nf-core/liftoff/**" From 5ed10bdf45859615a71ef7ff975a26bb321f4ea6 Mon Sep 17 00:00:00 2001 From: Usman Rashid Date: Wed, 20 Mar 2024 11:59:35 +1300 Subject: [PATCH 29/46] Added gt/gff3validator (#4718) * Added gt/gff3validator * Make error handling a bit more intuitive * Fixed a problem with info echo and simplified test assertions --------- Co-authored-by: Leon Rauschning <99650940+lrauschning@users.noreply.github.com> --- .../nf-core/gt/gff3validator/environment.yml | 9 ++ modules/nf-core/gt/gff3validator/main.nf | 61 ++++++++++ modules/nf-core/gt/gff3validator/meta.yml | 49 ++++++++ .../gt/gff3validator/tests/main.nf.test | 98 ++++++++++++++++ .../gt/gff3validator/tests/main.nf.test.snap | 107 ++++++++++++++++++ .../gt/gff3validator/tests/nextflow.config | 5 + .../nf-core/gt/gff3validator/tests/tags.yml | 2 + 7 files changed, 331 insertions(+) create mode 100644 modules/nf-core/gt/gff3validator/environment.yml create mode 100644 modules/nf-core/gt/gff3validator/main.nf create mode 100644 modules/nf-core/gt/gff3validator/meta.yml create mode 100644 modules/nf-core/gt/gff3validator/tests/main.nf.test create mode 100644 modules/nf-core/gt/gff3validator/tests/main.nf.test.snap create mode 100644 modules/nf-core/gt/gff3validator/tests/nextflow.config create mode 100644 modules/nf-core/gt/gff3validator/tests/tags.yml diff --git a/modules/nf-core/gt/gff3validator/environment.yml b/modules/nf-core/gt/gff3validator/environment.yml new file mode 100644 index 00000000000..ea57ebe06a8 --- /dev/null +++ b/modules/nf-core/gt/gff3validator/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "gt_gff3validator" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::genometools-genometools=1.6.5" diff --git a/modules/nf-core/gt/gff3validator/main.nf b/modules/nf-core/gt/gff3validator/main.nf new file mode 100644 index 00000000000..8c6899cafa3 --- /dev/null +++ b/modules/nf-core/gt/gff3validator/main.nf @@ -0,0 +1,61 @@ +process GT_GFF3VALIDATOR { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/genometools-genometools:1.6.5--py310h3db02ab_0': + 'biocontainers/genometools-genometools:1.6.5--py310h3db02ab_0' }" + + input: + tuple val(meta), path(gff3) + + output: + tuple val(meta), path('*.success.log') , emit: success_log , optional: true + tuple val(meta), path('*.error.log') , emit: error_log , optional: true + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + gt \\ + gff3validator \\ + "$gff3" \\ + > "${prefix}.stdout" \\ + 2> >(tee "${prefix}.stderr" >&2) \\ + || echo "Errors from gt-gff3validator printed to ${prefix}.error.log" + + if grep -q "input is valid GFF3" "${prefix}.stdout"; then + echo "Validation successful..." + # emit stdout to the success output channel + mv \\ + "${prefix}.stdout" \\ + "${prefix}.success.log" + else + echo "Validation failed..." + # emit stderr to the error output channel + mv \\ + "${prefix}.stderr" \\ + "${prefix}.error.log" + fi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + genometools: \$(gt --version | head -1 | sed 's/gt (GenomeTools) //') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch "${prefix}.success.log" + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + genometools: \$(gt --version | head -1 | sed 's/gt (GenomeTools) //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/gt/gff3validator/meta.yml b/modules/nf-core/gt/gff3validator/meta.yml new file mode 100644 index 00000000000..3322faf90cf --- /dev/null +++ b/modules/nf-core/gt/gff3validator/meta.yml @@ -0,0 +1,49 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "gt_gff3validator" +description: "GenomeTools gt-gff3validator utility to strictly validate a GFF3 file" +keywords: + - genome + - gff3 + - annotation + - validation +tools: + - "gt": + description: "The GenomeTools genome analysis system" + homepage: "https://genometools.org/index.html" + documentation: "https://genometools.org/documentation.html" + tool_dev_url: "https://github.com/genometools/genometools" + doi: "10.1109/TCBB.2013.68" + licence: ["ISC"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - gff3: + type: file + description: Input gff3 file + pattern: "*.{gff,gff3}" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test' ]` + - success_log: + type: file + description: Log file for successful validation + pattern: "*.success.log" + - error_log: + type: file + description: Log file for failed validation + pattern: "*.error.log" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@GallVp" +maintainers: + - "@GallVp" diff --git a/modules/nf-core/gt/gff3validator/tests/main.nf.test b/modules/nf-core/gt/gff3validator/tests/main.nf.test new file mode 100644 index 00000000000..766e3e7425d --- /dev/null +++ b/modules/nf-core/gt/gff3validator/tests/main.nf.test @@ -0,0 +1,98 @@ +nextflow_process { + + name "Test Process GT_GFF3VALIDATOR" + script "../main.nf" + process "GT_GFF3VALIDATOR" + + tag "modules" + tag "modules_nfcore" + tag "gt" + tag "gt/gff3validator" + tag "gt/gff3" + + test("sarscov2-gff3-valid") { + + config './nextflow.config' + + setup { + run("GT_GFF3") { + script "../../../../nf-core/gt/gff3" + + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['sarscov2']['genome']['genome_gff3'], checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = GT_GFF3.out.gt_gff3 + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert path(process.out.success_log[0][1]).text.contains("input is valid GFF3") }, + { assert process.out.error_log == [] } + ) + } + + } + + test("sarscov2-gff3-stub") { + + options '-stub' + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['sarscov2']['genome']['genome_gff3'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2-gff3-invalid") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['genome']['genome_gff3'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert process.out.success_log == [] }, + { assert path(process.out.error_log[0][1]).text.contains("gt gff3validator: error:") } + ) + } + + } +} diff --git a/modules/nf-core/gt/gff3validator/tests/main.nf.test.snap b/modules/nf-core/gt/gff3validator/tests/main.nf.test.snap new file mode 100644 index 00000000000..ccc83f90f51 --- /dev/null +++ b/modules/nf-core/gt/gff3validator/tests/main.nf.test.snap @@ -0,0 +1,107 @@ +{ + "sarscov2-gff3-stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.success.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,5927673eb73a8c22408643d224414215" + ], + "error_log": [ + + ], + "success_log": [ + [ + { + "id": "test" + }, + "test.success.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,5927673eb73a8c22408643d224414215" + ] + } + ], + "timestamp": "2024-01-11T09:29:13.14468" + }, + "sarscov2-gff3-invalid": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test" + }, + "test.error.log:md5,c5d16b263a87072a13cca44fd811b8e2" + ] + ], + "2": [ + "versions.yml:md5,5927673eb73a8c22408643d224414215" + ], + "error_log": [ + [ + { + "id": "test" + }, + "test.error.log:md5,c5d16b263a87072a13cca44fd811b8e2" + ] + ], + "success_log": [ + + ], + "versions": [ + "versions.yml:md5,5927673eb73a8c22408643d224414215" + ] + } + ], + "timestamp": "2023-11-29T11:09:23.708792" + }, + "sarscov2-gff3-valid": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.success.log:md5,b11ca5c18c865fc808ea0fef0b07da30" + ] + ], + "1": [ + + ], + "2": [ + "versions.yml:md5,5927673eb73a8c22408643d224414215" + ], + "error_log": [ + + ], + "success_log": [ + [ + { + "id": "test" + }, + "test.success.log:md5,b11ca5c18c865fc808ea0fef0b07da30" + ] + ], + "versions": [ + "versions.yml:md5,5927673eb73a8c22408643d224414215" + ] + } + ], + "timestamp": "2023-12-13T10:34:54.485391" + } +} \ No newline at end of file diff --git a/modules/nf-core/gt/gff3validator/tests/nextflow.config b/modules/nf-core/gt/gff3validator/tests/nextflow.config new file mode 100644 index 00000000000..c69915daf5d --- /dev/null +++ b/modules/nf-core/gt/gff3validator/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: GT_GFF3 { + ext.args = '-tidy -retainids' + } +} diff --git a/modules/nf-core/gt/gff3validator/tests/tags.yml b/modules/nf-core/gt/gff3validator/tests/tags.yml new file mode 100644 index 00000000000..98c39ffe080 --- /dev/null +++ b/modules/nf-core/gt/gff3validator/tests/tags.yml @@ -0,0 +1,2 @@ +gt/gff3validator: + - "modules/nf-core/gt/gff3validator/**" From 383a1fa09439aedca02a86c93fa1b0a5d699a7eb Mon Sep 17 00:00:00 2001 From: Andrea Telatin <15690844+telatin@users.noreply.github.com> Date: Wed, 20 Mar 2024 03:14:53 +0000 Subject: [PATCH 30/46] Add module seqfu/stats (#5275) * seqfu/stats * fix test * improve-tests * improve-tests-fixsnap * Update modules/nf-core/seqfu/stats/main.nf Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/seqfu/stats/main.nf Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/seqfu/stats/tests/main.nf.test Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> * Update modules/nf-core/seqfu/stats/tests/main.nf.test Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --------- Co-authored-by: Sateesh_Peri <33637490+sateeshperi@users.noreply.github.com> --- modules/nf-core/seqfu/stats/environment.yml | 9 +++ modules/nf-core/seqfu/stats/main.nf | 51 +++++++++++++ modules/nf-core/seqfu/stats/meta.yml | 57 ++++++++++++++ .../nf-core/seqfu/stats/tests/main.nf.test | 75 +++++++++++++++++++ .../seqfu/stats/tests/main.nf.test.snap | 56 ++++++++++++++ modules/nf-core/seqfu/stats/tests/tags.yml | 2 + 6 files changed, 250 insertions(+) create mode 100644 modules/nf-core/seqfu/stats/environment.yml create mode 100644 modules/nf-core/seqfu/stats/main.nf create mode 100644 modules/nf-core/seqfu/stats/meta.yml create mode 100644 modules/nf-core/seqfu/stats/tests/main.nf.test create mode 100644 modules/nf-core/seqfu/stats/tests/main.nf.test.snap create mode 100644 modules/nf-core/seqfu/stats/tests/tags.yml diff --git a/modules/nf-core/seqfu/stats/environment.yml b/modules/nf-core/seqfu/stats/environment.yml new file mode 100644 index 00000000000..abd60be65b4 --- /dev/null +++ b/modules/nf-core/seqfu/stats/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "seqfu_stats" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::seqfu=1.20.3" diff --git a/modules/nf-core/seqfu/stats/main.nf b/modules/nf-core/seqfu/stats/main.nf new file mode 100644 index 00000000000..0f8bb3e220a --- /dev/null +++ b/modules/nf-core/seqfu/stats/main.nf @@ -0,0 +1,51 @@ +process SEQFU_STATS { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/seqfu:1.20.3--h1eb128b_0': + 'biocontainers/seqfu:1.20.3--h1eb128b_0' }" + + + input: + // stats can get one or more fasta or fastq files + tuple val(meta), path(files) + + output: + tuple val(meta), path("*.tsv") , emit: stats + tuple val(meta), path("*_mqc.txt"), emit: multiqc + 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}" + """ + seqfu \\ + stats \\ + $args \\ + --multiqc ${prefix}_mqc.txt \\ + $files > ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + seqfu: \$(seqfu version) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}_mqc.txt + seqfu stats ${prefix}_mqc.txt > ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + seqfu: \$(samtools --version |& sed '1!d ; s/samtools //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/seqfu/stats/meta.yml b/modules/nf-core/seqfu/stats/meta.yml new file mode 100644 index 00000000000..df6093c5120 --- /dev/null +++ b/modules/nf-core/seqfu/stats/meta.yml @@ -0,0 +1,57 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "seqfu_stats" +description: Statistics for FASTA or FASTQ files +keywords: + - seqfu + - stats + - n50 +tools: + - "seqfu": + description: "Cross-platform compiled suite of tools to manipulate and inspect FASTA and FASTQ files" + homepage: "https://telatin.github.io/seqfu2/" + documentation: "https://telatin.github.io/seqfu2/" + tool_dev_url: "https://github.com/telatin/seqfu2" + doi: "10.3390/bioengineering8050059" + licence: ["GPL v3"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - files: + type: file + description: One or more FASTA or FASTQ files + pattern: "*.{fasta,fastq,fasta.gz,fastq.gz,fq,fq.gz}" + +output: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + + - stats: + type: file + description: Tab-separated output file with basic sequence statistics. + pattern: "*.{tsv}" + + - multiqc: + type: file + description: MultiQC ready table + pattern: "*.{_mqc.txt}" + +authors: + - "@telatin" +maintainers: + - "@telatin" diff --git a/modules/nf-core/seqfu/stats/tests/main.nf.test b/modules/nf-core/seqfu/stats/tests/main.nf.test new file mode 100644 index 00000000000..d8d7de6049e --- /dev/null +++ b/modules/nf-core/seqfu/stats/tests/main.nf.test @@ -0,0 +1,75 @@ +nextflow_process { + + name "Test Process SEQFU_STATS" + script "../main.nf" + process "SEQFU_STATS" + + tag "modules" + tag "modules_nfcore" + tag "seqfu" + tag "seqfu/stats" + + + test("seqfu stats - faa") { + // test with 1 FAA file (with multiple sequences of different length) + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['sarscov2']['genome']['proteome_fasta'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.stats }, + { assert process.out.multiqc }, + { assert process.out.stats.size() == 1 }, + { assert snapshot(process.out.versions).match("versions-single") }, + { assert snapshot(process.out.stats).match("stats-single") }, + { assert path(process.out.stats.get(0).get(1)).md5 == "26141ef87ad8a6f59a6f283cc0a06fda" } + ) + } + + } + + test("seqfu stats - multiple files") { + // test feeding a mix of files including compressed + when { + process { + """ + input[0] = [ + [ id:'test' ], + [ + file(params.test_data['sarscov2']['genome']['proteome_fasta'], checkIfExists: true), + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), + file(params.test_data['sarscov2']['genome']['genome_fasta_gz'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + ] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.stats }, + { assert process.out.multiqc }, + { assert process.out.stats.size() == 1 }, + { assert path(process.out.versions[0]).readLines()[1].contains('.') }, + { assert snapshot(process.out.stats).match("stats-multi") }, + { assert snapshot(process.out.stats).md5().match("multi-lines") }, + { assert path(process.out.stats[0][1]).readLines()[0] == 'File\t#Seq\tTotal bp\tAvg\tN50\tN75\tN90\tauN\tMin\tMax' }, + { assert path(process.out.multiqc[0][1]).readLines().join('\n').contains('genome.fasta') }, + { assert path(process.out.multiqc[0][1]).readLines().join('\n').contains('proteome.fasta') } + ) + } + + } + +} diff --git a/modules/nf-core/seqfu/stats/tests/main.nf.test.snap b/modules/nf-core/seqfu/stats/tests/main.nf.test.snap new file mode 100644 index 00000000000..8049c827b33 --- /dev/null +++ b/modules/nf-core/seqfu/stats/tests/main.nf.test.snap @@ -0,0 +1,56 @@ +{ + "versions-single": { + "content": [ + [ + "versions.yml:md5,fd11b4665f68f22e7ad4c646ad3c56cd" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T20:21:50.896221522" + }, + "multi-lines": { + "content": "d5ab14ce74939f856edc64c6a8d250d3", + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T20:22:03.775940585" + }, + "stats-single": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.tsv:md5,26141ef87ad8a6f59a6f283cc0a06fda" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T20:21:50.937732021" + }, + "stats-multi": { + "content": [ + [ + [ + { + "id": "test" + }, + "test.tsv:md5,98102573ecf7e3b9e53db1c6e0f02b06" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T20:22:03.681146614" + } +} \ No newline at end of file diff --git a/modules/nf-core/seqfu/stats/tests/tags.yml b/modules/nf-core/seqfu/stats/tests/tags.yml new file mode 100644 index 00000000000..2685ed43339 --- /dev/null +++ b/modules/nf-core/seqfu/stats/tests/tags.yml @@ -0,0 +1,2 @@ +seqfu/stats: + - "modules/nf-core/seqfu/stats/**" From c2342b45bbfc5d6fe19cc4154b38fa57177c67dd Mon Sep 17 00:00:00 2001 From: Kobe Lavaerts <77338340+kobelavaerts@users.noreply.github.com> Date: Wed, 20 Mar 2024 08:27:57 +0100 Subject: [PATCH 31/46] nf-test bases2fastq (#5272) * add nf-test to bases2fastq * add untar tag to tags.yml * added stub * [automated] Fix linting with Prettier --------- Co-authored-by: nf-core-bot Co-authored-by: Joon Klaps <61584065+Joon-Klaps@users.noreply.github.com> --- modules/nf-core/bases2fastq/main.nf | 17 +++ .../nf-core/bases2fastq/tests/main.nf.test | 78 +++++++++++++ .../bases2fastq/tests/main.nf.test.snap | 104 ++++++++++++++++++ modules/nf-core/bases2fastq/tests/tags.yml | 3 + tests/config/pytest_modules.yml | 4 - tests/modules/nf-core/bases2fastq/main.nf | 23 ---- .../nf-core/bases2fastq/nextflow.config | 9 -- tests/modules/nf-core/bases2fastq/test.yml | 17 --- 8 files changed, 202 insertions(+), 53 deletions(-) create mode 100644 modules/nf-core/bases2fastq/tests/main.nf.test create mode 100644 modules/nf-core/bases2fastq/tests/main.nf.test.snap create mode 100644 modules/nf-core/bases2fastq/tests/tags.yml delete mode 100644 tests/modules/nf-core/bases2fastq/main.nf delete mode 100644 tests/modules/nf-core/bases2fastq/nextflow.config delete mode 100644 tests/modules/nf-core/bases2fastq/test.yml diff --git a/modules/nf-core/bases2fastq/main.nf b/modules/nf-core/bases2fastq/main.nf index 44d83102dec..2f12b6d0f62 100644 --- a/modules/nf-core/bases2fastq/main.nf +++ b/modules/nf-core/bases2fastq/main.nf @@ -41,4 +41,21 @@ process BASES2FASTQ { bases2fastq: \$(bases2fastq --version | sed -e "s/bases2fastq version //g") END_VERSIONS """ + + stub: + """ + mkdir output + mkdir output/Samples + mkdir output/Samples/DefaultSample + + touch output/Metrics.csv + touch output/RunManifest.json + touch output/UnassignedSequences.csv + echo | gzip > output/Samples/DefaultSample/DefaultSample_R1.fastq.gz + echo | gzip > output/Samples/DefaultSample/DefaultSample_R2.fastq.gz + touch output/Bases2Fastq-Sim_QC.html + touch output/RunStats.json + touch output/Samples/DefaultSample/DefaultSample_stats.json + touch versions.yml + """ } diff --git a/modules/nf-core/bases2fastq/tests/main.nf.test b/modules/nf-core/bases2fastq/tests/main.nf.test new file mode 100644 index 00000000000..cf91d0c9c5f --- /dev/null +++ b/modules/nf-core/bases2fastq/tests/main.nf.test @@ -0,0 +1,78 @@ +nextflow_process { + + name "Test Process BASES2FASTQ" + script "../main.nf" + process "BASES2FASTQ" + + tag "modules" + tag "modules_nfcore" + tag "bases2fastq" + tag "untar" + + setup { + run("UNTAR") { + script "modules/nf-core/untar/main.nf" + process { + """ + input[0] = Channel.of([ [id: "sim-data", samplesheet: file("https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv", checkIfExists: true)], file("https://github.com/nf-core/test-datasets/raw/demultiplex/testdata/sim-data/sim-data.tar.gz", checkIfExists: true) ]) + """ + } + } + } + + test("sim-data.tar.gz - bcl") { + when { + process { + """ + input[0]= UNTAR.out.untar.map{meta, untar -> [meta, meta.samplesheet, untar]} + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.metrics, + process.out.generated_run_manifest, + process.out.unassigned, + process.out.sample_fastq, + file(process.out.qc_report[0][1]).name, + file(process.out.run_stats[0][1]).name, + file(process.out.sample_json[0][1]).name + ).match() + } + ) + } + + } + + test("sim-data.tar.gz - bcl -stub") { + options "-stub" + when { + process { + """ + input[0]= UNTAR.out.untar.map{meta, untar -> [meta, meta.samplesheet, untar]} + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.metrics, + process.out.generated_run_manifest, + process.out.unassigned, + process.out.sample_fastq, + file(process.out.qc_report[0][1]).name, + file(process.out.run_stats[0][1]).name, + file(process.out.sample_json[0][1]).name + ).match() + } + ) + } + } +} diff --git a/modules/nf-core/bases2fastq/tests/main.nf.test.snap b/modules/nf-core/bases2fastq/tests/main.nf.test.snap new file mode 100644 index 00000000000..bbf89247b88 --- /dev/null +++ b/modules/nf-core/bases2fastq/tests/main.nf.test.snap @@ -0,0 +1,104 @@ +{ + "sim-data.tar.gz - bcl -stub": { + "content": [ + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + "Metrics.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + "RunManifest.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + "UnassignedSequences.csv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + [ + "DefaultSample_R1.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "DefaultSample_R2.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "Bases2Fastq-Sim_QC.html", + "RunStats.json", + "DefaultSample_stats.json" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T16:28:23.376144712" + }, + "sim-data.tar.gz - bcl": { + "content": [ + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + "Metrics.csv:md5,a8094b308b5653071ac029a27733e4a6" + ] + ], + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + "RunManifest.json:md5,a07dce8ee25c2a6f9355b677c26b53e2" + ] + ], + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + "UnassignedSequences.csv:md5,11c1693830ce941b8cfb8d2431a59097" + ] + ], + [ + [ + { + "id": "sim-data", + "samplesheet": "/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv" + }, + [ + "DefaultSample_R1.fastq.gz:md5,eeec01b3de76c2b849b0f08b18081a2d", + "DefaultSample_R2.fastq.gz:md5,ccbd16b893d2a069b91d5e4284109868" + ] + ] + ], + "Bases2Fastq-Sim_QC.html", + "RunStats.json", + "DefaultSample_stats.json" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T16:20:46.509235687" + } +} \ No newline at end of file diff --git a/modules/nf-core/bases2fastq/tests/tags.yml b/modules/nf-core/bases2fastq/tests/tags.yml new file mode 100644 index 00000000000..1643c9798b7 --- /dev/null +++ b/modules/nf-core/bases2fastq/tests/tags.yml @@ -0,0 +1,3 @@ +bases2fastq: + - "modules/nf-core/bases2fastq/**" + - "modules/nf-core/untar/**" diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 3834021e04d..d9733192abe 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -100,10 +100,6 @@ bandage/image: barrnap: - modules/nf-core/barrnap/** - tests/modules/nf-core/barrnap/** -bases2fastq: - - modules/nf-core/untar/** - - modules/nf-core/bases2fastq/** - - tests/modules/nf-core/bases2fastq/** basicpy: - modules/nf-core/basicpy/** - tests/modules/nf-core/basicpy/** diff --git a/tests/modules/nf-core/bases2fastq/main.nf b/tests/modules/nf-core/bases2fastq/main.nf deleted file mode 100644 index d9fdac02715..00000000000 --- a/tests/modules/nf-core/bases2fastq/main.nf +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { BASES2FASTQ } from '../../../../modules/nf-core/bases2fastq/main.nf' -include { UNTAR } from '../../../../modules/nf-core/untar/main.nf' - -workflow test_bases2fastq { - - input = Channel.value([ - [ id:'sim-data' ], // meta map - file("https://raw.githubusercontent.com/nf-core/test-datasets/demultiplex/testdata/sim-data/RunManifest.csv", checkIfExists: true), - ]) - - ch_input = input.join( - UNTAR ( [ - [ id:'sim-data' ], - file("https://github.com/nf-core/test-datasets/raw/demultiplex/testdata/sim-data/sim-data.tar.gz", checkIfExists: true) - ]).untar - ) - - BASES2FASTQ ( ch_input ) -} diff --git a/tests/modules/nf-core/bases2fastq/nextflow.config b/tests/modules/nf-core/bases2fastq/nextflow.config deleted file mode 100644 index 2977ef7761a..00000000000 --- a/tests/modules/nf-core/bases2fastq/nextflow.config +++ /dev/null @@ -1,9 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: UNTAR { - publishDir = [ enabled: false ] - } - -} diff --git a/tests/modules/nf-core/bases2fastq/test.yml b/tests/modules/nf-core/bases2fastq/test.yml deleted file mode 100644 index 08d78381756..00000000000 --- a/tests/modules/nf-core/bases2fastq/test.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: "bases2fastq" - command: nextflow run ./tests/modules/nf-core/bases2fastq -entry test_bases2fastq -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/bases2fastq/nextflow.config - tags: - - "bases2fastq" - files: - - path: output/bases2fastq/output/Bases2Fastq-Sim_QC.html - - path: output/bases2fastq/output/Metrics.csv - md5sum: a8094b308b5653071ac029a27733e4a6 - - path: output/bases2fastq/output/RunManifest.json - - path: output/bases2fastq/output/RunStats.json - - path: output/bases2fastq/output/UnassignedSequences.csv - md5sum: 11c1693830ce941b8cfb8d2431a59097 - - path: output/bases2fastq/output/Samples/DefaultSample/DefaultSample_R1.fastq.gz - md5sum: 831c90ea31eff881e825cda691da77ae - - path: output/bases2fastq/output/Samples/DefaultSample/DefaultSample_R2.fastq.gz - md5sum: e6c1f7ec00910ef195ff3d427c7a9f23 - - path: output/bases2fastq/output/Samples/DefaultSample/DefaultSample_stats.json From f42872b165d4242b6b2d8ea6b2d1035c64acf403 Mon Sep 17 00:00:00 2001 From: Maxime U Garcia Date: Wed, 20 Mar 2024 08:53:05 +0100 Subject: [PATCH 32/46] update paths for VEP (#5281) update paths --- modules/nf-core/ensemblvep/vep/tests/main.nf.test | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/nf-core/ensemblvep/vep/tests/main.nf.test b/modules/nf-core/ensemblvep/vep/tests/main.nf.test index f072dcabd75..e7cbebd481e 100644 --- a/modules/nf-core/ensemblvep/vep/tests/main.nf.test +++ b/modules/nf-core/ensemblvep/vep/tests/main.nf.test @@ -31,7 +31,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true), [] ]) input[1] = params.vep_genome @@ -40,7 +40,7 @@ nextflow_process { input[4] = ENSEMBLVEP_DOWNLOAD.out.cache.map{ meta, cache -> [cache] } input[5] = Channel.value([ [id:"fasta"], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]) input[6] = [] """ @@ -76,7 +76,7 @@ nextflow_process { """ input[0] = Channel.of([ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/vcf/test.vcf', checkIfExists: true), [] ]) input[1] = params.vep_genome @@ -85,7 +85,7 @@ nextflow_process { input[4] = ENSEMBLVEP_DOWNLOAD.out.cache.map{ meta, cache -> [cache] } input[5] = Channel.value([ [id:"fasta"], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ]) input[6] = [] """ From 60a7dbae179bcfa24c10294cc9a07423a239c19a Mon Sep 17 00:00:00 2001 From: Maxime U Garcia Date: Wed, 20 Mar 2024 09:32:19 +0100 Subject: [PATCH 33/46] Add README to modules build with Docker (#4935) * add Dockerfile * remove environment.yml * EC lint * add comment * remove Dockerfile * add README --------- Co-authored-by: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> --- modules/nf-core/deepvariant/README.md | 9 +++++++++ modules/nf-core/deepvariant/environment.yml | 5 ----- modules/nf-core/deepvariant/main.nf | 1 + modules/nf-core/gatk4/cnnscorevariants/README.md | 9 +++++++++ .../gatk4/determinegermlinecontigploidy/README.md | 9 +++++++++ modules/nf-core/gatk4/germlinecnvcaller/README.md | 9 +++++++++ .../nf-core/gatk4/postprocessgermlinecnvcalls/README.md | 9 +++++++++ 7 files changed, 46 insertions(+), 5 deletions(-) create mode 100644 modules/nf-core/deepvariant/README.md delete mode 100644 modules/nf-core/deepvariant/environment.yml create mode 100644 modules/nf-core/gatk4/cnnscorevariants/README.md create mode 100644 modules/nf-core/gatk4/determinegermlinecontigploidy/README.md create mode 100644 modules/nf-core/gatk4/germlinecnvcaller/README.md create mode 100644 modules/nf-core/gatk4/postprocessgermlinecnvcalls/README.md diff --git a/modules/nf-core/deepvariant/README.md b/modules/nf-core/deepvariant/README.md new file mode 100644 index 00000000000..ca112a7d339 --- /dev/null +++ b/modules/nf-core/deepvariant/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/deepvariant/README.html) recipe is not fully working as expected + +Hence, we are using the docker container provided by the authors of the tool: + +- [google/deepvariant](https://hub.docker.com/r/google/deepvariant) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/deepvariant) for convenience. diff --git a/modules/nf-core/deepvariant/environment.yml b/modules/nf-core/deepvariant/environment.yml deleted file mode 100644 index 648a76dea69..00000000000 --- a/modules/nf-core/deepvariant/environment.yml +++ /dev/null @@ -1,5 +0,0 @@ -name: deepvariant -channels: - - conda-forge - - bioconda - - defaults diff --git a/modules/nf-core/deepvariant/main.nf b/modules/nf-core/deepvariant/main.nf index 2d5c480c4d4..507b6c1174b 100644 --- a/modules/nf-core/deepvariant/main.nf +++ b/modules/nf-core/deepvariant/main.nf @@ -2,6 +2,7 @@ process DEEPVARIANT { tag "$meta.id" label 'process_high' + //Conda is not supported at the moment container "nf-core/deepvariant:1.5.0" input: diff --git a/modules/nf-core/gatk4/cnnscorevariants/README.md b/modules/nf-core/gatk4/cnnscorevariants/README.md new file mode 100644 index 00000000000..c6a4545655a --- /dev/null +++ b/modules/nf-core/gatk4/cnnscorevariants/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/gatk4/README.html) recipe is not fully working as expected, cf [github issue](https://github.com/broadinstitute/gatk/issues/7811) + +Hence, we are using the docker container provided by the authors of the tool: + +- [broadinstitute/gatk](https://hub.docker.com/r/broadinstitute/gatk) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/gatk) for convenience. diff --git a/modules/nf-core/gatk4/determinegermlinecontigploidy/README.md b/modules/nf-core/gatk4/determinegermlinecontigploidy/README.md new file mode 100644 index 00000000000..c6a4545655a --- /dev/null +++ b/modules/nf-core/gatk4/determinegermlinecontigploidy/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/gatk4/README.html) recipe is not fully working as expected, cf [github issue](https://github.com/broadinstitute/gatk/issues/7811) + +Hence, we are using the docker container provided by the authors of the tool: + +- [broadinstitute/gatk](https://hub.docker.com/r/broadinstitute/gatk) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/gatk) for convenience. diff --git a/modules/nf-core/gatk4/germlinecnvcaller/README.md b/modules/nf-core/gatk4/germlinecnvcaller/README.md new file mode 100644 index 00000000000..c6a4545655a --- /dev/null +++ b/modules/nf-core/gatk4/germlinecnvcaller/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/gatk4/README.html) recipe is not fully working as expected, cf [github issue](https://github.com/broadinstitute/gatk/issues/7811) + +Hence, we are using the docker container provided by the authors of the tool: + +- [broadinstitute/gatk](https://hub.docker.com/r/broadinstitute/gatk) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/gatk) for convenience. diff --git a/modules/nf-core/gatk4/postprocessgermlinecnvcalls/README.md b/modules/nf-core/gatk4/postprocessgermlinecnvcalls/README.md new file mode 100644 index 00000000000..c6a4545655a --- /dev/null +++ b/modules/nf-core/gatk4/postprocessgermlinecnvcalls/README.md @@ -0,0 +1,9 @@ +# Conda is not supported at the moment + +The [bioconda](https://bioconda.github.io/recipes/gatk4/README.html) recipe is not fully working as expected, cf [github issue](https://github.com/broadinstitute/gatk/issues/7811) + +Hence, we are using the docker container provided by the authors of the tool: + +- [broadinstitute/gatk](https://hub.docker.com/r/broadinstitute/gatk) + +This image is mirrored on the [nf-core quay.io](https://quay.io/repository/nf-core/gatk) for convenience. From 3afb95b2e15fc4a2347470255a7ef654f650c8ec Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:21:38 +0100 Subject: [PATCH 34/46] add cram/index support to bwamem2 (#5248) * add cram/index support to bwamem2 * update tests --- modules/nf-core/bwamem2/mem/main.nf | 39 +++++++++++++++++-- modules/nf-core/bwamem2/mem/meta.yml | 27 +++++++++++++ .../nf-core/bwamem2/mem/tests/main.nf.test | 25 +++++++----- .../bwamem2/mem/tests/main.nf.test.snap | 30 +++++++------- subworkflows/nf-core/fastq_align_dna/main.nf | 2 +- 5 files changed, 93 insertions(+), 30 deletions(-) diff --git a/modules/nf-core/bwamem2/mem/main.nf b/modules/nf-core/bwamem2/mem/main.nf index 29f90778777..729428c4e07 100644 --- a/modules/nf-core/bwamem2/mem/main.nf +++ b/modules/nf-core/bwamem2/mem/main.nf @@ -10,11 +10,16 @@ process BWAMEM2_MEM { input: tuple val(meta), path(reads) tuple val(meta2), path(index) + tuple val(meta3), path(fasta) val sort_bam output: - tuple val(meta), path("*.bam"), emit: bam - path "versions.yml" , emit: versions + tuple val(meta), path("*.sam") , emit: sam , optional:true + tuple val(meta), path("*.bam") , emit: bam , optional:true + tuple val(meta), path("*.cram") , emit: cram, optional:true + tuple val(meta), path("*.crai") , emit: crai, optional:true + tuple val(meta), path("*.csi") , emit: csi , optional:true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -24,6 +29,13 @@ process BWAMEM2_MEM { def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def samtools_command = sort_bam ? 'sort' : 'view' + + def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/ + def extension_matcher = (args2 =~ extension_pattern) + def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" + """ INDEX=`find -L ./ -name "*.amb" | sed 's/\\.amb\$//'` @@ -33,7 +45,7 @@ process BWAMEM2_MEM { -t $task.cpus \\ \$INDEX \\ $reads \\ - | samtools $samtools_command $args2 -@ $task.cpus -o ${prefix}.bam - + | samtools $samtools_command $args2 -@ $task.cpus ${reference} -o ${prefix}.${extension} - cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -43,9 +55,28 @@ process BWAMEM2_MEM { """ stub: + + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + def samtools_command = sort_bam ? 'sort' : 'view' + def extension_pattern = /(--output-fmt|-O)+\s+(\S+)/ + def extension_matcher = (args2 =~ extension_pattern) + def extension = extension_matcher.getCount() > 0 ? extension_matcher[0][2].toLowerCase() : "bam" + def reference = fasta && extension=="cram" ? "--reference ${fasta}" : "" + if (!fasta && extension=="cram") error "Fasta reference is required for CRAM output" + + def create_index = "" + if (extension == "cram") { + create_index = "touch ${prefix}.crai" + } else if (extension == "bam") { + create_index = "touch ${prefix}.csi" + } + """ - touch ${prefix}.bam + touch ${prefix}.${extension} + ${create_index} + cat <<-END_VERSIONS > versions.yml "${task.process}": bwamem2: \$(echo \$(bwa-mem2 version 2>&1) | sed 's/.* //') diff --git a/modules/nf-core/bwamem2/mem/meta.yml b/modules/nf-core/bwamem2/mem/meta.yml index 04891b26a97..931f712943d 100644 --- a/modules/nf-core/bwamem2/mem/meta.yml +++ b/modules/nf-core/bwamem2/mem/meta.yml @@ -37,6 +37,15 @@ input: type: file description: BWA genome index files pattern: "Directory containing BWA index *.{0132,amb,ann,bwt.2bit.64,pac}" + - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome' ] + - fasta: + type: file + description: Reference genome in FASTA format + pattern: "*.{fa,fasta,fna}" - sort_bam: type: boolean description: use samtools sort (true) or samtools view (false) @@ -47,15 +56,33 @@ output: description: | Groovy Map containing sample information e.g. [ id:'test', single_end:false ] + - sam: + type: file + description: Output SAM file containing read alignments + pattern: "*.{sam}" - bam: type: file description: Output BAM file containing read alignments pattern: "*.{bam}" + - cram: + type: file + description: Output CRAM file containing read alignments + pattern: "*.{cram}" + - crai: + type: file + description: Index file for CRAM file + pattern: "*.{crai}" + - csi: + type: file + description: Index file for BAM file + pattern: "*.{csi}" - versions: type: file description: File containing software versions pattern: "versions.yml" authors: - "@maxulysse" + - "@matthdsm" maintainers: - "@maxulysse" + - "@matthdsm" diff --git a/modules/nf-core/bwamem2/mem/tests/main.nf.test b/modules/nf-core/bwamem2/mem/tests/main.nf.test index 365a0c433c1..5e67f70b6a2 100644 --- a/modules/nf-core/bwamem2/mem/tests/main.nf.test +++ b/modules/nf-core/bwamem2/mem/tests/main.nf.test @@ -10,7 +10,7 @@ nextflow_process { tag "bwamem2/mem" tag "bwamem2/index" - test("sarscov2 - fastq, index, false") { + test("sarscov2 - fastq, index, fasta, false") { setup { run("BWAMEM2_INDEX") { @@ -34,7 +34,8 @@ nextflow_process { [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = false + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = false """ } } @@ -51,7 +52,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, true") { + test("sarscov2 - fastq, index, fasta, true") { setup { run("BWAMEM2_INDEX") { @@ -75,7 +76,8 @@ nextflow_process { [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = true + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true """ } } @@ -92,7 +94,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, false") { + test("sarscov2 - [fastq1, fastq2], index, fasta, false") { setup { run("BWAMEM2_INDEX") { @@ -119,7 +121,8 @@ nextflow_process { ] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = false + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = false """ } } @@ -136,7 +139,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, true") { + test("sarscov2 - [fastq1, fastq2], index, fasta, true") { setup { run("BWAMEM2_INDEX") { @@ -163,7 +166,8 @@ nextflow_process { ] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = true + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true """ } } @@ -180,7 +184,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, true - stub") { + test("sarscov2 - [fastq1, fastq2], index, fasta, true - stub") { options "-stub" @@ -209,7 +213,8 @@ nextflow_process { ] ]) input[1] = BWAMEM2_INDEX.out.index - input[2] = true + input[2] = Channel.of([[:], [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]]) + input[3] = true """ } } diff --git a/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap b/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap index 84be71c60c7..9fb1e69d07d 100644 --- a/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap +++ b/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "sarscov2 - [fastq1, fastq2], index, true": { + "sarscov2 - [fastq1, fastq2], index, fasta, false": { "content": [ "test.bam", [ @@ -8,11 +8,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:30:22.691288603" + "timestamp": "2024-03-19T13:13:18.890289958" }, - "sarscov2 - [fastq1, fastq2], index, false": { + "sarscov2 - [fastq1, fastq2], index, fasta, true - stub": { "content": [ "test.bam", [ @@ -21,11 +21,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:30:11.276168706" + "timestamp": "2024-03-19T13:45:51.821633029" }, - "sarscov2 - [fastq1, fastq2], index, true - stub": { + "sarscov2 - [fastq1, fastq2], index, fasta, true": { "content": [ "test.bam", [ @@ -34,11 +34,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:30:32.07431961" + "timestamp": "2024-03-19T13:13:36.458291078" }, - "sarscov2 - fastq, index, false": { + "sarscov2 - fastq, index, fasta, false": { "content": [ "test.bam", [ @@ -47,11 +47,11 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:29:48.586760544" + "timestamp": "2024-03-19T13:12:44.084654507" }, - "sarscov2 - fastq, index, true": { + "sarscov2 - fastq, index, fasta, true": { "content": [ "test.bam", [ @@ -60,8 +60,8 @@ ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.10.1" }, - "timestamp": "2024-02-19T13:29:59.846686393" + "timestamp": "2024-03-19T13:13:01.763341681" } } \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_align_dna/main.nf b/subworkflows/nf-core/fastq_align_dna/main.nf index f907b16e47a..b710a4a6403 100644 --- a/subworkflows/nf-core/fastq_align_dna/main.nf +++ b/subworkflows/nf-core/fastq_align_dna/main.nf @@ -42,7 +42,7 @@ workflow FASTQ_ALIGN_DNA { ch_versions = ch_versions.mix(BWAMEM1_MEM.out.versions) break case 'bwamem2': - BWAMEM2_MEM (ch_reads, ch_aligner_index, sort) // If aligner is bwa-mem2 + BWAMEM2_MEM (ch_reads, ch_aligner_index, ch_fasta, sort) // If aligner is bwa-mem2 ch_bam = ch_bam.mix(BWAMEM2_MEM.out.bam) ch_versions = ch_versions.mix(BWAMEM2_MEM.out.versions) break From 653218e79ffa76fde20319e9062f8b8da5cf7555 Mon Sep 17 00:00:00 2001 From: Joon Klaps <61584065+Joon-Klaps@users.noreply.github.com> Date: Wed, 20 Mar 2024 09:22:20 +0100 Subject: [PATCH 35/46] 4557 new module kaijumergeoutputs + stub Kraken2/Kraken2 (#5249) * init kaiju-mergedOutputs * init kaiju_mergeoutputs * Update file paths and add test case for stub in kraken2_kraken2 * adressing comments reviewer * Fix variable assignment in db.config and nodb.config * Add docker.fixOwnership to process block in db.config and nodb.config * Update process configuration to fix ownership issue * typo * Remove docker.fixOwnership from db.config --- .../kaiju/mergeoutputs/environment.yml | 9 ++ modules/nf-core/kaiju/mergeoutputs/main.nf | 53 +++++++ modules/nf-core/kaiju/mergeoutputs/meta.yml | 53 +++++++ .../kaiju/mergeoutputs/tests/db.config | 5 + .../kaiju/mergeoutputs/tests/main.nf.test | 133 ++++++++++++++++++ .../mergeoutputs/tests/main.nf.test.snap | 107 ++++++++++++++ .../kaiju/mergeoutputs/tests/nodb.config | 14 ++ .../nf-core/kaiju/mergeoutputs/tests/tags.yml | 2 + modules/nf-core/kraken2/kraken2/main.nf | 27 ++++ 9 files changed, 403 insertions(+) create mode 100644 modules/nf-core/kaiju/mergeoutputs/environment.yml create mode 100644 modules/nf-core/kaiju/mergeoutputs/main.nf create mode 100644 modules/nf-core/kaiju/mergeoutputs/meta.yml create mode 100644 modules/nf-core/kaiju/mergeoutputs/tests/db.config create mode 100644 modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test create mode 100644 modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test.snap create mode 100644 modules/nf-core/kaiju/mergeoutputs/tests/nodb.config create mode 100644 modules/nf-core/kaiju/mergeoutputs/tests/tags.yml diff --git a/modules/nf-core/kaiju/mergeoutputs/environment.yml b/modules/nf-core/kaiju/mergeoutputs/environment.yml new file mode 100644 index 00000000000..c42f573c131 --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "kaiju_mergeoutputs" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::kaiju=1.10.0" diff --git a/modules/nf-core/kaiju/mergeoutputs/main.nf b/modules/nf-core/kaiju/mergeoutputs/main.nf new file mode 100644 index 00000000000..a3c5296e859 --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/main.nf @@ -0,0 +1,53 @@ +process KAIJU_MERGEOUTPUTS { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/kaiju:1.10.0--h43eeafb_0': + 'biocontainers/kaiju:1.10.0--h43eeafb_0' }" + + input: + tuple val(meta), path(kaiju), path(kraken) + path (db) + + output: + tuple val(meta), path("*.tsv"), emit: merged + 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 dbnodes = db ? '-t <(find -L ${db} -name "*nodes.dmp")' : '' + script: + if ("$kaiju" == "${prefix}.tsv") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + if ("$kraken" == "${prefix}.tsv") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + """ + kaiju-mergeOutputs \\ + -i <(sort -k2,2 ${kaiju}) \\ + -j <(sort -k2,2 ${kraken}) \\ + -o ${prefix}.tsv \\ + $dbnodes \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.tsv + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kaiju: \$(echo \$( kaiju -h 2>&1 | sed -n 1p | sed 's/^.*Kaiju //' )) + END_VERSIONS + """ +} diff --git a/modules/nf-core/kaiju/mergeoutputs/meta.yml b/modules/nf-core/kaiju/mergeoutputs/meta.yml new file mode 100644 index 00000000000..4ec5000344c --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/meta.yml @@ -0,0 +1,53 @@ +name: kaiju_mergeoutputs +description: Merge two tab-separated output files of Kaiju and Kraken in the column format +keywords: + - classify + - metagenomics + - fastq + - taxonomic profiling +tools: + - kaiju: + description: Fast and sensitive taxonomic classification for metagenomics + homepage: https://kaiju.binf.ku.dk/ + documentation: https://github.com/bioinformatics-centre/kaiju/blob/master/README.md + tool_dev_url: https://github.com/bioinformatics-centre/kaiju + doi: "10.1038/ncomms11257" + licence: ["GNU GPL v3"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - kaiju: + type: file + description: | + Results with taxonomic classification of each read from Kaiju + - kraken: + type: file + description: | + Results with taxonomic classification of each read from Kraken + pattern: "*.{tsv}" + - db: + type: directory + description: | + List containing the database and nodes files for Kaiju + e.g. [ 'database.fmi', 'nodes.dmp' ] +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - merged: + type: file + description: Results with merged taxonomic classification of each read based on the given strategy '1', '2', 'lca' [default] or 'lowest' + pattern: "*.tsv" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@Joon-Klaps" +maintainers: + - "@Joon-Klaps" diff --git a/modules/nf-core/kaiju/mergeoutputs/tests/db.config b/modules/nf-core/kaiju/mergeoutputs/tests/db.config new file mode 100644 index 00000000000..257dba4704b --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/tests/db.config @@ -0,0 +1,5 @@ +process { + withName: KAIJU_MERGEOUTPUTS{ + ext.prefix = {"${meta.id}_merged"} + } +} diff --git a/modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test b/modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test new file mode 100644 index 00000000000..5c2d5b3159d --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test @@ -0,0 +1,133 @@ +nextflow_process { + + name "Test Process KAIJU_MERGEOUTPUTS" + script "../main.nf" + process "KAIJU_MERGEOUTPUTS" + + tag "modules" + tag "modules_nfcore" + tag "kaiju" + tag "untar" + tag "kaiju/kaiju" + tag "kraken2/kraken2" + tag "kaiju/mergeoutputs" + + setup { + run("UNTAR",alias: "UNTAR_KRAKEN2" ) { + config "./nodb.config" + script "../../../untar/main.nf" + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kraken2.tar.gz', checkIfExists: true) + ]) + """ + } + } + run("KRAKEN2_KRAKEN2") { + config "./nodb.config" + script "../../../kraken2/kraken2/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:true ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + input[1] = UNTAR_KRAKEN2.out.untar.map{ it[1] } + input[2] = false + input[3] = true + """ + } + } + run("UNTAR",alias: "UNTAR_KAIJU" ) { + config "./nodb.config" + script "../../../untar/main.nf" + process { + """ + input[0] = Channel.of([ + [], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/db/kaiju.tar.gz', checkIfExists: true) + ]) + """ + } + } + run("KAIJU_KAIJU") { + config "./nodb.config" + script "../../../kaiju/kaiju/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:true ], + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ] + input[1] = UNTAR_KAIJU.out.untar.map{ it[1] } + """ + } + } + } + + test("sarscov2 - kraken2.kaiju.classified - noDB ") { + config "./nodb.config" + + when { + process { + """ + input[0] = KAIJU_KAIJU.out.results.join(KRAKEN2_KRAKEN2.out.classified_reads_assignment) + input[1] = [ ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - kraken2.kaiju.classified - kaiju.DB ") { + config "./db.config" + when { + process { + """ + input[0] = KAIJU_KAIJU.out.results.join(KRAKEN2_KRAKEN2.out.classified_reads_assignment) + input[1] = UNTAR_KAIJU.out.untar.map{ it[1] } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - kraken2.kaiju.classified - noDB - stub ") { + config "./nodb.config" + options "-stub" + + when { + process { + """ + input[0] = KAIJU_KAIJU.out.results.join(KRAKEN2_KRAKEN2.out.classified_reads_assignment) + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test.snap b/modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test.snap new file mode 100644 index 00000000000..7ee12505930 --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/tests/main.nf.test.snap @@ -0,0 +1,107 @@ +{ + "sarscov2 - kraken2.kaiju.classified - noDB - stub ": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_merged.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,fe28eae98973762f4fb19fc562a56b9f" + ], + "merged": [ + [ + { + "id": "test", + "single_end": true + }, + "test_merged.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,fe28eae98973762f4fb19fc562a56b9f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:48:25.353007932" + }, + "sarscov2 - kraken2.kaiju.classified - noDB ": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_merged.tsv:md5,64fef9779d5003775c327bb534403859" + ] + ], + "1": [ + "versions.yml:md5,fe28eae98973762f4fb19fc562a56b9f" + ], + "merged": [ + [ + { + "id": "test", + "single_end": true + }, + "test_merged.tsv:md5,64fef9779d5003775c327bb534403859" + ] + ], + "versions": [ + "versions.yml:md5,fe28eae98973762f4fb19fc562a56b9f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:47:53.326864948" + }, + "sarscov2 - kraken2.kaiju.classified - kaiju.DB ": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test_merged.tsv:md5,64fef9779d5003775c327bb534403859" + ] + ], + "1": [ + "versions.yml:md5,fe28eae98973762f4fb19fc562a56b9f" + ], + "merged": [ + [ + { + "id": "test", + "single_end": true + }, + "test_merged.tsv:md5,64fef9779d5003775c327bb534403859" + ] + ], + "versions": [ + "versions.yml:md5,fe28eae98973762f4fb19fc562a56b9f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:48:11.274433603" + } +} \ No newline at end of file diff --git a/modules/nf-core/kaiju/mergeoutputs/tests/nodb.config b/modules/nf-core/kaiju/mergeoutputs/tests/nodb.config new file mode 100644 index 00000000000..e6f6332b3c5 --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/tests/nodb.config @@ -0,0 +1,14 @@ +process { + withName: UNTAR_KAIJU{ + ext.args2 = {"--no-same-owner"} + } + + withName: UNTAR_KRAKEN2{ + ext.args2 = {"--no-same-owner"} + } + + withName: KAIJU_MERGEOUTPUTS{ + ext.prefix = {"${meta.id}_merged"} + ext.args= "-c 1" + } +} diff --git a/modules/nf-core/kaiju/mergeoutputs/tests/tags.yml b/modules/nf-core/kaiju/mergeoutputs/tests/tags.yml new file mode 100644 index 00000000000..8b1f3c8634d --- /dev/null +++ b/modules/nf-core/kaiju/mergeoutputs/tests/tags.yml @@ -0,0 +1,2 @@ +kaiju/mergeoutputs: + - "modules/nf-core/kaiju/mergeoutputs/**" diff --git a/modules/nf-core/kraken2/kraken2/main.nf b/modules/nf-core/kraken2/kraken2/main.nf index cdf02d0f145..92cd9c34f7a 100644 --- a/modules/nf-core/kraken2/kraken2/main.nf +++ b/modules/nf-core/kraken2/kraken2/main.nf @@ -55,4 +55,31 @@ process KRAKEN2_KRAKEN2 { pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) END_VERSIONS """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def paired = meta.single_end ? "" : "--paired" + def classified = meta.single_end ? "${prefix}.classified.fastq.gz" : "${prefix}.classified_1.fastq.gz ${prefix}.classified_2.fastq.gz" + def unclassified = meta.single_end ? "${prefix}.unclassified.fastq.gz" : "${prefix}.unclassified_1.fastq.gz ${prefix}.unclassified_2.fastq.gz" + def readclassification_option = save_reads_assignment ? "--output ${prefix}.kraken2.classifiedreads.txt" : "--output /dev/null" + def compress_reads_command = save_output_fastqs ? "pigz -p $task.cpus *.fastq" : "" + + """ + touch ${prefix}.kraken2.report.txt + if [ "$save_output_fastqs" == "true" ]; then + touch $classified + touch $unclassified + fi + if [ "$save_reads_assignment" == "true" ]; then + touch ${prefix}.kraken2.classifiedreads.txt + fi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + kraken2: \$(echo \$(kraken2 --version 2>&1) | sed 's/^.*Kraken version //; s/ .*\$//') + pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) + END_VERSIONS + """ + } From 89cf292ab826db67279cf11339c5afc53a9e419d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Pe=C3=B1a-P=C3=A9rez?= Date: Wed, 20 Mar 2024 09:26:07 +0100 Subject: [PATCH 36/46] gatk4_asereadcounter add updated meta and nf-tests (#5164) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat updated meta * feat add nf-tests * Update modules/nf-core/gatk4/asereadcounter/meta.yml Co-authored-by: Matthias Hörtenhuber * Update modules/nf-core/gatk4/asereadcounter/meta.yml Co-authored-by: Matthias Hörtenhuber * applyed reviewers suggestions * modified pytest_modules.yml --------- Co-authored-by: lucia.pena.perez@scilifelab.se Co-authored-by: Matthias Hörtenhuber --- modules/nf-core/gatk4/asereadcounter/main.nf | 8 +-- .../nf-core/gatk4/asereadcounter/main.nf.test | 54 +++++++++++++++++++ .../gatk4/asereadcounter/main.nf.test.snap | 35 ++++++++++++ modules/nf-core/gatk4/asereadcounter/meta.yml | 28 ++++++++++ tests/config/pytest_modules.yml | 6 +-- .../nf-core/gatk4/asereadcounter/main.nf | 23 -------- .../gatk4/asereadcounter/nextflow.config | 5 -- .../nf-core/gatk4/asereadcounter/test.yml | 17 ------ 8 files changed, 124 insertions(+), 52 deletions(-) create mode 100644 modules/nf-core/gatk4/asereadcounter/main.nf.test create mode 100644 modules/nf-core/gatk4/asereadcounter/main.nf.test.snap delete mode 100644 tests/modules/nf-core/gatk4/asereadcounter/main.nf delete mode 100644 tests/modules/nf-core/gatk4/asereadcounter/nextflow.config delete mode 100644 tests/modules/nf-core/gatk4/asereadcounter/test.yml diff --git a/modules/nf-core/gatk4/asereadcounter/main.nf b/modules/nf-core/gatk4/asereadcounter/main.nf index 4a151d6c6e7..9b5b62a2061 100644 --- a/modules/nf-core/gatk4/asereadcounter/main.nf +++ b/modules/nf-core/gatk4/asereadcounter/main.nf @@ -9,10 +9,10 @@ process GATK4_ASEREADCOUNTER { input: tuple val(meta), path(input), path(input_index) - tuple val(meta), path(vcf), path(tbi) - path fasta - path fai - path dict + tuple val(meta2), path(vcf), path(tbi) + tuple val(meta3), path(fasta) + tuple val(meta4), path(fai) + tuple val(meta5), path(dict) path intervals output: diff --git a/modules/nf-core/gatk4/asereadcounter/main.nf.test b/modules/nf-core/gatk4/asereadcounter/main.nf.test new file mode 100644 index 00000000000..e532d38d9af --- /dev/null +++ b/modules/nf-core/gatk4/asereadcounter/main.nf.test @@ -0,0 +1,54 @@ +nextflow_process { + + name "Test Process GATK4_ASEREADCOUNTER" + tag "modules_nfcore" + tag "modules" + tag "gatk4" + tag "gatk4/asereadcounter" + script "modules/nf-core/gatk4/asereadcounter/main.nf" + process "GATK4_ASEREADCOUNTER" + + test("Should run without failures") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path +'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path +'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path +'genomics/sarscov2/illumina/vcf/test.vcf.gz', checkIfExists: true), + file(params.modules_testdata_base_path +'genomics/sarscov2/illumina/vcf/test.vcf.gz.tbi', checkIfExists: true) + ] + input[2] = [ + [ id:'reference' ], // meta map + file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + input[3] = [ + [ id:'reference' ], // meta map + file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome.fasta.fai', checkIfExists: true) + ] + input[4] = [ + [ id:'reference' ], // meta map + file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome.dict', checkIfExists: true) + ] + input[5] = [ + file(params.modules_testdata_base_path +'genomics/sarscov2/genome/picard/targets.interval_list', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + ) + } + + } + +} diff --git a/modules/nf-core/gatk4/asereadcounter/main.nf.test.snap b/modules/nf-core/gatk4/asereadcounter/main.nf.test.snap new file mode 100644 index 00000000000..cb2740864b2 --- /dev/null +++ b/modules/nf-core/gatk4/asereadcounter/main.nf.test.snap @@ -0,0 +1,35 @@ +{ + "Should run without failures": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test_ase.csv:md5,4fbcaf6b6a390889c56e105c41470b7b" + ] + ], + "1": [ + "versions.yml:md5,d567b20620f5adf0829cc4b4adb9f6ff" + ], + "csv": [ + [ + { + "id": "test" + }, + "test_ase.csv:md5,4fbcaf6b6a390889c56e105c41470b7b" + ] + ], + "versions": [ + "versions.yml:md5,d567b20620f5adf0829cc4b4adb9f6ff" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T10:03:42.158801" + } +} \ No newline at end of file diff --git a/modules/nf-core/gatk4/asereadcounter/meta.yml b/modules/nf-core/gatk4/asereadcounter/meta.yml index 2282322deee..7367dec7eca 100644 --- a/modules/nf-core/gatk4/asereadcounter/meta.yml +++ b/modules/nf-core/gatk4/asereadcounter/meta.yml @@ -25,18 +25,46 @@ input: type: file description: BAM/CRAM/SAM file pattern: "*.{bam,cram,sam}" + - input_index: + type: file + description: index file for input file + pattern: "*.{bai,crai}" + - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. `[ id:'reference' ]` - vcf: type: file description: VCF file pattern: "*.{vcf.gz}" + - tbi: + type: file + description: index file for VCF file + pattern: "*.{vcf.gz.tbi}" + - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. `[ id:'reference' ]` - fasta: type: file description: fasta file pattern: "*.{fasta,fa}" + - meta4: + type: map + description: | + Groovy Map containing reference information + e.g. `[ id:'reference' ]` - fai: type: file description: fasta index file pattern: "*.{fai}" + - meta5: + type: map + description: | + Groovy Map containing reference information + e.g. `[ id:'reference' ]` - dict: type: file description: dictionary file diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index d9733192abe..d72dc4ddf8a 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -697,9 +697,9 @@ gatk/unifiedgenotyper: gatk4/applyvqsr: - modules/nf-core/gatk4/applyvqsr/** - tests/modules/nf-core/gatk4/applyvqsr/** -gatk4/asereadcounter: - - modules/nf-core/gatk4/asereadcounter/** - - tests/modules/nf-core/gatk4/asereadcounter/** +gatk4/bedtointervallist: + - modules/nf-core/gatk4/bedtointervallist/** + - tests/modules/nf-core/gatk4/bedtointervallist/** gatk4/calculatecontamination: - modules/nf-core/gatk4/calculatecontamination/** - tests/modules/nf-core/gatk4/calculatecontamination/** diff --git a/tests/modules/nf-core/gatk4/asereadcounter/main.nf b/tests/modules/nf-core/gatk4/asereadcounter/main.nf deleted file mode 100644 index 0af3d0a2bb1..00000000000 --- a/tests/modules/nf-core/gatk4/asereadcounter/main.nf +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { GATK4_ASEREADCOUNTER } from '../../../../../modules/nf-core/gatk4/asereadcounter/main.nf' - -workflow test_gatk4_asereadcounter { - - input = [ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) - ] - vcf = [ [ id:'test' ], // meta map - file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true), - file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true) - ] - fasta = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) - fai = file(params.test_data['sarscov2']['genome']['genome_fasta_fai'], checkIfExists: true) - dict = file(params.test_data['sarscov2']['genome']['genome_dict'], checkIfExists: true) - intervals = file(params.test_data['sarscov2']['genome']['targets_interval_list'], checkIfExists: true) - - GATK4_ASEREADCOUNTER ( input, vcf, fasta, fai, dict, intervals ) -} diff --git a/tests/modules/nf-core/gatk4/asereadcounter/nextflow.config b/tests/modules/nf-core/gatk4/asereadcounter/nextflow.config deleted file mode 100644 index 50f50a7a357..00000000000 --- a/tests/modules/nf-core/gatk4/asereadcounter/nextflow.config +++ /dev/null @@ -1,5 +0,0 @@ -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - -} \ No newline at end of file diff --git a/tests/modules/nf-core/gatk4/asereadcounter/test.yml b/tests/modules/nf-core/gatk4/asereadcounter/test.yml deleted file mode 100644 index 98ee2ffb50a..00000000000 --- a/tests/modules/nf-core/gatk4/asereadcounter/test.yml +++ /dev/null @@ -1,17 +0,0 @@ -- name: gatk4 asereadcounter test_gatk4_asereadcounter - command: nextflow run ./tests/modules/nf-core/gatk4/asereadcounter -entry test_gatk4_asereadcounter -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gatk4/asereadcounter/nextflow.config - tags: - - gatk4/asereadcounter - - gatk4 - files: - - path: output/gatk4/test_ase.csv - md5sum: 4fbcaf6b6a390889c56e105c41470b7b - - path: output/gatk4/versions.yml -- name: gatk4 asereadcounter test_gatk4_asereadcounter_stubs - command: nextflow run ./tests/modules/nf-core/gatk4/asereadcounter -entry test_gatk4_asereadcounter -c ./tests/config/nextflow.config -c ./tests/modules/nf-core/gatk4/asereadcounter/nextflow.config -stub-run - tags: - - gatk4/asereadcounter - - gatk4 - files: - - path: output/gatk4/test_ase.csv - - path: output/gatk4/versions.yml From 8487a4441d6e49f443fc29006746eb12382f2e19 Mon Sep 17 00:00:00 2001 From: John Orgera <65687576+johnoooh@users.noreply.github.com> Date: Wed, 20 Mar 2024 04:39:05 -0400 Subject: [PATCH 37/46] Bamstats (#4474) * initial commit * commit to test * added :: * changed md5 * back to : * added comments and md5 * removed . * added bamstats to a line * spaces after colons * colon issues * sed tests * sed changes * sed fix * ' fix * sed fix * uising back * fix removed * sed fixed hopefully * md5 fix * removed todo * documentation added to meta.yml * removed todos * removed todo * fixed whitespace * fix licence * whitespace * whitespace again * para change * para change * md5 change * Update modules/nf-core/bamstats/generalstats/main.nf Co-authored-by: Gisela Gabernet * todo removed * nf-test conversion * Fix bamstats module test.yml * Migrate bamstats tests to nf-test * Update bamstats/generalstats module and tests --------- Co-authored-by: Gisela Gabernet Co-authored-by: Emilio Palumbo --- .../bamstats/generalstats/environment.yml | 9 +++ modules/nf-core/bamstats/generalstats/main.nf | 51 ++++++++++++++++ .../nf-core/bamstats/generalstats/meta.yml | 46 ++++++++++++++ .../bamstats/generalstats/tests/main.nf.test | 60 +++++++++++++++++++ .../generalstats/tests/main.nf.test.snap | 26 ++++++++ .../bamstats/generalstats/tests/tags.yml | 2 + 6 files changed, 194 insertions(+) create mode 100644 modules/nf-core/bamstats/generalstats/environment.yml create mode 100644 modules/nf-core/bamstats/generalstats/main.nf create mode 100644 modules/nf-core/bamstats/generalstats/meta.yml create mode 100644 modules/nf-core/bamstats/generalstats/tests/main.nf.test create mode 100644 modules/nf-core/bamstats/generalstats/tests/main.nf.test.snap create mode 100644 modules/nf-core/bamstats/generalstats/tests/tags.yml diff --git a/modules/nf-core/bamstats/generalstats/environment.yml b/modules/nf-core/bamstats/generalstats/environment.yml new file mode 100644 index 00000000000..71d07d16ef1 --- /dev/null +++ b/modules/nf-core/bamstats/generalstats/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "bamstats_generalstats" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::bamstats=0.3.5" diff --git a/modules/nf-core/bamstats/generalstats/main.nf b/modules/nf-core/bamstats/generalstats/main.nf new file mode 100644 index 00000000000..4bae58d6ba1 --- /dev/null +++ b/modules/nf-core/bamstats/generalstats/main.nf @@ -0,0 +1,51 @@ +process BAMSTATS_GENERALSTATS { + tag "$meta.id" + label 'process_single' + conda "bioconda::bamstats=0.3.5" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/bamstats:0.3.5--he881be0_0': + 'biocontainers/bamstats:0.3.5--he881be0_0' }" + + input: + tuple val(meta), path(bam) + + output: + tuple val(meta), path("*.json"), emit: json + 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}" + // Several ARGS are available. + // -a is a helpfu; one where you can add a BED file + // -u, --uniq outputs genomic coverage statistics for uniqely mapped reads + """ + bamstats \\ + -i $bam \\ + $args \\ + -c $task.cpus \\ + -o ${prefix}.json + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bamstats: \$(echo \$(bamstats --version 2>&1) | sed 's/^.*bamstats == version://; s/Using.*\$//' | sed 's/built.*//' ) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + touch ${prefix}.json + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bamstats: \$(echo \$(bamstats --version 2>&1) | sed 's/^.*bamstats == version://; s/Using.*\$//' | sed 's/built.*//' ) + END_VERSIONS + """ +} + diff --git a/modules/nf-core/bamstats/generalstats/meta.yml b/modules/nf-core/bamstats/generalstats/meta.yml new file mode 100644 index 00000000000..a0921f4a3e3 --- /dev/null +++ b/modules/nf-core/bamstats/generalstats/meta.yml @@ -0,0 +1,46 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/yaml-schema.json +name: "bamstats_generalstats" +description: write your description here +keywords: + - bam + - statistics + - genomics +tools: + - "bamstats": + description: "A command line tool to compute mapping statistics from a BAM file" + homepage: "https://github.com/guigolab/bamstats/" + documentation: "https://github.com/guigolab/bamstats/" + tool_dev_url: "https://github.com/guigolab" + licence: ["BSD-3-clause"] + +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'test', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - json: + type: file + description: json containing bam statistics + pattern: "*.json" + +authors: + - "@johnoooh" diff --git a/modules/nf-core/bamstats/generalstats/tests/main.nf.test b/modules/nf-core/bamstats/generalstats/tests/main.nf.test new file mode 100644 index 00000000000..8a5a18b1104 --- /dev/null +++ b/modules/nf-core/bamstats/generalstats/tests/main.nf.test @@ -0,0 +1,60 @@ +nextflow_process { + + name "Test Process BAMSTATS_GENERALSTATS" + script "../main.nf" + process "BAMSTATS_GENERALSTATS" + + tag "modules" + tag "modules_nfcore" + tag "bamstats" + tag "bamstats/generalstats" + + test("sarscov2 - bam") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.json.get(0)[1]).exists() }, + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.json.get(0)[1]).exists() }, + { assert snapshot(process.out.versions).match("versions_stub") } + ) + } + + } + +} diff --git a/modules/nf-core/bamstats/generalstats/tests/main.nf.test.snap b/modules/nf-core/bamstats/generalstats/tests/main.nf.test.snap new file mode 100644 index 00000000000..c2244d1bcba --- /dev/null +++ b/modules/nf-core/bamstats/generalstats/tests/main.nf.test.snap @@ -0,0 +1,26 @@ +{ + "versions_stub": { + "content": [ + [ + "versions.yml:md5,6d858a3f76d1852b879f15436882c3cf" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T16:52:19.198122" + }, + "versions": { + "content": [ + [ + "versions.yml:md5,6d858a3f76d1852b879f15436882c3cf" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T16:52:07.413799" + } +} \ No newline at end of file diff --git a/modules/nf-core/bamstats/generalstats/tests/tags.yml b/modules/nf-core/bamstats/generalstats/tests/tags.yml new file mode 100644 index 00000000000..d5bb0d9d1c7 --- /dev/null +++ b/modules/nf-core/bamstats/generalstats/tests/tags.yml @@ -0,0 +1,2 @@ +bamstats/generalstats: + - "modules/nf-core/bamstats/generalstats/**" From 61f2ea506bd87ef436b0086f91a07abc6035fcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Famke=20B=C3=A4uerle?= <45968370+famosab@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:25:09 +0100 Subject: [PATCH 38/46] Add wittyer as module (#5171) * feat: add wittyer as module * fix: adjust output and version * fix: copy output and script from local * feat: fill in in meta file * fix: remove config file input * fix: run prettier * feat: explain how to create docker image * fix: README for Docker image * fix: modify environment file * fix: stub and file extensions * fix: remove custom extensions * feat: add test file - failing * fix: correct input for tests * fix: licence * fix: container name * fix: finally correct container * fix syntax errors * normal test works, stub fails * fix expected outputs * fix: mention making image public * fix add stageAs, use dotnet * run prettier * [automated] Fix linting with Prettier * add comment for run * fix trailing whitespace * add dependencies to fix linting * fix harmonize inputs in meta and main * fix: run prettier * [automated] Fix linting with Prettier * fix index names * fix version to stub_version in stub test Co-authored-by: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> * extend tests to capture as much as possible * test with bed file * fix: remove stageAs * fix tests for stageAs removal * remove '' in meta file * exclude conda test for wittyer --------- Co-authored-by: nf-core-bot Co-authored-by: Nicolas Vannieuwkerke <101190534+nvnieuwk@users.noreply.github.com> --- .github/workflows/test.yml | 2 + modules/nf-core/wittyer/README.md | 28 ++ modules/nf-core/wittyer/environment.yml | 7 + modules/nf-core/wittyer/main.nf | 69 ++++ modules/nf-core/wittyer/meta.yml | 66 ++++ modules/nf-core/wittyer/tests/main.nf.test | 100 +++++ .../nf-core/wittyer/tests/main.nf.test.snap | 347 ++++++++++++++++++ modules/nf-core/wittyer/tests/tags.yml | 2 + 8 files changed, 621 insertions(+) create mode 100644 modules/nf-core/wittyer/README.md create mode 100644 modules/nf-core/wittyer/environment.yml create mode 100644 modules/nf-core/wittyer/main.nf create mode 100644 modules/nf-core/wittyer/meta.yml create mode 100644 modules/nf-core/wittyer/tests/main.nf.test create mode 100644 modules/nf-core/wittyer/tests/main.nf.test.snap create mode 100644 modules/nf-core/wittyer/tests/tags.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fd2dbcf793e..544b2cf26b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -585,6 +585,8 @@ jobs: tags: subworkflows/vcf_annotate_ensemblvep - profile: singularity tags: bases2fastq + - profile: conda + tags: wittyer env: NXF_ANSI_LOG: false SENTIEON_LICENSE_BASE64: ${{ secrets.SENTIEON_LICENSE_BASE64 }} diff --git a/modules/nf-core/wittyer/README.md b/modules/nf-core/wittyer/README.md new file mode 100644 index 00000000000..d2ba0e09b41 --- /dev/null +++ b/modules/nf-core/wittyer/README.md @@ -0,0 +1,28 @@ +# Updating the docker container and making a new module release + +witty.er is a commercial tool from Illumina. The container provided for the witty.er nf-core module is not provided nor supported by Illumina. Updating the witty.er versions in the container and pushing the update to Dockerhub needs to be done manually. + +1. Navigate to the witty.er github repository. - [witty.er](https://github.com/Illumina/witty.er) +2. Download the latest release. + ```bash + wget https://github.com/Illumina/witty.er/archive/refs/tags/.tar.gz + ``` +3. Uncompress the released package. + ```bash + tar -xvf .tar.gz + ``` +4. Change to the uncompressed directory. +5. Build docker image using provided Dockerfile. + + ```bash + docker build -t wittyer: --platform linux/amd64 . + ``` + +6. Access rights are needed to push the container to the Dockerhub nfcore organization, please ask a core team member to do so. + + ```bash + docker tag wittyer: quay.io/nf-core/wittyer: + docker push quay.io/nf-core/wittyer: + ``` + +7. Make the image public. diff --git a/modules/nf-core/wittyer/environment.yml b/modules/nf-core/wittyer/environment.yml new file mode 100644 index 00000000000..f8378df2479 --- /dev/null +++ b/modules/nf-core/wittyer/environment.yml @@ -0,0 +1,7 @@ +name: wittyer +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - tabix diff --git a/modules/nf-core/wittyer/main.nf b/modules/nf-core/wittyer/main.nf new file mode 100644 index 00000000000..c2b943f393b --- /dev/null +++ b/modules/nf-core/wittyer/main.nf @@ -0,0 +1,69 @@ +process WITTYER { + tag "$meta.id" + label 'process_single' + + container "nf-core/wittyer:0.3.3.0" + + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "WITTYER module does not support Conda. Please use Docker / Singularity / Podman instead." + } + + input: + tuple val(meta), path(query_vcf), path(query_vcf_index), path(truth_vcf), path(truth_vcf_index), path(bed) + + output: + tuple val(meta), path("*.json") , emit: report + tuple val(meta), path("*.vcf.gz") , emit: bench_vcf + tuple val(meta), path("*.vcf.gz.tbi") , emit: bench_vcf_tbi + 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 regions = bed ? "--includeBed=$bed" : "" + if ("$truth_vcf" == "${prefix}.vcf.gz") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + if ("$query_vcf" == "${prefix}.vcf.gz") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + if ("$query_vcf_index" == "${prefix}.vcf.gz.tbi") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + if ("$query_vcf_index" == "${prefix}.vcf.gz.tbi") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + + // dotnet /opt/Wittyer/Wittyer.dll might need to be replaced with new docker image + """ + mkdir bench + + dotnet /opt/Wittyer/Wittyer.dll \\ + --truthVcf=${truth_vcf} \\ + --inputVcf=${query_vcf} \\ + --outputDirectory=bench \\ + ${regions} \\ + ${args} + + mv bench/Wittyer.Stats.json ${prefix}.json + mv bench/*.vcf.gz ${prefix}.vcf.gz + mv bench/*.vcf.gz.tbi ${prefix}.vcf.gz.tbi + + rm -rf bench + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + wittyer: \$(dotnet /opt/Wittyer/Wittyer.dll --version |& sed '1!d ; s/witty.er //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.json + echo "" | gzip > ${prefix}.vcf.gz + touch ${prefix}.vcf.gz.tbi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + wittyer: \$(dotnet /opt/Wittyer/Wittyer.dll --version |& sed '1!d ; s/witty.er //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/wittyer/meta.yml b/modules/nf-core/wittyer/meta.yml new file mode 100644 index 00000000000..097f90fbbad --- /dev/null +++ b/modules/nf-core/wittyer/meta.yml @@ -0,0 +1,66 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: wittyer +description: A large variant benchmarking tool analogous to hap.py for small variants. +keywords: + - structural-variants + - benchmarking + - vcf +tools: + - wittyer: + description: "Illumina tool for large variant benchmarking" + homepage: "https://github.com/Illumina/witty.er" + documentation: "https://github.com/Illumina/witty.er" + tool_dev_url: "https://github.com/Illumina/witty.er" + licence: ["BSD-2"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - query_vcf: + type: file + description: A VCF with called variants to benchmark against the standard + pattern: "*.{vcf,vcf.gz}" + - query_vcf_index: + type: file + description: The index of the called VCF (optional) + pattern: "*.tbi" + - truth_vcf: + type: file + description: A standard VCF to compare against + pattern: "*.{vcf,vcf.gz}" + - truth_vcf_index: + type: file + description: The index of the standard VCF (optional) + pattern: "*.tbi" + - bed: + type: file + description: A BED file specifying regions to be included in the analysis (optional) + pattern: "*.bed" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - report: + type: file + description: Detailed per-sample-pair, per-svtype, per-bin stats + pattern: "*.json" + - bench_vcf: + type: file + description: Updated query and truth entries merged into one file + pattern: "*.vcf.gz" + - bench_vcf_tbi: + type: file + description: Index of merged query and truth entries VCF file + pattern: "*.vcf.gz.tbi" +authors: + - "@famosab" +maintainers: + - "@famosab" diff --git a/modules/nf-core/wittyer/tests/main.nf.test b/modules/nf-core/wittyer/tests/main.nf.test new file mode 100644 index 00000000000..3c23ffe66eb --- /dev/null +++ b/modules/nf-core/wittyer/tests/main.nf.test @@ -0,0 +1,100 @@ +nextflow_process { + + name "Test Process WITTYER" + script "../main.nf" + process "WITTYER" + + tag "modules" + tag "modules_nfcore" + tag "wittyer" + + test("human - simulatedSV - vcf_gz") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['simulated_sv'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv2'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv2_tbi'], checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert snapshot(process.out.bench_vcf).match("bench_vcf") }, + { assert snapshot(process.out.bench_vcf_tbi).match("bench_vcf_tbi") }, + { assert snapshot(process.out.report).match("report") }, + { assert snapshot(process.out.version).match("version") } + ) + } + + } + + test("human - simulatedSV - vcf_gz - bed") { + + when { + process { + """ + input[0] = [ + [ id:'test_bed', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['simulated_sv'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv2'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv2_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['genome']['genome_21_multi_interval_bed'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert snapshot(process.out.bench_vcf).match("bed_bench_vcf") }, + { assert snapshot(process.out.bench_vcf_tbi).match("bed_bench_vcf_tbi") }, + { assert snapshot(process.out.report).match("bed_report") }, + { assert snapshot(process.out.version).match("bed_version") } + ) + } + + } + + test("human - simulatedSV - vcf_gz - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test_stub', single_end:false ], // meta map + file(params.test_data['homo_sapiens']['illumina']['simulated_sv'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv_tbi'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv2'], checkIfExists: true), + file(params.test_data['homo_sapiens']['illumina']['simulated_sv2_tbi'], checkIfExists: true), + [] + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() }, + { assert snapshot(process.out.version).match("stub_version") } + ) + } + + } + +} diff --git a/modules/nf-core/wittyer/tests/main.nf.test.snap b/modules/nf-core/wittyer/tests/main.nf.test.snap new file mode 100644 index 00000000000..a25d824420d --- /dev/null +++ b/modules/nf-core/wittyer/tests/main.nf.test.snap @@ -0,0 +1,347 @@ +{ + "human - simulatedSV - vcf_gz - bed": { + "content": [ + { + "0": [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.json:md5,c6515ada81b5ccf5aa5b4f1268da2800" + ] + ], + "1": [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.vcf.gz:md5,7e5f24415c80ca986e81be90f831e000" + ] + ], + "2": [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.vcf.gz.tbi:md5,e4de1e1d27208b56f5a7bfbe31542240" + ] + ], + "3": [ + "versions.yml:md5,4a5148f206a3b12f0ebe87e81cedc31a" + ], + "bench_vcf": [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.vcf.gz:md5,7e5f24415c80ca986e81be90f831e000" + ] + ], + "bench_vcf_tbi": [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.vcf.gz.tbi:md5,e4de1e1d27208b56f5a7bfbe31542240" + ] + ], + "report": [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.json:md5,c6515ada81b5ccf5aa5b4f1268da2800" + ] + ], + "versions": [ + "versions.yml:md5,4a5148f206a3b12f0ebe87e81cedc31a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:41:49.782336703" + }, + "stub_version": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:57.223103062" + }, + "human - simulatedSV - vcf_gz": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,fb70eac691c1067167091ab2d3b12de3" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf.gz:md5,ff56c3084a59507362f6b7b7dc46ffdc" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf.gz.tbi:md5,b9b448e5f11eebbcfeb9a123e838caa4" + ] + ], + "3": [ + "versions.yml:md5,4a5148f206a3b12f0ebe87e81cedc31a" + ], + "bench_vcf": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf.gz:md5,ff56c3084a59507362f6b7b7dc46ffdc" + ] + ], + "bench_vcf_tbi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf.gz.tbi:md5,b9b448e5f11eebbcfeb9a123e838caa4" + ] + ], + "report": [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,fb70eac691c1067167091ab2d3b12de3" + ] + ], + "versions": [ + "versions.yml:md5,4a5148f206a3b12f0ebe87e81cedc31a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:41:44.466462714" + }, + "bench_vcf": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf.gz:md5,ff56c3084a59507362f6b7b7dc46ffdc" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:47.523573536" + }, + "bench_vcf_tbi": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.vcf.gz.tbi:md5,b9b448e5f11eebbcfeb9a123e838caa4" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:47.532504108" + }, + "report": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.json:md5,fb70eac691c1067167091ab2d3b12de3" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:47.537692046" + }, + "bed_report": { + "content": [ + [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.json:md5,c6515ada81b5ccf5aa5b4f1268da2800" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:52.863563564" + }, + "bed_version": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:52.868467701" + }, + "version": { + "content": null, + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:47.542666285" + }, + "human - simulatedSV - vcf_gz - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test_stub", + "single_end": false + }, + "test_stub.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test_stub", + "single_end": false + }, + "test_stub.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "2": [ + [ + { + "id": "test_stub", + "single_end": false + }, + "test_stub.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,4a5148f206a3b12f0ebe87e81cedc31a" + ], + "bench_vcf": [ + [ + { + "id": "test_stub", + "single_end": false + }, + "test_stub.vcf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "bench_vcf_tbi": [ + [ + { + "id": "test_stub", + "single_end": false + }, + "test_stub.vcf.gz.tbi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "report": [ + [ + { + "id": "test_stub", + "single_end": false + }, + "test_stub.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,4a5148f206a3b12f0ebe87e81cedc31a" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:57.215084162" + }, + "bed_bench_vcf": { + "content": [ + [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.vcf.gz:md5,7e5f24415c80ca986e81be90f831e000" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:52.852045028" + }, + "bed_bench_vcf_tbi": { + "content": [ + [ + [ + { + "id": "test_bed", + "single_end": false + }, + "test_bed.vcf.gz.tbi:md5,e4de1e1d27208b56f5a7bfbe31542240" + ] + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:36:52.857651771" + } +} \ No newline at end of file diff --git a/modules/nf-core/wittyer/tests/tags.yml b/modules/nf-core/wittyer/tests/tags.yml new file mode 100644 index 00000000000..177db940a55 --- /dev/null +++ b/modules/nf-core/wittyer/tests/tags.yml @@ -0,0 +1,2 @@ +wittyer: + - "modules/nf-core/wittyer/**" From dcf17cc0ed8fd5ea57e61a13e0147cddb5c1ee30 Mon Sep 17 00:00:00 2001 From: dimple-aspiring-cat <148437461+dimple-aspiring-cat@users.noreply.github.com> Date: Wed, 20 Mar 2024 10:39:55 +0100 Subject: [PATCH 39/46] Remove unnecessary .view() in subworkflows/nf-core/vcf_phase_shapeit5 & tests/modules/nf-core/shapeit5/ligate/main.nf (#5280) * .view() deleted * Delete unecessary view * Update licence * Bcftools view compressed output * Update licence --------- Co-authored-by: Dimple Adiwal Co-authored-by: Dimple Adiwal Co-authored-by: Louis LE NEZET <58640615+LouisLeNezet@users.noreply.github.com> --- modules/nf-core/shapeit5/ligate/meta.yml | 4 ++-- subworkflows/nf-core/vcf_phase_shapeit5/main.nf | 3 +-- tests/modules/nf-core/shapeit5/ligate/main.nf | 4 +--- tests/modules/nf-core/shapeit5/ligate/nextflow.config | 1 + tests/subworkflows/nf-core/vcf_phase_shapeit5/nextflow.config | 1 + 5 files changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/nf-core/shapeit5/ligate/meta.yml b/modules/nf-core/shapeit5/ligate/meta.yml index ab68274eb89..ed1e5e9efed 100644 --- a/modules/nf-core/shapeit5/ligate/meta.yml +++ b/modules/nf-core/shapeit5/ligate/meta.yml @@ -12,8 +12,8 @@ tools: homepage: "https://odelaneau.github.io/shapeit5/" documentation: "https://odelaneau.github.io/shapeit5/docs/documentation" tool_dev_url: "https://github.com/odelaneau/shapeit5" - doi: "10.1101/2022.10.19.512867 " - licence: "['MIT']" + doi: "10.1101/2022.10.19.512867" + licence: ["MIT"] input: - meta: type: map diff --git a/subworkflows/nf-core/vcf_phase_shapeit5/main.nf b/subworkflows/nf-core/vcf_phase_shapeit5/main.nf index 0ddebcb3d41..966f9019055 100644 --- a/subworkflows/nf-core/vcf_phase_shapeit5/main.nf +++ b/subworkflows/nf-core/vcf_phase_shapeit5/main.nf @@ -66,10 +66,9 @@ workflow VCF_PHASE_SHAPEIT5 { ch_ligate_input = SHAPEIT5_PHASECOMMON.out.phased_variant .join(VCF_INDEX1.out.csi, failOnMismatch:true, failOnDuplicate:true) - .view() .map{ meta, vcf, csi -> newmeta = meta + [id: meta.id.split("_")[0..-2].join("_")] - [newmeta, vcf, csi]}.view() + [newmeta, vcf, csi]} .combine(ch_chunks_number, by:0) .map{meta, vcf, csi, chunks_num -> [groupKey(meta, chunks_num), vcf, csi]} diff --git a/tests/modules/nf-core/shapeit5/ligate/main.nf b/tests/modules/nf-core/shapeit5/ligate/main.nf index 3b92a03ed8f..1213f7bd3a8 100644 --- a/tests/modules/nf-core/shapeit5/ligate/main.nf +++ b/tests/modules/nf-core/shapeit5/ligate/main.nf @@ -32,7 +32,7 @@ workflow test_shapeit5_ligate { phase_input = Channel.of([[ id:'NA12878_1X']]) .combine(BCFTOOLS_VIEW.out.vcf.collect().map{it[1]}) .combine(BCFTOOLS_INDEX.out.csi.collect().map{it[1]}) - .combine(sample).view() + .combine(sample) .combine(region) .map{ meta, vcf, csi, sample, region -> [meta + [region: region.replace(":","_")], @@ -43,7 +43,6 @@ workflow test_shapeit5_ligate { phased_variant = SHAPEIT5_PHASECOMMON.output.phased_variant .map{ meta, vcf -> [meta.subMap(["id"]), vcf]} - .view() BCFTOOLS_INDEX2 ( phased_variant ) @@ -55,6 +54,5 @@ workflow test_shapeit5_ligate { a.getName() <=> b.getName()}, csi]} - ligate_input.view() SHAPEIT5_LIGATE ( ligate_input ) } diff --git a/tests/modules/nf-core/shapeit5/ligate/nextflow.config b/tests/modules/nf-core/shapeit5/ligate/nextflow.config index 665b5b02e5f..f96da6737f4 100644 --- a/tests/modules/nf-core/shapeit5/ligate/nextflow.config +++ b/tests/modules/nf-core/shapeit5/ligate/nextflow.config @@ -1,6 +1,7 @@ process { withName: BCFTOOLS_VIEW { ext.args = [ + "-Oz", "-e 'GT=\"./.\"||GT=\".\"'" ].join(' ') ext.prefix = { "${meta.id}" } diff --git a/tests/subworkflows/nf-core/vcf_phase_shapeit5/nextflow.config b/tests/subworkflows/nf-core/vcf_phase_shapeit5/nextflow.config index 2d06b2b2718..9a9f10a640b 100644 --- a/tests/subworkflows/nf-core/vcf_phase_shapeit5/nextflow.config +++ b/tests/subworkflows/nf-core/vcf_phase_shapeit5/nextflow.config @@ -5,6 +5,7 @@ process { } withName: BCFTOOLS_VIEW { ext.args = [ + "-Oz", "-e 'GT=\"./.\"||GT=\".\"'" ].join(' ') } From 0c3919176959e6bf72fec1d8e1539add87426bb2 Mon Sep 17 00:00:00 2001 From: soulj Date: Wed, 20 Mar 2024 10:16:48 +0000 Subject: [PATCH 40/46] Igv reports (#5263) * add inital igvreports module * add full input and tests --------- Co-authored-by: Andrea Telatin <15690844+telatin@users.noreply.github.com> --- modules/nf-core/igvreports/environment.yml | 9 ++ modules/nf-core/igvreports/main.nf | 48 ++++++++ modules/nf-core/igvreports/meta.yml | 47 ++++++++ modules/nf-core/igvreports/tests/main.nf.test | 107 ++++++++++++++++++ .../igvreports/tests/main.nf.test.snap | 38 +++++++ .../igvreports/tests/nextflow_genome.config | 7 ++ modules/nf-core/igvreports/tests/tags.yml | 2 + 7 files changed, 258 insertions(+) create mode 100644 modules/nf-core/igvreports/environment.yml create mode 100644 modules/nf-core/igvreports/main.nf create mode 100644 modules/nf-core/igvreports/meta.yml create mode 100644 modules/nf-core/igvreports/tests/main.nf.test create mode 100644 modules/nf-core/igvreports/tests/main.nf.test.snap create mode 100644 modules/nf-core/igvreports/tests/nextflow_genome.config create mode 100644 modules/nf-core/igvreports/tests/tags.yml diff --git a/modules/nf-core/igvreports/environment.yml b/modules/nf-core/igvreports/environment.yml new file mode 100644 index 00000000000..5ed725f46e9 --- /dev/null +++ b/modules/nf-core/igvreports/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "igvreports" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::igv-reports=1.12.0" diff --git a/modules/nf-core/igvreports/main.nf b/modules/nf-core/igvreports/main.nf new file mode 100644 index 00000000000..3fbc0c05a92 --- /dev/null +++ b/modules/nf-core/igvreports/main.nf @@ -0,0 +1,48 @@ +process IGVREPORTS { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/igv-reports:1.12.0--pyh7cba7a3_0': + 'biocontainers/igv-reports:1.12.0--pyh7cba7a3_0' }" + + input: + tuple val(meta), path(sites) + path genomeFasta //optional genome fasta file + + output: + tuple val(meta), path("*.html") , emit: report + 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 fasta = genomeFasta ? "--fasta ${genomeFasta}" : "" + """ + create_report $sites \ + $args \ + $fasta \ + --output ${meta.id}_report.html + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + igvreports: \$(python -c "import igv_reports; print(igv_reports.__version__)") + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${meta.id}_report.html + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + igvreports: \$(python -c "import igv_reports; print(igv_reports.__version__)") + END_VERSIONS + """ +} diff --git a/modules/nf-core/igvreports/meta.yml b/modules/nf-core/igvreports/meta.yml new file mode 100644 index 00000000000..6c1ecfdcc29 --- /dev/null +++ b/modules/nf-core/igvreports/meta.yml @@ -0,0 +1,47 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "igvreports" +description: A Python application to generate self-contained HTML reports for variant review and other genomic applications +keywords: + - vcf + - variant + - genomics +tools: + - "igvreports": + description: "Creates self-contained html pages for visual variant review with IGV (igv.js)." + homepage: "https://github.com/igvteam/igv-reports" + documentation: "https://github.com/igvteam/igv-reports" + tool_dev_url: "https://github.com/igvteam/igv-reports" + doi: "10.1093/bioinformatics/btac830" + licence: ["MIT"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + + - sites: + type: file + description: VCF, BED, MAF, BEDPE, or generic tab delimited file of genomic variant sites + - genomeFasta: + type: file + description: Reference fasta file + pattern: "*.{fasta,fa}" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - report: + type: file + description: html report with a table of genomic sites and an embedded IGV genome browser for viewing data for each site + pattern: "*.{html}" + +authors: + - "@souljamie" +maintainers: + - "@souljamie" diff --git a/modules/nf-core/igvreports/tests/main.nf.test b/modules/nf-core/igvreports/tests/main.nf.test new file mode 100644 index 00000000000..de6a174cba1 --- /dev/null +++ b/modules/nf-core/igvreports/tests/main.nf.test @@ -0,0 +1,107 @@ +nextflow_process { + + name "Test Process IGVREPORTS" + script "../main.nf" + process "IGVREPORTS" + + tag "modules" + tag "modules_nfcore" + tag "igvreports" + + test("testvariantsWithFasta - vcf") { + + when { + process { + """ + input[0] = [ [ id:'test'], // meta map + file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) + ] + input[1] = file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match()}, + { + with(process.out.report) { + with(get(0)) { + assert get(1).endsWith("_report.html") + } + } + } + ) + } + + } + + + + test("testvariantsWithGenome - vcf") { + config "./nextflow_genome.config" + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file("https://raw.githubusercontent.com/igvteam/igv-reports/master/test/data/variants/variants.vcf") + ] + // Need to specify the empty optional fasta input + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match()}, + { + with(process.out.report) { + with(get(0)) { + assert get(1).endsWith("_report.html") + } + } + } + ) + } + + } + + test("testvariantWithGenome - vcf - stub") { + config "./nextflow_genome.config" + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file("https://raw.githubusercontent.com/igvteam/igv-reports/master/test/data/variants/variants.vcf") + ] + input[1] = [] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.versions).match()}, + { + with(process.out.report) { + with(get(0)) { + assert get(1).endsWith("_report.html") + } + } + } + ) + } + + } + +} diff --git a/modules/nf-core/igvreports/tests/main.nf.test.snap b/modules/nf-core/igvreports/tests/main.nf.test.snap new file mode 100644 index 00000000000..d17d7bf3f9a --- /dev/null +++ b/modules/nf-core/igvreports/tests/main.nf.test.snap @@ -0,0 +1,38 @@ +{ + "testvariantWithGenome - vcf - stub": { + "content": [ + [ + "versions.yml:md5,38325133c4cb8cd794588faf67feb345" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T12:09:37.091895286" + }, + "testvariantsWithGenome - vcf": { + "content": [ + [ + "versions.yml:md5,38325133c4cb8cd794588faf67feb345" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:55:24.216860945" + }, + "testvariantsWithFasta - vcf": { + "content": [ + [ + "versions.yml:md5,38325133c4cb8cd794588faf67feb345" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:41:37.146728439" + } +} \ No newline at end of file diff --git a/modules/nf-core/igvreports/tests/nextflow_genome.config b/modules/nf-core/igvreports/tests/nextflow_genome.config new file mode 100644 index 00000000000..3bb4626ba23 --- /dev/null +++ b/modules/nf-core/igvreports/tests/nextflow_genome.config @@ -0,0 +1,7 @@ +process { + + withName: IGVREPORTS { + ext.args = '--genome hg38' + } + +} diff --git a/modules/nf-core/igvreports/tests/tags.yml b/modules/nf-core/igvreports/tests/tags.yml new file mode 100644 index 00000000000..51c88459074 --- /dev/null +++ b/modules/nf-core/igvreports/tests/tags.yml @@ -0,0 +1,2 @@ +igvreports: + - "modules/nf-core/igvreports/**" From 53c2b466994f07def210b7f4cc866bb5a8a2cb92 Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Wed, 20 Mar 2024 11:19:38 +0100 Subject: [PATCH 41/46] Revert "update kallistobustools count output list" (#5307) Revert "update kallistobustools count output list (#5110)" This reverts commit 9d3e489286eead7dfe1010fd324904d8b698eca7. --- .../nf-core/kallistobustools/count/main.nf | 8 ++--- .../nf-core/kallistobustools/count/meta.yml | 8 ----- .../count/tests/main.nf.test.snap | 30 ++----------------- 3 files changed, 5 insertions(+), 41 deletions(-) diff --git a/modules/nf-core/kallistobustools/count/main.nf b/modules/nf-core/kallistobustools/count/main.nf index 1efda00abb8..841ea2fea6c 100644 --- a/modules/nf-core/kallistobustools/count/main.nf +++ b/modules/nf-core/kallistobustools/count/main.nf @@ -17,11 +17,9 @@ process KALLISTOBUSTOOLS_COUNT { val workflow_mode output: - tuple val(meta), path ("*.count") , emit: count - tuple val(meta), path ("*.count/counts_unfiltered"), emit: raw_counts - tuple val(meta), path ("*.count/counts_filtered") , emit: filtered_counts, optional: true - path "versions.yml" , emit: versions - path "*.count/*/*.mtx" , emit: matrix //Ensure that kallisto finished and produced outputs + tuple val(meta), path ("*.count") , emit: count + path "versions.yml" , emit: versions + path "*.count/*/*.mtx" , emit: matrix //Ensure that kallisto finished and produced outputs when: task.ext.when == null || task.ext.when diff --git a/modules/nf-core/kallistobustools/count/meta.yml b/modules/nf-core/kallistobustools/count/meta.yml index d491dffaae3..55d5dc6cdc4 100644 --- a/modules/nf-core/kallistobustools/count/meta.yml +++ b/modules/nf-core/kallistobustools/count/meta.yml @@ -58,14 +58,6 @@ output: type: file description: kb count output folder pattern: "*.{count}" - - raw_counts: - type: file - description: kb raw counts output folder - pattern: "*.{count}/counts_unfiltered" - - filtered_counts: - type: file - description: kb filtered counts output folder - pattern: "*.{count}/counts_filtered" - versions: type: file description: File containing software versions diff --git a/modules/nf-core/kallistobustools/count/tests/main.nf.test.snap b/modules/nf-core/kallistobustools/count/tests/main.nf.test.snap index 6f6b3183328..3378c3c16fa 100644 --- a/modules/nf-core/kallistobustools/count/tests/main.nf.test.snap +++ b/modules/nf-core/kallistobustools/count/tests/main.nf.test.snap @@ -15,22 +15,9 @@ ] ], "1": [ - [ - { - "id": "test" - }, - [ - "cells_x_genes.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ] - ], - "2": [ - - ], - "3": [ "versions.yml:md5,6ec06270afe0a7572c41567160d927d9" ], - "4": [ + "2": [ "cells_x_genes.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" ], "count": [ @@ -44,23 +31,10 @@ ] ] ] - ], - "filtered_counts": [ - ], "matrix": [ "cells_x_genes.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" ], - "raw_counts": [ - [ - { - "id": "test" - }, - [ - "cells_x_genes.mtx:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ] - ], "versions": [ "versions.yml:md5,6ec06270afe0a7572c41567160d927d9" ] @@ -70,7 +44,7 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-18T11:38:48.980939376" + "timestamp": "2024-03-01T15:48:45.775904562" }, "genome.fasta + genome.gtf + '10X3' + 'standard'": { "content": [ From 1774f7876ee03f65ccf49ca2e6bdef7c2356ebca Mon Sep 17 00:00:00 2001 From: Felipe Marques de Almeida Date: Wed, 20 Mar 2024 11:19:46 +0100 Subject: [PATCH 42/46] Revert "add paths in output directive in cellranger cout module" (#5306) Revert "add paths in output directive in cellranger cout module (#5108)" This reverts commit 92ca535c5a8c0fe89eb71e649ee536bd355ce4fc. --- modules/nf-core/cellranger/count/main.nf | 10 +--- modules/nf-core/cellranger/count/meta.yml | 8 --- .../cellranger/count/tests/main.nf.test.snap | 52 +------------------ 3 files changed, 4 insertions(+), 66 deletions(-) diff --git a/modules/nf-core/cellranger/count/main.nf b/modules/nf-core/cellranger/count/main.nf index 1811d7457ff..42aa09c9f5b 100644 --- a/modules/nf-core/cellranger/count/main.nf +++ b/modules/nf-core/cellranger/count/main.nf @@ -9,10 +9,8 @@ process CELLRANGER_COUNT { path reference output: - tuple val(meta), path("**/outs/**") , emit: outs - tuple val(meta), path("**/outs/filtered_feature_bc_matrix**"), emit: filtered - tuple val(meta), path("**/outs/raw_feature_bc_matrix**") , emit: raw - path "versions.yml" , emit: versions + tuple val(meta), path("**/outs/**"), emit: outs + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -34,11 +32,7 @@ process CELLRANGER_COUNT { def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir -p "${prefix}/outs/" - mkdir -p "${prefix}/outs/filtered_feature_bc_matrix" - mkdir -p "${prefix}/outs/raw_feature_bc_matrix" echo "$prefix" > ${prefix}/outs/fake_file.txt - echo "$prefix" > ${prefix}/outs/filtered_feature_bc_matrix/fake_file.txt - echo "$prefix" > ${prefix}/outs/raw_feature_bc_matrix/fake_file.txt cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/cellranger/count/meta.yml b/modules/nf-core/cellranger/count/meta.yml index 562449769b8..1f1768a857b 100644 --- a/modules/nf-core/cellranger/count/meta.yml +++ b/modules/nf-core/cellranger/count/meta.yml @@ -40,14 +40,6 @@ output: type: file description: Files containing the outputs of Cell Ranger, see official 10X Genomics documentation for a complete list pattern: "${meta.id}/outs/*" - - filtered: - type: file - description: Files containing the filtered outputs of Cell Ranger. - pattern: "**/outs/filtered_feature_bc_matrix**" - - raw: - type: file - description: Files containing the raw outputs of Cell Ranger. - pattern: "**/outs/raw_feature_bc_matrix**" - versions: type: file description: File containing software version diff --git a/modules/nf-core/cellranger/count/tests/main.nf.test.snap b/modules/nf-core/cellranger/count/tests/main.nf.test.snap index edfb304b733..7eafafd02e9 100644 --- a/modules/nf-core/cellranger/count/tests/main.nf.test.snap +++ b/modules/nf-core/cellranger/count/tests/main.nf.test.snap @@ -27,30 +27,6 @@ "content": [ { "0": [ - [ - { - "id": "test_10x", - "single_end": false, - "strandedness": "auto" - }, - [ - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d", - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d", - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d" - ] - ] - ], - "1": [ - [ - { - "id": "test_10x", - "single_end": false, - "strandedness": "auto" - }, - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d" - ] - ], - "2": [ [ { "id": "test_10x", @@ -60,34 +36,10 @@ "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d" ] ], - "3": [ + "1": [ "versions.yml:md5,30cee1a9146b01c48d9b1db6bbe813b6" ], - "filtered": [ - [ - { - "id": "test_10x", - "single_end": false, - "strandedness": "auto" - }, - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d" - ] - ], "outs": [ - [ - { - "id": "test_10x", - "single_end": false, - "strandedness": "auto" - }, - [ - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d", - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d", - "fake_file.txt:md5,0d98223c768861fd6af96f00148dbb8d" - ] - ] - ], - "raw": [ [ { "id": "test_10x", @@ -106,6 +58,6 @@ "nf-test": "0.8.4", "nextflow": "23.10.1" }, - "timestamp": "2024-03-18T11:41:17.258523741" + "timestamp": "2024-03-05T17:16:12.322822411" } } \ No newline at end of file From 9d0f89b445e1f5b2fb30476f4be9a8b519c07846 Mon Sep 17 00:00:00 2001 From: Oliver Schwengers Date: Wed, 20 Mar 2024 11:52:05 +0100 Subject: [PATCH 43/46] Remove AMRFinderPlus DB update on each invocation (#5232) Remove the AMRFinderPlus DB update which is invoked on each Bakta execution, nevertheless, it should be downloaded and installed during the DB download via bakta_db download. Co-authored-by: Jasmin Frangenberg <73216762+jasmezz@users.noreply.github.com> --- modules/nf-core/bakta/bakta/main.nf | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/nf-core/bakta/bakta/main.nf b/modules/nf-core/bakta/bakta/main.nf index 7c83d94bf19..9a32c3dac93 100644 --- a/modules/nf-core/bakta/bakta/main.nf +++ b/modules/nf-core/bakta/bakta/main.nf @@ -35,8 +35,6 @@ process BAKTA_BAKTA { def proteins_opt = proteins ? "--proteins ${proteins[0]}" : "" def prodigal_tf = prodigal_tf ? "--prodigal-tf ${prodigal_tf[0]}" : "" """ - amrfinder_update --force_update --database $db/amrfinderplus-db - bakta \\ $fasta \\ $args \\ From 9f892b5da34b25da790af7baa48caeb869481bb9 Mon Sep 17 00:00:00 2001 From: Christian Heide <11767963+jch-13@users.noreply.github.com> Date: Wed, 20 Mar 2024 13:02:00 +0100 Subject: [PATCH 44/46] Add subworkflow mapAD (#5239) Add mapAD subworkflow --- .../nf-core/fastq_align_mapad/main.nf | 76 +++++++++++++ .../nf-core/fastq_align_mapad/meta.yml | 100 ++++++++++++++++++ .../fastq_align_mapad/tests/main.nf.test | 67 ++++++++++++ .../fastq_align_mapad/tests/main.nf.test.snap | 66 ++++++++++++ .../fastq_align_mapad/tests/nextflow.config | 12 +++ .../nf-core/fastq_align_mapad/tests/tags.yml | 2 + 6 files changed, 323 insertions(+) create mode 100644 subworkflows/nf-core/fastq_align_mapad/main.nf create mode 100644 subworkflows/nf-core/fastq_align_mapad/meta.yml create mode 100644 subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test create mode 100644 subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test.snap create mode 100644 subworkflows/nf-core/fastq_align_mapad/tests/nextflow.config create mode 100644 subworkflows/nf-core/fastq_align_mapad/tests/tags.yml diff --git a/subworkflows/nf-core/fastq_align_mapad/main.nf b/subworkflows/nf-core/fastq_align_mapad/main.nf new file mode 100644 index 00000000000..6c114892f3e --- /dev/null +++ b/subworkflows/nf-core/fastq_align_mapad/main.nf @@ -0,0 +1,76 @@ +// +// Alignment with mapAD and sort +// + +include { MAPAD_MAP } from '../../../modules/nf-core/mapad/map/main' +include { BAM_SORT_STATS_SAMTOOLS } from '../bam_sort_stats_samtools/main' + +workflow FASTQ_ALIGN_MAPAD { + + take: + ch_reads // channel (mandatory): [ val(meta), path(reads) ]. Important: meta REQUIRES single_end` entry! + ch_index // channel (mandatory): [ val(meta), path(index) ] + ch_fasta // channel (optional) : [ val(meta3), path(fasta) ] + val_mismatch_parameter + val_double_stranded_library + val_five_prime_overhang + val_three_prime_overhang + val_deam_rate_double_stranded + val_deam_rate_single_stranded + val_indel_rate + + + main: + + ch_versions = Channel.empty() + + // WARNING: You must specify in your prefix `meta.id_index` in your `modules.conf` + // to ensure that you do not overwrite multiple BAM files from one sample mapped + // against multiple references. This meta map is added by the subworkflow but can be removed + // after if necessary. + + // Ensure when multiple references are provided, that reference/read combinations + // are correctly associated throughout the subworkflow by copying the sample + // specific metadata to the index on each combination + + ch_prepped_input = ch_reads + .combine(ch_index) + .map{ + meta, reads, meta_index, index -> + + // Create a combined id that includes the ids of the reads and the index used. + // Also keep the id of the index with a new name to avoid name collisions. + def key_read_ref = meta.id + "_" + meta_index.id + def id_index = meta_index.id + + [ meta + [key_read_ref: key_read_ref] + [id_index: id_index], reads, meta_index + [key_read_ref: key_read_ref] + [id_index: id_index], index ] + } + + // Drop the index_meta, as the id of the index is now kept within the read meta. + ch_preppedinput_for_mapad = ch_prepped_input + .multiMap { + meta, reads, meta_index, index -> + reads: [ meta, reads ] + index: [ meta, index ] + } + + // Alignment + MAPAD_MAP ( ch_preppedinput_for_mapad.reads, ch_preppedinput_for_mapad.index, val_mismatch_parameter, val_double_stranded_library, val_five_prime_overhang, val_three_prime_overhang, val_deam_rate_double_stranded, val_deam_rate_single_stranded, val_indel_rate ) + ch_versions = ch_versions.mix( MAPAD_MAP.out.versions.first() ) + + // Sort, index BAM file and run samtools stats, flagstat and idxstats + BAM_SORT_STATS_SAMTOOLS ( MAPAD_MAP.out.bam, ch_fasta ) + ch_versions = ch_versions.mix(BAM_SORT_STATS_SAMTOOLS.out.versions) + + emit: + bam_unsorted = MAPAD_MAP.out.bam // channel: [ val(meta), path(bam) ] + + bam = BAM_SORT_STATS_SAMTOOLS.out.bam // channel: [ val(meta), path(bam) ] + bai = BAM_SORT_STATS_SAMTOOLS.out.bai // channel: [ val(meta), path(bai) ] + csi = BAM_SORT_STATS_SAMTOOLS.out.csi // channel: [ val(meta), path(csi) ] + stats = BAM_SORT_STATS_SAMTOOLS.out.stats // channel: [ val(meta), path(stats) ] + flagstat = BAM_SORT_STATS_SAMTOOLS.out.flagstat // channel: [ val(meta), path(flagstat) ] + idxstats = BAM_SORT_STATS_SAMTOOLS.out.idxstats // channel: [ val(meta), path(idxstats) ] + + versions = ch_versions // channel: [ path(versions.yml) ] +} diff --git a/subworkflows/nf-core/fastq_align_mapad/meta.yml b/subworkflows/nf-core/fastq_align_mapad/meta.yml new file mode 100644 index 00000000000..c459fd263e9 --- /dev/null +++ b/subworkflows/nf-core/fastq_align_mapad/meta.yml @@ -0,0 +1,100 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/subworkflows/yaml-schema.json +name: "fastq_align_mapad" +description: Align FASTQ files against reference genome with the mapAD aDNA short-read aligner producing a sorted and indexed BAM files +keywords: + - sort + - fastq + - bam + - mapad + - align + - map +components: + - mapad/map + - samtools/sort + - samtools/index + - samtools/stats + - samtools/idxstats + - samtools/flagstat + - bam_sort_stats_samtools +input: + - ch_reads: + description: | + List of input FASTQ file + Structure: [ val(meta), path(reads) ] + - ch_index: + description: | + mapAD genome index files + Structure: [ val(meta), path(index) ] + - ch_fasta: + type: file + description: | + Reference fasta file + Structure: [ val(meta), path(fasta) ] + - val_mismatch_parameter: + type: float + description: | + `bwa aln` compatible allowed-mismatches parameter + - val_double_stranded_library: + type: boolean + description: | + If true, `--library` is set to `double_stranded` + pattern: "true|false" + - val_five_prime_overhang: + type: float + description: | + 5' overhang parameter (global overhang parameter + if `val_double_stranded_library` is set to `true`) + - val_three_prime_overhang: + type: float + description: | + 3' overhang parameter (ignored if + `val_double_stranded_library` is set to `true`) + - val_deam_rate_double_stranded: + type: float + description: | + `-d` parameter. Specifies the expected deamination + rate in double-stranded stems of the reads. + - val_deam_rate_single_stranded: + type: float + description: | + `-s` parameter. Specifies the expected deamination + rate in single-stranded overhangs of the reads. + - val_indel_rate: + type: float + description: | + `-i` parameter. Specifies the expected rate of InDels. +output: + - bam_unsorted: + description: | + BAM file produced by mapAD + Structure: [ val(meta), path(bam) ] + - bam: + description: | + BAM file sorted by samtools + Structure: [ val(meta), path(bam) ] + - bai: + description: | + BAI index of the sorted BAM file + Structure: [ val(meta), path(bai) ] + - csi: + description: | + CSI index of the sorted BAM file + Structure: [ val(meta), path(csi) ] + - stats: + description: | + File containing samtools stats output + Structure: [ val(meta), path(stats) ] + - flagstat: + description: | + File containing samtools flagstat output + Structure: [ val(meta), path(flagstat) ] + - idxstats: + description: | + File containing samtools idxstats output + Structure: [ val(meta), path(idxstats) ] + - versions: + description: | + Files containing software versions + Structure: [ path(versions.yml) ] +authors: + - "@jch-13" diff --git a/subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test b/subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test new file mode 100644 index 00000000000..841497c0f93 --- /dev/null +++ b/subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test @@ -0,0 +1,67 @@ +nextflow_workflow { + + name "Test Subworkflow FASTQ_ALIGN_MAPAD" + script "../main.nf" + config "./nextflow.config" + workflow "FASTQ_ALIGN_MAPAD" + + tag "subworkflows" + tag "subworkflows_nfcore" + tag "subworkflows/fastq_align_mapad" + tag "subworkflows/bam_sort_stats_samtools" + tag "mapad" + tag "mapad/map" + tag "mapad/index" + + + test("sarscov2 - bam - single_end") { + setup { + run("MAPAD_INDEX") { + script "../../../../modules/nf-core/mapad/index/main.nf" + process { + """ + input[0] = [ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)] + """ + } + } + } + + when { + workflow { + """ + input[0] = Channel.of([ [ id:'test', single_end:true ], // meta map + file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true) + ]) + input[1] = MAPAD_INDEX.out.index + input[2] = [ [ id:'genome' ], + file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + ] + input[3] = 0.03 + input[4] = false + input[5] = 0.5 + input[6] = 0.5 + input[7] = 0.02 + input[8] = 1.0 + input[9] = 0.001 + """ + } + } + + then { + assertAll( + { assert workflow.success }, + { assert snapshot( + workflow.out.bai, + workflow.out.csi, + workflow.out.stats, + workflow.out.flagstat, + workflow.out.idxstats, + workflow.out.versions, + ).match() + }, + { assert file(workflow.out.bam_unsorted.get(0).get(1)).exists() }, + { assert file(workflow.out.bam.get(0).get(1)).exists() }, + ) + } + } +} diff --git a/subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test.snap new file mode 100644 index 00000000000..b069d429bd1 --- /dev/null +++ b/subworkflows/nf-core/fastq_align_mapad/tests/main.nf.test.snap @@ -0,0 +1,66 @@ +{ + "sarscov2 - bam - single_end": { + "content": [ + [ + [ + { + "id": "test", + "single_end": true, + "key_read_ref": "test_genome", + "id_index": "genome" + }, + "test.sorted.bam.bai:md5,4ddb73895b1424a09cab389d536f3611" + ] + ], + [ + + ], + [ + [ + { + "id": "test", + "single_end": true, + "key_read_ref": "test_genome", + "id_index": "genome" + }, + "test.sorted.bam.stats:md5,aa0845cab33b7fed9ce65143fafc4ac6" + ] + ], + [ + [ + { + "id": "test", + "single_end": true, + "key_read_ref": "test_genome", + "id_index": "genome" + }, + "test.sorted.bam.flagstat:md5,08dd9ecd07c50d038756da90d0813961" + ] + ], + [ + [ + { + "id": "test", + "single_end": true, + "key_read_ref": "test_genome", + "id_index": "genome" + }, + "test.sorted.bam.idxstats:md5,4cf38c87984783a24c2ebeb0598292f8" + ] + ], + [ + "versions.yml:md5,3b366ad42150e9e0121caeb0291c1b3c", + "versions.yml:md5,486dcd9469c7e98c54cbcb25651024ea", + "versions.yml:md5,75ff2e03627b2c64930703e205d338ab", + "versions.yml:md5,886ec6d544b4770bc49470fe38689453", + "versions.yml:md5,e96fa5cf98e9910e2680fda162305a1a", + "versions.yml:md5,f1d10c97aa161f4fe262469b7aeb349d" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T09:55:17.646783154" + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_align_mapad/tests/nextflow.config b/subworkflows/nf-core/fastq_align_mapad/tests/nextflow.config new file mode 100644 index 00000000000..7927c34294a --- /dev/null +++ b/subworkflows/nf-core/fastq_align_mapad/tests/nextflow.config @@ -0,0 +1,12 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + + withName: '.*:BAM_SORT_STATS_SAMTOOLS:SAMTOOLS_.*' { + ext.prefix = { "${meta.id}.sorted" } + } + + withName: '.*:BAM_SORT_STATS_SAMTOOLS:BAM_STATS_SAMTOOLS:.*' { + ext.prefix = { "${meta.id}.sorted.bam" } + } +} \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_align_mapad/tests/tags.yml b/subworkflows/nf-core/fastq_align_mapad/tests/tags.yml new file mode 100644 index 00000000000..86acf871fa6 --- /dev/null +++ b/subworkflows/nf-core/fastq_align_mapad/tests/tags.yml @@ -0,0 +1,2 @@ +subworkflows/fastq_align_mapad: + - subworkflows/nf-core/fastq_align_mapad/** From 6920a611782d056e3c11f0d32bb93cfae064524d Mon Sep 17 00:00:00 2001 From: lgrochowalski Date: Wed, 20 Mar 2024 13:03:53 +0100 Subject: [PATCH 45/46] Leviosam2 index (#5316) * first version * improvments * whitespaces * whitespaces * whitespaces * prettier --------- Co-authored-by: zxBIB Grochowalski,Lukasz (GCBDS) EXTERNAL --- .../nf-core/leviosam2/index/environment.yml | 8 ++ modules/nf-core/leviosam2/index/main.nf | 49 ++++++++++++ modules/nf-core/leviosam2/index/meta.yml | 45 +++++++++++ .../leviosam2/index/tests/main.nf.test | 75 +++++++++++++++++++ .../leviosam2/index/tests/main.nf.test.snap | 68 +++++++++++++++++ .../nf-core/leviosam2/index/tests/tags.yml | 3 + 6 files changed, 248 insertions(+) create mode 100644 modules/nf-core/leviosam2/index/environment.yml create mode 100644 modules/nf-core/leviosam2/index/main.nf create mode 100644 modules/nf-core/leviosam2/index/meta.yml create mode 100644 modules/nf-core/leviosam2/index/tests/main.nf.test create mode 100644 modules/nf-core/leviosam2/index/tests/main.nf.test.snap create mode 100644 modules/nf-core/leviosam2/index/tests/tags.yml diff --git a/modules/nf-core/leviosam2/index/environment.yml b/modules/nf-core/leviosam2/index/environment.yml new file mode 100644 index 00000000000..f59fd991b8f --- /dev/null +++ b/modules/nf-core/leviosam2/index/environment.yml @@ -0,0 +1,8 @@ +--- +name: "leviosam2_index" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::leviosam2=0.4.2" diff --git a/modules/nf-core/leviosam2/index/main.nf b/modules/nf-core/leviosam2/index/main.nf new file mode 100644 index 00000000000..f8ef233bcd1 --- /dev/null +++ b/modules/nf-core/leviosam2/index/main.nf @@ -0,0 +1,49 @@ +process LEVIOSAM2_INDEX { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/leviosam2:0.4.2--h4ac6f70_0': + 'biocontainers/leviosam2:0.4.2--h4ac6f70_0' }" + + input: + tuple val(meta), path(fai) + path(chain) + + output: + tuple val(meta), path("*.clft"), emit: clft + 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}" + + """ + leviosam2 \\ + index \\ + -c ${chain} \\ + -p ${prefix} \\ + -F ${fai} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + leviosam2: \$(leviosam2 --version) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.clft + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + leviosam2: \$(leviosam2 --version) + END_VERSIONS + """ +} diff --git a/modules/nf-core/leviosam2/index/meta.yml b/modules/nf-core/leviosam2/index/meta.yml new file mode 100644 index 00000000000..ab5a3a279b2 --- /dev/null +++ b/modules/nf-core/leviosam2/index/meta.yml @@ -0,0 +1,45 @@ +--- +name: "leviosam2_index" +description: Index chain files for lift over +keywords: + - leviosam2 + - index + - lift +tools: + - "leviosam2": + description: "Fast and accurate coordinate conversion between assemblies" + homepage: "https://github.com/milkschen/leviosam2/blob/main/workflow/README.md" + documentation: "https://github.com/milkschen/leviosam2/blob/main/workflow/README.md" + licence: ["MIT"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'reference' ]` + - fai: + type: file + description: FAI (FASTA index) file of the target reference + pattern: "*.{fai}" + - chain: + type: file + description: Chain file to index. + pattern: "*.{chain}" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'reference' ]` + - clft: + type: file + description: Clft file of indexed chain + pattern: "*.{clft}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@lgrochowalski" +maintainers: + - "@lgrochowalski" diff --git a/modules/nf-core/leviosam2/index/tests/main.nf.test b/modules/nf-core/leviosam2/index/tests/main.nf.test new file mode 100644 index 00000000000..f1ad0a3b18e --- /dev/null +++ b/modules/nf-core/leviosam2/index/tests/main.nf.test @@ -0,0 +1,75 @@ +nextflow_process { + + name "Test Process LEVIOSAM2_INDEX" + script "../main.nf" + process "LEVIOSAM2_INDEX" + + tag "modules" + tag "modules_nfcore" + tag "leviosam2" + tag "leviosam2/index" + tag "gunzip" + + test("index") { + setup { + run("GUNZIP") { + script "../../../gunzip/main.nf" + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_chain_gz'], checkIfExists: true) + ] + """ + } + + } + } + + when { + process { + """ + input[0] = [ + [ id:'test' ], + file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) + ] + input[1] = GUNZIP.out.gunzip.map{ meta, gunzip -> gunzip } + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("index - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['genome']['genome_fasta_fai'], checkIfExists: true) + ] + input[1] = file(params.test_data['homo_sapiens']['genome']['genome_chain_gz'], checkIfExists: true) + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/leviosam2/index/tests/main.nf.test.snap b/modules/nf-core/leviosam2/index/tests/main.nf.test.snap new file mode 100644 index 00000000000..d0e9f33ccc8 --- /dev/null +++ b/modules/nf-core/leviosam2/index/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "index - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.clft:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,36cf8d4dceb8156f779cd6352eba61dc" + ], + "clft": [ + [ + { + "id": "test" + }, + "test.clft:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,36cf8d4dceb8156f779cd6352eba61dc" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T11:21:32.906054" + }, + "index": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.clft:md5,f6ce975bfe33512114ac2cb8aefbffe2" + ] + ], + "1": [ + "versions.yml:md5,36cf8d4dceb8156f779cd6352eba61dc" + ], + "clft": [ + [ + { + "id": "test" + }, + "test.clft:md5,f6ce975bfe33512114ac2cb8aefbffe2" + ] + ], + "versions": [ + "versions.yml:md5,36cf8d4dceb8156f779cd6352eba61dc" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-20T11:20:40.461365" + } +} \ No newline at end of file diff --git a/modules/nf-core/leviosam2/index/tests/tags.yml b/modules/nf-core/leviosam2/index/tests/tags.yml new file mode 100644 index 00000000000..a1547a1d9dd --- /dev/null +++ b/modules/nf-core/leviosam2/index/tests/tags.yml @@ -0,0 +1,3 @@ +leviosam2/index: + - "modules/nf-core/leviosam2/index/**" + - "modules/nf-core/gunzip/**" From 7b29d1b22c0d7d4d5f03f3295d310e785fd3cb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kre=C5=A1imir=20Be=C5=A1tak?= <86408271+kbestak@users.noreply.github.com> Date: Wed, 20 Mar 2024 13:13:32 +0100 Subject: [PATCH 46/46] Added contrast limited adaptive histogram equalization module (#5268) * clahe_module * removed todos * Fixed linting, excluded conda tests. * Added conda test skip to workflows/test.yml. --------- Co-authored-by: Florian Wuennemann --- .github/workflows/test.yml | 2 + modules/nf-core/molkartgarage/clahe/main.nf | 49 +++++++++++++++ modules/nf-core/molkartgarage/clahe/meta.yml | 52 ++++++++++++++++ .../molkartgarage/clahe/tests/main.nf.test | 60 +++++++++++++++++++ .../clahe/tests/main.nf.test.snap | 14 +++++ .../molkartgarage/clahe/tests/nextflow.config | 7 +++ .../molkartgarage/clahe/tests/tags.yml | 2 + 7 files changed, 186 insertions(+) create mode 100644 modules/nf-core/molkartgarage/clahe/main.nf create mode 100644 modules/nf-core/molkartgarage/clahe/meta.yml create mode 100644 modules/nf-core/molkartgarage/clahe/tests/main.nf.test create mode 100644 modules/nf-core/molkartgarage/clahe/tests/main.nf.test.snap create mode 100644 modules/nf-core/molkartgarage/clahe/tests/nextflow.config create mode 100644 modules/nf-core/molkartgarage/clahe/tests/tags.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 544b2cf26b1..6bf82516a05 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -561,6 +561,8 @@ jobs: tags: merquryfk/merquryfk - profile: conda tags: merquryfk/ploidyplot + - profile: conda + tags: molkartgarage/clahe - profile: conda tags: quartonotebook - profile: conda diff --git a/modules/nf-core/molkartgarage/clahe/main.nf b/modules/nf-core/molkartgarage/clahe/main.nf new file mode 100644 index 00000000000..1d070aeebcf --- /dev/null +++ b/modules/nf-core/molkartgarage/clahe/main.nf @@ -0,0 +1,49 @@ +process MOLKARTGARAGE_CLAHE { + tag "$meta.id" + label 'process_medium' + + container "ghcr.io/schapirolabor/molkart-local:v0.1.1" + + input: + tuple val(meta), path(image) + + output: + tuple val(meta), path("*.tiff") , emit: img_clahe + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + // Exit if running this module with -profile conda / -profile mamba + if (workflow.profile.tokenize(',').intersect(['conda', 'mamba']).size() >= 1) { + error "Molkartgarage/clahe module does not support Conda. Please use Docker / Singularity / Podman instead." + } + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + python /local/scripts/molkart_clahe.py \ + --input ${image} \ + --output ${prefix}.tiff \ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + molkart_clahe: \$(python /local/scripts/molkart_clahe.py --version) + scikit-image: 0.19.2 + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.tiff + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + molkart_clahe: \$(python3 /local/scripts/molkart_clahe.py --version) + scikit-image: 0.19.2 + END_VERSIONS + """ +} diff --git a/modules/nf-core/molkartgarage/clahe/meta.yml b/modules/nf-core/molkartgarage/clahe/meta.yml new file mode 100644 index 00000000000..9ca71304aa3 --- /dev/null +++ b/modules/nf-core/molkartgarage/clahe/meta.yml @@ -0,0 +1,52 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "molkartgarage_clahe" +description: Contrast-limited adjusted histogram equalization (CLAHE) on single-channel tif images. +keywords: + - clahe + - image_processing + - imaging + - correction +tools: + - "molkartgarage": + description: "One-stop-shop for scripts and tools for processing data for molkart and spatial omics pipelines." + homepage: https://github.com/SchapiroLabor/molkart-local/tree/main + documentation: https://github.com/SchapiroLabor/molkart-local/tree/main + tool_dev_url: https://github.com/SchapiroLabor/molkart-local/blob/main/scripts/molkart_clahe.py + licence: ["MIT"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1']` + + - image: + type: file + description: Single-channel tiff file to be corrected. + pattern: "*.{tif,tiff}" + +output: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1']` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + + - img_clahe: + type: file + description: CLAHE corrected tiff file. + pattern: "*.{tiff}" + +authors: + - "@kbestak" +maintainers: + - "@kbestak" diff --git a/modules/nf-core/molkartgarage/clahe/tests/main.nf.test b/modules/nf-core/molkartgarage/clahe/tests/main.nf.test new file mode 100644 index 00000000000..15c67b7d7fa --- /dev/null +++ b/modules/nf-core/molkartgarage/clahe/tests/main.nf.test @@ -0,0 +1,60 @@ +// test with: nf-core modules test molkartgarage/clahe +nextflow_process { + + name "Test Process MOLKARTGARAGE_CLAHE" + script "../main.nf" + config "./nextflow.config" + process "MOLKARTGARAGE_CLAHE" + + tag "modules" + tag "modules_nfcore" + tag "molkartgarage" + tag "molkartgarage/clahe" + + test("clahe - tiff") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['imaging']['tiff']['mouse_heart_wga'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert process.out.img_clahe }, // uuid in metadata changes so md5sums are not the same + { assert snapshot(process.out.versions).match("versions") } + ) + } + + } + + test("clahe - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['imaging']['tiff']['mouse_heart_wga'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success } + ) + } + + } + +} diff --git a/modules/nf-core/molkartgarage/clahe/tests/main.nf.test.snap b/modules/nf-core/molkartgarage/clahe/tests/main.nf.test.snap new file mode 100644 index 00000000000..349a0e9bfa6 --- /dev/null +++ b/modules/nf-core/molkartgarage/clahe/tests/main.nf.test.snap @@ -0,0 +1,14 @@ +{ + "versions": { + "content": [ + [ + "versions.yml:md5,ddf084b777e987eb83271f02e4e4cf2b" + ] + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T13:20:00.607838647" + } +} \ No newline at end of file diff --git a/modules/nf-core/molkartgarage/clahe/tests/nextflow.config b/modules/nf-core/molkartgarage/clahe/tests/nextflow.config new file mode 100644 index 00000000000..72dd3fcceec --- /dev/null +++ b/modules/nf-core/molkartgarage/clahe/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: "MOLKARTGARAGE_CLAHE" { + ext.args = '--tile-size 368 --tile-size 48 --pixel-size 0.138 --cliplimit 0.01' + } + +} diff --git a/modules/nf-core/molkartgarage/clahe/tests/tags.yml b/modules/nf-core/molkartgarage/clahe/tests/tags.yml new file mode 100644 index 00000000000..b7bba012974 --- /dev/null +++ b/modules/nf-core/molkartgarage/clahe/tests/tags.yml @@ -0,0 +1,2 @@ +molkartgarage/clahe: + - "modules/nf-core/molkartgarage/clahe/**"