From 24dc2d21132b07b4c3d36c9836885427a5019b11 Mon Sep 17 00:00:00 2001 From: jvhagey Date: Mon, 2 May 2022 11:30:19 -0400 Subject: [PATCH] added tests --- modules/srst2/srst2/main.nf | 4 ++-- modules/srst2/srst2/meta.yml | 6 +++++- tests/modules/srst2/srst2/main.nf | 31 +++++++++++++++++++++++++++--- tests/modules/srst2/srst2/test.yml | 21 ++++++++++++++++++-- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/modules/srst2/srst2/main.nf b/modules/srst2/srst2/main.nf index 4ee9f6a6..e8a91716 100644 --- a/modules/srst2/srst2/main.nf +++ b/modules/srst2/srst2/main.nf @@ -11,8 +11,9 @@ process SRST2_SRST2 { tuple val(meta), path(fastq_s), path(db) output: - tuple val(meta), path("*_genes_*_results.txt") , emit: gene_results + tuple val(meta), path("*_genes_*_results.txt") , optional:true, emit: gene_results tuple val(meta), path("*_fullgenes_*_results.txt") , optional:true, emit: fullgene_results + tuple val(meta), path("*_mlst_*_results.txt") , optional:true, emit: mlst_results tuple val(meta), path("*.pileup") , emit: pileup tuple val(meta), path("*.sorted.bam") , emit: sorted_bam path "versions.yml" , emit: versions @@ -38,7 +39,6 @@ process SRST2_SRST2 { --output ${prefix} \\ ${database} \\ $args - cat <<-END_VERSIONS > versions.yml "${task.process}": srst2: \$(echo \$(srst2 --version 2>&1) | sed 's/srst2 //' )) diff --git a/modules/srst2/srst2/meta.yml b/modules/srst2/srst2/meta.yml index 3755fb34..94c763bb 100644 --- a/modules/srst2/srst2/meta.yml +++ b/modules/srst2/srst2/meta.yml @@ -49,12 +49,16 @@ output: pattern: "versions.yml" - txt: type: file - description: A detailed report, with one row per gene per sample described here: https://github.com/katholt/srst2#gene-typing + description: A detailed report, with one row per gene per sample described here github.com/katholt/srst2#gene-typing pattern: "*_fullgenes_*_results.txt" - txt: type: file description: A tabulated summary report of samples x genes. pattern: "*_genes_*_results.txt" + - txt: + type: file + description: A tabulated summary report of mlst subtyping. + pattern: "*_mlst_*_results.txt" - bam: type: file description: Sorted BAM file diff --git a/tests/modules/srst2/srst2/main.nf b/tests/modules/srst2/srst2/main.nf index 235f3ff9..7d51937b 100644 --- a/tests/modules/srst2/srst2/main.nf +++ b/tests/modules/srst2/srst2/main.nf @@ -4,9 +4,34 @@ nextflow.enable.dsl = 2 include { SRST2_SRST2 } from '../../../../modules/srst2/srst2/main.nf' +workflow test_srst2_srst2_exit { + + input = [ + [ id:'test', single_end:false, db:"test"], // meta map + [ file(params.test_data['bacteroides_fragilis']['illumina']['test1_1_fastq_gz'], checkIfExists: true), + file(params.test_data['bacteroides_fragilis']['illumina']['test1_2_fastq_gz'], checkIfExists: true) ], +// [("")] + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/srst2/resFinder_20180221_srst2.fasta') + ] + + SRST2_SRST2(input) +} + +workflow test_srst2_srst2_mlst { + + input = [ + [ id:'test', single_end:false, db:"mlst"], // meta map + [ file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/srst2/SRR9067271_1.fastq.gz", checkIfExists: true), + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/srst2/SRR9067271_2.fastq.gz", checkIfExists: true) ], + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/srst2/MLST_DB.fas') + ] + + SRST2_SRST2(input) +} + workflow test_srst2_srst2_paired_end { - input = [ + input = [ [ id:'test', single_end:false, db:"gene"], // meta map [ file(params.test_data['bacteroides_fragilis']['illumina']['test1_1_fastq_gz'], checkIfExists: true), file(params.test_data['bacteroides_fragilis']['illumina']['test1_2_fastq_gz'], checkIfExists: true) ], @@ -18,11 +43,11 @@ workflow test_srst2_srst2_paired_end { workflow test_srst2_srst2_single_end { - input = [ + input = [ [ id:'test', single_end:true, db:"gene" ], // meta map file(params.test_data['bacteroides_fragilis']['illumina']['test1_1_fastq_gz'], checkIfExists: true), file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/delete_me/srst2/resFinder_20180221_srst2.fasta') // Change to params.test_data syntax after the data is included in tests/config/test_data.config ] SRST2_SRST2(input) -} \ No newline at end of file +} diff --git a/tests/modules/srst2/srst2/test.yml b/tests/modules/srst2/srst2/test.yml index f011b4d1..102c78a4 100644 --- a/tests/modules/srst2/srst2/test.yml +++ b/tests/modules/srst2/srst2/test.yml @@ -1,8 +1,22 @@ +- name: srst2 srst2 test_srst2_srst2_mlst + command: nextflow run tests/modules/srst2/srst2 -entry test_srst2_srst2_mlst -c tests/config/nextflow.config + tags: + - srst2/srst2 + - srst2 + files: + - path: output/srst2/test__SRR9067271.MLST_DB.pileup + md5sum: f59217dd9340264b9913c20b545b2ce7 + - path: output/srst2/test__SRR9067271.MLST_DB.sorted.bam + - path: output/srst2/test__mlst__MLST_DB__results.txt + md5sum: ec1b1f69933401d67c57f64cad11a098 + - path: output/srst2/versions.yml + md5sum: a0c256a2fd3636069710b8ef22ee5ea7 + - name: srst2 srst2 test_srst2_srst2_paired_end command: nextflow run tests/modules/srst2/srst2 -entry test_srst2_srst2_paired_end -c tests/config/nextflow.config tags: - - srst2 - srst2/srst2 + - srst2 files: - path: output/srst2/test__genes__resFinder_20180221_srst2__results.txt md5sum: 099aa6cacec5524b311f606debdfb3a9 @@ -15,8 +29,8 @@ - name: srst2 srst2 test_srst2_srst2_single_end command: nextflow run tests/modules/srst2/srst2 -entry test_srst2_srst2_single_end -c tests/config/nextflow.config tags: - - srst2 - srst2/srst2 + - srst2 files: - path: output/srst2/test__fullgenes__resFinder_20180221_srst2__results.txt md5sum: d0762ef8c38afd0e0a34cce52ed1a3db @@ -27,3 +41,6 @@ - path: output/srst2/test__test1_1.resFinder_20180221_srst2.sorted.bam - path: output/srst2/versions.yml md5sum: 790fe00493c6634d17801a930073218b + +- name: srst2 srst2 test_srst2_srst2_exit #Testing pipeline exit when not meta.db + exit_code: 1