From 09c630f3409beba4ab24915c46d784e36b6a1d02 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Mon, 27 Oct 2025 16:11:51 +0000 Subject: [PATCH 01/10] Add autocycler modules --- .../autocycler/cluster/environment.yml | 10 ++ modules/nf-core/autocycler/cluster/main.nf | 54 +++++++++ modules/nf-core/autocycler/cluster/meta.yml | 109 ++++++++++++++++++ .../autocycler/cluster/tests/main.nf.test | 74 ++++++++++++ .../autocycler/combine/environment.yml | 10 ++ modules/nf-core/autocycler/combine/main.nf | 49 ++++++++ modules/nf-core/autocycler/combine/meta.yml | 78 +++++++++++++ .../autocycler/combine/tests/main.nf.test | 74 ++++++++++++ .../autocycler/compress/environment.yml | 10 ++ modules/nf-core/autocycler/compress/main.nf | 52 +++++++++ modules/nf-core/autocycler/compress/meta.yml | 71 ++++++++++++ .../autocycler/compress/tests/main.nf.test | 74 ++++++++++++ .../autocycler/resolve/environment.yml | 10 ++ modules/nf-core/autocycler/resolve/main.nf | 54 +++++++++ modules/nf-core/autocycler/resolve/meta.yml | 76 ++++++++++++ .../autocycler/resolve/tests/main.nf.test | 74 ++++++++++++ .../autocycler/subsample/environment.yml | 10 ++ modules/nf-core/autocycler/subsample/main.nf | 55 +++++++++ modules/nf-core/autocycler/subsample/meta.yml | 60 ++++++++++ .../autocycler/subsample/tests/main.nf.test | 74 ++++++++++++ .../nf-core/autocycler/trim/environment.yml | 10 ++ modules/nf-core/autocycler/trim/main.nf | 49 ++++++++ modules/nf-core/autocycler/trim/meta.yml | 66 +++++++++++ .../autocycler/trim/tests/main.nf.test | 74 ++++++++++++ 24 files changed, 1277 insertions(+) create mode 100644 modules/nf-core/autocycler/cluster/environment.yml create mode 100644 modules/nf-core/autocycler/cluster/main.nf create mode 100644 modules/nf-core/autocycler/cluster/meta.yml create mode 100644 modules/nf-core/autocycler/cluster/tests/main.nf.test create mode 100644 modules/nf-core/autocycler/combine/environment.yml create mode 100644 modules/nf-core/autocycler/combine/main.nf create mode 100644 modules/nf-core/autocycler/combine/meta.yml create mode 100644 modules/nf-core/autocycler/combine/tests/main.nf.test create mode 100644 modules/nf-core/autocycler/compress/environment.yml create mode 100644 modules/nf-core/autocycler/compress/main.nf create mode 100644 modules/nf-core/autocycler/compress/meta.yml create mode 100644 modules/nf-core/autocycler/compress/tests/main.nf.test create mode 100644 modules/nf-core/autocycler/resolve/environment.yml create mode 100644 modules/nf-core/autocycler/resolve/main.nf create mode 100644 modules/nf-core/autocycler/resolve/meta.yml create mode 100644 modules/nf-core/autocycler/resolve/tests/main.nf.test create mode 100644 modules/nf-core/autocycler/subsample/environment.yml create mode 100644 modules/nf-core/autocycler/subsample/main.nf create mode 100644 modules/nf-core/autocycler/subsample/meta.yml create mode 100644 modules/nf-core/autocycler/subsample/tests/main.nf.test create mode 100644 modules/nf-core/autocycler/trim/environment.yml create mode 100644 modules/nf-core/autocycler/trim/main.nf create mode 100644 modules/nf-core/autocycler/trim/meta.yml create mode 100644 modules/nf-core/autocycler/trim/tests/main.nf.test diff --git a/modules/nf-core/autocycler/cluster/environment.yml b/modules/nf-core/autocycler/cluster/environment.yml new file mode 100644 index 00000000000..09bd33d1a6b --- /dev/null +++ b/modules/nf-core/autocycler/cluster/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # TODO nf-core: List required Conda package(s). + # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/cluster/main.nf b/modules/nf-core/autocycler/cluster/main.nf new file mode 100644 index 00000000000..494daaf67e4 --- /dev/null +++ b/modules/nf-core/autocycler/cluster/main.nf @@ -0,0 +1,54 @@ +process AUTOCYCLER_CLUSTER { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/autocycler:0.5.2--h3ab6199_0': + 'biocontainers/autocycler:0.5.2--h3ab6199_0' }" + + input: + tuple val(meta), path(gfa) + + output: + tuple val(meta), path("clustering/qc_pass/*/*.gfa"), emit: clusters + tuple val(meta), path("clustering/qc_pass/*/*.yaml"), emit: clusterstats + tuple val(meta), path("clustering/*.newick"), emit: newick + tuple val(meta), path("clustering/*.tsv"), emit: tsv + tuple val(meta), path("clustering/*.phylip"), emit: pairwisedistances + tuple val(meta), path("clustering/*.yaml"), emit: stats + + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + autocycler cluster \\ + $args \\ + -a . + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir clustering/qc_pass/cluster_000 -p + touch clustering.{newick,yaml,tsv} + touch pairwise_distances.phylip + touch clustering/qc_pass/cluster_000/0_untrimmed.{gfa,yaml} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/autocycler/cluster/meta.yml b/modules/nf-core/autocycler/cluster/meta.yml new file mode 100644 index 00000000000..83b5de55829 --- /dev/null +++ b/modules/nf-core/autocycler/cluster/meta.yml @@ -0,0 +1,109 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "autocycler_cluster" +description: Cluster replicons in compressed assemblies with Autocycler. +keywords: + - autocycler + - genome-assembly + - clustering + - long-read +tools: + - autocycler: + description: "A tools for generating consensus long-read assemblies for bacterial genomes." + homepage: "https://github.com/rrwick/Autocycler/wiki" + documentation: "https://github.com/rrwick/Autocycler/wiki" + tool_dev_url: "https://github.com/rrwick/Autocycler" + doi: "10.1093/bioinformatics/btaf474" + licence: ["GPL-3.0"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - gfa: + type: file + description: | + Assembly graph files produced by the compression step. + pattern: "*/*.gfa" + +output: + clusters: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "clustering/qc_pass/*/*.gfa": + type: file + description: Aassembly graphs of clustered contigs. + pattern: "clustering/qc_pass/*/*.gfa" + ontologies: + - edam: "http://edamontology.org/format_3975" #GFA1 + clusterstats: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "clustering/qc_pass/*/*.yaml": + type: file + description: Per-cluster metrics reported by Autocycler. + pattern: "clustering/qc_pass/*/*.yaml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + newick: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "clustering/*.newick": + type: file + description: Newick tree relating contigs. + pattern: "clustering/*.newick" + tsv: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "clustering/*.tsv": + type: file + description: Tabular summary of cluster relationships. + pattern: "clustering/*.tsv" + pairwisedistances: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "clustering/*.phylip": + type: file + description: Pairwise distance matrix in PHYLIP format. + pattern: "clustering/*.phylip" + stats: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "clustering/*.yaml": + type: file + description: Run-level statistics for the clustering step. + pattern: "clustering/*.yaml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@dwells-eit" +maintainers: + - "@dwells-eit" diff --git a/modules/nf-core/autocycler/cluster/tests/main.nf.test b/modules/nf-core/autocycler/cluster/tests/main.nf.test new file mode 100644 index 00000000000..c14abd23935 --- /dev/null +++ b/modules/nf-core/autocycler/cluster/tests/main.nf.test @@ -0,0 +1,74 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test autocycler/cluster +nextflow_process { + + name "Test Process AUTOCYCLER_CLUSTER" + script "../main.nf" + process "AUTOCYCLER_CLUSTER" + + tag "modules" + tag "modules_" + tag "autocycler" + tag "autocycler/cluster" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} diff --git a/modules/nf-core/autocycler/combine/environment.yml b/modules/nf-core/autocycler/combine/environment.yml new file mode 100644 index 00000000000..09bd33d1a6b --- /dev/null +++ b/modules/nf-core/autocycler/combine/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # TODO nf-core: List required Conda package(s). + # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/combine/main.nf b/modules/nf-core/autocycler/combine/main.nf new file mode 100644 index 00000000000..94919fb9ef8 --- /dev/null +++ b/modules/nf-core/autocycler/combine/main.nf @@ -0,0 +1,49 @@ +process AUTOCYCLER_COMBINE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/autocycler:0.5.2--h3ab6199_0': + 'biocontainers/autocycler:0.5.2--h3ab6199_0' }" + + input: + tuple val(meta), path(clusters) + + output: + tuple val(meta), path("$prefix/consensus_assembly.fasta"), emit: fasta + tuple val(meta), path("$prefix/consensus_assembly.gfa"), emit: gfa + tuple val(meta), path("$prefix/consensus_assembly.yaml"), emit: stats + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + autocycler combine \\ + $args \\ + -i $clusters \\ + -a $prefix + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir $prefix + touch $prefix/consensus_assembly.{fasta,gfa,yaml} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/autocycler/combine/meta.yml b/modules/nf-core/autocycler/combine/meta.yml new file mode 100644 index 00000000000..ecc32c07041 --- /dev/null +++ b/modules/nf-core/autocycler/combine/meta.yml @@ -0,0 +1,78 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "autocycler_combine" +description: Merge resolved cluster assemblies into final consensus outputs with Autocycler. +keywords: + - autocycler + - genome-assembly + - consensus + - long-read +tools: + - autocycler: + description: "A tools for generating consensus long-read assemblies for bacterial genomes." + homepage: "https://github.com/rrwick/Autocycler/wiki" + documentation: "https://github.com/rrwick/Autocycler/wiki" + tool_dev_url: "https://github.com/rrwick/Autocycler" + doi: "10.1093/bioinformatics/btaf474" + licence: ["GPL-3.0"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - clusters: + type: file + description: | + Final cluster assembly graphs (GFA) to be combined into consensus sequences. + pattern: "*.gfa" + +output: + fasta: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*/consensus_assembly.fasta": + type: file + description: Consensus genome sequence generated by Autocycler. + pattern: "*/consensus_assembly.fasta" + ontologies: + - edam: "http://edamontology.org/format_1929" # FASTA + gfa: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*/consensus_assembly.gfa": + type: file + description: Consensus assembly graph generated by Autocycler. + pattern: "*/consensus_assembly.gfa" + ontologies: + - edam: "http://edamontology.org/format_3975" #GFA1 stats: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*/consensus_assembly.yaml": + type: file + description: Run statistics for the combine step. + pattern: "*/consensus_assembly.yaml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@dwells-eit" +maintainers: + - "@dwells-eit" diff --git a/modules/nf-core/autocycler/combine/tests/main.nf.test b/modules/nf-core/autocycler/combine/tests/main.nf.test new file mode 100644 index 00000000000..9d72926c15f --- /dev/null +++ b/modules/nf-core/autocycler/combine/tests/main.nf.test @@ -0,0 +1,74 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test autocycler/combine +nextflow_process { + + name "Test Process AUTOCYCLER_COMBINE" + script "../main.nf" + process "AUTOCYCLER_COMBINE" + + tag "modules" + tag "modules_" + tag "autocycler" + tag "autocycler/combine" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} diff --git a/modules/nf-core/autocycler/compress/environment.yml b/modules/nf-core/autocycler/compress/environment.yml new file mode 100644 index 00000000000..09bd33d1a6b --- /dev/null +++ b/modules/nf-core/autocycler/compress/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # TODO nf-core: List required Conda package(s). + # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/compress/main.nf b/modules/nf-core/autocycler/compress/main.nf new file mode 100644 index 00000000000..a7330344c74 --- /dev/null +++ b/modules/nf-core/autocycler/compress/main.nf @@ -0,0 +1,52 @@ + +process AUTOCYCLER_COMPRESS { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/autocycler:0.5.2--h3ab6199_0': + 'biocontainers/autocycler:0.5.2--h3ab6199_0' }" + + input: + tuple val(meta), path(assemblies) + + output: + tuple val(meta), path("$prefix/*.gfa"), emit: gfa + tuple val(meta), path("$prefix/*.yaml"), emit: stats + + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + autocycler compress \\ + $args \\ + -t $task.cpus \\ + -i . \\ + -a ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + mkdir $prefix + touch ${prefix}/input_assemblies.gfa + touch ${prefix}/input_assemblies.yaml + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/autocycler/compress/meta.yml b/modules/nf-core/autocycler/compress/meta.yml new file mode 100644 index 00000000000..b4d09122e2a --- /dev/null +++ b/modules/nf-core/autocycler/compress/meta.yml @@ -0,0 +1,71 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "autocycler_compress" +description: Package candidate assemblies for clustering by Autocycler. +keywords: + - autocycler + - genome-assembly + - compression + - long-read +tools: + - autocycler: + description: "A tools for generating consensus long-read assemblies for bacterial genomes." + homepage: "https://github.com/rrwick/Autocycler/wiki" + documentation: "https://github.com/rrwick/Autocycler/wiki" + tool_dev_url: "https://github.com/rrwick/Autocycler" + doi: "10.1093/bioinformatics/btaf474" + licence: ["GPL-3.0"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - assemblies: + type: file + description: | + Candidate assembly files (typically FASTA) generated for the sample. + pattern: "*.{fasta,fa,fasta.gz,fa.gz}" + ontologies: + - edam: "http://edamontology.org/format_1929" # FASTA + - edam: "http://edamontology.org/format_3989" # GZIP + +output: + gfa: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*/*.gfa": + type: file + description: Assembly graph files ready for clustering. + pattern: "*/*.gfa" + ontologies: + - edam: "http://edamontology.org/format_3975" #GFA1 + + stats: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*/*.yaml": + type: file + description: Summary statistics generated during compression. + pattern: "*/*.yaml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@dwells-eit" +maintainers: + - "@dwells-eit" diff --git a/modules/nf-core/autocycler/compress/tests/main.nf.test b/modules/nf-core/autocycler/compress/tests/main.nf.test new file mode 100644 index 00000000000..84cebb741a8 --- /dev/null +++ b/modules/nf-core/autocycler/compress/tests/main.nf.test @@ -0,0 +1,74 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test autocycler/compress +nextflow_process { + + name "Test Process AUTOCYCLER_COMPRESS" + script "../main.nf" + process "AUTOCYCLER_COMPRESS" + + tag "modules" + tag "modules_" + tag "autocycler" + tag "autocycler/compress" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} diff --git a/modules/nf-core/autocycler/resolve/environment.yml b/modules/nf-core/autocycler/resolve/environment.yml new file mode 100644 index 00000000000..09bd33d1a6b --- /dev/null +++ b/modules/nf-core/autocycler/resolve/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # TODO nf-core: List required Conda package(s). + # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/resolve/main.nf b/modules/nf-core/autocycler/resolve/main.nf new file mode 100644 index 00000000000..29c234c819c --- /dev/null +++ b/modules/nf-core/autocycler/resolve/main.nf @@ -0,0 +1,54 @@ +process AUTOCYCLER_RESOLVE { + tag "$meta.id" + label 'process_single' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/autocycler:0.5.2--h3ab6199_0': + 'biocontainers/autocycler:0.5.2--h3ab6199_0' }" + + input: + tuple val(meta), path(gfa) + + output: + tuple val(meta), path("3_bridged.gfa"), emit: bridged + tuple val(meta), path("4_merged.gfa"), emit: merged + tuple val(meta), path("5_final.gfa"), emit: resolved + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + autocycler resolve \\ + $args \\ + -c . + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + // TODO nf-core: A stub section should mimic the execution of the original module as best as possible + // Have a look at the following examples: + // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 + // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 + """ + + touch 3_bridged.gfa + touch 4_merged.gfa + touch 5_final.gfa + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/autocycler/resolve/meta.yml b/modules/nf-core/autocycler/resolve/meta.yml new file mode 100644 index 00000000000..37995980451 --- /dev/null +++ b/modules/nf-core/autocycler/resolve/meta.yml @@ -0,0 +1,76 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "autocycler_resolve" +description: Resolve trimmed assembly graphs into final contigs within Autocycler. +keywords: + - autocycler + - genome-assembly + - graph-resolution + - long-read +tools: + - autocycler: + description: "A tools for generating consensus long-read assemblies for bacterial genomes." + homepage: "https://github.com/rrwick/Autocycler/wiki" + documentation: "https://github.com/rrwick/Autocycler/wiki" + tool_dev_url: "https://github.com/rrwick/Autocycler" + doi: "10.1093/bioinformatics/btaf474" + licence: ["GPL-3.0"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - gfa: + type: file + description: | + Trimmed assembly graph in GFA format from the previous step. + pattern: "*.gfa" + +output: + bridged: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "3_bridged.gfa": + type: file + description: Assembly graph with bridges resolved. + pattern: "3_bridged.gfa" + ontologies: + - edam: "http://edamontology.org/format_3975" #GFA1 merged: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "4_merged.gfa": + type: file + description: Merged assembly graph after bridging. + pattern: "4_merged.gfa" + ontologies: + - edam: "http://edamontology.org/format_3975" #GFA1 resolved: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "5_final.gfa": + type: file + description: Final resolved assembly graph. + pattern: "5_final.gfa" + ontologies: + - edam: "http://edamontology.org/format_3975" #GFA1 versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@dwells-eit" +maintainers: + - "@dwells-eit" diff --git a/modules/nf-core/autocycler/resolve/tests/main.nf.test b/modules/nf-core/autocycler/resolve/tests/main.nf.test new file mode 100644 index 00000000000..bfe60f0f958 --- /dev/null +++ b/modules/nf-core/autocycler/resolve/tests/main.nf.test @@ -0,0 +1,74 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test autocycler/resolve +nextflow_process { + + name "Test Process AUTOCYCLER_RESOLVE" + script "../main.nf" + process "AUTOCYCLER_RESOLVE" + + tag "modules" + tag "modules_" + tag "autocycler" + tag "autocycler/resolve" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} diff --git a/modules/nf-core/autocycler/subsample/environment.yml b/modules/nf-core/autocycler/subsample/environment.yml new file mode 100644 index 00000000000..09bd33d1a6b --- /dev/null +++ b/modules/nf-core/autocycler/subsample/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # TODO nf-core: List required Conda package(s). + # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/subsample/main.nf b/modules/nf-core/autocycler/subsample/main.nf new file mode 100644 index 00000000000..f86d6ad315d --- /dev/null +++ b/modules/nf-core/autocycler/subsample/main.nf @@ -0,0 +1,55 @@ + +process AUTOCYCLER_SUBSAMPLE { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/autocycler:0.5.2--h3ab6199_0': + 'biocontainers/autocycler:0.5.2--h3ab6199_0' }" + + input: + // TODO nf-core: Where applicable please provide/convert compressed files as input/output + // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. + tuple val(meta), path(reads) + val genome_size + + output: + tuple val(meta), path("$prefix/*.fastq.gz"), emit: subsampled_reads + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + autocycler subsample \\ + $args \\ + --reads $reads \\ + --out_dir ${prefix} \\ + --genome_size $genome_size + + gzip $prefix/*.fastq + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + + mkdir $prefix + touch ${prefix}/sample_00.fastq + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/autocycler/subsample/meta.yml b/modules/nf-core/autocycler/subsample/meta.yml new file mode 100644 index 00000000000..889328503a5 --- /dev/null +++ b/modules/nf-core/autocycler/subsample/meta.yml @@ -0,0 +1,60 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "autocycler_subsample" +description: Downsample long-read sequencing data to the requested coverage using Autocycler. +keywords: + - autocycler + - subsampling + - long-read +tools: + - autocycler: + description: "A tools for generating consensus long-read assemblies for bacterial genomes." + homepage: "https://github.com/rrwick/Autocycler/wiki" + documentation: "https://github.com/rrwick/Autocycler/wiki" + tool_dev_url: "https://github.com/rrwick/Autocycler" + doi: "10.1093/bioinformatics/btaf474" + licence: ["GPL-3.0"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - reads: + type: file + description: | + Long-read sequencing reads for the sample in FASTQ format (compressed or uncompressed). + pattern: "*.{fastq,fastq.gz,fq,fq.gz}" + ontologies: + - edam: "http://edamontology.org/format_1930" # FASTQ + - genome_size: + type: integer + description: Expected genome size in bases used to calculate the target sequencing depth. + +output: + subsampled_reads: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*/*.fastq.gz": + type: file + description: Subsampled reads produced by Autocycler. + pattern: "*/*.fastq.gz" + ontologies: + - edam: "http://edamontology.org/format_1930" # FASTQ + - edam: "http://edamontology.org/format_3989" # GZIP + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@dwells" +maintainers: + - "@dwells" diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test b/modules/nf-core/autocycler/subsample/tests/main.nf.test new file mode 100644 index 00000000000..03244d6809b --- /dev/null +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test @@ -0,0 +1,74 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test autocycler/subsample +nextflow_process { + + name "Test Process AUTOCYCLER_SUBSAMPLE" + script "../main.nf" + process "AUTOCYCLER_SUBSAMPLE" + + tag "modules" + tag "modules_" + tag "autocycler" + tag "autocycler/subsample" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} diff --git a/modules/nf-core/autocycler/trim/environment.yml b/modules/nf-core/autocycler/trim/environment.yml new file mode 100644 index 00000000000..09bd33d1a6b --- /dev/null +++ b/modules/nf-core/autocycler/trim/environment.yml @@ -0,0 +1,10 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + # TODO nf-core: List required Conda package(s). + # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). + # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. + - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/trim/main.nf b/modules/nf-core/autocycler/trim/main.nf new file mode 100644 index 00000000000..59f6afb900d --- /dev/null +++ b/modules/nf-core/autocycler/trim/main.nf @@ -0,0 +1,49 @@ +process AUTOCYCLER_TRIM { + tag "$meta.id" + label 'process_low' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/autocycler:0.5.2--h3ab6199_0': + 'biocontainers/autocycler:0.5.2--h3ab6199_0' }" + + input: + tuple val(meta), path(gfa) + + output: + tuple val(meta), path("*.gfa"), emit: gfa + tuple val(meta), path("*.yaml"), emit: stats + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + autocycler trim \\ + $args \\ + --threads $task.cpus \\ + -c . + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + + touch 2_trimmed.gfa + touch 2_trimmed.yaml + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + autocycler: \$(autocycler --version | sed 's/^[^ ]* //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/autocycler/trim/meta.yml b/modules/nf-core/autocycler/trim/meta.yml new file mode 100644 index 00000000000..d7a4d645e4f --- /dev/null +++ b/modules/nf-core/autocycler/trim/meta.yml @@ -0,0 +1,66 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "autocycler_trim" +description: Trim cluster assembly graphs to remove unsupported segments prior to resolution. +keywords: + - autocycler + - genome-assembly + - graph-trimming + - long-read +tools: + - autocycler: + description: "A tools for generating consensus long-read assemblies for bacterial genomes." + homepage: "https://github.com/rrwick/Autocycler/wiki" + documentation: "https://github.com/rrwick/Autocycler/wiki" + tool_dev_url: "https://github.com/rrwick/Autocycler" + doi: "10.1093/bioinformatics/btaf474" + licence: ["GPL-3.0"] + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - gfa: + type: file + description: | + Cluster-specific assembly graph in GFA format. + pattern: "*.gfa" + +output: + gfa: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.gfa": + type: file + description: Trimmed assembly graphs emitted by Autocycler. + pattern: "*.gfa" + ontologies: + - edam: "http://edamontology.org/format_3975" #GFA1 stats: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.yaml": + type: file + description: Trimming statistics for each cluster. + pattern: "*.yaml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@dwells-eit" +maintainers: + - "@dwells-eit" diff --git a/modules/nf-core/autocycler/trim/tests/main.nf.test b/modules/nf-core/autocycler/trim/tests/main.nf.test new file mode 100644 index 00000000000..fa2cec5acf0 --- /dev/null +++ b/modules/nf-core/autocycler/trim/tests/main.nf.test @@ -0,0 +1,74 @@ +// TODO nf-core: Once you have added the required tests, please run the following command to build this file: +// nf-core modules test autocycler/trim +nextflow_process { + + name "Test Process AUTOCYCLER_TRIM" + script "../main.nf" + process "AUTOCYCLER_TRIM" + + tag "modules" + tag "modules_" + tag "autocycler" + tag "autocycler/trim" + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used + test("sarscov2 - bam") { + + // TODO nf-core: If you are created a test for a chained module + // (the module requires running more than one process to generate the required output) + // add the 'setup' method here. + // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. + test("sarscov2 - bam - stub") { + + options "-stub" + + when { + process { + """ + // TODO nf-core: define inputs of the process here. Example: + + input[0] = [ + [ 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() } + //TODO nf-core: Add all required assertions to verify the test output. + ) + } + + } + +} From a94ab4e785618505cbca8e8abb6d9f4ec9ac5425 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Mon, 27 Oct 2025 17:22:34 +0000 Subject: [PATCH 02/10] Write tests for `autocycler subsample` --- modules/nf-core/autocycler/subsample/main.nf | 2 +- .../autocycler/subsample/tests/main.nf.test | 30 ++++++------ .../subsample/tests/main.nf.test.snap | 47 +++++++++++++++++++ .../subsample/tests/nextflow.config | 5 ++ 4 files changed, 67 insertions(+), 17 deletions(-) create mode 100644 modules/nf-core/autocycler/subsample/tests/main.nf.test.snap create mode 100644 modules/nf-core/autocycler/subsample/tests/nextflow.config diff --git a/modules/nf-core/autocycler/subsample/main.nf b/modules/nf-core/autocycler/subsample/main.nf index f86d6ad315d..daee585ec70 100644 --- a/modules/nf-core/autocycler/subsample/main.nf +++ b/modules/nf-core/autocycler/subsample/main.nf @@ -45,7 +45,7 @@ process AUTOCYCLER_SUBSAMPLE { """ mkdir $prefix - touch ${prefix}/sample_00.fastq + touch ${prefix}/sample_00.fastq.gz cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test b/modules/nf-core/autocycler/subsample/tests/main.nf.test index 03244d6809b..9b34a0181d6 100644 --- a/modules/nf-core/autocycler/subsample/tests/main.nf.test +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test @@ -5,29 +5,26 @@ nextflow_process { name "Test Process AUTOCYCLER_SUBSAMPLE" script "../main.nf" process "AUTOCYCLER_SUBSAMPLE" + config "./nextflow.config" tag "modules" tag "modules_" tag "autocycler" tag "autocycler/subsample" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { - - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + test("Pseudomonas_fluorescens - fastq_gz") { when { + params{ + module_args = '--seed 1234' + } process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file('https://github.com/nf-core/test-datasets/raw/refs/heads/bacass/nanopore/subset15000.fq.gz', checkIfExists: true), // reads ] + input[1] = 30000 // genome size """ } } @@ -43,20 +40,21 @@ nextflow_process { } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("Pseudomonas_fluorescens - fastq_gz - stub") { options "-stub" when { + params{ + module_args = '' + } process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file('https://github.com/nf-core/test-datasets/raw/refs/heads/bacass/nanopore/subset15000.fq.gz', checkIfExists: true), // reads ] + input[1] = 30000 // genome size """ } } @@ -64,7 +62,7 @@ nextflow_process { then { assertAll( { assert process.success }, - { assert snapshot(process.out).match() } + // { assert snapshot(process.out).match() } //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test.snap b/modules/nf-core/autocycler/subsample/tests/main.nf.test.snap new file mode 100644 index 00000000000..27d2cf6faa4 --- /dev/null +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test.snap @@ -0,0 +1,47 @@ +{ + "Pseudomonas_fluorescens - fastq_gz": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "sample_01.fastq.gz:md5,b1cc8c9ee163474d67d7889e25e4e0ae", + "sample_02.fastq.gz:md5,c3124b6b062158d41e822a9ff16df988", + "sample_03.fastq.gz:md5,3f2db5a32a4a0cfdbb5a58b5a81f3a92", + "sample_04.fastq.gz:md5,28c99f7e4565924229a980500c185802" + ] + ] + ], + "1": [ + "versions.yml:md5,0abfe90f7bd1d54716b236993073b514" + ], + "subsampled_reads": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "sample_01.fastq.gz:md5,b1cc8c9ee163474d67d7889e25e4e0ae", + "sample_02.fastq.gz:md5,c3124b6b062158d41e822a9ff16df988", + "sample_03.fastq.gz:md5,3f2db5a32a4a0cfdbb5a58b5a81f3a92", + "sample_04.fastq.gz:md5,28c99f7e4565924229a980500c185802" + ] + ] + ], + "versions": [ + "versions.yml:md5,0abfe90f7bd1d54716b236993073b514" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-27T17:18:38.77396493" + } +} \ No newline at end of file diff --git a/modules/nf-core/autocycler/subsample/tests/nextflow.config b/modules/nf-core/autocycler/subsample/tests/nextflow.config new file mode 100644 index 00000000000..a7aa8f2f803 --- /dev/null +++ b/modules/nf-core/autocycler/subsample/tests/nextflow.config @@ -0,0 +1,5 @@ +process { + withName: 'AUTOCYCLER_SUBSAMPLE' { + ext.args = params.module_args + } +} From ff138798f6fc7b725b15c432db593c82d1331b11 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Tue, 28 Oct 2025 11:24:48 +0000 Subject: [PATCH 03/10] Add autocycler module tests --- modules/nf-core/autocycler/cluster/main.nf | 4 +- .../autocycler/cluster/tests/main.nf.test | 42 +-- .../cluster/tests/main.nf.test.snap | 276 ++++++++++++++ .../autocycler/combine/tests/main.nf.test | 79 ++-- .../combine/tests/main.nf.test.snap | 350 ++++++++++++++++++ .../autocycler/compress/tests/main.nf.test | 30 +- .../compress/tests/main.nf.test.snap | 108 ++++++ .../autocycler/resolve/tests/main.nf.test | 68 ++-- .../resolve/tests/main.nf.test.snap | 350 ++++++++++++++++++ .../autocycler/subsample/tests/main.nf.test | 6 - .../autocycler/trim/tests/main.nf.test | 56 ++- .../autocycler/trim/tests/main.nf.test.snap | 301 +++++++++++++++ 12 files changed, 1556 insertions(+), 114 deletions(-) create mode 100644 modules/nf-core/autocycler/cluster/tests/main.nf.test.snap create mode 100644 modules/nf-core/autocycler/combine/tests/main.nf.test.snap create mode 100644 modules/nf-core/autocycler/compress/tests/main.nf.test.snap create mode 100644 modules/nf-core/autocycler/resolve/tests/main.nf.test.snap create mode 100644 modules/nf-core/autocycler/trim/tests/main.nf.test.snap diff --git a/modules/nf-core/autocycler/cluster/main.nf b/modules/nf-core/autocycler/cluster/main.nf index 494daaf67e4..5194e68b79e 100644 --- a/modules/nf-core/autocycler/cluster/main.nf +++ b/modules/nf-core/autocycler/cluster/main.nf @@ -42,8 +42,8 @@ process AUTOCYCLER_CLUSTER { def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir clustering/qc_pass/cluster_000 -p - touch clustering.{newick,yaml,tsv} - touch pairwise_distances.phylip + touch clustering/clustering.{newick,yaml,tsv} + touch clustering/pairwise_distances.phylip touch clustering/qc_pass/cluster_000/0_untrimmed.{gfa,yaml} cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/autocycler/cluster/tests/main.nf.test b/modules/nf-core/autocycler/cluster/tests/main.nf.test index c14abd23935..75a19942764 100644 --- a/modules/nf-core/autocycler/cluster/tests/main.nf.test +++ b/modules/nf-core/autocycler/cluster/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test autocycler/cluster nextflow_process { name "Test Process AUTOCYCLER_CLUSTER" @@ -11,23 +9,29 @@ nextflow_process { tag "autocycler" tag "autocycler/cluster" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { + test("sarscov2 - assembly - fasta") { - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + setup { + run("AUTOCYCLER_COMPRESS") { + script "../../compress/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true), + ] // assemblies + ] + """ + } + } + } when { process { """ - // TODO nf-core: define inputs of the process here. Example: - - input[0] = [ - [ 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[0] = AUTOCYCLER_COMPRESS.out.gfa """ } } @@ -36,26 +40,21 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("sarscov2 - assembly - fasta - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] ] """ } @@ -65,7 +64,6 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/autocycler/cluster/tests/main.nf.test.snap b/modules/nf-core/autocycler/cluster/tests/main.nf.test.snap new file mode 100644 index 00000000000..a9fbc342d4e --- /dev/null +++ b/modules/nf-core/autocycler/cluster/tests/main.nf.test.snap @@ -0,0 +1,276 @@ +{ + "sarscov2 - assembly - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "0_untrimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "0_untrimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.newick:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "pairwise_distances.phylip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "6": [ + "versions.yml:md5,6c0bd1b1b590f56dd7fa72cc206acfe3" + ], + "clusters": [ + [ + { + "id": "test", + "single_end": false + }, + "0_untrimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "clusterstats": [ + [ + { + "id": "test", + "single_end": false + }, + "0_untrimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "newick": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.newick:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "pairwisedistances": [ + [ + { + "id": "test", + "single_end": false + }, + "pairwise_distances.phylip:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.tsv:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,6c0bd1b1b590f56dd7fa72cc206acfe3" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T10:44:36.312554184" + }, + "sarscov2 - assembly - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "1_untrimmed.gfa:md5,73912628f3a2c2d066bc36d14c7229b9", + "1_untrimmed.gfa:md5,719a197598d0f1499dccbbfe77ece24f", + "1_untrimmed.gfa:md5,8313fd7f1ab97e957ed1ee4bb20b655d", + "1_untrimmed.gfa:md5,6296117f3fca264d84ada14f778a23a6", + "1_untrimmed.gfa:md5,224d8fe4f6350f9e3c5b69c5078e3059" + ] + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "1_untrimmed.yaml:md5,6ac8ce32b804e839499e95279f3945db", + "1_untrimmed.yaml:md5,44c31adc6f2f2bae83bb3f90d5fe4ab1", + "1_untrimmed.yaml:md5,1b7a0a5583d9ba65a87546d11019213b", + "1_untrimmed.yaml:md5,2a1657662c94f7fa22f8c3eac7cd0e42", + "1_untrimmed.yaml:md5,2ee32f3c9b1bd21d702665f50c86a005" + ] + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.newick:md5,c0a4ebfeba0c1bb289be9267933a0f37" + ] + ], + "3": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.tsv:md5,30f7a64acefcc55a1863ff306a2901ac" + ] + ], + "4": [ + [ + { + "id": "test", + "single_end": false + }, + "pairwise_distances.phylip:md5,7e266e6d2b0834c802de7909521e197e" + ] + ], + "5": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.yaml:md5,1e48271631555f4f7a989620d0d4db8c" + ] + ], + "6": [ + "versions.yml:md5,6c0bd1b1b590f56dd7fa72cc206acfe3" + ], + "clusters": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "1_untrimmed.gfa:md5,73912628f3a2c2d066bc36d14c7229b9", + "1_untrimmed.gfa:md5,719a197598d0f1499dccbbfe77ece24f", + "1_untrimmed.gfa:md5,8313fd7f1ab97e957ed1ee4bb20b655d", + "1_untrimmed.gfa:md5,6296117f3fca264d84ada14f778a23a6", + "1_untrimmed.gfa:md5,224d8fe4f6350f9e3c5b69c5078e3059" + ] + ] + ], + "clusterstats": [ + [ + { + "id": "test", + "single_end": false + }, + [ + "1_untrimmed.yaml:md5,6ac8ce32b804e839499e95279f3945db", + "1_untrimmed.yaml:md5,44c31adc6f2f2bae83bb3f90d5fe4ab1", + "1_untrimmed.yaml:md5,1b7a0a5583d9ba65a87546d11019213b", + "1_untrimmed.yaml:md5,2a1657662c94f7fa22f8c3eac7cd0e42", + "1_untrimmed.yaml:md5,2ee32f3c9b1bd21d702665f50c86a005" + ] + ] + ], + "newick": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.newick:md5,c0a4ebfeba0c1bb289be9267933a0f37" + ] + ], + "pairwisedistances": [ + [ + { + "id": "test", + "single_end": false + }, + "pairwise_distances.phylip:md5,7e266e6d2b0834c802de7909521e197e" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.yaml:md5,1e48271631555f4f7a989620d0d4db8c" + ] + ], + "tsv": [ + [ + { + "id": "test", + "single_end": false + }, + "clustering.tsv:md5,30f7a64acefcc55a1863ff306a2901ac" + ] + ], + "versions": [ + "versions.yml:md5,6c0bd1b1b590f56dd7fa72cc206acfe3" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T10:43:46.382913621" + } +} \ No newline at end of file diff --git a/modules/nf-core/autocycler/combine/tests/main.nf.test b/modules/nf-core/autocycler/combine/tests/main.nf.test index 9d72926c15f..365f8a34bf5 100644 --- a/modules/nf-core/autocycler/combine/tests/main.nf.test +++ b/modules/nf-core/autocycler/combine/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test autocycler/combine nextflow_process { name "Test Process AUTOCYCLER_COMBINE" @@ -11,23 +9,65 @@ nextflow_process { tag "autocycler" tag "autocycler/combine" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { + test("sarscov2 - assemblies -fasta") { - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + setup { + run("AUTOCYCLER_COMPRESS") { + script "../../compress/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true), + ] // assemblies + ] + """ + } + } + run("AUTOCYCLER_CLUSTER") { + script "../../cluster/main.nf" + process { + """ + input[0] = AUTOCYCLER_COMPRESS.out.gfa + """ + } + } + run("AUTOCYCLER_TRIM") { + script "../../trim/main.nf" + process { + """ + AUTOCYCLER_CLUSTER.out.clusters + .flatMap { meta, gfa_list -> + gfa_list.collect { gfa -> [meta, gfa] } // Separate gfas, each with a meta + } + .map { meta, file -> + def cluster_id = (file.parent.name) // Add cluster id to meta + tuple( meta + [cluster: cluster_id], file ) + } + .set{ ch_clusters } // channel: [ val(meta), gfa] + + input[0] = ch_clusters + """ + } + } + run("AUTOCYCLER_RESOLVE"){ + script "../../resolve/main.nf" + process { + """ + input[0] = AUTOCYCLER_TRIM.out.gfa + """ + } + + } + } when { process { """ - // TODO nf-core: define inputs of the process here. Example: - - input[0] = [ - [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), - ] + AUTOCYCLER_RESOLVE.out.resolved.view{println it} + input[0] = AUTOCYCLER_RESOLVE.out.resolved """ } } @@ -36,26 +76,21 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("sarscov2 - assemblies -fasta - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] ] """ } @@ -65,10 +100,8 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } } - } diff --git a/modules/nf-core/autocycler/combine/tests/main.nf.test.snap b/modules/nf-core/autocycler/combine/tests/main.nf.test.snap new file mode 100644 index 00000000000..df12371f028 --- /dev/null +++ b/modules/nf-core/autocycler/combine/tests/main.nf.test.snap @@ -0,0 +1,350 @@ +{ + "sarscov2 - assemblies -fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "consensus_assembly.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "consensus_assembly.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "consensus_assembly.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb" + ], + "fasta": [ + [ + { + "id": "test", + "single_end": false + }, + "consensus_assembly.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "gfa": [ + [ + { + "id": "test", + "single_end": false + }, + "consensus_assembly.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false + }, + "consensus_assembly.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T11:15:12.388399773" + }, + "sarscov2 - assemblies -fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "consensus_assembly.fasta:md5,942e9dd63658ae5ee987c3865f64ef97" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "consensus_assembly.fasta:md5,3b5f0c0e1e480de5682e5956b40013ee" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "consensus_assembly.fasta:md5,6f06846e831457b1763b0e457b8c101e" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "consensus_assembly.fasta:md5,a161425fe8e139d75ae54fdd04e56545" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "consensus_assembly.fasta:md5,8b8d300eb4be010bd97e4a1aebbd61d4" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "consensus_assembly.gfa:md5,c69dd262070f9c81a87034f3aaf9888f" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "consensus_assembly.gfa:md5,6428e5cb960883dcdc4898fa0e972591" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "consensus_assembly.gfa:md5,30aaa1f58f19ccbf959ac8fa55a78f99" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "consensus_assembly.gfa:md5,4b946f7cc4d7055fb61bee1925be2bb0" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "consensus_assembly.gfa:md5,7b2b22be5424893816a4c12f6bc9e1f2" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "consensus_assembly.yaml:md5,20dfc59b6e81c68d1b74073032cc0d4d" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "consensus_assembly.yaml:md5,9c2e31d0d42dc7fe715482a19a5768c2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "consensus_assembly.yaml:md5,d19724fae1e2b9d0695ec93d25f080bb" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "consensus_assembly.yaml:md5,d9fcba2ec57942a133c527ae13fc72e6" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "consensus_assembly.yaml:md5,a935e95b6c41fcee0858902d797e5613" + ] + ], + "3": [ + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb" + ], + "fasta": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "consensus_assembly.fasta:md5,942e9dd63658ae5ee987c3865f64ef97" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "consensus_assembly.fasta:md5,3b5f0c0e1e480de5682e5956b40013ee" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "consensus_assembly.fasta:md5,6f06846e831457b1763b0e457b8c101e" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "consensus_assembly.fasta:md5,a161425fe8e139d75ae54fdd04e56545" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "consensus_assembly.fasta:md5,8b8d300eb4be010bd97e4a1aebbd61d4" + ] + ], + "gfa": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "consensus_assembly.gfa:md5,c69dd262070f9c81a87034f3aaf9888f" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "consensus_assembly.gfa:md5,6428e5cb960883dcdc4898fa0e972591" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "consensus_assembly.gfa:md5,30aaa1f58f19ccbf959ac8fa55a78f99" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "consensus_assembly.gfa:md5,4b946f7cc4d7055fb61bee1925be2bb0" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "consensus_assembly.gfa:md5,7b2b22be5424893816a4c12f6bc9e1f2" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "consensus_assembly.yaml:md5,20dfc59b6e81c68d1b74073032cc0d4d" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "consensus_assembly.yaml:md5,9c2e31d0d42dc7fe715482a19a5768c2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "consensus_assembly.yaml:md5,d19724fae1e2b9d0695ec93d25f080bb" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "consensus_assembly.yaml:md5,d9fcba2ec57942a133c527ae13fc72e6" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "consensus_assembly.yaml:md5,a935e95b6c41fcee0858902d797e5613" + ] + ], + "versions": [ + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb", + "versions.yml:md5,cd4c6e07ce524c5c2296afff8a45fecb" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T11:15:36.324875025" + } +} \ No newline at end of file diff --git a/modules/nf-core/autocycler/compress/tests/main.nf.test b/modules/nf-core/autocycler/compress/tests/main.nf.test index 84cebb741a8..8fa67cec113 100644 --- a/modules/nf-core/autocycler/compress/tests/main.nf.test +++ b/modules/nf-core/autocycler/compress/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test autocycler/compress nextflow_process { name "Test Process AUTOCYCLER_COMPRESS" @@ -11,22 +9,17 @@ nextflow_process { tag "autocycler" tag "autocycler/compress" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { - - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + test("sarscov2 - fasta") { when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true), + ] // assemblies ] """ } @@ -36,26 +29,24 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("sarscov2 - fasta - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true), + ] ] """ } @@ -65,7 +56,6 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/autocycler/compress/tests/main.nf.test.snap b/modules/nf-core/autocycler/compress/tests/main.nf.test.snap new file mode 100644 index 00000000000..1a5181e41cd --- /dev/null +++ b/modules/nf-core/autocycler/compress/tests/main.nf.test.snap @@ -0,0 +1,108 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,842cd4fed38c11bfb1130da4de2ade14" + ], + "gfa": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,842cd4fed38c11bfb1130da4de2ade14" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T09:03:44.162388971" + }, + "sarscov2 - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.gfa:md5,e4918bf93dc58755971bec2baf0897e6" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.yaml:md5,2d4d10d343d16ef57c9dceb12d8c6e1c" + ] + ], + "2": [ + "versions.yml:md5,842cd4fed38c11bfb1130da4de2ade14" + ], + "gfa": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.gfa:md5,e4918bf93dc58755971bec2baf0897e6" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false + }, + "input_assemblies.yaml:md5,2d4d10d343d16ef57c9dceb12d8c6e1c" + ] + ], + "versions": [ + "versions.yml:md5,842cd4fed38c11bfb1130da4de2ade14" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T09:02:09.484596514" + } +} \ No newline at end of file diff --git a/modules/nf-core/autocycler/resolve/tests/main.nf.test b/modules/nf-core/autocycler/resolve/tests/main.nf.test index bfe60f0f958..af249563c74 100644 --- a/modules/nf-core/autocycler/resolve/tests/main.nf.test +++ b/modules/nf-core/autocycler/resolve/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test autocycler/resolve nextflow_process { name "Test Process AUTOCYCLER_RESOLVE" @@ -11,23 +9,55 @@ nextflow_process { tag "autocycler" tag "autocycler/resolve" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { + test("sarscov2 - assemblies - fasta") { - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + setup { + run("AUTOCYCLER_COMPRESS") { + script "../../compress/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true), + ] // assemblies + ] + """ + } + } + run("AUTOCYCLER_CLUSTER") { + script "../../cluster/main.nf" + process { + """ + input[0] = AUTOCYCLER_COMPRESS.out.gfa + """ + } + } + run("AUTOCYCLER_TRIM") { + script "../../trim/main.nf" + process { + """ + AUTOCYCLER_CLUSTER.out.clusters + .flatMap { meta, gfa_list -> + gfa_list.collect { gfa -> [meta, gfa] } // Separate gfas, each with a meta + } + .map { meta, file -> + def cluster_id = (file.parent.name) // Add cluster id to meta + tuple( meta + [cluster: cluster_id], file ) + } + .set{ ch_clusters } // channel: [ val(meta), gfa] + + input[0] = ch_clusters + """ + } + } + } when { process { """ - // TODO nf-core: define inputs of the process here. Example: - - input[0] = [ - [ 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[0] = AUTOCYCLER_TRIM.out.gfa """ } } @@ -36,26 +66,21 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("sarscov2 - assemblies -fasta - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] ] """ } @@ -65,7 +90,6 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/autocycler/resolve/tests/main.nf.test.snap b/modules/nf-core/autocycler/resolve/tests/main.nf.test.snap new file mode 100644 index 00000000000..c58dc4c13c6 --- /dev/null +++ b/modules/nf-core/autocycler/resolve/tests/main.nf.test.snap @@ -0,0 +1,350 @@ +{ + "sarscov2 - assemblies - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "3_bridged.gfa:md5,32ab6dfb62c3e0a89e87827d3b216b11" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "3_bridged.gfa:md5,f8ddaec9123e475eab872cfe35767571" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "3_bridged.gfa:md5,f1d19e1dc4d76283358c880d44714bc2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "3_bridged.gfa:md5,0886b8a7eb8e86875c43f116cd756d7c" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "3_bridged.gfa:md5,f919ba084f3e6e05481843b7acc7470b" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "4_merged.gfa:md5,32ab6dfb62c3e0a89e87827d3b216b11" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "4_merged.gfa:md5,f8ddaec9123e475eab872cfe35767571" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "4_merged.gfa:md5,f1d19e1dc4d76283358c880d44714bc2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "4_merged.gfa:md5,0886b8a7eb8e86875c43f116cd756d7c" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "4_merged.gfa:md5,f919ba084f3e6e05481843b7acc7470b" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "5_final.gfa:md5,32ab6dfb62c3e0a89e87827d3b216b11" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "5_final.gfa:md5,f8ddaec9123e475eab872cfe35767571" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "5_final.gfa:md5,f1d19e1dc4d76283358c880d44714bc2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "5_final.gfa:md5,0886b8a7eb8e86875c43f116cd756d7c" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "5_final.gfa:md5,f919ba084f3e6e05481843b7acc7470b" + ] + ], + "3": [ + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e" + ], + "bridged": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "3_bridged.gfa:md5,32ab6dfb62c3e0a89e87827d3b216b11" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "3_bridged.gfa:md5,f8ddaec9123e475eab872cfe35767571" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "3_bridged.gfa:md5,f1d19e1dc4d76283358c880d44714bc2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "3_bridged.gfa:md5,0886b8a7eb8e86875c43f116cd756d7c" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "3_bridged.gfa:md5,f919ba084f3e6e05481843b7acc7470b" + ] + ], + "merged": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "4_merged.gfa:md5,32ab6dfb62c3e0a89e87827d3b216b11" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "4_merged.gfa:md5,f8ddaec9123e475eab872cfe35767571" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "4_merged.gfa:md5,f1d19e1dc4d76283358c880d44714bc2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "4_merged.gfa:md5,0886b8a7eb8e86875c43f116cd756d7c" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "4_merged.gfa:md5,f919ba084f3e6e05481843b7acc7470b" + ] + ], + "resolved": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "5_final.gfa:md5,32ab6dfb62c3e0a89e87827d3b216b11" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "5_final.gfa:md5,f8ddaec9123e475eab872cfe35767571" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "5_final.gfa:md5,f1d19e1dc4d76283358c880d44714bc2" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "5_final.gfa:md5,0886b8a7eb8e86875c43f116cd756d7c" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "5_final.gfa:md5,f919ba084f3e6e05481843b7acc7470b" + ] + ], + "versions": [ + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e", + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T11:05:51.541318237" + }, + "sarscov2 - assemblies -fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "3_bridged.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "4_merged.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + [ + { + "id": "test", + "single_end": false + }, + "5_final.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "3": [ + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e" + ], + "bridged": [ + [ + { + "id": "test", + "single_end": false + }, + "3_bridged.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "merged": [ + [ + { + "id": "test", + "single_end": false + }, + "4_merged.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "resolved": [ + [ + { + "id": "test", + "single_end": false + }, + "5_final.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,79bc18dd056bcbf7f1d6315822b6394e" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T11:05:27.313463504" + } +} \ No newline at end of file diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test b/modules/nf-core/autocycler/subsample/tests/main.nf.test index 9b34a0181d6..fcb1dce2809 100644 --- a/modules/nf-core/autocycler/subsample/tests/main.nf.test +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test autocycler/subsample nextflow_process { name "Test Process AUTOCYCLER_SUBSAMPLE" @@ -33,8 +31,6 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } @@ -62,8 +58,6 @@ nextflow_process { then { assertAll( { assert process.success }, - // { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/autocycler/trim/tests/main.nf.test b/modules/nf-core/autocycler/trim/tests/main.nf.test index fa2cec5acf0..910f35b8c49 100644 --- a/modules/nf-core/autocycler/trim/tests/main.nf.test +++ b/modules/nf-core/autocycler/trim/tests/main.nf.test @@ -11,23 +11,47 @@ nextflow_process { tag "autocycler" tag "autocycler/trim" - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used - test("sarscov2 - bam") { + test("sarscov2 - assemblies - fasta") { - // TODO nf-core: If you are created a test for a chained module - // (the module requires running more than one process to generate the required output) - // add the 'setup' method here. - // You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules). + setup { + run("AUTOCYCLER_COMPRESS") { + script "../../compress/main.nf" + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + [ + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/contigs.fasta', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/fasta/scaffolds.fasta', checkIfExists: true), + ] // assemblies + ] + """ + } + } + run("AUTOCYCLER_CLUSTER") { + script "../../cluster/main.nf" + process { + """ + input[0] = AUTOCYCLER_COMPRESS.out.gfa + """ + } + } + } when { process { """ - // TODO nf-core: define inputs of the process here. Example: + AUTOCYCLER_CLUSTER.out.clusters + .flatMap { meta, gfa_list -> + gfa_list.collect { gfa -> [meta, gfa] } // Separate gfas, each with a meta + } + .map { meta, file -> + def cluster_id = (file.parent.name) // Add cluster id to meta + tuple( meta + [cluster: cluster_id], file ) + } + .set{ ch_clusters } // channel: [ val(meta), gfa] - input[0] = [ - [ 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[0] = ch_clusters """ } } @@ -36,26 +60,21 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. - // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. ) } } - // TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix. - test("sarscov2 - bam - stub") { + test("sarscov2 - assemblies -fasta - stub") { options "-stub" when { process { """ - // TODO nf-core: define inputs of the process here. Example: - input[0] = [ [ id:'test', single_end:false ], // meta map - file(params.modules_testdata_base_path + 'genomics/sarscov2/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + [] ] """ } @@ -65,7 +84,6 @@ nextflow_process { assertAll( { assert process.success }, { assert snapshot(process.out).match() } - //TODO nf-core: Add all required assertions to verify the test output. ) } diff --git a/modules/nf-core/autocycler/trim/tests/main.nf.test.snap b/modules/nf-core/autocycler/trim/tests/main.nf.test.snap new file mode 100644 index 00000000000..a1a08b22690 --- /dev/null +++ b/modules/nf-core/autocycler/trim/tests/main.nf.test.snap @@ -0,0 +1,301 @@ +{ + "sarscov2 - assemblies - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "2_trimmed.gfa:md5,e4339397d2a188c90fc16a10aebba086" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "2_trimmed.gfa:md5,b754228734964e5c1a3f006da2de3c37" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "2_trimmed.gfa:md5,1bff9016ffb75edc4c73cdeedbc2b7c4" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "2_trimmed.gfa:md5,dbbb6784efded7f8cb436fb254c426fd" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "2_trimmed.gfa:md5,e08589f6402186b099efeb367add5a09" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "2_trimmed.yaml:md5,236a2cbde4b5c7a3423b65cab2d9204a" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "2_trimmed.yaml:md5,a3ce7e8c652fc91da69088cd776c94e6" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "2_trimmed.yaml:md5,bf72f5ecfed4757e2114665b3e2ff4e5" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "2_trimmed.yaml:md5,b8ca2603d9b0fbec9e0dd53c2d1003dd" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "2_trimmed.yaml:md5,de8ad13f8a9b4b911a08a53b9b88e4bd" + ] + ], + "2": [ + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" + ], + "gfa": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "2_trimmed.gfa:md5,e4339397d2a188c90fc16a10aebba086" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "2_trimmed.gfa:md5,b754228734964e5c1a3f006da2de3c37" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "2_trimmed.gfa:md5,1bff9016ffb75edc4c73cdeedbc2b7c4" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "2_trimmed.gfa:md5,dbbb6784efded7f8cb436fb254c426fd" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "2_trimmed.gfa:md5,e08589f6402186b099efeb367add5a09" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_001" + }, + "2_trimmed.yaml:md5,236a2cbde4b5c7a3423b65cab2d9204a" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_002" + }, + "2_trimmed.yaml:md5,a3ce7e8c652fc91da69088cd776c94e6" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_003" + }, + "2_trimmed.yaml:md5,bf72f5ecfed4757e2114665b3e2ff4e5" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_004" + }, + "2_trimmed.yaml:md5,b8ca2603d9b0fbec9e0dd53c2d1003dd" + ], + [ + { + "id": "test", + "single_end": false, + "cluster": "cluster_005" + }, + "2_trimmed.yaml:md5,de8ad13f8a9b4b911a08a53b9b88e4bd" + ] + ], + "versions": [ + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7", + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T10:57:59.014535177" + }, + "sarscov2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" + ], + "gfa": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T10:50:43.693655569" + }, + "sarscov2 - assemblies -fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "2": [ + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" + ], + "gfa": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "stats": [ + [ + { + "id": "test", + "single_end": false + }, + "2_trimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-28T10:58:04.464338286" + } +} \ No newline at end of file From deb88cf345c8aed1a6db952b2ba2e194bf4c8d95 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Tue, 28 Oct 2025 11:56:25 +0000 Subject: [PATCH 04/10] Fix lintting errors - Correct meta.yml output - tag all modules included in tests - remove final TODOs --- .../autocycler/cluster/environment.yml | 3 -- .../autocycler/cluster/tests/main.nf.test | 3 +- .../autocycler/combine/environment.yml | 3 -- modules/nf-core/autocycler/combine/meta.yml | 13 ++--- .../autocycler/combine/tests/main.nf.test | 6 ++- .../autocycler/compress/environment.yml | 3 -- modules/nf-core/autocycler/compress/meta.yml | 6 +-- .../autocycler/compress/tests/main.nf.test | 2 +- .../autocycler/resolve/environment.yml | 3 -- modules/nf-core/autocycler/resolve/main.nf | 5 -- modules/nf-core/autocycler/resolve/meta.yml | 9 ++-- .../autocycler/resolve/tests/main.nf.test | 5 +- .../autocycler/subsample/environment.yml | 3 -- modules/nf-core/autocycler/subsample/main.nf | 2 - modules/nf-core/autocycler/subsample/meta.yml | 2 +- .../autocycler/subsample/tests/main.nf.test | 2 +- .../nf-core/autocycler/trim/environment.yml | 3 -- modules/nf-core/autocycler/trim/meta.yml | 3 +- .../autocycler/trim/tests/main.nf.test | 6 +-- .../autocycler/trim/tests/main.nf.test.snap | 53 ------------------- 20 files changed, 35 insertions(+), 100 deletions(-) diff --git a/modules/nf-core/autocycler/cluster/environment.yml b/modules/nf-core/autocycler/cluster/environment.yml index 09bd33d1a6b..4acd4e2ab28 100644 --- a/modules/nf-core/autocycler/cluster/environment.yml +++ b/modules/nf-core/autocycler/cluster/environment.yml @@ -4,7 +4,4 @@ channels: - conda-forge - bioconda dependencies: - # TODO nf-core: List required Conda package(s). - # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/cluster/tests/main.nf.test b/modules/nf-core/autocycler/cluster/tests/main.nf.test index 75a19942764..792b02691f3 100644 --- a/modules/nf-core/autocycler/cluster/tests/main.nf.test +++ b/modules/nf-core/autocycler/cluster/tests/main.nf.test @@ -5,8 +5,9 @@ nextflow_process { process "AUTOCYCLER_CLUSTER" tag "modules" - tag "modules_" + tag "modules_nfcore" tag "autocycler" + tag "autocycler/compress" tag "autocycler/cluster" test("sarscov2 - assembly - fasta") { diff --git a/modules/nf-core/autocycler/combine/environment.yml b/modules/nf-core/autocycler/combine/environment.yml index 09bd33d1a6b..4acd4e2ab28 100644 --- a/modules/nf-core/autocycler/combine/environment.yml +++ b/modules/nf-core/autocycler/combine/environment.yml @@ -4,7 +4,4 @@ channels: - conda-forge - bioconda dependencies: - # TODO nf-core: List required Conda package(s). - # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/combine/meta.yml b/modules/nf-core/autocycler/combine/meta.yml index ecc32c07041..a79282a733c 100644 --- a/modules/nf-core/autocycler/combine/meta.yml +++ b/modules/nf-core/autocycler/combine/meta.yml @@ -35,7 +35,7 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - "*/consensus_assembly.fasta": + - "$prefix/consensus_assembly.fasta": type: file description: Consensus genome sequence generated by Autocycler. pattern: "*/consensus_assembly.fasta" @@ -47,21 +47,22 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - "*/consensus_assembly.gfa": + - "$prefix/consensus_assembly.gfa": type: file description: Consensus assembly graph generated by Autocycler. - pattern: "*/consensus_assembly.gfa" + pattern: "$prefix/consensus_assembly.gfa" ontologies: - - edam: "http://edamontology.org/format_3975" #GFA1 stats: + - edam: "http://edamontology.org/format_3975" #GFA1 + stats: - - meta: type: map description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - "*/consensus_assembly.yaml": + - "$prefix/consensus_assembly.yaml": type: file description: Run statistics for the combine step. - pattern: "*/consensus_assembly.yaml" + pattern: "$prefix/consensus_assembly.yaml" ontologies: - edam: "http://edamontology.org/format_3750" # YAML versions: diff --git a/modules/nf-core/autocycler/combine/tests/main.nf.test b/modules/nf-core/autocycler/combine/tests/main.nf.test index 365f8a34bf5..d6899e6a02b 100644 --- a/modules/nf-core/autocycler/combine/tests/main.nf.test +++ b/modules/nf-core/autocycler/combine/tests/main.nf.test @@ -5,8 +5,12 @@ nextflow_process { process "AUTOCYCLER_COMBINE" tag "modules" - tag "modules_" + tag "modules_nfcore" tag "autocycler" + tag "autocycler/compress" + tag "autocycler/cluster" + tag "autocycler/trim" + tag "autocycler/resolve" tag "autocycler/combine" test("sarscov2 - assemblies -fasta") { diff --git a/modules/nf-core/autocycler/compress/environment.yml b/modules/nf-core/autocycler/compress/environment.yml index 09bd33d1a6b..4acd4e2ab28 100644 --- a/modules/nf-core/autocycler/compress/environment.yml +++ b/modules/nf-core/autocycler/compress/environment.yml @@ -4,7 +4,4 @@ channels: - conda-forge - bioconda dependencies: - # TODO nf-core: List required Conda package(s). - # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/compress/meta.yml b/modules/nf-core/autocycler/compress/meta.yml index b4d09122e2a..95d74317358 100644 --- a/modules/nf-core/autocycler/compress/meta.yml +++ b/modules/nf-core/autocycler/compress/meta.yml @@ -38,10 +38,10 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - "*/*.gfa": + - "$prefix/*.gfa": type: file description: Assembly graph files ready for clustering. - pattern: "*/*.gfa" + pattern: "$prefix/*.gfa" ontologies: - edam: "http://edamontology.org/format_3975" #GFA1 @@ -51,7 +51,7 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - "*/*.yaml": + - "$prefix/*.yaml": type: file description: Summary statistics generated during compression. pattern: "*/*.yaml" diff --git a/modules/nf-core/autocycler/compress/tests/main.nf.test b/modules/nf-core/autocycler/compress/tests/main.nf.test index 8fa67cec113..a11e1d0b7f1 100644 --- a/modules/nf-core/autocycler/compress/tests/main.nf.test +++ b/modules/nf-core/autocycler/compress/tests/main.nf.test @@ -5,7 +5,7 @@ nextflow_process { process "AUTOCYCLER_COMPRESS" tag "modules" - tag "modules_" + tag "modules_nfcore" tag "autocycler" tag "autocycler/compress" diff --git a/modules/nf-core/autocycler/resolve/environment.yml b/modules/nf-core/autocycler/resolve/environment.yml index 09bd33d1a6b..4acd4e2ab28 100644 --- a/modules/nf-core/autocycler/resolve/environment.yml +++ b/modules/nf-core/autocycler/resolve/environment.yml @@ -4,7 +4,4 @@ channels: - conda-forge - bioconda dependencies: - # TODO nf-core: List required Conda package(s). - # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/resolve/main.nf b/modules/nf-core/autocycler/resolve/main.nf index 29c234c819c..38e19ea580c 100644 --- a/modules/nf-core/autocycler/resolve/main.nf +++ b/modules/nf-core/autocycler/resolve/main.nf @@ -36,12 +36,7 @@ process AUTOCYCLER_RESOLVE { stub: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - // TODO nf-core: A stub section should mimic the execution of the original module as best as possible - // Have a look at the following examples: - // Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63 - // Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54 """ - touch 3_bridged.gfa touch 4_merged.gfa touch 5_final.gfa diff --git a/modules/nf-core/autocycler/resolve/meta.yml b/modules/nf-core/autocycler/resolve/meta.yml index 37995980451..5dd628b1e16 100644 --- a/modules/nf-core/autocycler/resolve/meta.yml +++ b/modules/nf-core/autocycler/resolve/meta.yml @@ -40,7 +40,8 @@ output: description: Assembly graph with bridges resolved. pattern: "3_bridged.gfa" ontologies: - - edam: "http://edamontology.org/format_3975" #GFA1 merged: + - edam: "http://edamontology.org/format_3975" #GFA1 + merged: - - meta: type: map description: | @@ -51,7 +52,8 @@ output: description: Merged assembly graph after bridging. pattern: "4_merged.gfa" ontologies: - - edam: "http://edamontology.org/format_3975" #GFA1 resolved: + - edam: "http://edamontology.org/format_3975" #GFA1 + resolved: - - meta: type: map description: | @@ -62,7 +64,8 @@ output: description: Final resolved assembly graph. pattern: "5_final.gfa" ontologies: - - edam: "http://edamontology.org/format_3975" #GFA1 versions: + - edam: "http://edamontology.org/format_3975" #GFA1 + versions: - "versions.yml": type: file description: File containing software versions diff --git a/modules/nf-core/autocycler/resolve/tests/main.nf.test b/modules/nf-core/autocycler/resolve/tests/main.nf.test index af249563c74..130f4f2912b 100644 --- a/modules/nf-core/autocycler/resolve/tests/main.nf.test +++ b/modules/nf-core/autocycler/resolve/tests/main.nf.test @@ -5,8 +5,11 @@ nextflow_process { process "AUTOCYCLER_RESOLVE" tag "modules" - tag "modules_" + tag "modules_nfcore" tag "autocycler" + tag "autocycler/compress" + tag "autocycler/cluster" + tag "autocycler/trim" tag "autocycler/resolve" test("sarscov2 - assemblies - fasta") { diff --git a/modules/nf-core/autocycler/subsample/environment.yml b/modules/nf-core/autocycler/subsample/environment.yml index 09bd33d1a6b..4acd4e2ab28 100644 --- a/modules/nf-core/autocycler/subsample/environment.yml +++ b/modules/nf-core/autocycler/subsample/environment.yml @@ -4,7 +4,4 @@ channels: - conda-forge - bioconda dependencies: - # TODO nf-core: List required Conda package(s). - # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/subsample/main.nf b/modules/nf-core/autocycler/subsample/main.nf index daee585ec70..e8b88c97943 100644 --- a/modules/nf-core/autocycler/subsample/main.nf +++ b/modules/nf-core/autocycler/subsample/main.nf @@ -9,8 +9,6 @@ process AUTOCYCLER_SUBSAMPLE { 'biocontainers/autocycler:0.5.2--h3ab6199_0' }" input: - // TODO nf-core: Where applicable please provide/convert compressed files as input/output - // e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc. tuple val(meta), path(reads) val genome_size diff --git a/modules/nf-core/autocycler/subsample/meta.yml b/modules/nf-core/autocycler/subsample/meta.yml index 889328503a5..17e972ff4e5 100644 --- a/modules/nf-core/autocycler/subsample/meta.yml +++ b/modules/nf-core/autocycler/subsample/meta.yml @@ -39,7 +39,7 @@ output: description: | Groovy Map containing sample information e.g. `[ id:'sample1' ]` - - "*/*.fastq.gz": + - "$prefix/*.fastq.gz": type: file description: Subsampled reads produced by Autocycler. pattern: "*/*.fastq.gz" diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test b/modules/nf-core/autocycler/subsample/tests/main.nf.test index fcb1dce2809..97d24dd17c1 100644 --- a/modules/nf-core/autocycler/subsample/tests/main.nf.test +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test @@ -6,7 +6,7 @@ nextflow_process { config "./nextflow.config" tag "modules" - tag "modules_" + tag "modules_nfcore" tag "autocycler" tag "autocycler/subsample" diff --git a/modules/nf-core/autocycler/trim/environment.yml b/modules/nf-core/autocycler/trim/environment.yml index 09bd33d1a6b..4acd4e2ab28 100644 --- a/modules/nf-core/autocycler/trim/environment.yml +++ b/modules/nf-core/autocycler/trim/environment.yml @@ -4,7 +4,4 @@ channels: - conda-forge - bioconda dependencies: - # TODO nf-core: List required Conda package(s). - # Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10"). - # For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. - "bioconda::autocycler=0.5.2" diff --git a/modules/nf-core/autocycler/trim/meta.yml b/modules/nf-core/autocycler/trim/meta.yml index d7a4d645e4f..e69f8b1efa5 100644 --- a/modules/nf-core/autocycler/trim/meta.yml +++ b/modules/nf-core/autocycler/trim/meta.yml @@ -40,7 +40,8 @@ output: description: Trimmed assembly graphs emitted by Autocycler. pattern: "*.gfa" ontologies: - - edam: "http://edamontology.org/format_3975" #GFA1 stats: + - edam: "http://edamontology.org/format_3975" #GFA1 + stats: - - meta: type: map description: | diff --git a/modules/nf-core/autocycler/trim/tests/main.nf.test b/modules/nf-core/autocycler/trim/tests/main.nf.test index 910f35b8c49..693f04cf21f 100644 --- a/modules/nf-core/autocycler/trim/tests/main.nf.test +++ b/modules/nf-core/autocycler/trim/tests/main.nf.test @@ -1,5 +1,3 @@ -// TODO nf-core: Once you have added the required tests, please run the following command to build this file: -// nf-core modules test autocycler/trim nextflow_process { name "Test Process AUTOCYCLER_TRIM" @@ -7,8 +5,10 @@ nextflow_process { process "AUTOCYCLER_TRIM" tag "modules" - tag "modules_" + tag "modules_nfcore" tag "autocycler" + tag "autocycler/compress" + tag "autocycler/cluster" tag "autocycler/trim" test("sarscov2 - assemblies - fasta") { diff --git a/modules/nf-core/autocycler/trim/tests/main.nf.test.snap b/modules/nf-core/autocycler/trim/tests/main.nf.test.snap index a1a08b22690..9762d4262d1 100644 --- a/modules/nf-core/autocycler/trim/tests/main.nf.test.snap +++ b/modules/nf-core/autocycler/trim/tests/main.nf.test.snap @@ -192,59 +192,6 @@ }, "timestamp": "2025-10-28T10:57:59.014535177" }, - "sarscov2 - bam - stub": { - "content": [ - { - "0": [ - [ - { - "id": "test", - "single_end": false - }, - "2_trimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "1": [ - [ - { - "id": "test", - "single_end": false - }, - "2_trimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "2": [ - "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" - ], - "gfa": [ - [ - { - "id": "test", - "single_end": false - }, - "2_trimmed.gfa:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "stats": [ - [ - { - "id": "test", - "single_end": false - }, - "2_trimmed.yaml:md5,d41d8cd98f00b204e9800998ecf8427e" - ] - ], - "versions": [ - "versions.yml:md5,9d6f2f1409574f288a085c66ba884cb7" - ] - } - ], - "meta": { - "nf-test": "0.9.2", - "nextflow": "25.04.4" - }, - "timestamp": "2025-10-28T10:50:43.693655569" - }, "sarscov2 - assemblies -fasta - stub": { "content": [ { From be0b13dfdb649d024d1cb6f7f019a8c2d07963a8 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Tue, 28 Oct 2025 14:23:20 +0000 Subject: [PATCH 05/10] Harshil Alignment --- modules/nf-core/autocycler/cluster/main.nf | 17 ++++++++--------- modules/nf-core/autocycler/combine/main.nf | 14 +++++++------- modules/nf-core/autocycler/compress/main.nf | 9 ++++----- modules/nf-core/autocycler/resolve/main.nf | 10 +++++----- modules/nf-core/autocycler/subsample/main.nf | 10 +++++----- modules/nf-core/autocycler/trim/main.nf | 8 ++++---- 6 files changed, 33 insertions(+), 35 deletions(-) diff --git a/modules/nf-core/autocycler/cluster/main.nf b/modules/nf-core/autocycler/cluster/main.nf index 5194e68b79e..c2d0c7f5b02 100644 --- a/modules/nf-core/autocycler/cluster/main.nf +++ b/modules/nf-core/autocycler/cluster/main.nf @@ -11,20 +11,19 @@ process AUTOCYCLER_CLUSTER { tuple val(meta), path(gfa) output: - tuple val(meta), path("clustering/qc_pass/*/*.gfa"), emit: clusters + tuple val(meta), path("clustering/qc_pass/*/*.gfa"), emit: clusters tuple val(meta), path("clustering/qc_pass/*/*.yaml"), emit: clusterstats - tuple val(meta), path("clustering/*.newick"), emit: newick - tuple val(meta), path("clustering/*.tsv"), emit: tsv - tuple val(meta), path("clustering/*.phylip"), emit: pairwisedistances - tuple val(meta), path("clustering/*.yaml"), emit: stats - - path "versions.yml" , emit: versions + tuple val(meta), path("clustering/*.newick"), emit: newick + tuple val(meta), path("clustering/*.tsv"), emit: tsv + tuple val(meta), path("clustering/*.phylip"), emit: pairwisedistances + tuple val(meta), path("clustering/*.yaml"), emit: stats + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ autocycler cluster \\ @@ -38,7 +37,7 @@ process AUTOCYCLER_CLUSTER { """ stub: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir clustering/qc_pass/cluster_000 -p diff --git a/modules/nf-core/autocycler/combine/main.nf b/modules/nf-core/autocycler/combine/main.nf index 94919fb9ef8..80db2762112 100644 --- a/modules/nf-core/autocycler/combine/main.nf +++ b/modules/nf-core/autocycler/combine/main.nf @@ -12,16 +12,16 @@ process AUTOCYCLER_COMBINE { output: tuple val(meta), path("$prefix/consensus_assembly.fasta"), emit: fasta - tuple val(meta), path("$prefix/consensus_assembly.gfa"), emit: gfa - tuple val(meta), path("$prefix/consensus_assembly.yaml"), emit: stats - path "versions.yml" , emit: versions + tuple val(meta), path("$prefix/consensus_assembly.gfa"), emit: gfa + tuple val(meta), path("$prefix/consensus_assembly.yaml"), emit: stats + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ autocycler combine \\ $args \\ @@ -35,8 +35,8 @@ process AUTOCYCLER_COMBINE { """ stub: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ mkdir $prefix touch $prefix/consensus_assembly.{fasta,gfa,yaml} diff --git a/modules/nf-core/autocycler/compress/main.nf b/modules/nf-core/autocycler/compress/main.nf index a7330344c74..29ee404f453 100644 --- a/modules/nf-core/autocycler/compress/main.nf +++ b/modules/nf-core/autocycler/compress/main.nf @@ -12,17 +12,16 @@ process AUTOCYCLER_COMPRESS { tuple val(meta), path(assemblies) output: - tuple val(meta), path("$prefix/*.gfa"), emit: gfa + tuple val(meta), path("$prefix/*.gfa"), emit: gfa tuple val(meta), path("$prefix/*.yaml"), emit: stats - - path "versions.yml" , emit: versions + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ autocycler compress \\ $args \\ diff --git a/modules/nf-core/autocycler/resolve/main.nf b/modules/nf-core/autocycler/resolve/main.nf index 38e19ea580c..7913aaef3e5 100644 --- a/modules/nf-core/autocycler/resolve/main.nf +++ b/modules/nf-core/autocycler/resolve/main.nf @@ -12,15 +12,15 @@ process AUTOCYCLER_RESOLVE { output: tuple val(meta), path("3_bridged.gfa"), emit: bridged - tuple val(meta), path("4_merged.gfa"), emit: merged - tuple val(meta), path("5_final.gfa"), emit: resolved - path "versions.yml" , emit: versions + tuple val(meta), path("4_merged.gfa"), emit: merged + tuple val(meta), path("5_final.gfa"), emit: resolved + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ autocycler resolve \\ @@ -34,7 +34,7 @@ process AUTOCYCLER_RESOLVE { """ stub: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ touch 3_bridged.gfa diff --git a/modules/nf-core/autocycler/subsample/main.nf b/modules/nf-core/autocycler/subsample/main.nf index e8b88c97943..39d18ad1cc2 100644 --- a/modules/nf-core/autocycler/subsample/main.nf +++ b/modules/nf-core/autocycler/subsample/main.nf @@ -14,14 +14,14 @@ process AUTOCYCLER_SUBSAMPLE { output: tuple val(meta), path("$prefix/*.fastq.gz"), emit: subsampled_reads - path "versions.yml" , emit: versions + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ autocycler subsample \\ $args \\ @@ -38,8 +38,8 @@ process AUTOCYCLER_SUBSAMPLE { """ stub: - def args = task.ext.args ?: '' - prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" """ mkdir $prefix diff --git a/modules/nf-core/autocycler/trim/main.nf b/modules/nf-core/autocycler/trim/main.nf index 59f6afb900d..c53840bd480 100644 --- a/modules/nf-core/autocycler/trim/main.nf +++ b/modules/nf-core/autocycler/trim/main.nf @@ -11,15 +11,15 @@ process AUTOCYCLER_TRIM { tuple val(meta), path(gfa) output: - tuple val(meta), path("*.gfa"), emit: gfa + tuple val(meta), path("*.gfa"), emit: gfa tuple val(meta), path("*.yaml"), emit: stats - path "versions.yml" , emit: versions + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ autocycler trim \\ @@ -34,7 +34,7 @@ process AUTOCYCLER_TRIM { """ stub: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" """ From d70c4168c0833cf989a6e4cd006c04c3d144b28b Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Wed, 29 Oct 2025 07:47:00 +0000 Subject: [PATCH 06/10] Remove channel view (used for debugging) Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --- modules/nf-core/autocycler/combine/tests/main.nf.test | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/nf-core/autocycler/combine/tests/main.nf.test b/modules/nf-core/autocycler/combine/tests/main.nf.test index d6899e6a02b..86049595c46 100644 --- a/modules/nf-core/autocycler/combine/tests/main.nf.test +++ b/modules/nf-core/autocycler/combine/tests/main.nf.test @@ -70,7 +70,6 @@ nextflow_process { when { process { """ - AUTOCYCLER_RESOLVE.out.resolved.view{println it} input[0] = AUTOCYCLER_RESOLVE.out.resolved """ } From f3f3434056375d231ca8b71d89dbc73cb13e7234 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Wed, 29 Oct 2025 07:50:25 +0000 Subject: [PATCH 07/10] Make empty gzipped fastq file for subsample stub Work around for nf-test bug with .fastq.gz files that aren't gzipped Co-authored-by: Simon Pearce <24893913+SPPearce@users.noreply.github.com> --- modules/nf-core/autocycler/subsample/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/autocycler/subsample/main.nf b/modules/nf-core/autocycler/subsample/main.nf index 39d18ad1cc2..f113c1b6008 100644 --- a/modules/nf-core/autocycler/subsample/main.nf +++ b/modules/nf-core/autocycler/subsample/main.nf @@ -43,7 +43,7 @@ process AUTOCYCLER_SUBSAMPLE { """ mkdir $prefix - touch ${prefix}/sample_00.fastq.gz + echo | gzip > ${prefix}/sample_00.fastq.gz cat <<-END_VERSIONS > versions.yml "${task.process}": From f48b1eeb83a98059a1af4da61985ab767bac71a3 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Wed, 29 Oct 2025 09:41:02 +0000 Subject: [PATCH 08/10] Fix random seed by default and change test data Use small cov2 readset for testing, set genome size very low to allow subsampling --- modules/nf-core/autocycler/subsample/main.nf | 2 + .../autocycler/subsample/tests/main.nf.test | 12 ++--- .../subsample/tests/main.nf.test.snap | 53 +++++++++++++++---- 3 files changed, 49 insertions(+), 18 deletions(-) diff --git a/modules/nf-core/autocycler/subsample/main.nf b/modules/nf-core/autocycler/subsample/main.nf index f113c1b6008..65a4d1f2196 100644 --- a/modules/nf-core/autocycler/subsample/main.nf +++ b/modules/nf-core/autocycler/subsample/main.nf @@ -22,6 +22,8 @@ process AUTOCYCLER_SUBSAMPLE { script: def args = task.ext.args ?: '' prefix = task.ext.prefix ?: "${meta.id}" + // fix random seed for reproducibility if not specified in command line + if (!(args ==~ /.*--seed.*/)) {args += " --seed 42"} """ autocycler subsample \\ $args \\ diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test b/modules/nf-core/autocycler/subsample/tests/main.nf.test index 97d24dd17c1..b7751e8813d 100644 --- a/modules/nf-core/autocycler/subsample/tests/main.nf.test +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test @@ -3,7 +3,6 @@ nextflow_process { name "Test Process AUTOCYCLER_SUBSAMPLE" script "../main.nf" process "AUTOCYCLER_SUBSAMPLE" - config "./nextflow.config" tag "modules" tag "modules_nfcore" @@ -13,16 +12,13 @@ nextflow_process { test("Pseudomonas_fluorescens - fastq_gz") { when { - params{ - module_args = '--seed 1234' - } process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file('https://github.com/nf-core/test-datasets/raw/refs/heads/bacass/nanopore/subset15000.fq.gz', checkIfExists: true), // reads + file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test.fastq.gz', checkIfExists: true), // reads ] - input[1] = 30000 // genome size + input[1] = 300 // set genome size very small to get sufficient depth """ } } @@ -41,9 +37,6 @@ nextflow_process { options "-stub" when { - params{ - module_args = '' - } process { """ input[0] = [ @@ -58,6 +51,7 @@ nextflow_process { then { assertAll( { assert process.success }, + { assert snapshot(process.out).match() } ) } diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test.snap b/modules/nf-core/autocycler/subsample/tests/main.nf.test.snap index 27d2cf6faa4..c0d75d98e41 100644 --- a/modules/nf-core/autocycler/subsample/tests/main.nf.test.snap +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test.snap @@ -9,10 +9,10 @@ "single_end": false }, [ - "sample_01.fastq.gz:md5,b1cc8c9ee163474d67d7889e25e4e0ae", - "sample_02.fastq.gz:md5,c3124b6b062158d41e822a9ff16df988", - "sample_03.fastq.gz:md5,3f2db5a32a4a0cfdbb5a58b5a81f3a92", - "sample_04.fastq.gz:md5,28c99f7e4565924229a980500c185802" + "sample_01.fastq.gz:md5,7a9ac52d5071893300808fc11091bdbb", + "sample_02.fastq.gz:md5,e1e73dc1f31aa8b30834286d13ab500a", + "sample_03.fastq.gz:md5,e5cead9b5bbdf541062423065a5b6f51", + "sample_04.fastq.gz:md5,312cb2589411da99ecfd50392e999cdc" ] ] ], @@ -26,10 +26,10 @@ "single_end": false }, [ - "sample_01.fastq.gz:md5,b1cc8c9ee163474d67d7889e25e4e0ae", - "sample_02.fastq.gz:md5,c3124b6b062158d41e822a9ff16df988", - "sample_03.fastq.gz:md5,3f2db5a32a4a0cfdbb5a58b5a81f3a92", - "sample_04.fastq.gz:md5,28c99f7e4565924229a980500c185802" + "sample_01.fastq.gz:md5,7a9ac52d5071893300808fc11091bdbb", + "sample_02.fastq.gz:md5,e1e73dc1f31aa8b30834286d13ab500a", + "sample_03.fastq.gz:md5,e5cead9b5bbdf541062423065a5b6f51", + "sample_04.fastq.gz:md5,312cb2589411da99ecfd50392e999cdc" ] ] ], @@ -42,6 +42,41 @@ "nf-test": "0.9.2", "nextflow": "25.04.4" }, - "timestamp": "2025-10-27T17:18:38.77396493" + "timestamp": "2025-10-29T08:36:17.505206711" + }, + "Pseudomonas_fluorescens - fastq_gz - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "sample_00.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,0abfe90f7bd1d54716b236993073b514" + ], + "subsampled_reads": [ + [ + { + "id": "test", + "single_end": false + }, + "sample_00.fastq.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,0abfe90f7bd1d54716b236993073b514" + ] + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "25.04.4" + }, + "timestamp": "2025-10-29T08:07:36.406154106" } } \ No newline at end of file From 701e19df2a9d40c95c2aa34fa42de42c98b27227 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Wed, 29 Oct 2025 15:28:54 +0000 Subject: [PATCH 09/10] Update test data for `autocycler subsample` stub --- modules/nf-core/autocycler/subsample/tests/main.nf.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/nf-core/autocycler/subsample/tests/main.nf.test b/modules/nf-core/autocycler/subsample/tests/main.nf.test index b7751e8813d..c49afba8285 100644 --- a/modules/nf-core/autocycler/subsample/tests/main.nf.test +++ b/modules/nf-core/autocycler/subsample/tests/main.nf.test @@ -41,7 +41,7 @@ nextflow_process { """ input[0] = [ [ id:'test', single_end:false ], // meta map - file('https://github.com/nf-core/test-datasets/raw/refs/heads/bacass/nanopore/subset15000.fq.gz', checkIfExists: true), // reads + file(params.modules_testdata_base_path + 'genomics/sarscov2/nanopore/fastq/test.fastq.gz', checkIfExists: true), // reads ] input[1] = 30000 // genome size """ From dcb6f9e46083e154a5982ca04ca57708636ec0a5 Mon Sep 17 00:00:00 2001 From: dwells-eit Date: Wed, 29 Oct 2025 15:29:57 +0000 Subject: [PATCH 10/10] Remove unused prefix definition from `autocycler` `cluster`,`trim`,`resolve` --- modules/nf-core/autocycler/cluster/main.nf | 2 -- modules/nf-core/autocycler/resolve/main.nf | 2 -- modules/nf-core/autocycler/trim/main.nf | 2 -- 3 files changed, 6 deletions(-) diff --git a/modules/nf-core/autocycler/cluster/main.nf b/modules/nf-core/autocycler/cluster/main.nf index c2d0c7f5b02..7ed022d770b 100644 --- a/modules/nf-core/autocycler/cluster/main.nf +++ b/modules/nf-core/autocycler/cluster/main.nf @@ -24,7 +24,6 @@ process AUTOCYCLER_CLUSTER { script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" """ autocycler cluster \\ $args \\ @@ -38,7 +37,6 @@ process AUTOCYCLER_CLUSTER { stub: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" """ mkdir clustering/qc_pass/cluster_000 -p touch clustering/clustering.{newick,yaml,tsv} diff --git a/modules/nf-core/autocycler/resolve/main.nf b/modules/nf-core/autocycler/resolve/main.nf index 7913aaef3e5..409aa9f0d4c 100644 --- a/modules/nf-core/autocycler/resolve/main.nf +++ b/modules/nf-core/autocycler/resolve/main.nf @@ -21,7 +21,6 @@ process AUTOCYCLER_RESOLVE { script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" """ autocycler resolve \\ $args \\ @@ -35,7 +34,6 @@ process AUTOCYCLER_RESOLVE { stub: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" """ touch 3_bridged.gfa touch 4_merged.gfa diff --git a/modules/nf-core/autocycler/trim/main.nf b/modules/nf-core/autocycler/trim/main.nf index c53840bd480..4cca2a8dcc2 100644 --- a/modules/nf-core/autocycler/trim/main.nf +++ b/modules/nf-core/autocycler/trim/main.nf @@ -20,7 +20,6 @@ process AUTOCYCLER_TRIM { script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" """ autocycler trim \\ $args \\ @@ -35,7 +34,6 @@ process AUTOCYCLER_TRIM { stub: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" """ touch 2_trimmed.gfa