From 67e592bde6e8ff6696791517c27f2408ebd84a75 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Thu, 30 Oct 2025 09:55:52 +0100 Subject: [PATCH 1/3] Bulk update of nf-core modules --- modules.json | 27 +- modules/nf-core/bowtie2/align/environment.yml | 14 +- modules/nf-core/bowtie2/align/main.nf | 33 +- modules/nf-core/bowtie2/align/meta.yml | 140 +- .../bowtie2/align/tests/cram_crai.config | 5 + .../nf-core/bowtie2/align/tests/main.nf.test | 220 ++- .../bowtie2/align/tests/main.nf.test.snap | 238 +-- modules/nf-core/bowtie2/align/tests/tags.yml | 2 - modules/nf-core/bwa/mem/environment.yml | 13 +- modules/nf-core/bwa/mem/main.nf | 6 +- modules/nf-core/bwa/mem/meta.yml | 128 +- modules/nf-core/bwa/mem/tests/main.nf.test | 174 +-- .../nf-core/bwa/mem/tests/main.nf.test.snap | 332 ++-- modules/nf-core/bwa/mem/tests/tags.yml | 3 - modules/nf-core/bwamem2/mem/environment.yml | 13 +- modules/nf-core/bwamem2/mem/main.nf | 40 +- modules/nf-core/bwamem2/mem/meta.yml | 136 +- .../nf-core/bwamem2/mem/tests/main.nf.test | 122 +- .../bwamem2/mem/tests/main.nf.test.snap | 126 +- modules/nf-core/bwamem2/mem/tests/tags.yml | 2 - modules/nf-core/dragmap/align/environment.yml | 12 +- modules/nf-core/dragmap/align/main.nf | 64 +- modules/nf-core/dragmap/align/meta.yml | 135 +- .../nf-core/dragmap/align/tests/main.nf.test | 64 +- .../dragmap/align/tests/main.nf.test.snap | 199 ++- modules/nf-core/dragmap/align/tests/tags.yml | 2 - modules/nf-core/fastp/environment.yml | 7 +- modules/nf-core/fastp/main.nf | 36 +- modules/nf-core/fastp/meta.yml | 150 +- modules/nf-core/fastp/tests/main.nf.test | 886 +++++------ modules/nf-core/fastp/tests/main.nf.test.snap | 1330 ++++++++++++++--- .../fastp/tests/nextflow.interleaved.config | 5 + ...low.config => nextflow.save_failed.config} | 3 +- modules/nf-core/fastp/tests/tags.yml | 2 - modules/nf-core/fastqc/environment.yml | 4 +- modules/nf-core/fastqc/main.nf | 27 +- modules/nf-core/fastqc/meta.yml | 69 +- modules/nf-core/fastqc/tests/main.nf.test | 225 ++- .../nf-core/fastqc/tests/main.nf.test.snap | 370 ++++- modules/nf-core/fastqc/tests/tags.yml | 2 - modules/nf-core/samtools/view/environment.yml | 10 +- modules/nf-core/samtools/view/main.nf | 77 +- modules/nf-core/samtools/view/meta.yml | 182 ++- .../samtools/view/tests/cram_index.config | 3 + .../nf-core/samtools/view/tests/main.nf.test | 251 ++++ .../samtools/view/tests/main.nf.test.snap | 726 +++++++-- modules/nf-core/samtools/view/tests/tags.yml | 2 - .../nf-core/snapaligner/align/environment.yml | 7 +- modules/nf-core/snapaligner/align/main.nf | 15 +- modules/nf-core/snapaligner/align/meta.yml | 94 +- .../snapaligner/align/tests/main.nf.test | 139 ++ .../snapaligner/align/tests/main.nf.test.snap | 161 ++ .../snapaligner/align/tests/nextflow.config | 5 + modules/nf-core/strobealign/environment.yml | 9 + modules/nf-core/strobealign/main.nf | 110 ++ modules/nf-core/strobealign/meta.yml | 142 ++ .../nf-core/strobealign/tests/main.nf.test | 303 ++++ .../strobealign/tests/main.nf.test.snap | 274 ++++ .../nf-core/strobealign/tests/nextflow.config | 6 + .../fastq_align_bwa/tests/main.nf.test | 12 +- .../fastq_align_bwa/tests/main.nf.test.snap | 92 +- .../nf-core/fastq_align_bwa/tests/tags.yml | 2 - subworkflows/nf-core/fastq_align_dna/main.nf | 50 +- subworkflows/nf-core/fastq_align_dna/meta.yml | 3 + .../fastq_align_dna/tests/main.nf.test | 141 +- .../fastq_align_dna/tests/main.nf.test.snap | 292 ++-- .../fastq_align_dna/tests/nextflow.config | 12 - .../nf-core/fastq_align_dna/tests/tags.yml | 2 - .../nf-core/fastq_trim_fastp_fastqc/main.nf | 31 +- .../nf-core/fastq_trim_fastp_fastqc/meta.yml | 8 +- .../tests/main.nf.test | 241 +++ .../tests/main.nf.test.snap | 521 +++++++ 72 files changed, 7010 insertions(+), 2279 deletions(-) create mode 100644 modules/nf-core/bowtie2/align/tests/cram_crai.config delete mode 100644 modules/nf-core/bowtie2/align/tests/tags.yml delete mode 100644 modules/nf-core/bwa/mem/tests/tags.yml delete mode 100644 modules/nf-core/bwamem2/mem/tests/tags.yml delete mode 100644 modules/nf-core/dragmap/align/tests/tags.yml create mode 100644 modules/nf-core/fastp/tests/nextflow.interleaved.config rename modules/nf-core/fastp/tests/{nextflow.config => nextflow.save_failed.config} (50%) delete mode 100644 modules/nf-core/fastp/tests/tags.yml delete mode 100644 modules/nf-core/fastqc/tests/tags.yml create mode 100644 modules/nf-core/samtools/view/tests/cram_index.config delete mode 100644 modules/nf-core/samtools/view/tests/tags.yml create mode 100644 modules/nf-core/snapaligner/align/tests/main.nf.test create mode 100644 modules/nf-core/snapaligner/align/tests/main.nf.test.snap create mode 100644 modules/nf-core/snapaligner/align/tests/nextflow.config create mode 100644 modules/nf-core/strobealign/environment.yml create mode 100644 modules/nf-core/strobealign/main.nf create mode 100644 modules/nf-core/strobealign/meta.yml create mode 100644 modules/nf-core/strobealign/tests/main.nf.test create mode 100644 modules/nf-core/strobealign/tests/main.nf.test.snap create mode 100644 modules/nf-core/strobealign/tests/nextflow.config delete mode 100644 subworkflows/nf-core/fastq_align_bwa/tests/tags.yml delete mode 100644 subworkflows/nf-core/fastq_align_dna/tests/nextflow.config delete mode 100644 subworkflows/nf-core/fastq_align_dna/tests/tags.yml create mode 100644 subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test create mode 100644 subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test.snap diff --git a/modules.json b/modules.json index 86d3ca49..413758a7 100644 --- a/modules.json +++ b/modules.json @@ -7,7 +7,7 @@ "nf-core": { "bowtie2/align": { "branch": "master", - "git_sha": "3c77ca9aac783e76c3614a06db3bfe4fef619bde", + "git_sha": "ecf739de71e6abe5690616b48a9cba924170e8f6", "installed_by": ["fastq_align_dna"] }, "bowtie2/build": { @@ -22,7 +22,7 @@ }, "bwa/mem": { "branch": "master", - "git_sha": "b97197968ac12dde2463fa54541f6350c46f2035", + "git_sha": "1c46359c837ef768b004519f535c30378e8289fc", "installed_by": ["fastq_align_bwa", "fastq_align_dna", "modules"] }, "bwamem2/index": { @@ -32,7 +32,7 @@ }, "bwamem2/mem": { "branch": "master", - "git_sha": "74363e1acc38eaedeede8d429477397c1a6f9e18", + "git_sha": "d86336f3e7ae0d5f76c67b0859409769cfeb2af2", "installed_by": ["fastq_align_dna", "modules"] }, "custom/dumpsoftwareversions": { @@ -42,7 +42,7 @@ }, "dragmap/align": { "branch": "master", - "git_sha": "9a7efcec9b21baf1c67342faa6b8d905c972207f", + "git_sha": "41dfa3f7c0ffabb96a6a813fe321c6d1cc5b6e46", "installed_by": ["fastq_align_dna"] }, "dragmap/hashtable": { @@ -52,12 +52,12 @@ }, "fastp": { "branch": "master", - "git_sha": "003920c7f9a8ae19b69a97171922880220bedf56", + "git_sha": "d9ec4ef289ad39b8a662a7a12be50409b11df84b", "installed_by": ["fastq_trim_fastp_fastqc", "modules"] }, "fastqc": { "branch": "master", - "git_sha": "f4ae1d942bd50c5c0b9bd2de1393ce38315ba57c", + "git_sha": "41dfa3f7c0ffabb96a6a813fe321c6d1cc5b6e46", "installed_by": ["fastq_trim_fastp_fastqc", "modules"] }, "hmmcopy/readcounter": { @@ -122,12 +122,12 @@ }, "samtools/view": { "branch": "master", - "git_sha": "0bd7d2333a88483aa0476acea172e9f5f6dd83bb", + "git_sha": "c8be52dba1166c678e74cda9c3a3c221635c8bb1", "installed_by": ["modules"] }, "snapaligner/align": { "branch": "master", - "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", + "git_sha": "9a2df1234c202637503b0a3626ad5d118fa6a7ef", "installed_by": ["fastq_align_dna"] }, "snapaligner/index": { @@ -135,6 +135,11 @@ "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", "installed_by": ["fasta_index_dna"] }, + "strobealign": { + "branch": "master", + "git_sha": "c698799db60819ff8769000e429defad1cb432af", + "installed_by": ["fastq_align_dna"] + }, "wisecondorx/convert": { "branch": "master", "git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5", @@ -181,17 +186,17 @@ }, "fastq_align_bwa": { "branch": "master", - "git_sha": "b97197968ac12dde2463fa54541f6350c46f2035", + "git_sha": "1c46359c837ef768b004519f535c30378e8289fc", "installed_by": ["subworkflows"] }, "fastq_align_dna": { "branch": "master", - "git_sha": "b97197968ac12dde2463fa54541f6350c46f2035", + "git_sha": "070ddae7fb59384d3d85bf69eb9a1d71ab33ada9", "installed_by": ["subworkflows"] }, "fastq_trim_fastp_fastqc": { "branch": "master", - "git_sha": "cfd937a668919d948f6fcbf4218e79de50c2f36f", + "git_sha": "d9ec4ef289ad39b8a662a7a12be50409b11df84b", "installed_by": ["subworkflows"] }, "utils_nextflow_pipeline": { diff --git a/modules/nf-core/bowtie2/align/environment.yml b/modules/nf-core/bowtie2/align/environment.yml index d2796359..066ff52e 100644 --- a/modules/nf-core/bowtie2/align/environment.yml +++ b/modules/nf-core/bowtie2/align/environment.yml @@ -1,9 +1,13 @@ -name: bowtie2_align +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda - - defaults dependencies: - - bioconda::bowtie2=2.5.2 - - bioconda::samtools=1.18 - - conda-forge::pigz=2.6 + # renovate: datasource=conda depName=bioconda/bowtie2 + - bioconda::bowtie2=2.5.4 + # renovate: datasource=conda depName=bioconda/htslib + - bioconda::htslib=1.21 + # renovate: datasource=conda depName=bioconda/samtools + - bioconda::samtools=1.21 + - conda-forge::pigz=2.8 diff --git a/modules/nf-core/bowtie2/align/main.nf b/modules/nf-core/bowtie2/align/main.nf index 8c405ee3..631d0bf7 100644 --- a/modules/nf-core/bowtie2/align/main.nf +++ b/modules/nf-core/bowtie2/align/main.nf @@ -1,22 +1,27 @@ process BOWTIE2_ALIGN { tag "$meta.id" - label "process_high" + label 'process_high' conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-ac74a7f02cebcfcc07d8e8d1d750af9c83b4d45a:f70b31a2db15c023d641c32f433fb02cd04df5a6-0' : - 'biocontainers/mulled-v2-ac74a7f02cebcfcc07d8e8d1d750af9c83b4d45a:f70b31a2db15c023d641c32f433fb02cd04df5a6-0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/b4/b41b403e81883126c3227fc45840015538e8e2212f13abc9ae84e4b98891d51c/data' : + 'community.wave.seqera.io/library/bowtie2_htslib_samtools_pigz:edeb13799090a2a6' }" 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\$//"` @@ -52,8 +60,8 @@ process BOWTIE2_ALIGN { --threads $task.cpus \\ $unaligned \\ $args \\ - 2> >(tee ${prefix}.bowtie2.log >&2) \\ - | samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.${extension} - + 2>| >(tee ${prefix}.bowtie2.log >&2) \\ + | 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,18 @@ process BOWTIE2_ALIGN { } else { create_unmapped = save_unaligned ? "touch ${prefix}.unmapped_1.fastq.gz && touch ${prefix}.unmapped_2.fastq.gz" : "" } + 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/meta.yml b/modules/nf-core/bowtie2/align/meta.yml index e66811d0..0c12b28a 100644 --- a/modules/nf-core/bowtie2/align/meta.yml +++ b/modules/nf-core/bowtie2/align/meta.yml @@ -14,28 +14,41 @@ tools: sequencing reads to long reference sequences. homepage: http://bowtie-bio.sourceforge.net/bowtie2/index.shtml documentation: http://bowtie-bio.sourceforge.net/bowtie2/manual.shtml - doi: 10.1038/nmeth.1923 + doi: 10.1186/gb-2009-10-3-r25 licence: ["GPL-3.0-or-later"] + identifier: "" input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - reads: - type: file - description: | - List of input FastQ files of size 1 and 2 for single-end and paired-end data, - respectively. - - meta2: - type: map - description: | - Groovy Map containing reference information - e.g. [ id:'test', single_end:false ] - - index: - type: file - description: Bowtie2 genome index files - pattern: "*.ebwt" + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + ontologies: [] + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test', single_end:false ] + - index: + type: file + description: Bowtie2 genome index files + pattern: "*.ebwt" + ontologies: [] + - - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Bowtie2 genome fasta file + pattern: "*.fasta" + ontologies: [] - save_unaligned: type: boolean description: | @@ -46,22 +59,77 @@ input: description: use samtools sort (true) or samtools view (false) pattern: "true or false" output: - - aligned: - type: file - description: Output BAM/SAM file containing read alignments - pattern: "*.{bam,sam}" - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" - - fastq: - type: file - description: Unaligned FastQ files - pattern: "*.fastq.gz" - - log: - type: file - description: Aligment log - pattern: "*.log" + sam: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.sam": + type: file + description: Output SAM file containing read alignments + pattern: "*.sam" + ontologies: [] + bam: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.bam": + type: file + description: Output BAM file containing read alignments + pattern: "*.bam" + ontologies: [] + cram: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.cram": + type: file + description: Output CRAM file containing read alignments + pattern: "*.cram" + ontologies: [] + csi: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.csi": + type: file + description: Output SAM/BAM index for large inputs + pattern: "*.csi" + ontologies: [] + crai: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.crai": + type: file + description: Output CRAM index + pattern: "*.crai" + ontologies: [] + log: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.log": + type: file + description: Alignment log + pattern: "*.log" + ontologies: [] + fastq: + - - meta: + type: map + description: Groovy Map containing sample information + - "*fastq.gz": + type: file + description: Unaligned FastQ files + pattern: "*.fastq.gz" + ontologies: + - edam: http://edamontology.org/format_3989 # GZIP format + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@joseespinosa" - "@drpatelh" 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 00000000..03f1d5e5 --- /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 a478d17b..0de5950f 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") { @@ -17,7 +18,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -29,11 +30,12 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/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.modules_testdata_base_path + 'genomics/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 { @@ -62,7 +64,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -74,11 +76,12 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/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.modules_testdata_base_path + 'genomics/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 { @@ -107,7 +110,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -119,11 +122,12 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/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.modules_testdata_base_path + 'genomics/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") { @@ -151,7 +155,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -163,11 +167,12 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/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.modules_testdata_base_path + 'genomics/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") { @@ -195,7 +200,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -208,13 +213,14 @@ nextflow_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) + 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] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.modules_testdata_base_path + 'genomics/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") { @@ -242,7 +248,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -255,13 +261,14 @@ nextflow_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) + 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] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = true //sort + input[2] = [[ id:'test'], file(params.modules_testdata_base_path + 'genomics/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 { @@ -290,7 +297,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -302,11 +309,12 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/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.modules_testdata_base_path + 'genomics/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 { @@ -335,7 +343,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -348,13 +356,14 @@ nextflow_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) + 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] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.modules_testdata_base_path + 'genomics/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") { @@ -382,7 +391,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -395,13 +404,14 @@ nextflow_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) + 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] = BOWTIE2_BUILD.out.index - input[2] = true //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.modules_testdata_base_path + 'genomics/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") { @@ -429,7 +439,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -441,11 +451,12 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/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.modules_testdata_base_path + 'genomics/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.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + } + + when { + process { + """ + input[0] = [ + [ 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] = BOWTIE2_BUILD.out.index + input[2] = [[ id:'test'], file(params.modules_testdata_base_path + 'genomics/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 { @@ -475,7 +533,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -488,13 +546,14 @@ nextflow_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) + 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] = BOWTIE2_BUILD.out.index - input[2] = false //save_unaligned - input[3] = false //sort + input[2] = [[ id:'test'], file(params.modules_testdata_base_path + 'genomics/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 { @@ -523,7 +583,7 @@ nextflow_process { """ input[0] = [ [ id:'test'], - file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) ] """ } @@ -535,11 +595,12 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:true ], // meta map - file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/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.modules_testdata_base_path + 'genomics/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 883dc7ec..4ffd62e9 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 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,25 @@ process BWAMEM2_MEM { """ stub: + + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + 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" + 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 04891b26..6c7d1728 100644 --- a/modules/nf-core/bwamem2/mem/meta.yml +++ b/modules/nf-core/bwamem2/mem/meta.yml @@ -17,45 +17,117 @@ tools: documentation: http://www.htslib.org/doc/samtools.html arxiv: arXiv:1303.3997 licence: ["MIT"] + identifier: "biotools:bwa-mem2" input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - reads: - type: file - description: | - List of input FastQ files of size 1 and 2 for single-end and paired-end data, - respectively. - - meta2: - type: map - description: | - Groovy Map containing reference/index information - e.g. [ id:'test' ] - - index: - type: file - description: BWA genome index files - pattern: "Directory containing BWA index *.{0132,amb,ann,bwt.2bit.64,pac}" + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + ontologies: + - edam: "http://edamontology.org/data_2044" # Sequence + - edam: "http://edamontology.org/format_1930" # FASTQ + - - meta2: + type: map + description: | + Groovy Map containing reference/index information + e.g. [ id:'test' ] + - index: + type: file + description: BWA genome index files + pattern: "Directory containing BWA index *.{0132,amb,ann,bwt.2bit.64,pac}" + ontologies: + - edam: "http://edamontology.org/data_3210" # Genome index + - - 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}" + ontologies: + - edam: "http://edamontology.org/data_2044" # Sequence + - edam: "http://edamontology.org/format_1929" # FASTA - sort_bam: type: boolean description: use samtools sort (true) or samtools view (false) pattern: "true or false" output: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - bam: - type: file - description: Output BAM file containing read alignments - pattern: "*.{bam}" - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" + sam: + - - meta: + type: map + 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}" + ontologies: + - edam: "http://edamontology.org/format_2573" # SAM + bam: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.bam": + type: file + description: Output BAM file containing read alignments + pattern: "*.{bam}" + ontologies: + - edam: "http://edamontology.org/format_2572" # BAM + cram: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.cram": + type: file + description: Output CRAM file containing read alignments + pattern: "*.{cram}" + ontologies: + - edam: "http://edamontology.org/format_3462" # CRAM + crai: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.crai": + type: file + description: Index file for CRAM file + pattern: "*.{crai}" + ontologies: [] + csi: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.csi": + type: file + description: Index file for BAM file + pattern: "*.{csi}" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML 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 365a0c43..9e0ab14a 100644 --- a/modules/nf-core/bwamem2/mem/tests/main.nf.test +++ b/modules/nf-core/bwamem2/mem/tests/main.nf.test @@ -10,21 +10,21 @@ nextflow_process { tag "bwamem2/mem" tag "bwamem2/index" - test("sarscov2 - fastq, index, false") { - - setup { - run("BWAMEM2_INDEX") { - script "../../index/main.nf" - process { - """ - input[0] = Channel.of([ - [:], // meta map - [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] - ]) - """ - } + setup { + run("BWAMEM2_INDEX") { + script "../../index/main.nf" + process { + """ + input[0] = Channel.of([ + [:], // meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + ]) + """ } } + } + + test("sarscov2 - fastq, index, fasta, false") { when { process { @@ -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 """ } } @@ -43,7 +44,8 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.bam[0][1]).name, + bam(process.out.bam[0][1]).getHeaderMD5(), + bam(process.out.bam[0][1]).getReadsMD5(), process.out.versions ).match() } ) @@ -51,21 +53,7 @@ nextflow_process { } - test("sarscov2 - fastq, index, true") { - - setup { - run("BWAMEM2_INDEX") { - script "../../index/main.nf" - process { - """ - input[0] = Channel.of([ - [:], // meta map - [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] - ]) - """ - } - } - } + test("sarscov2 - fastq, index, fasta, true") { when { process { @@ -75,7 +63,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 """ } } @@ -84,7 +73,8 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.bam[0][1]).name, + bam(process.out.bam[0][1]).getHeaderMD5(), + bam(process.out.bam[0][1]).getReadsMD5(), process.out.versions ).match() } ) @@ -92,21 +82,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, false") { - - setup { - run("BWAMEM2_INDEX") { - script "../../index/main.nf" - process { - """ - input[0] = Channel.of([ - [:], // meta map - [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] - ]) - """ - } - } - } + test("sarscov2 - [fastq1, fastq2], index, fasta, false") { when { process { @@ -119,7 +95,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 """ } } @@ -128,7 +105,8 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.bam[0][1]).name, + bam(process.out.bam[0][1]).getHeaderMD5(), + bam(process.out.bam[0][1]).getReadsMD5(), process.out.versions ).match() } ) @@ -136,21 +114,7 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, true") { - - setup { - run("BWAMEM2_INDEX") { - script "../../index/main.nf" - process { - """ - input[0] = Channel.of([ - [:], // meta map - [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] - ]) - """ - } - } - } + test("sarscov2 - [fastq1, fastq2], index, fasta, true") { when { process { @@ -163,7 +127,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 """ } } @@ -172,7 +137,8 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot( - file(process.out.bam[0][1]).name, + bam(process.out.bam[0][1]).getHeaderMD5(), + bam(process.out.bam[0][1]).getReadsMD5(), process.out.versions ).match() } ) @@ -180,24 +146,10 @@ nextflow_process { } - test("sarscov2 - [fastq1, fastq2], index, true - stub") { + test("sarscov2 - [fastq1, fastq2], index, fasta, true - stub") { options "-stub" - setup { - run("BWAMEM2_INDEX") { - script "../../index/main.nf" - process { - """ - input[0] = Channel.of([ - [:], // meta map - [file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] - ]) - """ - } - } - } - when { process { """ @@ -209,7 +161,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 """ } } @@ -217,10 +170,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot( - file(process.out.bam[0][1]).name, - process.out.versions - ).match() } + { assert snapshot(process.out).match() } ) } 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 84be71c6..b7d40a68 100644 --- a/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap +++ b/modules/nf-core/bwamem2/mem/tests/main.nf.test.snap @@ -1,67 +1,129 @@ { - "sarscov2 - [fastq1, fastq2], index, true": { + "sarscov2 - [fastq1, fastq2], index, fasta, false": { "content": [ - "test.bam", + "e414c2d48e2e44c2c52c20ecd88e8bd8", + "57aeef88ed701a8ebc8e2f0a381b2a6", [ - "versions.yml:md5,1c1a9566f189ec077b5179bbf453c51a" + "versions.yml:md5,3574188ab1f33fd99cff9f5562dfb885" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-02-19T13:30:22.691288603" + "timestamp": "2025-09-23T11:44:52.73673293" }, - "sarscov2 - [fastq1, fastq2], index, false": { + "sarscov2 - [fastq1, fastq2], index, fasta, true - stub": { "content": [ - "test.bam", - [ - "versions.yml:md5,1c1a9566f189ec077b5179bbf453c51a" - ] + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + "versions.yml:md5,3574188ab1f33fd99cff9f5562dfb885" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "sam": [ + + ], + "versions": [ + "versions.yml:md5,3574188ab1f33fd99cff9f5562dfb885" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-02-19T13:30:11.276168706" + "timestamp": "2025-09-23T11:45:14.834888709" }, - "sarscov2 - [fastq1, fastq2], index, true - stub": { + "sarscov2 - [fastq1, fastq2], index, fasta, true": { "content": [ - "test.bam", + "716ed1ef39deaad346ca7cf86e08f959", + "af8628d9df18b2d3d4f6fd47ef2bb872", [ - "versions.yml:md5,1c1a9566f189ec077b5179bbf453c51a" + "versions.yml:md5,3574188ab1f33fd99cff9f5562dfb885" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-02-19T13:30:32.07431961" + "timestamp": "2025-09-23T11:45:04.750057645" }, - "sarscov2 - fastq, index, false": { + "sarscov2 - fastq, index, fasta, false": { "content": [ - "test.bam", + "283a83f604f3f5338acedfee349dccf4", + "798439cbd7fd81cbcc5078022dc5479d", [ - "versions.yml:md5,1c1a9566f189ec077b5179bbf453c51a" + "versions.yml:md5,3574188ab1f33fd99cff9f5562dfb885" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-02-19T13:29:48.586760544" + "timestamp": "2025-09-23T11:44:28.57550711" }, - "sarscov2 - fastq, index, true": { + "sarscov2 - fastq, index, fasta, true": { "content": [ - "test.bam", + "ed99048bb552cac58e39923b550b6d5b", + "94fcf617f5b994584c4e8d4044e16b4f", [ - "versions.yml:md5,1c1a9566f189ec077b5179bbf453c51a" + "versions.yml:md5,3574188ab1f33fd99cff9f5562dfb885" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-02-19T13:29:59.846686393" + "timestamp": "2025-09-23T11:44:40.437183765" } } \ No newline at end of file diff --git a/modules/nf-core/bwamem2/mem/tests/tags.yml b/modules/nf-core/bwamem2/mem/tests/tags.yml deleted file mode 100644 index 134efb2b..00000000 --- a/modules/nf-core/bwamem2/mem/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -bwamem2/mem: - - "modules/nf-core/bwamem2/mem/**" diff --git a/modules/nf-core/dragmap/align/environment.yml b/modules/nf-core/dragmap/align/environment.yml index ccccf9c9..198f3fa7 100644 --- a/modules/nf-core/dragmap/align/environment.yml +++ b/modules/nf-core/dragmap/align/environment.yml @@ -1,10 +1,10 @@ -name: dragmap_align +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda - - defaults dependencies: - - dragmap=1.3.0 - # renovate: datasource=conda depName=bioconda/samtools - - samtools=1.18 - - pigz=2.8 + # WARN: Do not update this tool to 1.3.0 until https://github.com/Illumina/DRAGMAP/issues/47 is resolved + - bioconda::dragmap=1.2.1 + - bioconda::samtools=1.19.2 + - conda-forge::pigz=2.3.4 diff --git a/modules/nf-core/dragmap/align/main.nf b/modules/nf-core/dragmap/align/main.nf index 6945cf62..62e2b4a1 100644 --- a/modules/nf-core/dragmap/align/main.nf +++ b/modules/nf-core/dragmap/align/main.nf @@ -1,21 +1,27 @@ process DRAGMAP_ALIGN { - tag "$meta.id" + 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/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:7eed251370ac7f3537c3d9472cdb2f9f5d8da1c5-0': - 'biocontainers/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:7eed251370ac7f3537c3d9472cdb2f9f5d8da1c5-0' }" + // WARN: Do not update this tool to 1.3.0 until https://github.com/Illumina/DRAGMAP/issues/47 is resolved + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:df80ed8d23d0a2c43181a2b3dd1b39f2d00fab5c-0' + : 'biocontainers/mulled-v2-580d344d9d4a496cd403932da8765f9e0187774d:df80ed8d23d0a2c43181a2b3dd1b39f2d00fab5c-0'}" input: - tuple val(meta) , path(reads) + tuple val(meta), path(reads) tuple val(meta2), path(hashmap) - val sort_bam + tuple val(meta3), path(fasta) + val sort_bam output: - tuple val(meta), path("*.bam"), emit: bam - tuple val(meta), path('*.log'), emit: log - 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 + tuple val(meta), path('*.log'), emit: log + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when @@ -24,17 +30,24 @@ process DRAGMAP_ALIGN { def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def reads_command = meta.single_end ? "-1 $reads" : "-1 ${reads[0]} -2 ${reads[1]}" + def reads_command = meta.single_end ? "-1 ${reads}" : "-1 ${reads[0]} -2 ${reads[1]}" 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") + } """ dragen-os \\ - -r $hashmap \\ - $args \\ - --num-threads $task.cpus \\ - $reads_command \\ - 2> >(tee ${prefix}.dragmap.log >&2) \\ - | samtools $samtools_command $args2 --threads $task.cpus -o ${prefix}.bam - + -r ${hashmap} \\ + ${args} \\ + --num-threads ${task.cpus} \\ + ${reads_command} \\ + 2>| >(tee ${prefix}.dragmap.log >&2) \\ + | samtools ${samtools_command} ${args2} --threads ${task.cpus} ${reference} -o ${prefix}.${extension} - cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -45,9 +58,26 @@ process DRAGMAP_ALIGN { """ stub: + def args2 = task.ext.args2 ?: '' def prefix = task.ext.prefix ?: "${meta.id}" + 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" + 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} touch ${prefix}.log cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/dragmap/align/meta.yml b/modules/nf-core/dragmap/align/meta.yml index 8a7f84db..ba3ab484 100644 --- a/modules/nf-core/dragmap/align/meta.yml +++ b/modules/nf-core/dragmap/align/meta.yml @@ -13,35 +13,116 @@ tools: documentation: https://github.com/Illumina/dragmap tool_dev_url: https://github.com/Illumina/dragmap#basic-command-line-usage licence: ["GPL v3"] + identifier: "" input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - reads: - type: file - description: | - List of input FastQ files of size 1 and 2 for single-end and paired-end data, - respectively. - - meta2: - type: map - description: | - Groovy Map containing reference information - e.g. [ id:'test', single_end:false ] - - hashmap: - type: file - description: DRAGMAP hash table - pattern: "Directory containing DRAGMAP hash table *.{cmp,.bin,.txt}" + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + ontologies: [] + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test', single_end:false ] + - hashmap: + type: file + description: DRAGMAP hash table + pattern: "Directory containing DRAGMAP hash table *.{cmp,.bin,.txt}" + ontologies: [] + - - meta3: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'genome'] + - fasta: + type: file + description: Genome fasta reference files + pattern: "*.{fa,fasta,fna}" + ontologies: [] + - sort_bam: + type: boolean + description: Sort the BAM file output: - - bam: - type: file - description: Output BAM file containing read alignments - pattern: "*.{bam}" - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" + sam: + - - meta: + type: map + 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}" + ontologies: [] + bam: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.bam": + type: file + description: Output BAM file containing read alignments + pattern: "*.{bam}" + ontologies: [] + cram: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.cram": + type: file + description: Output CRAM file containing read alignments + pattern: "*.{cram}" + ontologies: [] + crai: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.crai": + type: file + description: Index file for CRAM file + pattern: "*.{crai}" + ontologies: [] + csi: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.csi": + type: file + description: Index file for CRAM file + pattern: "*.{csi}" + ontologies: [] + log: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.log": + type: file + description: Log file + pattern: "*.{log}" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@edmundmiller" maintainers: diff --git a/modules/nf-core/dragmap/align/tests/main.nf.test b/modules/nf-core/dragmap/align/tests/main.nf.test index ab6a8d1d..5abe76f6 100644 --- a/modules/nf-core/dragmap/align/tests/main.nf.test +++ b/modules/nf-core/dragmap/align/tests/main.nf.test @@ -9,7 +9,7 @@ nextflow_process { tag "dragmap/align" tag "dragmap/hashtable" - test("sarscov2 - fastq, hashtable, false") { + test("sarscov2 - fastq, hashtable, fasta, false") { setup { run("DRAGMAP_HASHTABLE") { @@ -33,25 +33,27 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ] input[1] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = false //sort + input[2] = [[id:'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = false //sort """ } } then { + assert { process.success } assertAll ( - { assert process.success }, { assert snapshot( file(process.out.bam[0][1]).name, file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") }, - file(process.out.versions[0]).name + process.out.versions, + path(process.out.versions[0]).yaml ).match() } ) } } - test("sarscov2 - fastq, hashtable, true") { + test("sarscov2 - fastq, hashtable, fasta, true") { setup { run("DRAGMAP_HASHTABLE") { @@ -75,25 +77,27 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ] input[1] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = true //sort + input[2] = [[id:'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = true //sort """ } } then { + assert { process.success } assertAll ( - { assert process.success }, { assert snapshot( file(process.out.bam[0][1]).name, file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") }, - file(process.out.versions[0]).name + process.out.versions, + path(process.out.versions[0]).yaml ).match() } ) } } - test("sarscov2 - [fastq1, fastq2], hashtable, false") { + test("sarscov2 - [fastq1, fastq2], hashtable, fasta, false") { setup { run("DRAGMAP_HASHTABLE") { @@ -120,25 +124,27 @@ nextflow_process { ] ] input[1] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = false //sort + input[2] = [[id:'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = false //sort """ } } then { + assert { process.success } assertAll ( - { assert process.success }, { assert snapshot( file(process.out.bam[0][1]).name, file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") }, - file(process.out.versions[0]).name + process.out.versions, + path(process.out.versions[0]).yaml ).match() } ) } } - test("sarscov2 - [fastq1, fastq2], hashtable, true") { + test("sarscov2 - [fastq1, fastq2], hashtable, fasta, true") { setup { run("DRAGMAP_HASHTABLE") { @@ -165,25 +171,27 @@ nextflow_process { ] ] input[1] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = true //sort + input[2] = [[id:'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = true //sort """ } } then { + assert { process.success } assertAll ( - { assert process.success }, { assert snapshot( file(process.out.bam[0][1]).name, file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") }, - file(process.out.versions[0]).name + process.out.versions, + path(process.out.versions[0]).yaml ).match() } ) } } - test("homo_sapiens - [fastq1, fastq2], hashtable, true") { + test("homo_sapiens - [fastq1, fastq2], hashtable, fasta, true") { setup { run("DRAGMAP_HASHTABLE") { @@ -210,25 +218,27 @@ nextflow_process { ] ] input[1] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = true //sort + input[2] = [[id:'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = true //sort """ } } then { + assert { process.success } assertAll ( - { assert process.success }, { assert snapshot( file(process.out.bam[0][1]).name, file(process.out.log[0][1]).readLines().findAll { it.startsWith("decompHash") }, - file(process.out.versions[0]).name + process.out.versions, + path(process.out.versions[0]).yaml ).match() } ) } } - test("sarscov2 - [fastq1, fastq2], hashtable, true - stub") { + test("sarscov2 - [fastq1, fastq2], hashtable, fasta, true - stub") { options "-stub" setup { @@ -256,22 +266,20 @@ nextflow_process { ] ] input[1] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = true //sort + input[2] = [[id:'test'],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)] + input[3] = true //sort """ } } then { + assert { process.success } assertAll ( - { assert process.success }, { assert snapshot( - file(process.out.bam[0][1]).name, - file(process.out.log[0][1]).name, - file(process.out.versions[0]).name + process.out, + path(process.out.versions[0]).yaml ).match() } ) } - } - } diff --git a/modules/nf-core/dragmap/align/tests/main.nf.test.snap b/modules/nf-core/dragmap/align/tests/main.nf.test.snap index 32d88a27..9a63fde0 100644 --- a/modules/nf-core/dragmap/align/tests/main.nf.test.snap +++ b/modules/nf-core/dragmap/align/tests/main.nf.test.snap @@ -1,5 +1,5 @@ { - "homo_sapiens - [fastq1, fastq2], hashtable, true": { + "sarscov2 - [fastq1, fastq2], hashtable, fasta, false": { "content": [ "test.bam", [ @@ -10,19 +10,24 @@ "decompHashTableAutoHits...", "decompHashTableSetFlags..." ], - "versions.yml" - ], - "timestamp": "2023-11-23T10:12:03.844836279" - }, - "sarscov2 - [fastq1, fastq2], hashtable, true - stub": { - "content": [ - "test.bam", - "test.log", - "versions.yml" + [ + "versions.yml:md5,bec50713b6dac1cc16fe68b731848394" + ], + { + "DRAGMAP_ALIGN": { + "dragmap": "1.2.1", + "samtools": "1.19.2", + "pigz": "2.3.4" + } + } ], - "timestamp": "2023-11-22T13:41:18.016853266" + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-04-10T11:33:50.428894432" }, - "sarscov2 - fastq, hashtable, false": { + "homo_sapiens - [fastq1, fastq2], hashtable, fasta, true": { "content": [ "test.bam", [ @@ -33,11 +38,24 @@ "decompHashTableAutoHits...", "decompHashTableSetFlags..." ], - "versions.yml" + [ + "versions.yml:md5,bec50713b6dac1cc16fe68b731848394" + ], + { + "DRAGMAP_ALIGN": { + "dragmap": "1.2.1", + "samtools": "1.19.2", + "pigz": "2.3.4" + } + } ], - "timestamp": "2023-11-23T10:11:33.956661024" + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-04-10T11:34:27.492548556" }, - "sarscov2 - fastq, hashtable, true": { + "sarscov2 - fastq, hashtable, fasta, true": { "content": [ "test.bam", [ @@ -48,11 +66,24 @@ "decompHashTableAutoHits...", "decompHashTableSetFlags..." ], - "versions.yml" + [ + "versions.yml:md5,bec50713b6dac1cc16fe68b731848394" + ], + { + "DRAGMAP_ALIGN": { + "dragmap": "1.2.1", + "samtools": "1.19.2", + "pigz": "2.3.4" + } + } ], - "timestamp": "2023-11-23T10:11:40.270598375" + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-04-10T11:33:39.843877739" }, - "sarscov2 - [fastq1, fastq2], hashtable, false": { + "sarscov2 - [fastq1, fastq2], hashtable, fasta, true": { "content": [ "test.bam", [ @@ -63,11 +94,120 @@ "decompHashTableAutoHits...", "decompHashTableSetFlags..." ], - "versions.yml" + [ + "versions.yml:md5,bec50713b6dac1cc16fe68b731848394" + ], + { + "DRAGMAP_ALIGN": { + "dragmap": "1.2.1", + "samtools": "1.19.2", + "pigz": "2.3.4" + } + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-04-10T11:34:00.702498161" + }, + "sarscov2 - [fastq1, fastq2], hashtable, fasta, true - stub": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + "versions.yml:md5,bec50713b6dac1cc16fe68b731848394" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "sam": [ + + ], + "versions": [ + "versions.yml:md5,bec50713b6dac1cc16fe68b731848394" + ] + }, + { + "DRAGMAP_ALIGN": { + "dragmap": "1.2.1", + "samtools": "1.19.2", + "pigz": "2.3.4" + } + } ], - "timestamp": "2023-11-23T10:11:46.928978876" + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-04-10T11:13:17.187912755" }, - "sarscov2 - [fastq1, fastq2], hashtable, true": { + "sarscov2 - fastq, hashtable, fasta, false": { "content": [ "test.bam", [ @@ -78,8 +218,21 @@ "decompHashTableAutoHits...", "decompHashTableSetFlags..." ], - "versions.yml" + [ + "versions.yml:md5,bec50713b6dac1cc16fe68b731848394" + ], + { + "DRAGMAP_ALIGN": { + "dragmap": "1.2.1", + "samtools": "1.19.2", + "pigz": "2.3.4" + } + } ], - "timestamp": "2023-11-23T10:11:53.506727278" + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-04-10T11:33:28.056988229" } } \ No newline at end of file diff --git a/modules/nf-core/dragmap/align/tests/tags.yml b/modules/nf-core/dragmap/align/tests/tags.yml deleted file mode 100644 index a2a388af..00000000 --- a/modules/nf-core/dragmap/align/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -dragmap/align: - - modules/nf-core/dragmap/align/** diff --git a/modules/nf-core/fastp/environment.yml b/modules/nf-core/fastp/environment.yml index 70389e66..0c36eed2 100644 --- a/modules/nf-core/fastp/environment.yml +++ b/modules/nf-core/fastp/environment.yml @@ -1,7 +1,8 @@ -name: fastp +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda - - defaults dependencies: - - bioconda::fastp=0.23.4 + # renovate: datasource=conda depName=bioconda/fastp + - bioconda::fastp=1.0.1 diff --git a/modules/nf-core/fastp/main.nf b/modules/nf-core/fastp/main.nf index 2a3b679e..85013f5d 100644 --- a/modules/nf-core/fastp/main.nf +++ b/modules/nf-core/fastp/main.nf @@ -4,12 +4,12 @@ process FASTP { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fastp:0.23.4--h5f740d0_0' : - 'biocontainers/fastp:0.23.4--h5f740d0_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/52/527b18847a97451091dba07a886b24f17f742a861f9f6c9a6bfb79d4f1f3bf9d/data' : + 'community.wave.seqera.io/library/fastp:1.0.1--c8b87fe62dcc103c' }" input: - tuple val(meta), path(reads) - path adapter_fasta + tuple val(meta), path(reads), path(adapter_fasta) + val discard_trimmed_pass val save_trimmed_fail val save_merged @@ -18,9 +18,9 @@ process FASTP { tuple val(meta), path('*.json') , emit: json tuple val(meta), path('*.html') , emit: html tuple val(meta), path('*.log') , emit: log - path "versions.yml" , emit: versions tuple val(meta), path('*.fail.fastq.gz') , optional:true, emit: reads_fail tuple val(meta), path('*.merged.fastq.gz'), optional:true, emit: reads_merged + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -29,7 +29,9 @@ 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" : '' + def out_fq1 = discard_trimmed_pass ?: ( meta.single_end ? "--out1 ${prefix}.fastp.fastq.gz" : "--out1 ${prefix}_1.fastp.fastq.gz" ) + def out_fq2 = discard_trimmed_pass ?: "--out2 ${prefix}_2.fastp.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') ) { @@ -45,7 +47,7 @@ process FASTP { $adapter_list \\ $fail_fastq \\ $args \\ - 2> >(tee ${prefix}.fastp.log >&2) \\ + 2>| >(tee ${prefix}.fastp.log >&2) \\ | gzip -c > ${prefix}.fastp.fastq.gz cat <<-END_VERSIONS > versions.yml @@ -59,14 +61,14 @@ process FASTP { fastp \\ --in1 ${prefix}.fastq.gz \\ - --out1 ${prefix}.fastp.fastq.gz \\ + $out_fq1 \\ --thread $task.cpus \\ --json ${prefix}.fastp.json \\ --html ${prefix}.fastp.html \\ $adapter_list \\ $fail_fastq \\ $args \\ - 2> >(tee ${prefix}.fastp.log >&2) + 2>| >(tee ${prefix}.fastp.log >&2) cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -81,8 +83,8 @@ process FASTP { fastp \\ --in1 ${prefix}_1.fastq.gz \\ --in2 ${prefix}_2.fastq.gz \\ - --out1 ${prefix}_1.fastp.fastq.gz \\ - --out2 ${prefix}_2.fastp.fastq.gz \\ + $out_fq1 \\ + $out_fq2 \\ --json ${prefix}.fastp.json \\ --html ${prefix}.fastp.html \\ $adapter_list \\ @@ -91,7 +93,7 @@ process FASTP { --thread $task.cpus \\ --detect_adapter_for_pe \\ $args \\ - 2> >(tee ${prefix}.fastp.log >&2) + 2>| >(tee ${prefix}.fastp.log >&2) cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -103,14 +105,16 @@ process FASTP { stub: def prefix = task.ext.prefix ?: "${meta.id}" def is_single_output = task.ext.args?.contains('--interleaved_in') || meta.single_end - def touch_reads = is_single_output ? "${prefix}.fastp.fastq.gz" : "${prefix}_1.fastp.fastq.gz ${prefix}_2.fastp.fastq.gz" - def touch_merged = (!is_single_output && save_merged) ? "touch ${prefix}.merged.fastq.gz" : "" + def touch_reads = (discard_trimmed_pass) ? "" : (is_single_output) ? "echo '' | gzip > ${prefix}.fastp.fastq.gz" : "echo '' | gzip > ${prefix}_1.fastp.fastq.gz ; echo '' | gzip > ${prefix}_2.fastp.fastq.gz" + def touch_merged = (!is_single_output && save_merged) ? "echo '' | gzip > ${prefix}.merged.fastq.gz" : "" + def touch_fail_fastq = (!save_trimmed_fail) ? "" : meta.single_end ? "echo '' | gzip > ${prefix}.fail.fastq.gz" : "echo '' | gzip > ${prefix}.paired.fail.fastq.gz ; echo '' | gzip > ${prefix}_1.fail.fastq.gz ; echo '' | gzip > ${prefix}_2.fail.fastq.gz" """ - touch $touch_reads + $touch_reads + $touch_fail_fastq + $touch_merged touch "${prefix}.fastp.json" touch "${prefix}.fastp.html" touch "${prefix}.fastp.log" - $touch_merged cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/fastp/meta.yml b/modules/nf-core/fastp/meta.yml index c22a16ab..324025fe 100644 --- a/modules/nf-core/fastp/meta.yml +++ b/modules/nf-core/fastp/meta.yml @@ -11,62 +11,114 @@ tools: documentation: https://github.com/OpenGene/fastp doi: 10.1093/bioinformatics/bty560 licence: ["MIT"] + identifier: biotools:fastp input: - - meta: - type: map - description: | - Groovy Map containing sample information. Use 'single_end: true' to specify single ended or interleaved FASTQs. Use 'single_end: false' for paired-end reads. - e.g. [ id:'test', single_end:false ] - - reads: - type: file + - - meta: + type: map + description: | + Groovy Map containing sample information. Use 'single_end: true' to specify single ended or interleaved FASTQs. Use 'single_end: false' for paired-end reads. + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. If you wish to run interleaved paired-end data, supply as single-end data + but with `--interleaved_in` in your `modules.conf`'s `ext.args` for the module. + ontologies: [] + - adapter_fasta: + type: file + description: File in FASTA format containing possible adapters to remove. + pattern: "*.{fasta,fna,fas,fa}" + ontologies: [] + - discard_trimmed_pass: + type: boolean description: | - List of input FastQ files of size 1 and 2 for single-end and paired-end data, - respectively. If you wish to run interleaved paired-end data, supply as single-end data - but with `--interleaved_in` in your `modules.conf`'s `ext.args` for the module. - - adapter_fasta: - type: file - description: File in FASTA format containing possible adapters to remove. - pattern: "*.{fasta,fna,fas,fa}" + Specify true to not write any reads that pass trimming thresholds. + This can be used to use fastp for the output report only. - save_trimmed_fail: type: boolean - description: Specify true to save files that failed to pass trimming thresholds ending in `*.fail.fastq.gz` + description: Specify true to save files that failed to pass trimming thresholds + ending in `*.fail.fastq.gz` - save_merged: type: boolean - description: Specify true to save all merged reads to the a file ending in `*.merged.fastq.gz` + description: Specify true to save all merged reads to a file ending in `*.merged.fastq.gz` output: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - reads: - type: file - description: The trimmed/modified/unmerged fastq reads - pattern: "*fastp.fastq.gz" - - json: - type: file - description: Results in JSON format - pattern: "*.json" - - html: - type: file - description: Results in HTML format - pattern: "*.html" - - log: - type: file - description: fastq log file - pattern: "*.log" - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" - - reads_fail: - type: file - description: Reads the failed the preprocessing - pattern: "*fail.fastq.gz" - - reads_merged: - type: file - description: Reads that were successfully merged - pattern: "*.{merged.fastq.gz}" + reads: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.fastp.fastq.gz": + type: file + description: The trimmed/modified/unmerged fastq reads + pattern: "*fastp.fastq.gz" + ontologies: + - edam: http://edamontology.org/format_3989 # GZIP format + json: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.json": + type: file + description: Results in JSON format + pattern: "*.json" + ontologies: + - edam: http://edamontology.org/format_3464 # JSON + html: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.html": + type: file + description: Results in HTML format + pattern: "*.html" + ontologies: [] + log: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.log": + type: file + description: fastq log file + pattern: "*.log" + ontologies: [] + reads_fail: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.fail.fastq.gz": + type: file + description: Reads the failed the preprocessing + pattern: "*fail.fastq.gz" + ontologies: + - edam: http://edamontology.org/format_3989 # GZIP format + reads_merged: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.merged.fastq.gz": + type: file + description: Reads that were successfully merged + pattern: "*.{merged.fastq.gz}" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@drpatelh" - "@kevinmenden" diff --git a/modules/nf-core/fastp/tests/main.nf.test b/modules/nf-core/fastp/tests/main.nf.test index 9b3f9a38..5125705c 100644 --- a/modules/nf-core/fastp/tests/main.nf.test +++ b/modules/nf-core/fastp/tests/main.nf.test @@ -10,20 +10,20 @@ nextflow_process { test("test_fastp_single_end") { when { - params { - outdir = "$outputDir" - } + process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = false + adapter_fasta = [] // empty list for no adapter file! + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = false input[0] = Channel.of([ [ id:'test', single_end: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_1.fastq.gz', checkIfExists: true) ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -31,68 +31,77 @@ nextflow_process { } then { - def html_text = [ "Q20 bases:12.922000 K (92.984097%)", - "single end (151 cycles)" ] - def log_text = [ "Q20 bases: 12922(92.9841%)", - "reads passed filter: 99" ] - def read_lines = ["@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", - "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", - "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads.get(0).get(1)).linesGzip.contains(read_line) } - } - }, - { html_text.each { html_part -> - { assert path(process.out.html.get(0).get(1)).getText().contains(html_part) } - } - }, - { assert snapshot(process.out.json).match("test_fastp_single_end_json") }, - { log_text.each { log_part -> - { assert path(process.out.log.get(0).get(1)).getText().contains(log_part) } - } - }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { file(it[1]).getName() } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_single_end-_match") - }, - { assert snapshot(process.out.versions).match("versions_single_end") } + { assert path(process.out.html.get(0).get(1)).getText().contains("single end (151 cycles)") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("reads passed filter: 99") }, + { assert snapshot( + process.out.reads, + process.out.reads_fail, + process.out.reads_merged, + process.out.versions).match() + } ) } } - test("test_fastp_single_end-stub") { - - options '-stub' + test("test_fastp_paired_end") { when { - params { - outdir = "$outputDir" + + process { + """ + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = false + + 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) + ], + adapter_fasta + ]) + input[1] = discard_trimmed_pass + input[2] = save_trimmed_fail + input[3] = save_merged + """ } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.html.get(0).get(1)).getText().contains("The input has little adapter percentage (~0.000000%), probably it's trimmed before.") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("Q30 bases: 12281(88.3716%)") }, + { assert snapshot( + process.out.reads, + process.out.reads_fail, + process.out.reads_merged, + process.out.versions).match() } + ) + } + } + + test("fastp test_fastp_interleaved") { + + config './nextflow.interleaved.config' + when { process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = false + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = false input[0] = Channel.of([ - [ id:'test', single_end:true ], - [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ] + [ id:'test', single_end:true ], // meta map + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true) ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -100,45 +109,115 @@ nextflow_process { } then { + assertAll( + { assert process.success }, + { assert path(process.out.html.get(0).get(1)).getText().contains("paired end (151 cycles + 151 cycles)") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("reads passed filter: 162") }, + { assert process.out.reads_fail == [] }, + { assert process.out.reads_merged == [] }, + { assert snapshot( + process.out.reads, + process.out.versions).match() } + ) + } + } + + test("test_fastp_single_end_trim_fail") { + when { + + process { + """ + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = true + save_merged = false + + input[0] = Channel.of([ + [ id:'test', single_end:true ], // meta map + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ], + adapter_fasta + ]) + input[1] = discard_trimmed_pass + input[2] = save_trimmed_fail + input[3] = save_merged + """ + } + } + + then { assertAll( { assert process.success }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { file(it[1]).getName() } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_single_end-for_stub_match") - }, - { assert snapshot(process.out.versions).match("versions_single_end_stub") } + { assert path(process.out.html.get(0).get(1)).getText().contains("single end (151 cycles)") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("reads passed filter: 99") }, + { assert snapshot( + process.out.reads, + process.out.reads_fail, + process.out.reads_merged, + process.out.versions).match() } ) } } - test("test_fastp_paired_end") { + test("test_fastp_paired_end_trim_fail") { + config './nextflow.save_failed.config' when { - params { - outdir = "$outputDir" + process { + """ + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = true + save_merged = false + + 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) + ], + adapter_fasta + ]) + input[1] = discard_trimmed_pass + input[2] = save_trimmed_fail + input[3] = save_merged + """ } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.html.get(0).get(1)).getText().contains("The input has little adapter percentage (~0.000000%), probably it's trimmed before.") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("reads passed filter: 162") }, + { assert snapshot( + process.out.reads, + process.out.reads_fail, + process.out.reads_merged, + process.out.versions).match() } + ) + } + } + + test("test_fastp_paired_end_merged") { + + when { process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = false + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = true 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) + ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -146,83 +225,117 @@ nextflow_process { } then { - def html_text = [ "Q20 bases:25.719000 K (93.033098%)", - "The input has little adapter percentage (~0.000000%), probably it's trimmed before."] - def log_text = [ "No adapter detected for read1", - "Q30 bases: 12281(88.3716%)"] - def json_text = ['"passed_filter_reads": 198'] - def read1_lines = ["@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", - "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", - "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads.get(0).get(1).get(0)).linesGzip.contains(read1_line) } - } - }, - { read2_lines.each { read2_line -> - { assert path(process.out.reads.get(0).get(1).get(1)).linesGzip.contains(read2_line) } - } - }, - { html_text.each { html_part -> - { assert path(process.out.html.get(0).get(1)).getText().contains(html_part) } - } - }, - { json_text.each { json_part -> - { assert path(process.out.json.get(0).get(1)).getText().contains(json_part) } - } - }, - { log_text.each { log_part -> - { assert path(process.out.log.get(0).get(1)).getText().contains(log_part) } - } - }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { it[1].collect { item -> file(item).getName() } } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_paired_end_match") - }, - { assert snapshot(process.out.versions).match("versions_paired_end") } + { assert path(process.out.html.get(0).get(1)).getText().contains("The input has little adapter percentage (~0.000000%), probably it's trimmed before.") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("total reads: 75") }, + { assert snapshot( + process.out.reads, + process.out.reads_fail, + process.out.reads_merged, + process.out.versions).match() }, ) } } - test("test_fastp_paired_end-stub") { + test("test_fastp_paired_end_merged_adapterlist") { + + when { + process { + """ + adapter_fasta = file(params.modules_testdata_base_path + 'delete_me/fastp/adapters.fasta', checkIfExists: true) + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = true + + 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) + ], + adapter_fasta + ]) + input[1] = false + input[2] = false + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.html.get(0).get(1)).getText().contains("
") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("total bases: 13683") }, + { assert snapshot( + process.out.reads, + process.out.reads_fail, + process.out.reads_merged, + process.out.versions).match() } + ) + } + } - options '-stub' + test("test_fastp_single_end_qc_only") { when { - params { - outdir = "$outputDir" + process { + """ + adapter_fasta = [] + discard_trimmed_pass = true + save_trimmed_fail = false + save_merged = false + + input[0] = Channel.of([ + [ id:'test', single_end:true ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ], + adapter_fasta + ]) + + input[1] = discard_trimmed_pass + input[2] = save_trimmed_fail + input[3] = save_merged + """ } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.html.get(0).get(1)).getText().contains("single end (151 cycles)") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("reads passed filter: 99") }, + { assert snapshot( + process.out.reads, + process.out.reads, + process.out.reads_fail, + process.out.reads_fail, + process.out.reads_merged, + process.out.reads_merged, + process.out.versions).match() } + ) + } + } + + test("test_fastp_paired_end_qc_only") { + + when { process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = false + adapter_fasta = [] + discard_trimmed_pass = true + save_trimmed_fail = false + save_merged = false 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) + ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -232,41 +345,39 @@ nextflow_process { then { assertAll( { assert process.success }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { it[1].collect { item -> file(item).getName() } } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_paired_end-for_stub_match") - }, - { assert snapshot(process.out.versions).match("versions_paired_end-stub") } + { assert path(process.out.html.get(0).get(1)).getText().contains("The input has little adapter percentage (~0.000000%), probably it's trimmed before.") }, + { assert path(process.out.log.get(0).get(1)).getText().contains("Q30 bases: 12281(88.3716%)") }, + { assert snapshot( + process.out.reads, + process.out.reads, + process.out.reads_fail, + process.out.reads_fail, + process.out.reads_merged, + process.out.reads_merged, + process.out.versions).match() } ) } } - test("fastp test_fastp_interleaved") { - config './nextflow.config' + test("test_fastp_single_end - stub") { + + options "-stub" + when { - params { - outdir = "$outputDir" - } + process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = false + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = false input[0] = Channel.of([ - [ id:'test', single_end:true ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true) ] + [ id:'test', single_end:true ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -274,69 +385,66 @@ nextflow_process { } then { - 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"] - def read_lines = [ "@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", - "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", - "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads.get(0).get(1)).linesGzip.contains(read_line) } - } - }, - { html_text.each { html_part -> - { assert path(process.out.html.get(0).get(1)).getText().contains(html_part) } - } - }, - { assert snapshot(process.out.json).match("fastp test_fastp_interleaved_json") }, - { log_text.each { log_part -> - { assert path(process.out.log.get(0).get(1)).getText().contains(log_part) } - } - }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { file(it[1]).getName() } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_interleaved-_match") - }, - { assert snapshot(process.out.versions).match("versions_interleaved") } + { assert snapshot(process.out).match() } ) } } - test("fastp test_fastp_interleaved-stub") { + test("test_fastp_paired_end - stub") { - options '-stub' + options "-stub" - config './nextflow.config' when { - params { - outdir = "$outputDir" + + process { + """ + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = false + + 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) ], + adapter_fasta + ]) + input[1] = discard_trimmed_pass + input[2] = save_trimmed_fail + input[3] = save_merged + """ } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("fastp - stub test_fastp_interleaved") { + + options "-stub" + + config './nextflow.interleaved.config' + when { process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = false + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = false input[0] = Channel.of([ [ id:'test', single_end:true ], // meta map - [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true) ] + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true) ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -346,41 +454,30 @@ nextflow_process { then { assertAll( { assert process.success }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { file(it[1]).getName() } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_interleaved-for_stub_match") - }, - { assert snapshot(process.out.versions).match("versions_interleaved-stub") } + { assert snapshot(process.out).match() } ) } } - test("test_fastp_single_end_trim_fail") { + test("test_fastp_single_end_trim_fail - stub") { + + options "-stub" when { - params { - outdir = "$outputDir" - } + process { """ - adapter_fasta = [] - save_trimmed_fail = true - save_merged = false + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = true + save_merged = false input[0] = Channel.of([ [ id:'test', single_end:true ], // 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_1.fastq.gz', checkIfExists: true) ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -388,61 +485,33 @@ nextflow_process { } then { - def html_text = [ "Q20 bases:12.922000 K (92.984097%)", - "single end (151 cycles)"] - def log_text = [ "Q20 bases: 12922(92.9841%)", - "reads passed filter: 99" ] - def read_lines = [ "@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", - "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", - "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads.get(0).get(1)).linesGzip.contains(read_line) } - } - }, - { failed_read_lines.each { failed_read_line -> - { assert path(process.out.reads_fail.get(0).get(1)).linesGzip.contains(failed_read_line) } - } - }, - { html_text.each { html_part -> - { assert path(process.out.html.get(0).get(1)).getText().contains(html_part) } - } - }, - { assert snapshot(process.out.json).match("test_fastp_single_end_trim_fail_json") }, - { log_text.each { log_part -> - { assert path(process.out.log.get(0).get(1)).getText().contains(log_part) } - } - }, - { assert snapshot(process.out.versions).match("versions_single_end_trim_fail") } + { assert snapshot(process.out).match() } ) } } - test("test_fastp_paired_end_trim_fail") { + test("test_fastp_paired_end_trim_fail - stub") { + + options "-stub" + config './nextflow.save_failed.config' when { - params { - outdir = "$outputDir" - } process { """ - adapter_fasta = [] - save_trimmed_fail = true - save_merged = false + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = true + save_merged = false 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_2.fastq.gz', checkIfExists: true)], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -450,76 +519,32 @@ nextflow_process { } then { - def html_text = [ "Q20 bases:25.719000 K (93.033098%)", - "The input has little adapter percentage (~0.000000%), probably it's trimmed before."] - def log_text = [ "No adapter detected for read1", - "Q30 bases: 12281(88.3716%)"] - def json_text = ['"passed_filter_reads": 198'] - def read1_lines = ["@ERR5069949.2151832 NS500628:121:HK3MMAFX2:2:21208:10793:15304/1", - "TCATAAACCAAAGCACTCACAGTGTCAACAATTTCAGCAGGACAACGCCGACAAGTTCCGAGGAACATGTCTGGACCTATAGTTTTCATAAGTCTACACACTGAATTGAAATATTCTGGTTCTAGTGTGCCCTTAGTTAGCAATGTGCGT", - "AAAAAAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEAEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEAAEEEEE - { assert path(process.out.reads.get(0).get(1).get(0)).linesGzip.contains(read1_line) } - } - }, - { read2_lines.each { read2_line -> - { assert path(process.out.reads.get(0).get(1).get(1)).linesGzip.contains(read2_line) } - } - }, - { failed_read2_lines.each { failed_read2_line -> - { assert path(process.out.reads_fail.get(0).get(1).get(1)).linesGzip.contains(failed_read2_line) } - } - }, - { html_text.each { html_part -> - { assert path(process.out.html.get(0).get(1)).getText().contains(html_part) } - } - }, - { json_text.each { json_part -> - { assert path(process.out.json.get(0).get(1)).getText().contains(json_part) } - } - }, - { log_text.each { log_part -> - { assert path(process.out.log.get(0).get(1)).getText().contains(log_part) } - } - }, - { assert snapshot(process.out.versions).match("versions_paired_end_trim_fail") } + { assert snapshot(process.out).match() } ) } } - test("test_fastp_paired_end_merged") { + test("test_fastp_paired_end_merged - stub") { + + options "-stub" when { - params { - outdir = "$outputDir" - } process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = true + adapter_fasta = [] + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = true + 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_2.fastq.gz', checkIfExists: true) ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -527,93 +552,34 @@ nextflow_process { } then { - def html_text = [ "
"] - def log_text = [ "Merged and filtered:", - "total reads: 75", - "total bases: 13683"] - def json_text = ['"merged_and_filtered": {', '"total_reads": 75', '"total_bases": 13683'] - def read1_lines = [ "@ERR5069949.1066259 NS500628:121:HK3MMAFX2:1:11312:18369:8333/1", - "CCTTATGACAGCAAGAACTGTGTATGATGATGGTGCTAGGAGAGTGTGGACACTTATGAATGTCTTGACACTCGTTTATAAAGTTTATTATGGTAATGCTTTAGATCAAGCCATTTCCATGTGGGCTCTTATAATCTCTGTTACTTC", - "AAAAAEAEEAEEEEEEEEEEEEEEEEAEEEEAEEEEEEEEAEEEEEEEEEEEEEEEEE/EAEEEEEE/6EEEEEEEEEEAEEAEEE/EE/AEEAEEEEEAEEEA/EEAAEAE - { assert path(process.out.reads.get(0).get(1).get(0)).linesGzip.contains(read1_line) } - } - }, - { read2_lines.each { read2_line -> - { assert path(process.out.reads.get(0).get(1).get(1)).linesGzip.contains(read2_line) } - } - }, - { read_merged_lines.each { read_merged_line -> - { assert path(process.out.reads_merged.get(0).get(1)).linesGzip.contains(read_merged_line) } - } - }, - { html_text.each { html_part -> - { assert path(process.out.html.get(0).get(1)).getText().contains(html_part) } - } - }, - { json_text.each { json_part -> - { assert path(process.out.json.get(0).get(1)).getText().contains(json_part) } - } - }, - { log_text.each { log_part -> - { assert path(process.out.log.get(0).get(1)).getText().contains(log_part) } - } - }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { it[1].collect { item -> file(item).getName() } } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_paired_end_merged_match") - }, - { assert snapshot(process.out.versions).match("versions_paired_end_merged") } + { assert snapshot(process.out).match() } ) } } - test("test_fastp_paired_end_merged-stub") { + test("test_fastp_paired_end_merged_adapterlist - stub") { - options '-stub' + options "-stub" when { - params { - outdir = "$outputDir" - } process { """ - adapter_fasta = [] - save_trimmed_fail = false - save_merged = true + adapter_fasta = file(params.modules_testdata_base_path + 'delete_me/fastp/adapters.fasta', checkIfExists: true) + discard_trimmed_pass = false + save_trimmed_fail = false + save_merged = true 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) + ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -623,42 +589,62 @@ nextflow_process { then { assertAll( { assert process.success }, - { - assert snapshot( - ( - [process.out.reads[0][0].toString()] + // meta - process.out.reads.collect { it[1].collect { item -> file(item).getName() } } + - process.out.json.collect { file(it[1]).getName() } + - process.out.html.collect { file(it[1]).getName() } + - process.out.log.collect { file(it[1]).getName() } + - process.out.reads_fail.collect { file(it[1]).getName() } + - process.out.reads_merged.collect { file(it[1]).getName() } - ).sort() - ).match("test_fastp_paired_end_merged-for_stub_match") - }, - { assert snapshot(process.out.versions).match("versions_paired_end_merged_stub") } + { assert snapshot(process.out).match() } ) } } - test("test_fastp_paired_end_merged_adapterlist") { + test("test_fastp_single_end_qc_only - stub") { + + options "-stub" when { - params { - outdir = "$outputDir" + process { + """ + adapter_fasta = [] + discard_trimmed_pass = true + save_trimmed_fail = false + save_merged = false + + input[0] = Channel.of([ + [ id:'test', single_end:true ], + [ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ], + adapter_fasta + ]) + input[1] = discard_trimmed_pass + input[2] = save_trimmed_fail + input[3] = save_merged + """ } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_fastp_paired_end_qc_only - stub") { + + options "-stub" + + when { process { """ - adapter_fasta = Channel.of([ file(params.modules_testdata_base_path + 'delete_me/fastp/adapters.fasta', checkIfExists: true) ]) - save_trimmed_fail = false - save_merged = true + adapter_fasta = [] + discard_trimmed_pass = true + save_trimmed_fail = false + save_merged = false 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_2.fastq.gz', checkIfExists: true) ], + adapter_fasta ]) - input[1] = adapter_fasta + input[1] = discard_trimmed_pass input[2] = save_trimmed_fail input[3] = save_merged """ @@ -666,57 +652,9 @@ nextflow_process { } then { - def html_text = [ "
"] - def log_text = [ "Merged and filtered:", - "total reads: 75", - "total bases: 13683"] - def json_text = ['"merged_and_filtered": {', '"total_reads": 75', '"total_bases": 13683',"--adapter_fasta"] - def read1_lines = ["@ERR5069949.1066259 NS500628:121:HK3MMAFX2:1:11312:18369:8333/1", - "CCTTATGACAGCAAGAACTGTGTATGATGATGGTGCTAGGAGAGTGTGGACACTTATGAATGTCTTGACACTCGTTTATAAAGTTTATTATGGTAATGCTTTAGATCAAGCCATTTCCATGTGGGCTCTTATAATCTCTGTTACTTC", - "AAAAAEAEEAEEEEEEEEEEEEEEEEAEEEEAEEEEEEEEAEEEEEEEEEEEEEEEEE/EAEEEEEE/6EEEEEEEEEEAEEAEEE/EE/AEEAEEEEEAEEEA/EEAAEAE - { assert path(process.out.reads.get(0).get(1).get(0)).linesGzip.contains(read1_line) } - } - }, - { read2_lines.each { read2_line -> - { assert path(process.out.reads.get(0).get(1).get(1)).linesGzip.contains(read2_line) } - } - }, - { read_merged_lines.each { read_merged_line -> - { assert path(process.out.reads_merged.get(0).get(1)).linesGzip.contains(read_merged_line) } - } - }, - { html_text.each { html_part -> - { assert path(process.out.html.get(0).get(1)).getText().contains(html_part) } - } - }, - { json_text.each { json_part -> - { assert path(process.out.json.get(0).get(1)).getText().contains(json_part) } - } - }, - { log_text.each { log_part -> - { assert path(process.out.log.get(0).get(1)).getText().contains(log_part) } - } - }, - { assert snapshot(process.out.versions).match("versions_paired_end_merged_adapterlist") } + { assert snapshot(process.out).match() } ) } } diff --git a/modules/nf-core/fastp/tests/main.nf.test.snap b/modules/nf-core/fastp/tests/main.nf.test.snap index b4c0e1dd..a30c680d 100644 --- a/modules/nf-core/fastp/tests/main.nf.test.snap +++ b/modules/nf-core/fastp/tests/main.nf.test.snap @@ -1,330 +1,1250 @@ { - "fastp test_fastp_interleaved_json": { + "test_fastp_single_end_qc_only - stub": { "content": [ - [ - [ - { - "id": "test", - "single_end": true - }, - "test.fastp.json:md5,168f516f7bd4b7b6c32da7cba87299a4" + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + + ], + "reads_fail": [ + + ], + "reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] - ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-01-17T18:08:06.123035" + "timestamp": "2025-09-11T09:55:42.073182" }, - "test_fastp_paired_end_merged-for_stub_match": { + "test_fastp_paired_end": { "content": [ [ [ - "test_1.fastp.fastq.gz", - "test_2.fastp.fastq.gz" - ], - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "test.merged.fastq.gz", - "{id=test, single_end=false}" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-01-17T18:10:13.467574" - }, - "versions_interleaved": { - "content": [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7", + "test_2.fastp.fastq.gz:md5,25cbdca08e2083dbd4f0502de6b62f39" + ] + ] + ], + [ + + ], + [ + + ], [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:56:24.615634793" + "timestamp": "2025-09-19T16:23:12.436191" }, - "test_fastp_single_end_json": { + "test_fastp_paired_end_merged_adapterlist": { "content": [ [ [ { "id": "test", - "single_end": true + "single_end": false }, - "test.fastp.json:md5,c852d7a6dba5819e4ac8d9673bedcacc" + [ + "test_1.fastp.fastq.gz:md5,54b726a55e992a869fd3fa778afe1672", + "test_2.fastp.fastq.gz:md5,29d3b33b869f7b63417b8ff07bb128ba" + ] ] - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-01-17T18:06:00.223817" - }, - "versions_paired_end": { - "content": [ + ], [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-02-01T11:55:42.333545689" - }, - "test_fastp_paired_end_match": { - "content": [ + + ], [ [ - "test_1.fastp.fastq.gz", - "test_2.fastp.fastq.gz" - ], - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "{id=test, single_end=false}" + { + "id": "test", + "single_end": false + }, + "test.merged.fastq.gz:md5,c873bb1ab3fa859dcc47306465e749d5" + ] + ], + [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T12:03:06.431833729" + "timestamp": "2025-09-19T16:23:32.267735" }, - "test_fastp_interleaved-_match": { + "test_fastp_single_end_qc_only": { "content": [ [ - "test.fastp.fastq.gz", - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "{id=test, single_end=true}" + + ], + [ + + ], + [ + + ], + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T12:03:37.827323085" + "timestamp": "2025-09-19T16:23:36.149003" }, - "test_fastp_paired_end_merged_match": { + "test_fastp_paired_end_trim_fail": { "content": [ [ [ - "test_1.fastp.fastq.gz", - "test_2.fastp.fastq.gz" - ], - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "test.merged.fastq.gz", - "{id=test, single_end=false}" - ] - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" - }, - "timestamp": "2024-02-01T12:08:44.496251446" - }, - "versions_single_end_stub": { - "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.paired.fail.fastq.gz:md5,409b687c734cedd7a1fec14d316e1366", + "test_1.fail.fastq.gz:md5,4f273cf3159c13f79e8ffae12f5661f6", + "test_2.fail.fastq.gz:md5,f97b9edefb5649aab661fbc9e71fc995" + ] + ] + ], + [ + + ], [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:55:27.354051299" + "timestamp": "2025-09-19T16:23:24.23891" }, - "versions_interleaved-stub": { + "fastp - stub test_fastp_interleaved": { "content": [ - [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "reads_fail": [ + + ], + "reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:56:46.535528418" + "timestamp": "2025-09-11T09:55:19.47199" }, - "versions_single_end_trim_fail": { + "test_fastp_single_end - stub": { "content": [ - [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "reads_fail": [ + + ], + "reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:59:03.724591407" + "timestamp": "2025-09-11T09:55:09.617001" }, - "test_fastp_paired_end-for_stub_match": { + "test_fastp_paired_end_merged_adapterlist - stub": { "content": [ - [ - [ - "test_1.fastp.fastq.gz", - "test_2.fastp.fastq.gz" + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] ], - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "{id=test, single_end=false}" - ] + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "test.merged.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "reads_fail": [ + + ], + "reads_merged": [ + [ + { + "id": "test", + "single_end": false + }, + "test.merged.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-01-17T18:07:15.398827" + "timestamp": "2025-09-11T09:55:37.413738" }, - "versions_paired_end-stub": { + "test_fastp_paired_end_merged - stub": { "content": [ - [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "test.merged.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "reads_fail": [ + + ], + "reads_merged": [ + [ + { + "id": "test", + "single_end": false + }, + "test.merged.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:56:06.50017282" + "timestamp": "2025-09-11T09:55:32.965652" }, - "versions_single_end": { + "test_fastp_paired_end_merged": { "content": [ [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" + [ + { + "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.merged.fastq.gz:md5,c873bb1ab3fa859dcc47306465e749d5" + ] + ], + [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:55:07.67921647" + "timestamp": "2025-09-19T16:23:28.074624" }, - "versions_paired_end_merged_stub": { + "test_fastp_paired_end - stub": { "content": [ - [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "reads_fail": [ + + ], + "reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:59:47.350653154" + "timestamp": "2025-09-11T09:55:14.414258" }, - "test_fastp_interleaved-for_stub_match": { + "test_fastp_single_end": { "content": [ [ - "test.fastp.fastq.gz", - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "{id=test, single_end=true}" + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7" + ] + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-01-17T18:08:06.127974" + "timestamp": "2025-09-19T16:23:08.469846" }, - "versions_paired_end_trim_fail": { + "test_fastp_single_end_trim_fail - stub": { "content": [ - [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "5": [ + + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "reads_fail": [ + [ + { + "id": "test", + "single_end": true + }, + "test.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:59:18.140484878" + "timestamp": "2025-09-11T09:55:23.871395" }, - "test_fastp_single_end-for_stub_match": { + "test_fastp_paired_end_trim_fail - stub": { "content": [ - [ - "test.fastp.fastq.gz", - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "{id=test, single_end=true}" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.paired.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_1.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "5": [ + + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "reads_fail": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test.paired.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_1.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fail.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-01-17T18:06:00.244202" + "timestamp": "2025-09-11T09:55:28.399328" }, - "test_fastp_single_end-_match": { + "fastp test_fastp_interleaved": { "content": [ [ - "test.fastp.fastq.gz", - "test.fastp.html", - "test.fastp.json", - "test.fastp.log", - "{id=test, single_end=true}" + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,217d62dc13a23e92513a1bd8e1bcea39" + ] + ], + [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:57:30.791982648" + "timestamp": "2025-09-19T16:23:16.479494" }, - "versions_paired_end_merged_adapterlist": { + "test_fastp_single_end_trim_fail": { "content": [ [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" + [ + { + "id": "test", + "single_end": true + }, + "test.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7" + ] + ], + [ + [ + { + "id": "test", + "single_end": true + }, + "test.fail.fastq.gz:md5,3e4aaadb66a5b8fc9b881bf39c227abd" + ] + ], + [ + + ], + [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T12:05:37.845370554" + "timestamp": "2025-09-19T16:23:20.299076" }, - "versions_paired_end_merged": { + "test_fastp_paired_end_qc_only": { "content": [ [ - "versions.yml:md5,48ffc994212fb1fc9f83a74fa69c9f02" + + ], + [ + + ], + [ + + ], + [ + + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-01T11:59:32.860543858" + "timestamp": "2025-09-19T16:23:40.113724" }, - "test_fastp_single_end_trim_fail_json": { + "test_fastp_paired_end_qc_only - stub": { "content": [ - [ - [ - { - "id": "test", - "single_end": true - }, - "test.fastp.json:md5,9a7ee180f000e8d00c7fb67f06293eb5" + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + + ], + "reads_fail": [ + + ], + "reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,c4974822658d02533e660fae343f281b" ] - ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-01-17T18:08:41.942317" + "timestamp": "2025-09-11T09:55:46.696419" } } \ No newline at end of file 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 00000000..4be8dbd2 --- /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 0f7849ad..53b61b0c 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/modules/nf-core/fastp/tests/tags.yml b/modules/nf-core/fastp/tests/tags.yml deleted file mode 100644 index c1afcce7..00000000 --- a/modules/nf-core/fastp/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -fastp: - - modules/nf-core/fastp/** diff --git a/modules/nf-core/fastqc/environment.yml b/modules/nf-core/fastqc/environment.yml index 1787b38a..f9f54ee9 100644 --- a/modules/nf-core/fastqc/environment.yml +++ b/modules/nf-core/fastqc/environment.yml @@ -1,7 +1,7 @@ -name: fastqc +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda - - defaults dependencies: - bioconda::fastqc=0.12.1 diff --git a/modules/nf-core/fastqc/main.nf b/modules/nf-core/fastqc/main.nf index 9e19a74c..23e16634 100644 --- a/modules/nf-core/fastqc/main.nf +++ b/modules/nf-core/fastqc/main.nf @@ -1,5 +1,5 @@ process FASTQC { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' conda "${moduleDir}/environment.yml" @@ -19,21 +19,30 @@ process FASTQC { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" // Make list of old name and new name pairs to use for renaming in the bash while loop def old_new_pairs = reads instanceof Path || reads.size() == 1 ? [[ reads, "${prefix}.${reads.extension}" ]] : reads.withIndex().collect { entry, index -> [ entry, "${prefix}_${index + 1}.${entry.extension}" ] } - def rename_to = old_new_pairs*.join(' ').join(' ') - def renamed_files = old_new_pairs.collect{ old_name, new_name -> new_name }.join(' ') + def rename_to = old_new_pairs*.join(' ').join(' ') + def renamed_files = old_new_pairs.collect{ _old_name, new_name -> new_name }.join(' ') + + // The total amount of allocated RAM by FastQC is equal to the number of threads defined (--threads) time the amount of RAM defined (--memory) + // https://github.com/s-andrews/FastQC/blob/1faeea0412093224d7f6a07f777fad60a5650795/fastqc#L211-L222 + // Dividing the task.memory by task.cpu allows to stick to requested amount of RAM in the label + def memory_in_mb = task.memory ? task.memory.toUnit('MB') / task.cpus : null + // FastQC memory value allowed range (100 - 10000) + def fastqc_memory = memory_in_mb > 10000 ? 10000 : (memory_in_mb < 100 ? 100 : memory_in_mb) + """ - printf "%s %s\\n" $rename_to | while read old_name new_name; do + printf "%s %s\\n" ${rename_to} | while read old_name new_name; do [ -f "\${new_name}" ] || ln -s \$old_name \$new_name done fastqc \\ - $args \\ - --threads $task.cpus \\ - $renamed_files + ${args} \\ + --threads ${task.cpus} \\ + --memory ${fastqc_memory} \\ + ${renamed_files} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/fastqc/meta.yml b/modules/nf-core/fastqc/meta.yml index ee5507e0..c8d9d025 100644 --- a/modules/nf-core/fastqc/meta.yml +++ b/modules/nf-core/fastqc/meta.yml @@ -11,40 +11,55 @@ tools: FastQC gives general quality metrics about your reads. It provides information about the quality score distribution across your reads, the per base sequence content (%A/C/G/T). + You get information about adapter contamination and other overrepresented sequences. homepage: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/ documentation: https://www.bioinformatics.babraham.ac.uk/projects/fastqc/Help/ licence: ["GPL-2.0-only"] + identifier: biotools:fastqc input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - reads: - type: file - description: | - List of input FastQ files of size 1 and 2 for single-end and paired-end data, - respectively. + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + ontologies: [] output: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - html: - type: file - description: FastQC report - pattern: "*_{fastqc.html}" - - zip: - type: file - description: FastQC report archive - pattern: "*_{fastqc.zip}" - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" + html: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.html": + type: file + description: FastQC report + pattern: "*_{fastqc.html}" + ontologies: [] + zip: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.zip": + type: file + description: FastQC report archive + pattern: "*_{fastqc.zip}" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@drpatelh" - "@grst" diff --git a/modules/nf-core/fastqc/tests/main.nf.test b/modules/nf-core/fastqc/tests/main.nf.test index 70edae4d..e9d79a07 100644 --- a/modules/nf-core/fastqc/tests/main.nf.test +++ b/modules/nf-core/fastqc/tests/main.nf.test @@ -23,17 +23,14 @@ nextflow_process { then { assertAll ( - { assert process.success }, - - // NOTE The report contains the date inside it, which means that the md5sum is stable per day, but not longer than that. So you can't md5sum it. - // looks like this:
Mon 2 Oct 2023
test.gz
- // https://github.com/nf-core/modules/pull/3903#issuecomment-1743620039 - - { assert process.out.html[0][1] ==~ ".*/test_fastqc.html" }, - { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, - { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, - - { assert snapshot(process.out.versions).match("fastqc_versions_single") } + { assert process.success }, + // NOTE The report contains the date inside it, which means that the md5sum is stable per day, but not longer than that. So you can't md5sum it. + // looks like this:
Mon 2 Oct 2023
test.gz
+ // https://github.com/nf-core/modules/pull/3903#issuecomment-1743620039 + { assert process.out.html[0][1] ==~ ".*/test_fastqc.html" }, + { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, + { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, + { assert snapshot(process.out.versions).match() } ) } } @@ -54,16 +51,14 @@ nextflow_process { then { assertAll ( - { assert process.success }, - - { assert process.out.html[0][1][0] ==~ ".*/test_1_fastqc.html" }, - { assert process.out.html[0][1][1] ==~ ".*/test_2_fastqc.html" }, - { assert process.out.zip[0][1][0] ==~ ".*/test_1_fastqc.zip" }, - { assert process.out.zip[0][1][1] ==~ ".*/test_2_fastqc.zip" }, - { assert path(process.out.html[0][1][0]).text.contains("File typeConventional base calls") }, - { assert path(process.out.html[0][1][1]).text.contains("File typeConventional base calls") }, - - { assert snapshot(process.out.versions).match("fastqc_versions_paired") } + { assert process.success }, + { assert process.out.html[0][1][0] ==~ ".*/test_1_fastqc.html" }, + { assert process.out.html[0][1][1] ==~ ".*/test_2_fastqc.html" }, + { assert process.out.zip[0][1][0] ==~ ".*/test_1_fastqc.zip" }, + { assert process.out.zip[0][1][1] ==~ ".*/test_2_fastqc.zip" }, + { assert path(process.out.html[0][1][0]).text.contains("File typeConventional base calls") }, + { assert path(process.out.html[0][1][1]).text.contains("File typeConventional base calls") }, + { assert snapshot(process.out.versions).match() } ) } } @@ -83,13 +78,11 @@ nextflow_process { then { assertAll ( - { assert process.success }, - - { assert process.out.html[0][1] ==~ ".*/test_fastqc.html" }, - { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, - { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, - - { assert snapshot(process.out.versions).match("fastqc_versions_interleaved") } + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test_fastqc.html" }, + { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, + { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, + { assert snapshot(process.out.versions).match() } ) } } @@ -109,13 +102,11 @@ nextflow_process { then { assertAll ( - { assert process.success }, - - { assert process.out.html[0][1] ==~ ".*/test_fastqc.html" }, - { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, - { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, - - { assert snapshot(process.out.versions).match("fastqc_versions_bam") } + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/test_fastqc.html" }, + { assert process.out.zip[0][1] ==~ ".*/test_fastqc.zip" }, + { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, + { assert snapshot(process.out.versions).match() } ) } } @@ -138,22 +129,20 @@ nextflow_process { then { assertAll ( - { assert process.success }, - - { assert process.out.html[0][1][0] ==~ ".*/test_1_fastqc.html" }, - { assert process.out.html[0][1][1] ==~ ".*/test_2_fastqc.html" }, - { assert process.out.html[0][1][2] ==~ ".*/test_3_fastqc.html" }, - { assert process.out.html[0][1][3] ==~ ".*/test_4_fastqc.html" }, - { assert process.out.zip[0][1][0] ==~ ".*/test_1_fastqc.zip" }, - { assert process.out.zip[0][1][1] ==~ ".*/test_2_fastqc.zip" }, - { assert process.out.zip[0][1][2] ==~ ".*/test_3_fastqc.zip" }, - { assert process.out.zip[0][1][3] ==~ ".*/test_4_fastqc.zip" }, - { assert path(process.out.html[0][1][0]).text.contains("File typeConventional base calls") }, - { assert path(process.out.html[0][1][1]).text.contains("File typeConventional base calls") }, - { assert path(process.out.html[0][1][2]).text.contains("File typeConventional base calls") }, - { assert path(process.out.html[0][1][3]).text.contains("File typeConventional base calls") }, - - { assert snapshot(process.out.versions).match("fastqc_versions_multiple") } + { assert process.success }, + { assert process.out.html[0][1][0] ==~ ".*/test_1_fastqc.html" }, + { assert process.out.html[0][1][1] ==~ ".*/test_2_fastqc.html" }, + { assert process.out.html[0][1][2] ==~ ".*/test_3_fastqc.html" }, + { assert process.out.html[0][1][3] ==~ ".*/test_4_fastqc.html" }, + { assert process.out.zip[0][1][0] ==~ ".*/test_1_fastqc.zip" }, + { assert process.out.zip[0][1][1] ==~ ".*/test_2_fastqc.zip" }, + { assert process.out.zip[0][1][2] ==~ ".*/test_3_fastqc.zip" }, + { assert process.out.zip[0][1][3] ==~ ".*/test_4_fastqc.zip" }, + { assert path(process.out.html[0][1][0]).text.contains("File typeConventional base calls") }, + { assert path(process.out.html[0][1][1]).text.contains("File typeConventional base calls") }, + { assert path(process.out.html[0][1][2]).text.contains("File typeConventional base calls") }, + { assert path(process.out.html[0][1][3]).text.contains("File typeConventional base calls") }, + { assert snapshot(process.out.versions).match() } ) } } @@ -173,21 +162,18 @@ nextflow_process { then { assertAll ( - { assert process.success }, - - { assert process.out.html[0][1] ==~ ".*/mysample_fastqc.html" }, - { assert process.out.zip[0][1] ==~ ".*/mysample_fastqc.zip" }, - { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, - - { assert snapshot(process.out.versions).match("fastqc_versions_custom_prefix") } + { assert process.success }, + { assert process.out.html[0][1] ==~ ".*/mysample_fastqc.html" }, + { assert process.out.zip[0][1] ==~ ".*/mysample_fastqc.zip" }, + { assert path(process.out.html[0][1]).text.contains("File typeConventional base calls") }, + { assert snapshot(process.out.versions).match() } ) } } test("sarscov2 single-end [fastq] - stub") { - options "-stub" - + options "-stub" when { process { """ @@ -201,12 +187,123 @@ nextflow_process { then { assertAll ( - { assert process.success }, - { assert snapshot(process.out.html.collect { file(it[1]).getName() } + - process.out.zip.collect { file(it[1]).getName() } + - process.out.versions ).match("fastqc_stub") } + { assert process.success }, + { assert snapshot(process.out).match() } ) } } + test("sarscov2 paired-end [fastq] - stub") { + + options "-stub" + when { + process { + """ + 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) ] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 interleaved [fastq] - stub") { + + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_interleaved.fastq.gz', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 paired-end [bam] - stub") { + + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [id: 'test', single_end: false], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 multiple [fastq] - stub") { + + options "-stub" + when { + process { + """ + 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/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) ] + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("sarscov2 custom_prefix - stub") { + + options "-stub" + when { + process { + """ + input[0] = Channel.of([ + [ id:'mysample', single_end:true ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) + ]) + """ + } + } + + then { + assertAll ( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } } diff --git a/modules/nf-core/fastqc/tests/main.nf.test.snap b/modules/nf-core/fastqc/tests/main.nf.test.snap index 86f7c311..d5db3092 100644 --- a/modules/nf-core/fastqc/tests/main.nf.test.snap +++ b/modules/nf-core/fastqc/tests/main.nf.test.snap @@ -1,88 +1,392 @@ { - "fastqc_versions_interleaved": { + "sarscov2 custom_prefix": { "content": [ [ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.3" }, - "timestamp": "2024-01-31T17:40:07.293713" + "timestamp": "2024-07-22T11:02:16.374038" }, - "fastqc_stub": { + "sarscov2 single-end [fastq] - stub": { "content": [ - [ - "test.html", - "test.zip", - "versions.yml:md5,e1cc25ca8af856014824abd842e93978" - ] + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "html": [ + [ + { + "id": "test", + "single_end": true + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "zip": [ + [ + { + "id": "test", + "single_end": true + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-07-22T11:02:24.993809" + }, + "sarscov2 custom_prefix - stub": { + "content": [ + { + "0": [ + [ + { + "id": "mysample", + "single_end": true + }, + "mysample.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "mysample", + "single_end": true + }, + "mysample.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "html": [ + [ + { + "id": "mysample", + "single_end": true + }, + "mysample.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "zip": [ + [ + { + "id": "mysample", + "single_end": true + }, + "mysample.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.3" }, - "timestamp": "2024-01-31T17:31:01.425198" + "timestamp": "2024-07-22T11:03:10.93942" }, - "fastqc_versions_multiple": { + "sarscov2 interleaved [fastq]": { "content": [ [ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.3" }, - "timestamp": "2024-01-31T17:40:55.797907" + "timestamp": "2024-07-22T11:01:42.355718" }, - "fastqc_versions_bam": { + "sarscov2 paired-end [bam]": { "content": [ [ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.3" }, - "timestamp": "2024-01-31T17:40:26.795862" + "timestamp": "2024-07-22T11:01:53.276274" }, - "fastqc_versions_single": { + "sarscov2 multiple [fastq]": { "content": [ [ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.3" }, - "timestamp": "2024-01-31T17:39:27.043675" + "timestamp": "2024-07-22T11:02:05.527626" }, - "fastqc_versions_paired": { + "sarscov2 paired-end [fastq]": { "content": [ [ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-07-22T11:01:31.188871" + }, + "sarscov2 paired-end [fastq] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "zip": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-07-22T11:02:34.273566" + }, + "sarscov2 multiple [fastq] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "zip": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" }, - "timestamp": "2024-01-31T17:39:47.584191" + "timestamp": "2024-07-22T11:03:02.304411" }, - "fastqc_versions_custom_prefix": { + "sarscov2 single-end [fastq]": { "content": [ [ "versions.yml:md5,e1cc25ca8af856014824abd842e93978" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-07-22T11:01:19.095607" + }, + "sarscov2 interleaved [fastq] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "zip": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" + }, + "timestamp": "2024-07-22T11:02:44.640184" + }, + "sarscov2 paired-end [bam] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e1cc25ca8af856014824abd842e93978" + ], + "zip": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.3" }, - "timestamp": "2024-01-31T17:41:14.576531" + "timestamp": "2024-07-22T11:02:53.550742" } } \ No newline at end of file diff --git a/modules/nf-core/fastqc/tests/tags.yml b/modules/nf-core/fastqc/tests/tags.yml deleted file mode 100644 index 7834294b..00000000 --- a/modules/nf-core/fastqc/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -fastqc: - - modules/nf-core/fastqc/** diff --git a/modules/nf-core/samtools/view/environment.yml b/modules/nf-core/samtools/view/environment.yml index b0676f33..89e12a64 100644 --- a/modules/nf-core/samtools/view/environment.yml +++ b/modules/nf-core/samtools/view/environment.yml @@ -1,8 +1,10 @@ -name: samtools_view +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda - - defaults dependencies: - - bioconda::samtools=1.19.2 - - bioconda::htslib=1.19.1 + # renovate: datasource=conda depName=bioconda/htslib + - bioconda::htslib=1.22.1 + # renovate: datasource=conda depName=bioconda/samtools + - bioconda::samtools=1.22.1 diff --git a/modules/nf-core/samtools/view/main.nf b/modules/nf-core/samtools/view/main.nf index 5a8989d6..02d9b0f9 100644 --- a/modules/nf-core/samtools/view/main.nf +++ b/modules/nf-core/samtools/view/main.nf @@ -4,22 +4,25 @@ process SAMTOOLS_VIEW { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/samtools:1.19.2--h50ea8bc_0' : - 'biocontainers/samtools:1.19.2--h50ea8bc_0' }" + 'https://depot.galaxyproject.org/singularity/samtools:1.22.1--h96c455f_0' : + 'biocontainers/samtools:1.22.1--h96c455f_0' }" input: tuple val(meta), path(input), path(index) tuple val(meta2), path(fasta) path qname + val index_format output: - tuple val(meta), path("*.bam"), emit: bam, optional: true - tuple val(meta), path("*.cram"), emit: cram, optional: true - tuple val(meta), path("*.sam"), emit: sam, optional: true - tuple val(meta), path("*.bai"), emit: bai, optional: true - tuple val(meta), path("*.csi"), emit: csi, optional: true - tuple val(meta), path("*.crai"), emit: crai, optional: true - path "versions.yml", emit: versions + tuple val(meta), path("${prefix}.bam"), emit: bam, optional: true + tuple val(meta), path("${prefix}.cram"), emit: cram, optional: true + tuple val(meta), path("${prefix}.sam"), emit: sam, optional: true + tuple val(meta), path("${prefix}.${file_type}.bai"), emit: bai, optional: true + tuple val(meta), path("${prefix}.${file_type}.csi"), emit: csi, optional: true + tuple val(meta), path("${prefix}.${file_type}.crai"), emit: crai, optional: true + tuple val(meta), path("${prefix}.unselected.${file_type}"), emit: unselected, optional: true + tuple val(meta), path("${prefix}.unselected.${file_type}.{csi,crai}"), emit: unselected_index, optional: true + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when @@ -27,22 +30,34 @@ process SAMTOOLS_VIEW { script: def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" + prefix = task.ext.prefix ?: "${meta.id}" def reference = fasta ? "--reference ${fasta}" : "" - def readnames = qname ? "--qname-file ${qname}": "" - def file_type = args.contains("--output-fmt sam") ? "sam" : - args.contains("--output-fmt bam") ? "bam" : - args.contains("--output-fmt cram") ? "cram" : - input.getExtension() + file_type = args.contains("--output-fmt sam") ? "sam" : + args.contains("--output-fmt bam") ? "bam" : + args.contains("--output-fmt cram") ? "cram" : + input.getExtension() + + output_file = index_format ? "${prefix}.${file_type}##idx##${prefix}.${file_type}.${index_format} --write-index" : "${prefix}.${file_type}" + // Can't choose index type of unselected file + readnames = qname ? "--qname-file ${qname} --output-unselected ${prefix}.unselected.${file_type}": "" + if ("$input" == "${prefix}.${file_type}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + if (index_format) { + if (!index_format.matches('bai|csi|crai')) { + error "Index format not one of bai, csi, crai." + } else if (file_type == "sam") { + error "Indexing not compatible with SAM output" + } + } """ + # Note: --threads value represents *additional* CPUs to allocate (total CPUs = 1 + --threads). samtools \\ view \\ --threads ${task.cpus-1} \\ ${reference} \\ ${readnames} \\ $args \\ - -o ${prefix}.${file_type} \\ + -o ${output_file} \\ $input \\ $args2 @@ -54,18 +69,32 @@ process SAMTOOLS_VIEW { stub: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def file_type = args.contains("--output-fmt sam") ? "sam" : - args.contains("--output-fmt bam") ? "bam" : - args.contains("--output-fmt cram") ? "cram" : - input.getExtension() - if ("$input" == "${prefix}.${file_type}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" - - def index = args.contains("--write-index") ? "touch ${prefix}.csi" : "" + prefix = task.ext.prefix ?: "${meta.id}" + file_type = args.contains("--output-fmt sam") ? "sam" : + args.contains("--output-fmt bam") ? "bam" : + args.contains("--output-fmt cram") ? "cram" : + input.getExtension() + default_index_format = + file_type == "bam" ? "csi" : + file_type == "cram" ? "crai" : "" + index = index_format ? "touch ${prefix}.${file_type}.${index_format}" : args.contains("--write-index") ? "touch ${prefix}.${file_type}.${default_index_format}" : "" + unselected = qname ? "touch ${prefix}.unselected.${file_type}" : "" + // Can't choose index type of unselected file + unselected_index = qname && (args.contains("--write-index") || index_format) ? "touch ${prefix}.unselected.${file_type}.${default_index_format}" : "" + if ("$input" == "${prefix}.${file_type}") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!" + if (index_format) { + if (!index_format.matches('bai|csi|crai')) { + error "Index format not one of bai, csi, crai." + } else if (file_type == "sam") { + error "Indexing not compatible with SAM output." + } + } """ touch ${prefix}.${file_type} ${index} + ${unselected} + ${unselected_index} cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/samtools/view/meta.yml b/modules/nf-core/samtools/view/meta.yml index 3dadafae..3ebbdb89 100644 --- a/modules/nf-core/samtools/view/meta.yml +++ b/modules/nf-core/samtools/view/meta.yml @@ -15,68 +15,138 @@ tools: documentation: http://www.htslib.org/doc/samtools.html doi: 10.1093/bioinformatics/btp352 licence: ["MIT"] + identifier: biotools:samtools input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - input: - type: file - description: BAM/CRAM/SAM file - pattern: "*.{bam,cram,sam}" - - index: - type: file - description: BAM.BAI/BAM.CSI/CRAM.CRAI file (optional) - pattern: "*.{.bai,.csi,.crai}" - - meta2: - type: map - description: | - Groovy Map containing reference information - e.g. [ id:'test' ] - - fasta: - type: file - description: Reference file the CRAM was created with (optional) - pattern: "*.{fasta,fa}" + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - input: + type: file + description: BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + ontologies: [] + - index: + type: file + description: BAM.BAI/BAM.CSI/CRAM.CRAI file (optional) + pattern: "*.{.bai,.csi,.crai}" + ontologies: [] + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test' ] + - fasta: + type: file + description: Reference file the CRAM was created with (optional) + pattern: "*.{fasta,fa}" + ontologies: [] - qname: type: file description: Optional file with read names to output only select alignments pattern: "*.{txt,list}" + ontologies: [] + - index_format: + type: string + description: Index format, used together with ext.args = '--write-index' + pattern: "bai|csi|crai" output: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - bam: - type: file - description: optional filtered/converted BAM file - pattern: "*.{bam}" - - cram: - type: file - description: optional filtered/converted CRAM file - pattern: "*.{cram}" - - sam: - type: file - description: optional filtered/converted SAM file - pattern: "*.{sam}" - # bai, csi, and crai are created with `--write-index` - - bai: - type: file - description: optional BAM file index - pattern: "*.{bai}" - - csi: - type: file - description: optional tabix BAM file index - pattern: "*.{csi}" - - crai: - type: file - description: optional CRAM file index - pattern: "*.{crai}" - - versions: - type: file - description: File containing software versions - pattern: "versions.yml" + bam: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.bam: + type: file + description: optional filtered/converted BAM file + pattern: "*.{bam}" + ontologies: [] + cram: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.cram: + type: file + description: optional filtered/converted CRAM file + pattern: "*.{cram}" + ontologies: [] + sam: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.sam: + type: file + description: optional filtered/converted SAM file + pattern: "*.{sam}" + ontologies: [] + bai: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.${file_type}.bai: + type: file + description: optional BAM file index + pattern: "*.{bai}" + ontologies: [] + csi: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.${file_type}.csi: + type: file + description: optional tabix BAM file index + pattern: "*.{csi}" + ontologies: [] + crai: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.${file_type}.crai: + type: file + description: optional CRAM file index + pattern: "*.{crai}" + ontologies: [] + unselected: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.unselected.${file_type}: + type: file + description: optional file with unselected alignments + pattern: "*.unselected.{bam,cram,sam}" + ontologies: [] + unselected_index: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - ${prefix}.unselected.${file_type}.{csi,crai}: + type: file + description: index for the "unselected" file + pattern: "*.unselected.{csi,crai}" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@drpatelh" - "@joseespinosa" diff --git a/modules/nf-core/samtools/view/tests/cram_index.config b/modules/nf-core/samtools/view/tests/cram_index.config new file mode 100644 index 00000000..ed87c334 --- /dev/null +++ b/modules/nf-core/samtools/view/tests/cram_index.config @@ -0,0 +1,3 @@ +process { + ext.args = "--output-fmt cram --write-index" +} diff --git a/modules/nf-core/samtools/view/tests/main.nf.test b/modules/nf-core/samtools/view/tests/main.nf.test index 45a0defb..d8551dd8 100644 --- a/modules/nf-core/samtools/view/tests/main.nf.test +++ b/modules/nf-core/samtools/view/tests/main.nf.test @@ -21,6 +21,7 @@ nextflow_process { ]) input[1] = [[],[]] input[2] = [] + input[3] = [] """ } } @@ -39,6 +40,135 @@ nextflow_process { } } + test("bam_csi_index") { + + config "./bam_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = [] + input[3] = 'csi' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + file(process.out.csi[0][1]).name, + process.out.versions).match() + } + ) + } + } + + test("bam_bai_index") { + + config "./bam_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = [] + input[3] = 'bai' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + file(process.out.bai[0][1]).name, + process.out.versions).match() } + ) + } + } + + test("bam_bai_index_unselected") { + + config "./bam_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = Channel.of('testN:1') + .collectFile(name: 'selected_reads.txt') + input[3] = 'bai' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.bam[0][1]).name, + file(process.out.bai[0][1]).name, + file(process.out.unselected[0][1]).name, + file(process.out.unselected_index[0][1]).name, + process.out.versions).match() + } + ) + } + } + + test("cram_crai_index_unselected") { + + config "./cram_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = Channel.of('testN:1') + .collectFile(name: 'selected_reads.txt') + input[3] = 'crai' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + file(process.out.cram[0][1]).name, + file(process.out.crai[0][1]).name, + file(process.out.unselected[0][1]).name, + file(process.out.unselected_index[0][1]).name, + process.out.versions).match() + } + ) + } + } + test("cram") { when { @@ -54,6 +184,7 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ]) input[2] = [] + input[3] = [] """ } } @@ -89,6 +220,7 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ]) input[2] = [] + input[3] = [] """ } } @@ -124,6 +256,7 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ]) input[2] = [] + input[3] = [] """ } } @@ -159,6 +292,7 @@ nextflow_process { file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ]) input[2] = Channel.of("testN:2817", "testN:2814").collectFile(name: "readnames.list", newLine: true) + input[3] = [] """ } } @@ -172,6 +306,8 @@ nextflow_process { { assert snapshot(process.out.crai).match("cram_to_bam_index_qname_crai") }, { assert snapshot(process.out.cram).match("cram_to_bam_index_qname_cram") }, { assert snapshot(process.out.sam).match("cram_to_bam_index_qname_sam") }, + { assert snapshot(file(process.out.unselected[0][1]).name).match("cram_to_bam_index_qname_unselected") }, + { assert snapshot(file(process.out.unselected_index[0][1]).name).match("cram_to_bam_index_qname_unselected_csi") }, { assert snapshot(process.out.versions).match("cram_to_bam_index_qname_versions") } ) } @@ -192,6 +328,7 @@ nextflow_process { ]) input[1] = [[],[]] input[2] = [] + input[3] = [] """ } } @@ -209,4 +346,118 @@ nextflow_process { ) } } + + test("bam_csi_index - stub") { + + options "-stub" + config "./bam_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = [] + input[3] = 'csi' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("bam_bai_index - stub") { + + options "-stub" + config "./bam_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = [] + input[3] = 'bai' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("bam_bai_index_uselected - stub") { + + options "-stub" + config "./bam_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = Channel.of('testN:1') + .collectFile(name: 'selected_reads.txt') + input[3] = 'bai' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("cram_crai_index_unselected - stub") { + + options "-stub" + config "./cram_index.config" + + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] + ]) + input[1] = [[],[]] + input[2] = Channel.of('testN:1') + .collectFile(name: 'selected_reads.txt') + input[3] = 'crai' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } } diff --git a/modules/nf-core/samtools/view/tests/main.nf.test.snap b/modules/nf-core/samtools/view/tests/main.nf.test.snap index f55943a7..5ec65d62 100644 --- a/modules/nf-core/samtools/view/tests/main.nf.test.snap +++ b/modules/nf-core/samtools/view/tests/main.nf.test.snap @@ -9,16 +9,6 @@ }, "timestamp": "2024-02-12T19:37:51.256068" }, - "cram_to_bam_index_csi": { - "content": [ - "test.bam.csi" - ], - "meta": { - "nf-test": "0.8.4", - "nextflow": "23.04.3" - }, - "timestamp": "2024-02-12T19:38:12.958617" - }, "bam_stub_bam": { "content": [ "test.bam" @@ -56,28 +46,36 @@ "bam_stub_versions": { "content": [ [ - "versions.yml:md5,4ea32c57d546102a1b32d9693ada7cf1" + "versions.yml:md5,376bd183239f91c807210bfeb299d306" ] ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:20:28.366024" + }, + "cram_to_bam_index_qname_csi": { + "content": [ + "test.bam.csi" + ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.04.3" }, - "timestamp": "2024-02-13T16:13:09.713353823" + "timestamp": "2024-02-12T19:38:23.325496" }, - "cram_to_bam_index_cram": { + "cram_to_bam_index_qname_unselected_csi": { "content": [ - [ - - ] + "test.unselected.bam.csi" ], "meta": { "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:12.972288" + "timestamp": "2024-02-12T19:38:23.328458" }, - "cram_to_bam_sam": { + "bam_csi": { "content": [ [ @@ -87,45 +85,170 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:04.999247" + "timestamp": "2024-02-12T19:37:51.262882" }, - "cram_to_bam_index_sam": { + "cram_to_bam_index_bam": { "content": [ - [ - - ] + "test.bam" ], "meta": { "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:12.976457" + "timestamp": "2024-02-12T19:38:12.95456" }, - "cram_crai": { + "cram_to_bam_index_versions": { "content": [ [ - + "versions.yml:md5,376bd183239f91c807210bfeb299d306" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.04.3" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-12T19:37:56.497581" + "timestamp": "2025-09-10T15:20:20.3853" }, - "cram_csi": { + "bam_csi_index": { "content": [ + "test.bam", + "test.bam.csi", [ - + "versions.yml:md5,376bd183239f91c807210bfeb299d306" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.04.3" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-12T19:37:56.50038" + "timestamp": "2025-09-10T15:19:54.889079" }, - "cram_to_bam_cram": { + "bam_versions": { + "content": [ + [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:19:51.017781" + }, + "cram_crai_index_unselected - stub": { + "content": [ + { + "0": [ + + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.cram:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "test.cram.crai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.cram:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.cram.crai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ], + "bai": [ + + ], + "bam": [ + + ], + "crai": [ + [ + { + "id": "test", + "single_end": false + }, + "test.cram.crai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "cram": [ + [ + { + "id": "test", + "single_end": false + }, + "test.cram:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "csi": [ + + ], + "sam": [ + + ], + "unselected": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.cram:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "unselected_index": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.cram.crai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:20:44.809515" + }, + "bam_crai": { "content": [ [ @@ -135,19 +258,21 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:04.992239" + "timestamp": "2024-02-12T19:37:51.259774" }, - "cram_to_bam_index_qname_csi": { + "bam_cram": { "content": [ - "test.bam.csi" + [ + + ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:23.325496" + "timestamp": "2024-02-12T19:37:51.261287" }, - "bam_stub_sam": { + "cram_sam": { "content": [ [ @@ -157,19 +282,21 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:32.079529" + "timestamp": "2024-02-12T19:37:56.502625" }, - "cram_cram": { + "cram_versions": { "content": [ - "test.cram" + [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.04.3" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-12T19:37:56.490286" + "timestamp": "2025-09-10T15:20:12.471005" }, - "bam_csi": { + "cram_to_bam_index_bai": { "content": [ [ @@ -179,9 +306,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:37:51.262882" + "timestamp": "2024-02-12T19:38:12.962863" }, - "cram_to_bam_crai": { + "cram_to_bam_index_qname_sam": { "content": [ [ @@ -191,65 +318,247 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:04.989247" + "timestamp": "2024-02-12T19:38:23.337634" }, - "cram_to_bam_index_crai": { + "bam_csi_index - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + + ], + "8": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ], + "bai": [ + + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "sam": [ + + ], + "unselected": [ + + ], + "unselected_index": [ + + ], + "versions": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:20:32.118817" + }, + "cram_to_bam_index_csi": { "content": [ - [ - - ] + "test.bam.csi" ], "meta": { "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:12.967681" + "timestamp": "2024-02-12T19:38:12.958617" }, - "cram_to_bam_index_qname_versions": { + "bam_bai_index": { "content": [ + "test.bam", + "test.bam.bai", [ - "versions.yml:md5,4ea32c57d546102a1b32d9693ada7cf1" + "versions.yml:md5,376bd183239f91c807210bfeb299d306" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-13T16:13:03.935041046" + "timestamp": "2025-09-10T15:19:58.85102" }, - "cram_to_bam_bam": { + "cram_to_bam_index_cram": { "content": [ - "test.bam" + [ + + ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:04.982361" + "timestamp": "2024-02-12T19:38:12.972288" }, - "cram_to_bam_index_bam": { + "bam_bai_index - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + + ], + "8": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ], + "bai": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + + ], + "sam": [ + + ], + "unselected": [ + + ], + "unselected_index": [ + + ], + "versions": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:20:35.787886" + }, + "cram_to_bam_sam": { "content": [ - "test.bam" + [ + + ] ], "meta": { "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:12.95456" + "timestamp": "2024-02-12T19:38:04.999247" }, - "cram_to_bam_index_versions": { + "cram_to_bam_index_sam": { "content": [ [ - "versions.yml:md5,4ea32c57d546102a1b32d9693ada7cf1" + ] ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.04.3" }, - "timestamp": "2024-02-13T16:12:55.910685496" + "timestamp": "2024-02-12T19:38:12.976457" }, - "cram_to_bam_bai": { + "cram_crai": { "content": [ [ @@ -259,21 +568,21 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:04.98601" + "timestamp": "2024-02-12T19:37:56.497581" }, - "cram_to_bam_versions": { + "cram_csi": { "content": [ [ - "versions.yml:md5,4ea32c57d546102a1b32d9693ada7cf1" + ] ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.04.3" }, - "timestamp": "2024-02-13T16:12:47.715221169" + "timestamp": "2024-02-12T19:37:56.50038" }, - "cram_bam": { + "cram_to_bam_cram": { "content": [ [ @@ -283,9 +592,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:37:56.495512" + "timestamp": "2024-02-12T19:38:04.992239" }, - "bam_stub_cram": { + "bam_stub_sam": { "content": [ [ @@ -295,9 +604,19 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:32.076908" + "timestamp": "2024-02-12T19:38:32.079529" }, - "cram_to_bam_index_qname_bai": { + "cram_cram": { + "content": [ + "test.cram" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.3" + }, + "timestamp": "2024-02-12T19:37:56.490286" + }, + "cram_to_bam_crai": { "content": [ [ @@ -307,9 +626,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:23.328458" + "timestamp": "2024-02-12T19:38:04.989247" }, - "cram_to_bam_index_qname_crai": { + "cram_to_bam_index_crai": { "content": [ [ @@ -319,21 +638,47 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:23.330789" + "timestamp": "2024-02-12T19:38:12.967681" }, - "cram_bai": { + "cram_crai_index_unselected": { "content": [ + "test.cram", + "test.cram.crai", + "test.unselected.cram", + "test.unselected.cram.crai", [ - + "versions.yml:md5,376bd183239f91c807210bfeb299d306" ] ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:20:07.026136" + }, + "cram_to_bam_index_qname_versions": { + "content": [ + [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:20:24.609054" + }, + "cram_to_bam_bam": { + "content": [ + "test.bam" + ], "meta": { "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:37:56.493129" + "timestamp": "2024-02-12T19:38:04.982361" }, - "bam_stub_crai": { + "cram_to_bam_bai": { "content": [ [ @@ -343,31 +688,33 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:32.074313" + "timestamp": "2024-02-12T19:38:04.98601" }, - "cram_to_bam_index_qname_bam": { + "cram_to_bam_versions": { "content": [ - "test.bam" + [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.04.3" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-12T19:38:23.322874" + "timestamp": "2025-09-10T15:20:16.51014" }, - "bam_versions": { + "cram_bam": { "content": [ [ - "versions.yml:md5,4ea32c57d546102a1b32d9693ada7cf1" + ] ], "meta": { "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nextflow": "23.04.3" }, - "timestamp": "2024-02-13T16:12:31.692607421" + "timestamp": "2024-02-12T19:37:56.495512" }, - "cram_to_bam_index_qname_cram": { + "bam_stub_cram": { "content": [ [ @@ -377,9 +724,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:23.333248" + "timestamp": "2024-02-12T19:38:32.076908" }, - "bam_crai": { + "cram_to_bam_index_qname_bai": { "content": [ [ @@ -389,9 +736,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:37:51.259774" + "timestamp": "2024-02-12T19:38:23.328458" }, - "bam_cram": { + "cram_to_bam_index_qname_crai": { "content": [ [ @@ -401,9 +748,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:37:51.261287" + "timestamp": "2024-02-12T19:38:23.330789" }, - "cram_to_bam_csi": { + "cram_bai": { "content": [ [ @@ -413,9 +760,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:04.995454" + "timestamp": "2024-02-12T19:37:56.493129" }, - "cram_sam": { + "bam_stub_crai": { "content": [ [ @@ -425,21 +772,35 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:37:56.502625" + "timestamp": "2024-02-12T19:38:32.074313" }, - "cram_versions": { + "cram_to_bam_index_qname_bam": { "content": [ + "test.bam" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.3" + }, + "timestamp": "2024-02-12T19:38:23.322874" + }, + "bam_bai_index_unselected": { + "content": [ + "test.bam", + "test.bam.bai", + "test.unselected.bam", + "test.unselected.bam.csi", [ - "versions.yml:md5,4ea32c57d546102a1b32d9693ada7cf1" + "versions.yml:md5,376bd183239f91c807210bfeb299d306" ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "24.01.0" + "nf-test": "0.9.2", + "nextflow": "25.04.6" }, - "timestamp": "2024-02-13T16:12:39.913411036" + "timestamp": "2025-09-10T15:20:03.049076" }, - "bam_sam": { + "cram_to_bam_index_qname_cram": { "content": [ [ @@ -449,9 +810,9 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:37:51.264651" + "timestamp": "2024-02-12T19:38:23.333248" }, - "cram_to_bam_index_bai": { + "cram_to_bam_csi": { "content": [ [ @@ -461,9 +822,132 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:12.962863" + "timestamp": "2024-02-12T19:38:04.995454" }, - "cram_to_bam_index_qname_sam": { + "bam_bai_index_uselected - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.bam.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ], + "bai": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "crai": [ + + ], + "cram": [ + + ], + "csi": [ + + ], + "sam": [ + + ], + "unselected": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "unselected_index": [ + [ + { + "id": "test", + "single_end": false + }, + "test.unselected.bam.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,376bd183239f91c807210bfeb299d306" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-10T15:20:39.633146" + }, + "cram_to_bam_index_qname_unselected": { + "content": [ + "test.unselected.bam" + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.04.3" + }, + "timestamp": "2024-02-12T19:38:23.322874" + }, + "bam_sam": { "content": [ [ @@ -473,11 +957,11 @@ "nf-test": "0.8.4", "nextflow": "23.04.3" }, - "timestamp": "2024-02-12T19:38:23.337634" + "timestamp": "2024-02-12T19:37:51.264651" }, "bam_stub_csi": { "content": [ - "test.csi" + "test.bam.csi" ], "meta": { "nf-test": "0.8.4", diff --git a/modules/nf-core/samtools/view/tests/tags.yml b/modules/nf-core/samtools/view/tests/tags.yml deleted file mode 100644 index 4fdf1dd1..00000000 --- a/modules/nf-core/samtools/view/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -samtools/view: - - "modules/nf-core/samtools/view/**" diff --git a/modules/nf-core/snapaligner/align/environment.yml b/modules/nf-core/snapaligner/align/environment.yml index cc8b82da..5dc75127 100644 --- a/modules/nf-core/snapaligner/align/environment.yml +++ b/modules/nf-core/snapaligner/align/environment.yml @@ -1,7 +1,8 @@ -name: snapaligner_align +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json channels: - conda-forge - bioconda - - defaults dependencies: - - bioconda::snap-aligner=2.0.3 + # renovate: datasource=conda depName=bioconda/snap-aligner + - bioconda::snap-aligner=2.0.5 diff --git a/modules/nf-core/snapaligner/align/main.nf b/modules/nf-core/snapaligner/align/main.nf index 9e47c16e..ffda274d 100644 --- a/modules/nf-core/snapaligner/align/main.nf +++ b/modules/nf-core/snapaligner/align/main.nf @@ -4,8 +4,8 @@ process SNAPALIGNER_ALIGN { conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/snap-aligner:2.0.3--hd03093a_0': - 'biocontainers/snap-aligner:2.0.3--hd03093a_0' }" + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/21/21f75cd3d97dfe58e62bea51751b04d33a03a16eae3e9947335d569e22962143/data': + 'community.wave.seqera.io/library/snap-aligner:2.0.5--23601d3a3a2ae452' }" input: tuple val(meta) , path(reads, stageAs: "?/*") @@ -40,4 +40,15 @@ process SNAPALIGNER_ALIGN { snapaligner: \$(snap-aligner 2>&1| head -n 1 | sed 's/^.*version //;s/.\$//') END_VERSIONS """ + + stub: + """ + touch test.bam + touch test.bam.bai + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + snapaligner: \$(snap-aligner 2>&1| head -n 1 | sed 's/^.*version //;s/.\$//') + END_VERSIONS + """ } diff --git a/modules/nf-core/snapaligner/align/meta.yml b/modules/nf-core/snapaligner/align/meta.yml index 16e2a5e6..66f2fca4 100644 --- a/modules/nf-core/snapaligner/align/meta.yml +++ b/modules/nf-core/snapaligner/align/meta.yml @@ -8,50 +8,70 @@ keywords: - sam tools: - "snapaligner": - description: "Scalable Nucleotide Alignment Program -- a fast and accurate read aligner for high-throughput sequencing data" + description: "Scalable Nucleotide Alignment Program -- a fast and accurate read + aligner for high-throughput sequencing data" homepage: "http://snap.cs.berkeley.edu" documentation: "https://1drv.ms/b/s!AhuEg_0yZD86hcpblUt-muHKYsG8fA?e=R8ogug" tool_dev_url: "https://github.com/amplab/snap" doi: "10.1101/2021.11.23.469039" - licence: "['Apache v2']" + licence: ["Apache v2"] + identifier: "" input: - - meta: - type: map - description: | - Groovy Map containing sample information - e.g. [ id:'test', single_end:false ] - - reads: - type: file - description: List of input fastq files of size 2 for paired fastq or 1 for bam or single fastq - pattern: "*.{fastq.gz,fq.gz,fastq,fq,bam}" - - meta2: - type: map - description: | - Groovy Map containing reference information - e.g. [ id:'test', single_end:false ] - - index: - type: file - description: List of SNAP genome index files - pattern: "{Genome,GenomeIndex,GenomeIndexHash,OverflowTable}" + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: List of input fastq files of size 2 for paired fastq or 1 for bam + or single fastq + pattern: "*.{fastq.gz,fq.gz,fastq,fq,bam}" + ontologies: + - edam: http://edamontology.org/format_1930 # FASTQ + - - meta2: + type: map + description: | + Groovy Map containing reference information + e.g. [ id:'test', single_end:false ] + - index: + type: file + description: List of SNAP genome index files + pattern: "{Genome,GenomeIndex,GenomeIndexHash,OverflowTable}" + ontologies: [] 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" - - bam: - type: file - description: Aligned BAM file - pattern: "*.{bam}" - - bai: - type: file - description: Optional aligned BAM file index - pattern: "*.{bai}" + bam: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.bam": + type: file + description: Aligned BAM file + pattern: "*.{bam}" + ontologies: [] + bai: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*.bai": + type: file + description: Optional aligned BAM file index + pattern: "*.{bai}" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML authors: - "@matthdsm" maintainers: - "@matthdsm" + - "@delfiterradas" + - "@sofiromano" diff --git a/modules/nf-core/snapaligner/align/tests/main.nf.test b/modules/nf-core/snapaligner/align/tests/main.nf.test new file mode 100644 index 00000000..43a6d935 --- /dev/null +++ b/modules/nf-core/snapaligner/align/tests/main.nf.test @@ -0,0 +1,139 @@ +nextflow_process { + + name "Test Process SNAPALIGNER_ALIGN" + config "./nextflow.config" + script "../main.nf" + process "SNAPALIGNER_ALIGN" + + tag "modules" + tag "modules_nfcore" + tag "snapaligner" + tag "snapaligner/index" + tag "snapaligner/align" + + test("test_snapaligner_single") { + + setup { + run("SNAPALIGNER_INDEX") { + script "../../index/main.nf" + + process { + """ + input[0] = [ + [id:"test"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists:true), + [], + [], + [] + ] + """ + } + } + } + when { + params { + module_args = "-so" + } + process { + """ + input[0] = [ + [id:'test',single_end:true],// meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz',checkIfExists:true)] + ] + input[1] = SNAPALIGNER_INDEX.out.index + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + test("test_snapaligner_paired") { + + setup { + run("SNAPALIGNER_INDEX") { + script "../../index/main.nf" + + process { + """ + input[0] = [ + [id:"test"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists:true), + [], + [], + [] + ] + """ + } + } + } + when { + params { + module_args = "-so" + } + process { + """ + input[0] = [ + [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] = SNAPALIGNER_INDEX.out.index + """ + } + } + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } + + test("test_snapaligner_stub") { + options '-stub' + + setup { + run("SNAPALIGNER_INDEX") { + script "../../index/main.nf" + + process { + """ + input[0] = [ + [id:"test"], + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists:true), + [], + [], + [] + ] + """ + } + } + } + + when { + params { + module_args = "-so" + } + process { + """ + input[0] = [ + [id:'test',single_end:true],// meta map + [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists:true)] + ] + input[1] = SNAPALIGNER_INDEX.out.index + + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} \ No newline at end of file diff --git a/modules/nf-core/snapaligner/align/tests/main.nf.test.snap b/modules/nf-core/snapaligner/align/tests/main.nf.test.snap new file mode 100644 index 00000000..f660cd39 --- /dev/null +++ b/modules/nf-core/snapaligner/align/tests/main.nf.test.snap @@ -0,0 +1,161 @@ +{ + "test_snapaligner_single": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,fc98a93036a3c5f7c674d470f7c5515a" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,c46eb41ccbca7a9a9a8522e44c2cd490" + ] + ], + "2": [ + "versions.yml:md5,dd98393cd432d8472209fcb8f6be362f" + ], + "bai": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,c46eb41ccbca7a9a9a8522e44c2cd490" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,fc98a93036a3c5f7c674d470f7c5515a" + ] + ], + "versions": [ + "versions.yml:md5,dd98393cd432d8472209fcb8f6be362f" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-23T12:01:44.085165306" + }, + "test_snapaligner_stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,dd98393cd432d8472209fcb8f6be362f" + ], + "bai": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam.bai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,dd98393cd432d8472209fcb8f6be362f" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-23T12:01:58.930050472" + }, + "test_snapaligner_paired": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d4e6df5e063034da268fa4b97db369d3" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d5979aec0109084091150ceb4d87d351" + ] + ], + "2": [ + "versions.yml:md5,dd98393cd432d8472209fcb8f6be362f" + ], + "bai": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.bai:md5,d5979aec0109084091150ceb4d87d351" + ] + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d4e6df5e063034da268fa4b97db369d3" + ] + ], + "versions": [ + "versions.yml:md5,dd98393cd432d8472209fcb8f6be362f" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-23T12:01:51.606664577" + } +} \ No newline at end of file diff --git a/modules/nf-core/snapaligner/align/tests/nextflow.config b/modules/nf-core/snapaligner/align/tests/nextflow.config new file mode 100644 index 00000000..9b117ae2 --- /dev/null +++ b/modules/nf-core/snapaligner/align/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: "SNAPALIGNER_ALIGN" { + ext.args = params.module_args + } +} diff --git a/modules/nf-core/strobealign/environment.yml b/modules/nf-core/strobealign/environment.yml new file mode 100644 index 00000000..fc1f89b8 --- /dev/null +++ b/modules/nf-core/strobealign/environment.yml @@ -0,0 +1,9 @@ +channels: + - conda-forge + - bioconda + +dependencies: + - bioconda::htslib=1.22.1 + - bioconda::samtools=1.22.1 + - bioconda::strobealign=0.16.1 + - conda-forge::pigz=2.8 diff --git a/modules/nf-core/strobealign/main.nf b/modules/nf-core/strobealign/main.nf new file mode 100644 index 00000000..5ad71bac --- /dev/null +++ b/modules/nf-core/strobealign/main.nf @@ -0,0 +1,110 @@ +process STROBEALIGN { + tag "${meta.id}" + label 'process_high' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/59/59cce6872df48a1e5cc9ccee89f066210694c6ec9f62d9c931cc6925ca0f6a5f/data' : + 'community.wave.seqera.io/library/htslib_samtools_strobealign_pigz:4fa4f439c6bea386' }" + + input: + tuple val(meta) , path(reads) + tuple val(meta2), path(fasta) + tuple val(meta3), path(index) + val sort_bam + + output: + 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("*.paf.gz") , emit: paf , optional: true + tuple val(meta), path("*.tsv.gz") , emit: tsv , optional: true + tuple val(meta), path("*.sti") , emit: sti , optional: true + 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}" + + // Determine output file extension and command + def samtools_command = sort_bam ? 'sort' : 'view' + def extension = args.contains("-x") + ? "paf" + : args.contains("--aemb") + ? "tsv" + : args.contains("--create-index") + ? "sti" + : args2.contains("--output-fmt cram") + ? "cram" + : sort_bam && args2.contains("-O cram") + ? "cram" + : !sort_bam && args2.contains("-C") + ? "cram" + : "bam" + def reference = fasta && extension == "cram" ? "--reference ${fasta}" : "" + if (!fasta && extension == "cram") { + error("Fasta reference is required for CRAM output") + } + def output_cmd = extension == "bam" || extension == "cram" + ? "samtools ${samtools_command} ${args2} ${reference} --threads ${task.cpus} -o ${prefix}.${extension} -" + : extension == "paf" + ? "pigz ${args2} > ${prefix}.paf.gz" + : extension == "tsv" + ? "pigz ${args2} > ${prefix}.tsv.gz" + : extension == "sti" + ? "tee ${prefix}.log > /dev/null" + : error("Unable to determine output command for extension: ${extension}") + + """ + strobealign \\ + ${args} \\ + -t ${task.cpus} \\ + ${fasta} \\ + ${reads} \\ + | ${output_cmd} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + strobealign: \$(echo \$(strobealign --version)) + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def extension = args.contains("-x") + ? "paf" + : args.contains("--aemb") + ? "tsv" + : args2.contains("--output-fmt cram") + ? "cram" + : sort_bam && args2.contains("-O cram") + ? "cram" + : !sort_bam && args2.contains("-C") + ? "cram" + : "bam" + + """ + touch ${prefix}.${extension} + touch ${prefix}.csi + touch ${prefix}.crai + echo "" | pigz > ${prefix}.paf.gz + echo "" | pigz > ${prefix}.tsv.gz + touch ${prefix}.sti + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + strobealign: \$(echo \$(strobealign --version)) + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) + END_VERSIONS + """ +} diff --git a/modules/nf-core/strobealign/meta.yml b/modules/nf-core/strobealign/meta.yml new file mode 100644 index 00000000..e4ede404 --- /dev/null +++ b/modules/nf-core/strobealign/meta.yml @@ -0,0 +1,142 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "strobealign" +description: "Align short reads using dynamic seed size with strobemers" +keywords: + - strobealign + - strobemers + - alignment + - map + - fastq + - bam + - sam +tools: + - "strobealign": + description: "Align short reads using dynamic seed size with strobemers" + homepage: "https://github.com/ksahlin/strobealign" + documentation: "https://github.com/ksahlin/strobealign?tab=readme-ov-file#usage" + tool_dev_url: "https://github.com/ksahlin/strobealign" + doi: "10.1186/s13059-022-02831-7" + licence: ["MIT"] + identifier: biotools:strobealign + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - reads: + type: file + description: | + List of input FastQ files of size 1 and 2 for single-end and paired-end data, + respectively. + ontologies: + - edam: "http://edamontology.org/data_2044" # Sequence + - edam: "http://edamontology.org/format_1930" # FASTQ + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - fasta: + type: file + description: Reference genome in FASTA format + pattern: "*.{fasta,fa}" + ontologies: + - edam: "http://edamontology.org/data_2044" # Sequence + - edam: "http://edamontology.org/format_1929" # FASTA + - - meta3: + type: map + description: | + Groovy Map containing reference information. + e.g. [ id:'test', single_end:false ] + - index: + type: file + description: Strobealign genome index file + pattern: "*.sti" + ontologies: + - edam: "http://edamontology.org/data_3210" # Genome index + - sort_bam: + type: boolean + description: use samtools sort (true) or samtools view (false) + pattern: "true or false" +output: + bam: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.bam": + type: file + description: Output BAM file containing read alignments + pattern: "*.{bam}" + ontologies: + - edam: "http://edamontology.org/format_2572" # BAM + cram: + - - meta: + type: file + description: Output BAM file containing read alignments + ontologies: [] + - "*.cram": + type: file + description: Output CRAM file containing read alignments + pattern: "*.{cram}" + ontologies: + - edam: "http://edamontology.org/format_3462" # CRAM + csi: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.csi": + type: file + description: Optional index file for BAM file + pattern: "*.{csi}" + ontologies: [] + crai: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.crai": + type: file + description: Optional index file for CRAM file + pattern: "*.{crai}" + ontologies: [] + paf: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.paf.gz": + type: file + description: Output PAF file containing read alignments + pattern: "*.{paf.gz}" + ontologies: [] + tsv: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.tsv.gz": + type: file + description: Output TSV file containing read alignments + pattern: "*.{tsv.gz}" + ontologies: + - edam: "http://edamontology.org/format_3475" # TSV + sti: + - - meta: + type: map + description: Groovy Map containing sample information + - "*.sti": + type: file + description: Optional strobealign index file for fasta reference + pattern: "*.{sti}" + ontologies: [] + versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: http://edamontology.org/format_3750 # YAML +authors: + - "@matthdsm" +maintainers: + - "@matthdsm" + - "@nvnieuwk" diff --git a/modules/nf-core/strobealign/tests/main.nf.test b/modules/nf-core/strobealign/tests/main.nf.test new file mode 100644 index 00000000..360637c0 --- /dev/null +++ b/modules/nf-core/strobealign/tests/main.nf.test @@ -0,0 +1,303 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test strobealign +nextflow_process { + + name "Test Process STROBEALIGN" + script "../main.nf" + config './nextflow.config' + process "STROBEALIGN" + + tag "modules" + tag "modules_nfcore" + tag "strobealign" + + test("fastq - sorted bam") { + when { + params { + module_args = "" + module_args2 = "--output-fmt bam --write-index" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.bam, + process.out.csi, + process.out.versions + ).match() } + ) + } + } + + test("fastq - unsorted bam") { + when { + params { + module_args = "" + module_args2 = "--output-fmt bam" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.bam, + process.out.versions + ).match() } + ) + } + } + + test("fastq - sorted cram") { + when { + params { + module_args = "" + module_args2 = "--output-fmt cram,version=3.0 --write-index" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = true + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + cram(process.out.cram[0][1], 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/genome/genome.fasta').getReadsMD5(), + file(process.out.crai[0][1]).exists(), + process.out.versions + ).match() } + ) + } + } + + test("fastq - unsorted cram") { + when { + params { + module_args = "" + module_args2 = "--output-fmt cram,version=3.0" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + cram(process.out.cram[0][1], 'https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/genome/genome.fasta').getReadsMD5(), + process.out.versions + ).match() } + ) + } + } + + test("fastq - paf") { + when { + params { + module_args = "-x" + module_args2 = "" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.paf, + process.out.versions + ).match() } + ) + } + } + + test("fastq - tsv") { + when { + params { + module_args = "--aemb" + module_args2 = "" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.tsv, + process.out.versions + ).match() } + ) + } + } + + test("fastq - sti") { + when { + params { + module_args = "--create-index" + module_args2 = "" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.sti, + process.out.versions + ).match() } + ) + } + } + + test("stub") { + options "-stub" + when { + params { + module_args = "" + module_args2 = "" + } + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_1.fastq.gz', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test2_2.fastq.gz', checkIfExists: true) + ], + ] + input[1] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), + ] + input[2] = [[:], []] + input[3] = false + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/strobealign/tests/main.nf.test.snap b/modules/nf-core/strobealign/tests/main.nf.test.snap new file mode 100644 index 00000000..2b8f54dd --- /dev/null +++ b/modules/nf-core/strobealign/tests/main.nf.test.snap @@ -0,0 +1,274 @@ +{ + "fastq - sorted cram": { + "content": [ + "f3a1593b170cf1e9b9008b3afb77cc53", + true, + [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T12:55:51.0954" + }, + "fastq - sti": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "genome.fasta.r150.sti:md5,1fa95f6ba0167a729ddc6a444eb5e8f7" + ] + ], + [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T12:31:45.186708" + }, + "fastq - unsorted cram": { + "content": [ + "57aeef88ed701a8ebc8e2f0a381b2a6", + [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T12:42:46.49042" + }, + "fastq - tsv": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,1fcb7444ba029b7f41b3a836fec7ecac" + ] + ], + [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T12:31:39.58768" + }, + "stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.crai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "test.paf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "6": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sti:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "crai": [ + [ + { + "id": "test", + "single_end": false + }, + "test.crai:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "cram": [ + + ], + "csi": [ + [ + { + "id": "test", + "single_end": false + }, + "test.csi:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "paf": [ + [ + { + "id": "test", + "single_end": false + }, + "test.paf.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "sti": [ + [ + { + "id": "test", + "single_end": false + }, + "test.sti:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "test.tsv.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T11:56:39.765352" + }, + "fastq - unsorted bam": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,740d88010349b3cd487a8b6244c64c0d" + ] + ], + [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T12:31:18.225205" + }, + "fastq - paf": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.paf.gz:md5,0992a1eb3dff9beca5849b9d1fc66390" + ] + ], + [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T12:31:34.790627" + }, + "fastq - sorted bam": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam:md5,c9bf092d8998eac47b6b85afe9aa9038" + ] + ], + [ + [ + { + "id": "test", + "single_end": false + }, + "test.bam.csi:md5,8d53854f92b3f263db0ed27f4bbad054" + ] + ], + [ + "versions.yml:md5,5de873596967072366007d67fe652250" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-16T12:31:12.870782" + } +} \ No newline at end of file diff --git a/modules/nf-core/strobealign/tests/nextflow.config b/modules/nf-core/strobealign/tests/nextflow.config new file mode 100644 index 00000000..7c6b31b6 --- /dev/null +++ b/modules/nf-core/strobealign/tests/nextflow.config @@ -0,0 +1,6 @@ +process { + withName: STROBEALIGN { + ext.args = params.module_args + ext.args2 = params.module_args2 + } +} diff --git a/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test b/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test index 93c3aac3..7262325a 100644 --- a/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test +++ b/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test @@ -20,7 +20,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bwa/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -28,10 +28,10 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:true ],[ file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true) ]]) + input[0] = Channel.of([[ id:'test', single_end:true ],[ file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true) ]]) input[1] = BWA_INDEX.out.index input[2] = false - input[3] = Channel.value([[id: 'genome'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[3] = Channel.value([[id: 'genome'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -50,7 +50,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bwa/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -58,11 +58,11 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:false ], [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[0] = Channel.of([[ id:'test', single_end:false ], [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] = BWA_INDEX.out.index input[2] = false - input[3] = Channel.value([[id: 'genome'], file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[3] = Channel.value([[id: 'genome'], file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } diff --git a/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test.snap index 8e8075da..6e2d0d79 100644 --- a/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test.snap +++ b/subworkflows/nf-core/fastq_align_bwa/tests/main.nf.test.snap @@ -8,7 +8,7 @@ "id": "test", "single_end": false }, - "test.bam:md5,aea123a3828a99da1906126355f15a12" + "test.bam:md5,5dbdcfdba65fac634dcbb6984cffe2c4" ] ], "1": [ @@ -17,7 +17,7 @@ "id": "test", "single_end": false }, - "test.sorted.bam:md5,8d6755b312c5c41ff32632a0734e13df" + "test.sorted.bam:md5,ba4b90f87517a16a6ae6142f37a75d79" ] ], "2": [ @@ -26,7 +26,7 @@ "id": "test", "single_end": false }, - "test.sorted.bam.bai:md5,b5b49beae3e9ff2c620e680d81ceff81" + "test.sorted.bam.bai:md5,4c5e6fa0e71327b79034eebd652f2121" ] ], "3": [ @@ -38,7 +38,7 @@ "id": "test", "single_end": false }, - "test.sorted.bam.stats:md5,9c42440e435b7ad02a343d367affafcd" + "test.sorted.bam.stats:md5,75934f2a51780a80d2ab4674301a018d" ] ], "5": [ @@ -60,12 +60,12 @@ ] ], "7": [ - "versions.yml:md5,484d99e7712f776c479382a1f338845f", - "versions.yml:md5,4ebdf6c874da163e55a849b73e30a5d1", - "versions.yml:md5,634430380db3a08ad4e56159b82af9e8", - "versions.yml:md5,703c0bec9aac86f8e74b082131814e55", - "versions.yml:md5,959c12230206836d2572f1ac5a401f2f", - "versions.yml:md5,ca8dc5bf65d052d902af1b03fec0b1fd" + "versions.yml:md5,21c3a69aa768887de1715ea1b442b0ba", + "versions.yml:md5,42e5cc142537f96b0d91f10af4fa6a51", + "versions.yml:md5,819701fe5d2921de66bcb188a5c3cf9b", + "versions.yml:md5,a8c41baee5c473ada025c29ebb5c06e0", + "versions.yml:md5,e0f61a88407ffce16662ced57e5f38c9", + "versions.yml:md5,e83f9eaf352590ab72d4dbd4699dd1c0" ], "bai": [ [ @@ -73,7 +73,7 @@ "id": "test", "single_end": false }, - "test.sorted.bam.bai:md5,b5b49beae3e9ff2c620e680d81ceff81" + "test.sorted.bam.bai:md5,4c5e6fa0e71327b79034eebd652f2121" ] ], "bam": [ @@ -82,7 +82,7 @@ "id": "test", "single_end": false }, - "test.sorted.bam:md5,8d6755b312c5c41ff32632a0734e13df" + "test.sorted.bam:md5,ba4b90f87517a16a6ae6142f37a75d79" ] ], "bam_orig": [ @@ -91,7 +91,7 @@ "id": "test", "single_end": false }, - "test.bam:md5,aea123a3828a99da1906126355f15a12" + "test.bam:md5,5dbdcfdba65fac634dcbb6984cffe2c4" ] ], "csi": [ @@ -121,24 +121,24 @@ "id": "test", "single_end": false }, - "test.sorted.bam.stats:md5,9c42440e435b7ad02a343d367affafcd" + "test.sorted.bam.stats:md5,75934f2a51780a80d2ab4674301a018d" ] ], "versions": [ - "versions.yml:md5,484d99e7712f776c479382a1f338845f", - "versions.yml:md5,4ebdf6c874da163e55a849b73e30a5d1", - "versions.yml:md5,634430380db3a08ad4e56159b82af9e8", - "versions.yml:md5,703c0bec9aac86f8e74b082131814e55", - "versions.yml:md5,959c12230206836d2572f1ac5a401f2f", - "versions.yml:md5,ca8dc5bf65d052d902af1b03fec0b1fd" + "versions.yml:md5,21c3a69aa768887de1715ea1b442b0ba", + "versions.yml:md5,42e5cc142537f96b0d91f10af4fa6a51", + "versions.yml:md5,819701fe5d2921de66bcb188a5c3cf9b", + "versions.yml:md5,a8c41baee5c473ada025c29ebb5c06e0", + "versions.yml:md5,e0f61a88407ffce16662ced57e5f38c9", + "versions.yml:md5,e83f9eaf352590ab72d4dbd4699dd1c0" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-14T13:25:38.265819012" + "timestamp": "2025-09-23T11:18:38.446531992" }, "fastq_align_bwa_single_end": { "content": [ @@ -149,7 +149,7 @@ "id": "test", "single_end": true }, - "test.bam:md5,a74710a0345b4717bb4431bf9c257120" + "test.bam:md5,f7af092ddd5203f647ba96b926392c3e" ] ], "1": [ @@ -158,7 +158,7 @@ "id": "test", "single_end": true }, - "test.sorted.bam:md5,e023c5a6d28a4998a0d8199c459c2a08" + "test.sorted.bam:md5,c406a43adde2d9673e71d8a8c7db7cfd" ] ], "2": [ @@ -167,7 +167,7 @@ "id": "test", "single_end": true }, - "test.sorted.bam.bai:md5,9257847727b20a8f7288ad6912fbada4" + "test.sorted.bam.bai:md5,f79a40341ecfaae11d8621b138d4c2ea" ] ], "3": [ @@ -179,7 +179,7 @@ "id": "test", "single_end": true }, - "test.sorted.bam.stats:md5,c8e4edbf950def8abbd9e4ae74b31383" + "test.sorted.bam.stats:md5,0883b19c92a783883b3e11d5bfcc5d6a" ] ], "5": [ @@ -201,12 +201,12 @@ ] ], "7": [ - "versions.yml:md5,484d99e7712f776c479382a1f338845f", - "versions.yml:md5,4ebdf6c874da163e55a849b73e30a5d1", - "versions.yml:md5,634430380db3a08ad4e56159b82af9e8", - "versions.yml:md5,703c0bec9aac86f8e74b082131814e55", - "versions.yml:md5,959c12230206836d2572f1ac5a401f2f", - "versions.yml:md5,ca8dc5bf65d052d902af1b03fec0b1fd" + "versions.yml:md5,21c3a69aa768887de1715ea1b442b0ba", + "versions.yml:md5,42e5cc142537f96b0d91f10af4fa6a51", + "versions.yml:md5,819701fe5d2921de66bcb188a5c3cf9b", + "versions.yml:md5,a8c41baee5c473ada025c29ebb5c06e0", + "versions.yml:md5,e0f61a88407ffce16662ced57e5f38c9", + "versions.yml:md5,e83f9eaf352590ab72d4dbd4699dd1c0" ], "bai": [ [ @@ -214,7 +214,7 @@ "id": "test", "single_end": true }, - "test.sorted.bam.bai:md5,9257847727b20a8f7288ad6912fbada4" + "test.sorted.bam.bai:md5,f79a40341ecfaae11d8621b138d4c2ea" ] ], "bam": [ @@ -223,7 +223,7 @@ "id": "test", "single_end": true }, - "test.sorted.bam:md5,e023c5a6d28a4998a0d8199c459c2a08" + "test.sorted.bam:md5,c406a43adde2d9673e71d8a8c7db7cfd" ] ], "bam_orig": [ @@ -232,7 +232,7 @@ "id": "test", "single_end": true }, - "test.bam:md5,a74710a0345b4717bb4431bf9c257120" + "test.bam:md5,f7af092ddd5203f647ba96b926392c3e" ] ], "csi": [ @@ -262,23 +262,23 @@ "id": "test", "single_end": true }, - "test.sorted.bam.stats:md5,c8e4edbf950def8abbd9e4ae74b31383" + "test.sorted.bam.stats:md5,0883b19c92a783883b3e11d5bfcc5d6a" ] ], "versions": [ - "versions.yml:md5,484d99e7712f776c479382a1f338845f", - "versions.yml:md5,4ebdf6c874da163e55a849b73e30a5d1", - "versions.yml:md5,634430380db3a08ad4e56159b82af9e8", - "versions.yml:md5,703c0bec9aac86f8e74b082131814e55", - "versions.yml:md5,959c12230206836d2572f1ac5a401f2f", - "versions.yml:md5,ca8dc5bf65d052d902af1b03fec0b1fd" + "versions.yml:md5,21c3a69aa768887de1715ea1b442b0ba", + "versions.yml:md5,42e5cc142537f96b0d91f10af4fa6a51", + "versions.yml:md5,819701fe5d2921de66bcb188a5c3cf9b", + "versions.yml:md5,a8c41baee5c473ada025c29ebb5c06e0", + "versions.yml:md5,e0f61a88407ffce16662ced57e5f38c9", + "versions.yml:md5,e83f9eaf352590ab72d4dbd4699dd1c0" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-14T13:25:08.154131783" + "timestamp": "2025-09-23T11:18:26.552397834" } } \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_align_bwa/tests/tags.yml b/subworkflows/nf-core/fastq_align_bwa/tests/tags.yml deleted file mode 100644 index bfe89ccf..00000000 --- a/subworkflows/nf-core/fastq_align_bwa/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -subworkflows/fastq_align_bwa: - - subworkflows/nf-core/fastq_align_bwa/** diff --git a/subworkflows/nf-core/fastq_align_dna/main.nf b/subworkflows/nf-core/fastq_align_dna/main.nf index aa86d46a..526f0bb8 100644 --- a/subworkflows/nf-core/fastq_align_dna/main.nf +++ b/subworkflows/nf-core/fastq_align_dna/main.nf @@ -10,6 +10,7 @@ include { BWA_MEM as BWAMEM1_MEM } from '../../../modules/nf-core/bwa include { BWAMEM2_MEM as BWAMEM2_MEM } from '../../../modules/nf-core/bwamem2/mem/main' include { DRAGMAP_ALIGN } from "../../../modules/nf-core/dragmap/align/main" include { SNAPALIGNER_ALIGN as SNAP_ALIGN } from '../../../modules/nf-core/snapaligner/align/main' +include { STROBEALIGN } from "../../../modules/nf-core/strobealign/main" @@ -29,37 +30,42 @@ workflow FASTQ_ALIGN_DNA { ch_versions = Channel.empty() // Align fastq files to reference genome and (optionally) sort - switch (aligner) { - case 'bowtie2': - BOWTIE2_ALIGN(ch_reads, ch_aligner_index, false, sort) // if aligner is bowtie2 - ch_bam = ch_bam.mix(BOWTIE2_ALIGN.out.aligned) + if (aligner == 'bowtie2') { + BOWTIE2_ALIGN(ch_reads, ch_aligner_index, ch_fasta, false, sort) // if aligner is bowtie2 + ch_bam = ch_bam.mix(BOWTIE2_ALIGN.out.bam) ch_versions = ch_versions.mix(BOWTIE2_ALIGN.out.versions) - break - case 'bwamem': - BWAMEM1_MEM (ch_reads, ch_aligner_index, ch_fasta, sort) // If aligner is bwa-mem + } + else if (aligner == 'bwamem'){ + BWAMEM1_MEM (ch_reads, ch_aligner_index, ch_fasta, sort) // If aligner is bwa-mem ch_bam = ch_bam.mix(BWAMEM1_MEM.out.bam) ch_bam_index = ch_bam_index.mix(BWAMEM1_MEM.out.csi) 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 + } + else if (aligner == 'bwamem2'){ + 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 - case 'dragmap': - DRAGMAP_ALIGN(ch_reads, ch_aligner_index, sort) // If aligner is dragmap + } + else if (aligner == 'dragmap'){ + DRAGMAP_ALIGN(ch_reads, ch_aligner_index, ch_fasta, sort) // If aligner is dragmap ch_bam = ch_bam.mix(DRAGMAP_ALIGN.out.bam) ch_reports = ch_reports.mix(DRAGMAP_ALIGN.out.log) ch_versions = ch_versions.mix(DRAGMAP_ALIGN.out.versions) - break - case 'snap': - SNAP_ALIGN (ch_reads, ch_aligner_index) // If aligner is snap - ch_bam = ch_bam.mix(SNAP_ALIGN.out.bam) - ch_bam_index.mix(SNAP_ALIGN.out.bai) - ch_versions = ch_versions.mix(SNAP_ALIGN.out.versions) - break - default: - error "Unknown aligner: ${aligner}" + } + else if (aligner == 'snap'){ + SNAP_ALIGN (ch_reads, ch_aligner_index) // If aligner is snap + ch_bam = ch_bam.mix(SNAP_ALIGN.out.bam) + ch_bam_index.mix(SNAP_ALIGN.out.bai) + ch_versions = ch_versions.mix(SNAP_ALIGN.out.versions) + } + else if (aligner == 'strobealign'){ + STROBEALIGN (ch_reads, ch_fasta, ch_aligner_index, sort) // If aligner is strobealign + ch_bam = ch_bam.mix(STROBEALIGN.out.bam) + ch_bam_index = ch_bam_index.mix(STROBEALIGN.out.csi) + ch_versions = ch_versions.mix(STROBEALIGN.out.versions) + } + else { + error "Unknown aligner: ${aligner}" } emit: diff --git a/subworkflows/nf-core/fastq_align_dna/meta.yml b/subworkflows/nf-core/fastq_align_dna/meta.yml index cd452612..26c3e237 100644 --- a/subworkflows/nf-core/fastq_align_dna/meta.yml +++ b/subworkflows/nf-core/fastq_align_dna/meta.yml @@ -9,12 +9,14 @@ keywords: - bwamem2 - dragmap - snapaligner + - strobealign components: - bowtie2/align - bwa/mem - bwamem2/mem - dragmap/align - snapaligner/align + - strobealign input: - meta: type: map @@ -53,6 +55,7 @@ input: - bwamem2 - dragmap - snap + - strobealign - sort_bam: type: boolean description: sort output diff --git a/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test b/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test index 523029f7..b65eec69 100644 --- a/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test +++ b/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test @@ -22,6 +22,7 @@ nextflow_workflow { tag "snapaligner" tag "snapaligner/index" tag "snapaligner/align" + tag "strobealign" test("test_fastq_align_bowtie2_SE") { setup { @@ -29,7 +30,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bowtie2/build/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -37,9 +38,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)]]) + input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]]) input[1] = BOWTIE2_BUILD.out.index - input[2] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "bowtie2" input[4] = true """ @@ -63,7 +64,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bowtie2/build/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -71,9 +72,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:false ], [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[0] = Channel.of([[ id:'test', single_end:false ], [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] = BOWTIE2_BUILD.out.index - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "bowtie2" input[4] = true """ @@ -96,7 +97,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bwa/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -104,9 +105,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)]]) + input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]]) input[1] = BWA_INDEX.out.index - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "bwamem" input[4] = true """ @@ -115,8 +116,14 @@ nextflow_workflow { then { assertAll( - { assert workflow.success}, - { assert snapshot(workflow.out).match()} + { assert workflow.success }, + { assert snapshot( + file(workflow.out.bam[0][1]).name, + workflow.out.bam_index, + workflow.out.reports, + workflow.out.versions, + ).match() + } ) } } @@ -126,7 +133,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bwa/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -134,9 +141,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:false ], [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[0] = Channel.of([[ id:'test', single_end:false ], [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] = BWA_INDEX.out.index - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "bwamem" input[4] = true """ @@ -145,8 +152,14 @@ nextflow_workflow { then { assertAll( - { assert workflow.success}, - { assert snapshot(workflow.out).match()} + { assert workflow.success }, + { assert snapshot( + file(workflow.out.bam[0][1]).name, + workflow.out.bam_index, + workflow.out.reports, + workflow.out.versions, + ).match() + } ) } } @@ -156,7 +169,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bwamem2/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -164,9 +177,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)]]) + input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]]) input[1] = BWAMEM2_INDEX.out.index - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "bwamem2" input[4] = true """ @@ -175,8 +188,14 @@ nextflow_workflow { then { assertAll( - { assert workflow.success}, - { assert snapshot(workflow.out).match()} + { assert workflow.success }, + { assert snapshot( + file(workflow.out.bam[0][1]).name, + workflow.out.bam_index, + workflow.out.reports, + workflow.out.versions, + ).match() + } ) } } @@ -186,7 +205,7 @@ nextflow_workflow { script "../../../../modules/nf-core/bwamem2/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -194,9 +213,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:false ], [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[0] = Channel.of([[ id:'test', single_end:false ], [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] = BWAMEM2_INDEX.out.index - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "bwamem2" input[4] = true """ @@ -205,8 +224,14 @@ nextflow_workflow { then { assertAll( - { assert workflow.success}, - { assert snapshot(workflow.out).match()} + { assert workflow.success }, + { assert snapshot( + file(workflow.out.bam[0][1]).name, + workflow.out.bam_index, + workflow.out.reports, + workflow.out.versions, + ).match() + } ) } } @@ -216,7 +241,7 @@ nextflow_workflow { script "../../../../modules/nf-core/dragmap/hashtable/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -224,9 +249,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)]]) + input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]]) input[1] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "dragmap" input[4] = true """ @@ -250,7 +275,7 @@ nextflow_workflow { script "../../../../modules/nf-core/dragmap/hashtable/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) """ } } @@ -258,9 +283,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:false ], [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[0] = Channel.of([[ id:'test', single_end:false ], [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] = DRAGMAP_HASHTABLE.out.hashmap - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "dragmap" input[4] = true """ @@ -284,7 +309,7 @@ nextflow_workflow { script "../../../../modules/nf-core/snapaligner/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), [], [], []]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), [], [], []]) """ } } @@ -292,9 +317,9 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.test_data['sarscov2']['illumina']['test_1_fastq_gz'], checkIfExists: true)]]) + input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]]) input[1] = SNAPALIGNER_INDEX.out.index - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "snap" input[4] = true """ @@ -314,7 +339,7 @@ nextflow_workflow { script "../../../../modules/nf-core/snapaligner/index/main.nf" process { """ - input[0] = Channel.value([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true), [], [], []]) + input[0] = Channel.value([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true), [], [], []]) """ } } @@ -322,15 +347,55 @@ nextflow_workflow { when { workflow { """ - input[0] = Channel.of([[ id:'test', single_end:false ], [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[0] = Channel.of([[ id:'test', single_end:false ], [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] = SNAPALIGNER_INDEX.out.index - input[2] = Channel.of([ [ id:'genome' ],file(params.test_data['sarscov2']['genome']['genome_fasta'], checkIfExists: true)]) + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) input[3] = "snap" input[4] = true """ } } + then { + assertAll( + { assert workflow.success}, + { assert snapshot(workflow.out).match()} + ) + } + } + test ("test_fastq_align_strobealign_SE"){ + when { + workflow { + """ + input[0] = Channel.of([[ id:'test', single_end:true ], [file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fastq/test_1.fastq.gz', checkIfExists: true)]]) + input[1] = [[:],[]] + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) + input[3] = "strobealign" + input[4] = true + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert snapshot(workflow.out).match()} + ) + } + } + test ("test_fastq_align_strobealign_PE"){ + when { + workflow { + """ + input[0] = Channel.of([[ id:'test', single_end:false ], [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] = [[:],[]] + input[2] = Channel.of([ [ id:'genome' ],file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true)]) + input[3] = "strobealign" + input[4] = true + """ + } + } + then { assertAll( { assert workflow.success}, diff --git a/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test.snap index a4455526..9e34d924 100644 --- a/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test.snap +++ b/subworkflows/nf-core/fastq_align_dna/tests/main.nf.test.snap @@ -1,50 +1,22 @@ { "test_fastq_align_bwamem2_PE": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,170895db384b13b8c8a1e95c47ce2616" - ] - ], - "1": [ - - ], - "2": [ - - ], - "3": [ - "versions.yml:md5,75a13fa44ba2be2f448197c66a0f33bd" - ], - "bam": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,170895db384b13b8c8a1e95c47ce2616" - ] - ], - "bam_index": [ - - ], - "reports": [ - - ], - "versions": [ - "versions.yml:md5,75a13fa44ba2be2f448197c66a0f33bd" - ] - } + "test.bam", + [ + + ], + [ + + ], + [ + "versions.yml:md5,792091aac50160e3fbc865eba482e0c4" + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-13T15:39:29.012698" + "timestamp": "2025-09-23T11:46:20.36265064" }, "test_fastq_align_dragmap_PE": { "content": [ @@ -65,16 +37,16 @@ }, "timestamp": "2024-03-14T08:28:25.283436546" }, - "test_fastq_align_bwa_mem_SE": { + "test_fastq_align_strobealign_PE": { "content": [ { "0": [ [ { "id": "test", - "single_end": true + "single_end": false }, - "test.bam:md5,cb1e038bc4d990683fa485d632550b54" + "test.bam:md5,1d8fb5dce75cbfb87955c7ee03c17a5f" ] ], "1": [ @@ -84,15 +56,15 @@ ], "3": [ - "versions.yml:md5,df2c50a8d01847ebf62fd59c6d075a7f" + "versions.yml:md5,9d1991417e63455f5e7fe9d67e5985a4" ], "bam": [ [ { "id": "test", - "single_end": true + "single_end": false }, - "test.bam:md5,cb1e038bc4d990683fa485d632550b54" + "test.bam:md5,1d8fb5dce75cbfb87955c7ee03c17a5f" ] ], "bam_index": [ @@ -102,120 +74,83 @@ ], "versions": [ - "versions.yml:md5,df2c50a8d01847ebf62fd59c6d075a7f" + "versions.yml:md5,9d1991417e63455f5e7fe9d67e5985a4" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-23T14:32:08.743821" + }, + "test_fastq_align_bwa_mem_SE": { + "content": [ + "test.bam", + [ + + ], + [ + + ], + [ + "versions.yml:md5,315f4ae70b5322c025925d84c887da18" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-14T13:06:46.694388533" + "timestamp": "2025-09-23T11:20:12.631487104" }, "test_fastq_align_bwamem2_SE": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": true - }, - "test.bam:md5,ddcd42b9ce8d61dd1f3f218067d3a672" - ] - ], - "1": [ - - ], - "2": [ - - ], - "3": [ - "versions.yml:md5,75a13fa44ba2be2f448197c66a0f33bd" - ], - "bam": [ - [ - { - "id": "test", - "single_end": true - }, - "test.bam:md5,ddcd42b9ce8d61dd1f3f218067d3a672" - ] - ], - "bam_index": [ - - ], - "reports": [ - - ], - "versions": [ - "versions.yml:md5,75a13fa44ba2be2f448197c66a0f33bd" - ] - } + "test.bam", + [ + + ], + [ + + ], + [ + "versions.yml:md5,792091aac50160e3fbc865eba482e0c4" + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-13T15:39:10.185782" + "timestamp": "2025-09-23T11:46:07.813351063" }, "test_fastq_align_bwa_mem_PE": { "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,4682087bcdc3617384b375093fecd8dd" - ] - ], - "1": [ - - ], - "2": [ - - ], - "3": [ - "versions.yml:md5,df2c50a8d01847ebf62fd59c6d075a7f" - ], - "bam": [ - [ - { - "id": "test", - "single_end": false - }, - "test.bam:md5,4682087bcdc3617384b375093fecd8dd" - ] - ], - "bam_index": [ - - ], - "reports": [ - - ], - "versions": [ - "versions.yml:md5,df2c50a8d01847ebf62fd59c6d075a7f" - ] - } + "test.bam", + [ + + ], + [ + + ], + [ + "versions.yml:md5,315f4ae70b5322c025925d84c887da18" + ] ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-14T13:07:05.034749204" + "timestamp": "2025-09-23T11:20:21.322039351" }, "test_fastq_align_bowtie2_SE": { "content": [ "test.bam", - "versions.yml:md5,58966b8763c923187ed92d2c99663af9" + "versions.yml:md5,ef191e9624d747934f15d368715d87db" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-03-14T13:06:03.046538492" + "timestamp": "2025-03-24T14:20:30.468391" }, "test_fastq_align_dragmap_SE": { "content": [ @@ -239,13 +174,13 @@ "test_fastq_align_bowtie2_PE": { "content": [ "test.bam", - "versions.yml:md5,58966b8763c923187ed92d2c99663af9" + "versions.yml:md5,ef191e9624d747934f15d368715d87db" ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "24.10.4" }, - "timestamp": "2024-03-14T13:06:21.448282757" + "timestamp": "2025-03-24T14:25:41.372083" }, "test_fastq_align_snapaligner_PE": { "content": [ @@ -256,7 +191,7 @@ "id": "test", "single_end": false }, - "test.bam:md5,1f4f6c38e40ddd5da7f644bb0f794aa8" + "test.bam:md5,504bcc1ac7f8d8e1e728276a4ce4f4d4" ] ], "1": [ @@ -266,7 +201,7 @@ ], "3": [ - "versions.yml:md5,ef9883fd373e293fbf6a98985d3c0308" + "versions.yml:md5,e98be7da5d37b69852090365352c3534" ], "bam": [ [ @@ -274,7 +209,7 @@ "id": "test", "single_end": false }, - "test.bam:md5,1f4f6c38e40ddd5da7f644bb0f794aa8" + "test.bam:md5,504bcc1ac7f8d8e1e728276a4ce4f4d4" ] ], "bam_index": [ @@ -284,15 +219,62 @@ ], "versions": [ - "versions.yml:md5,ef9883fd373e293fbf6a98985d3c0308" + "versions.yml:md5,e98be7da5d37b69852090365352c3534" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" + }, + "timestamp": "2025-09-23T12:03:34.617919741" + }, + "test_fastq_align_strobealign_SE": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,30a9339ac99b881844cf8514f719f204" + ] + ], + "1": [ + + ], + "2": [ + + ], + "3": [ + "versions.yml:md5,9d1991417e63455f5e7fe9d67e5985a4" + ], + "bam": [ + [ + { + "id": "test", + "single_end": true + }, + "test.bam:md5,30a9339ac99b881844cf8514f719f204" + ] + ], + "bam_index": [ + + ], + "reports": [ + + ], + "versions": [ + "versions.yml:md5,9d1991417e63455f5e7fe9d67e5985a4" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-14T08:19:36.298315938" + "timestamp": "2025-09-23T14:32:01.424171" }, "test_fastq_align_snapaligner_SE": { "content": [ @@ -303,7 +285,7 @@ "id": "test", "single_end": true }, - "test.bam:md5,6b3188b8e48ec5c155cfe02b9a24d37a" + "test.bam:md5,9de00a20df23dc66ddf0d9bba2e486c3" ] ], "1": [ @@ -313,7 +295,7 @@ ], "3": [ - "versions.yml:md5,ef9883fd373e293fbf6a98985d3c0308" + "versions.yml:md5,e98be7da5d37b69852090365352c3534" ], "bam": [ [ @@ -321,7 +303,7 @@ "id": "test", "single_end": true }, - "test.bam:md5,6b3188b8e48ec5c155cfe02b9a24d37a" + "test.bam:md5,9de00a20df23dc66ddf0d9bba2e486c3" ] ], "bam_index": [ @@ -331,14 +313,14 @@ ], "versions": [ - "versions.yml:md5,ef9883fd373e293fbf6a98985d3c0308" + "versions.yml:md5,e98be7da5d37b69852090365352c3534" ] } ], "meta": { - "nf-test": "0.8.4", - "nextflow": "23.10.1" + "nf-test": "0.9.2", + "nextflow": "25.04.7" }, - "timestamp": "2024-03-14T08:19:23.611241423" + "timestamp": "2025-09-23T12:03:25.88186957" } } \ No newline at end of file diff --git a/subworkflows/nf-core/fastq_align_dna/tests/nextflow.config b/subworkflows/nf-core/fastq_align_dna/tests/nextflow.config deleted file mode 100644 index 87892757..00000000 --- a/subworkflows/nf-core/fastq_align_dna/tests/nextflow.config +++ /dev/null @@ -1,12 +0,0 @@ -process { - withName: BOWTIE2_BUILD { - } - withName: BWA_INDEX { - } - withName: BWAMEM2_INDEX { - } - withName: DRAGMAP_HASHTABLE { - } - withName: SNAPALIGNER_INDEX { - } -} diff --git a/subworkflows/nf-core/fastq_align_dna/tests/tags.yml b/subworkflows/nf-core/fastq_align_dna/tests/tags.yml deleted file mode 100644 index 346dd1c2..00000000 --- a/subworkflows/nf-core/fastq_align_dna/tests/tags.yml +++ /dev/null @@ -1,2 +0,0 @@ -subworkflows/fastq_align_dna: - - subworkflows/nf-core/fastq_align_dna/** diff --git a/subworkflows/nf-core/fastq_trim_fastp_fastqc/main.nf b/subworkflows/nf-core/fastq_trim_fastp_fastqc/main.nf index 4f1c84fc..c1943a3f 100644 --- a/subworkflows/nf-core/fastq_trim_fastp_fastqc/main.nf +++ b/subworkflows/nf-core/fastq_trim_fastp_fastqc/main.nf @@ -9,38 +9,45 @@ include { FASTP } from '../../../modules/nf-core/fastp/main' // // Function that parses fastp json output file to get total number of reads after trimming // -import groovy.json.JsonSlurper -def getFastpReadsAfterFiltering(json_file) { - def Map json = (Map) new JsonSlurper().parseText(json_file.text).get('summary') +def getFastpReadsAfterFiltering(json_file ) { + + if ( workflow.stubRun ) { return 1 } + + def json = new groovy.json.JsonSlurper().parseText(json_file.text).get('summary') return json['after_filtering']['total_reads'].toLong() } workflow FASTQ_TRIM_FASTP_FASTQC { + take: - ch_reads // channel: [ val(meta), path(reads) ] - ch_adapter_fasta // channel: [ path(fasta) ] - val_save_trimmed_fail // value: boolean - val_save_merged // value: boolean - val_skip_fastp // value: boolean - val_skip_fastqc // value: boolean + ch_reads // channel: [ val(meta), path(reads), path(adapter_fasta) ] + val_save_trimmed_fail // value: boolean + val_discard_trimmed_pass // value: boolean + val_save_merged // value: boolean + val_skip_fastp // value: boolean + val_skip_fastqc // value: boolean + main: ch_versions = Channel.empty() + // Split input channel for reads-only operations + ch_reads_only = ch_reads.map { meta, reads, adapter_fasta -> [ meta, reads ] } + ch_fastqc_raw_html = Channel.empty() ch_fastqc_raw_zip = Channel.empty() if (!val_skip_fastqc) { FASTQC_RAW ( - ch_reads + ch_reads_only ) ch_fastqc_raw_html = FASTQC_RAW.out.html ch_fastqc_raw_zip = FASTQC_RAW.out.zip ch_versions = ch_versions.mix(FASTQC_RAW.out.versions.first()) } - ch_trim_reads = ch_reads + ch_trim_reads = ch_reads_only ch_trim_json = Channel.empty() ch_trim_html = Channel.empty() ch_trim_log = Channel.empty() @@ -51,7 +58,7 @@ workflow FASTQ_TRIM_FASTP_FASTQC { if (!val_skip_fastp) { FASTP ( ch_reads, - ch_adapter_fasta, + val_discard_trimmed_pass, val_save_trimmed_fail, val_save_merged ) diff --git a/subworkflows/nf-core/fastq_trim_fastp_fastqc/meta.yml b/subworkflows/nf-core/fastq_trim_fastp_fastqc/meta.yml index 9f4e12e0..8451c1eb 100644 --- a/subworkflows/nf-core/fastq_trim_fastp_fastqc/meta.yml +++ b/subworkflows/nf-core/fastq_trim_fastp_fastqc/meta.yml @@ -29,6 +29,12 @@ input: description: | Structure: val(save_trimmed_fail) Specify true to save files that failed to pass trimming thresholds ending in `*.fail.fastq.gz` + - val_discard_trimmed_pass: + type: boolean + description: | + Structure: val(discard_trimmed) + Specify true to not write any reads that pass trimming thresholds. + This can be used to use fastp for the output report only. - val_save_merged: type: boolean description: | @@ -46,7 +52,7 @@ input: skip the fastp process if true output: - meta: - type: value + type: string description: Groovy Map containing sample information e.g. [ id:'test', single_end:false ] - reads: type: file diff --git a/subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test b/subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test new file mode 100644 index 00000000..06d86cdb --- /dev/null +++ b/subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test @@ -0,0 +1,241 @@ +nextflow_workflow { + + name "Test Subworkflow FASTQ_TRIM_FASTP_FASTQC" + script "../main.nf" + workflow "FASTQ_TRIM_FASTP_FASTQC" + + tag "subworkflows" + tag "subworkflows_nfcore" + tag "subworkflows/fastq_trim_fastp_fastqc" + tag "fastp" + tag "fastqc" + + + test("sarscov2 paired-end [fastq]") { + + when { + + 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) + ], + [] // adapter_fasta + ]) + input[1]=false // save_trimmed_fail + input[2]=false // discard_trimmed_pass + input[3]=false // save_merged + input[4]=false // skip_fastp + input[5]=false // skip_fastqc + """ + } + } + + then { + assert workflow.success + assertAll( + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, + { assert workflow.out.fastqc_trim_html }, + { assert workflow.out.fastqc_trim_zip }, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert snapshot( + workflow.out.reads, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.versions + ).match() + } + ) + } + } + + test("sarscov2 paired-end [fastq] | skip_fastqc") { + + when { + + 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) + ], + [] // adapter_fasta + ]) + input[1]=false // save_trimmed_fail + input[2]=false // discard_trimmed_pass + input[3]=false // save_merged + input[4]=false // skip_fastp + input[5]=true // skip_fastqc + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert !workflow.out.fastqc_raw_html }, + { assert !workflow.out.fastqc_raw_zip }, + { assert !workflow.out.fastqc_trim_html }, + { assert !workflow.out.fastqc_trim_zip }, + { assert workflow.out.trim_html }, + { assert workflow.out.trim_log }, + { assert snapshot( + workflow.out.reads, + workflow.out.trim_reads_fail, + workflow.out.trim_reads_merged, + workflow.out.versions + ).match()} + ) + } + } + + test("sarscov2 paired-end [fastq] | skip_fastp") { + + when { + + 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) + ], + [] // adapter_fasta + ]) + input[1]=false // save_trimmed_fail + input[2]=false // discard_trimmed_pass + input[3]=false // save_merged + input[4]=true // skip_fastp + input[5]=false // skip_fastqc + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert workflow.out.fastqc_raw_html }, + { assert workflow.out.fastqc_raw_zip }, + { assert !workflow.out.fastqc_trim_html }, + { assert !workflow.out.fastqc_trim_zip }, + { assert !workflow.out.trim_html }, + { assert !workflow.out.trim_log }, + { assert !workflow.out.trim_json}, + { assert !workflow.out.trim_reads_fail}, + { assert !workflow.out.trim_reads_merged}, + { assert snapshot( + workflow.out.reads, + workflow.out.versions + ).match()} + ) + } + } + + + test("sarscov2 paired-end [fastq] - stub") { + + options "-stub" + + when { + + 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) + ], + [] // adapter_fasta + ]) + input[1]=false // save_trimmed_fail + input[2]=false // discard_trimmed_pass + input[3]=false // save_merged + input[4]=false // skip_fastp + input[5]=false // skip_fastqc + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert snapshot(workflow.out).match() } + ) + } + } + test("sarscov2 paired-end [fastq] | skip_fastqc - stub") { + + options "-stub" + + when { + + 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) + ], + [] // adapter_fasta + ]) + input[1]=false // save_trimmed_fail + input[2]=false // discard_trimmed_pass + input[3]=false // save_merged + input[4]=false // skip_fastp + input[5]=true // skip_fastqc + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert snapshot(workflow.out).match() } + ) + } + } + test("sarscov2 paired-end [fastq] | skip_fastp - stub") { + + options "-stub" + + when { + + 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) + ], + [] // adapter_fasta + ]) + input[1]=false // save_trimmed_fail + input[2]=false // discard_trimmed_pass + input[3]=false // save_merged + input[4]=true // skip_fastp + input[5]=false // skip_fastqc + """ + } + } + + then { + assertAll( + { assert workflow.success}, + { assert snapshot(workflow.out).match() } + ) + } + } + + +} diff --git a/subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test.snap b/subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test.snap new file mode 100644 index 00000000..7303552f --- /dev/null +++ b/subworkflows/nf-core/fastq_trim_fastp_fastqc/tests/main.nf.test.snap @@ -0,0 +1,521 @@ +{ + "sarscov2 paired-end [fastq] | skip_fastqc": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7", + "test_2.fastp.fastq.gz:md5,25cbdca08e2083dbd4f0502de6b62f39" + ] + ] + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,57a7705081c77db6306e1635a34b60da" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-19T17:16:23.553004" + }, + "sarscov2 paired-end [fastq] | skip_fastqc - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "10": [ + "versions.yml:md5,57a7705081c77db6306e1635a34b60da" + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + + ], + "7": [ + + ], + "8": [ + + ], + "9": [ + + ], + "fastqc_raw_html": [ + + ], + "fastqc_raw_zip": [ + + ], + "fastqc_trim_html": [ + + ], + "fastqc_trim_zip": [ + + ], + "reads": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "trim_html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "trim_json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "trim_log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "trim_reads_fail": [ + + ], + "trim_reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,57a7705081c77db6306e1635a34b60da" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-11T09:59:49.639942" + }, + "sarscov2 paired-end [fastq] | skip_fastp - stub": { + "content": [ + { + "0": [ + [ + { + "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" + ] + ] + ], + "1": [ + + ], + "10": [ + "versions.yml:md5,f0b47642f44ee5f9130525d38cc3a448" + ], + "2": [ + + ], + "3": [ + + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + + ], + "9": [ + + ], + "fastqc_raw_html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fastqc_raw_zip": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fastqc_trim_html": [ + + ], + "fastqc_trim_zip": [ + + ], + "reads": [ + [ + { + "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" + ] + ] + ], + "trim_html": [ + + ], + "trim_json": [ + + ], + "trim_log": [ + + ], + "trim_reads_fail": [ + + ], + "trim_reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,f0b47642f44ee5f9130525d38cc3a448" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-29T11:48:28.343159755" + }, + "sarscov2 paired-end [fastq] | skip_fastp": { + "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,f0b47642f44ee5f9130525d38cc3a448" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.5" + }, + "timestamp": "2025-03-29T20:15:25.58513445" + }, + "sarscov2 paired-end [fastq]": { + "content": [ + [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,67b2bbae47f073e05a97a9c2edce23c7", + "test_2.fastp.fastq.gz:md5,25cbdca08e2083dbd4f0502de6b62f39" + ] + ] + ], + [ + + ], + [ + + ], + [ + "versions.yml:md5,1e855cf2085cdb306be0f1e4f44ae30e", + "versions.yml:md5,57a7705081c77db6306e1635a34b60da", + "versions.yml:md5,f0b47642f44ee5f9130525d38cc3a448" + ] + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-19T16:26:40.013347" + }, + "sarscov2 paired-end [fastq] - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "10": [ + "versions.yml:md5,1e855cf2085cdb306be0f1e4f44ae30e", + "versions.yml:md5,57a7705081c77db6306e1635a34b60da", + "versions.yml:md5,f0b47642f44ee5f9130525d38cc3a448" + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + + ], + "5": [ + + ], + "6": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "7": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "8": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "9": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fastqc_raw_html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fastqc_raw_zip": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fastqc_trim_html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "fastqc_trim_zip": [ + [ + { + "id": "test", + "single_end": false + }, + "test.zip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "reads": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "test_1.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940", + "test_2.fastp.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ] + ], + "trim_html": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.html:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "trim_json": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.json:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "trim_log": [ + [ + { + "id": "test", + "single_end": false + }, + "test.fastp.log:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "trim_reads_fail": [ + + ], + "trim_reads_merged": [ + + ], + "versions": [ + "versions.yml:md5,1e855cf2085cdb306be0f1e4f44ae30e", + "versions.yml:md5,57a7705081c77db6306e1635a34b60da", + "versions.yml:md5,f0b47642f44ee5f9130525d38cc3a448" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.6" + }, + "timestamp": "2025-09-11T09:59:44.486662" + } +} \ No newline at end of file From 26710581a601445bbbd53f89c11d80c164664d35 Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Fri, 31 Oct 2025 13:41:57 +0100 Subject: [PATCH 2/3] Fix cardinality for newer workflows --- workflows/samurai.nf | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workflows/samurai.nf b/workflows/samurai.nf index 3cb4f878..ce2b8140 100644 --- a/workflows/samurai.nf +++ b/workflows/samurai.nf @@ -100,10 +100,13 @@ workflow SAMURAI { skip_fastp = params.run_fastp ? false : true + ch_fastq = ch_input.map{meta, fasta -> [meta, fasta, []]} + FASTQ_TRIM_FASTP_FASTQC( - ch_input, [] /* adapters */, + ch_fastq, false /* save_trimmed_fail */, - false /* save_merged */, + false /* discard_trimmed_pass */, + false, /* save_merged */ skip_fastp /* skip_fastp */, false /* skip_fastqc */ ) From 271aa69555a729242e5096a4080f9e5f85a480ed Mon Sep 17 00:00:00 2001 From: Luca Beltrame Date: Tue, 4 Nov 2025 10:44:38 +0100 Subject: [PATCH 3/3] Fix the difference between upstream and not (prettier too aggressive) --- modules/nf-core/strobealign/meta.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/nf-core/strobealign/meta.yml b/modules/nf-core/strobealign/meta.yml index e4ede404..132d9872 100644 --- a/modules/nf-core/strobealign/meta.yml +++ b/modules/nf-core/strobealign/meta.yml @@ -10,14 +10,14 @@ keywords: - bam - sam tools: - - "strobealign": - description: "Align short reads using dynamic seed size with strobemers" - homepage: "https://github.com/ksahlin/strobealign" - documentation: "https://github.com/ksahlin/strobealign?tab=readme-ov-file#usage" - tool_dev_url: "https://github.com/ksahlin/strobealign" - doi: "10.1186/s13059-022-02831-7" - licence: ["MIT"] - identifier: biotools:strobealign +- "strobealign": + description: "Align short reads using dynamic seed size with strobemers" + homepage: "https://github.com/ksahlin/strobealign" + documentation: "https://github.com/ksahlin/strobealign?tab=readme-ov-file#usage" + tool_dev_url: "https://github.com/ksahlin/strobealign" + doi: "10.1186/s13059-022-02831-7" + licence: ['MIT'] + identifier: biotools:strobealign input: - - meta: @@ -136,7 +136,7 @@ output: ontologies: - edam: http://edamontology.org/format_3750 # YAML authors: - - "@matthdsm" +- "@matthdsm" maintainers: - - "@matthdsm" - - "@nvnieuwk" +- "@matthdsm" +- "@nvnieuwk"