diff --git a/modules.json b/modules.json index 7716936..e45930a 100644 --- a/modules.json +++ b/modules.json @@ -59,6 +59,14 @@ "modules" ] }, + "fastx/collapser": { + "branch": "master", + "git_sha": "210e7c8f33f8ca0e35e027aa8889d03205a57b88", + "installed_by": [ + "modules" + ], + "patch": "modules/nf-core/fastx/collapser/fastx-collapser.diff" + }, "gunzip": { "branch": "master", "git_sha": "5c460c5a4736974abde2843294f35307ee2b0e5e", diff --git a/modules/local/fastx_toolkit/collapser.nf b/modules/local/fastx_toolkit/collapser.nf deleted file mode 100644 index a071fde..0000000 --- a/modules/local/fastx_toolkit/collapser.nf +++ /dev/null @@ -1,33 +0,0 @@ -process FASTX_COLLAPSER { - tag "$meta.id" - label 'process_medium' - - conda "bioconda::fastx_toolkit=0.0.14" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/fastx_toolkit:0.0.14--hdbdd923_11': - 'quay.io/biocontainers/fastx_toolkit:0.0.14--hdbdd923_11' }" - - input: - tuple val(meta), path(fastq) - - output: - tuple val(meta), path("*fasta"), emit: collapsed - 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}" - """ - fastx_collapser \\ - -i $fastq \\ - -o ${prefix}.fasta - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - : \$(echo \$(fastx_collapser -h) | sed -nE 's/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/p' )) - END_VERSIONS - """ -} diff --git a/modules/nf-core/fastx/collapser/environment.yml b/modules/nf-core/fastx/collapser/environment.yml new file mode 100644 index 0000000..b685bd7 --- /dev/null +++ b/modules/nf-core/fastx/collapser/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "fastx_collapser" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - "bioconda::fastx_toolkit=0.0.14" diff --git a/modules/nf-core/fastx/collapser/fastx-collapser.diff b/modules/nf-core/fastx/collapser/fastx-collapser.diff new file mode 100644 index 0000000..266e2d5 --- /dev/null +++ b/modules/nf-core/fastx/collapser/fastx-collapser.diff @@ -0,0 +1,14 @@ +Changes in module 'nf-core/fastx/collapser' +--- modules/nf-core/fastx/collapser/main.nf ++++ modules/nf-core/fastx/collapser/main.nf +@@ -5,7 +5,7 @@ + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/fastx_toolkit:0.0.14--hdbdd923_11': +- 'biocontainers/fastx_toolkit:0.0.14--hdbdd923_11' }" ++ 'quay.io/biocontainers/fastx_toolkit:0.0.14--hdbdd923_11' }" + + input: + tuple val(meta), path(fastx) + +************************************************************ diff --git a/modules/nf-core/fastx/collapser/main.nf b/modules/nf-core/fastx/collapser/main.nf new file mode 100644 index 0000000..5447391 --- /dev/null +++ b/modules/nf-core/fastx/collapser/main.nf @@ -0,0 +1,46 @@ +process FASTX_COLLAPSER { + tag "$meta.id" + label 'process_medium' + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/fastx_toolkit:0.0.14--hdbdd923_11': + 'quay.io/biocontainers/fastx_toolkit:0.0.14--hdbdd923_11' }" + + input: + tuple val(meta), path(fastx) + + output: + tuple val(meta), path("${prefix}.fasta"), emit: fasta + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + fastx_collapser \\ + $args \\ + -i $fastx \\ + -o ${prefix}.fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fastx: \$(echo \$(fastx_collapser -h) | sed -nE 's/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/p' )) + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fasta + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + fastx: \$(echo \$(fastx_collapser -h) | sed -nE 's/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/p' )) + END_VERSIONS + """ +} diff --git a/modules/nf-core/fastx/collapser/meta.yml b/modules/nf-core/fastx/collapser/meta.yml new file mode 100644 index 0000000..ad36701 --- /dev/null +++ b/modules/nf-core/fastx/collapser/meta.yml @@ -0,0 +1,51 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "fastx_collapser" +description: Collapses identical sequences in a FASTQ/A file into a single sequence (while maintaining reads counts) +keywords: + - collapse + - genomics + - fasta + - fastq +tools: + - "fastx": + description: "A collection of command line tools for Short-Reads FASTA/FASTQ files preprocessing" + homepage: "http://hannonlab.cshl.edu/fastx_toolkit/" + documentation: "http://hannonlab.cshl.edu/fastx_toolkit/commandline.html" + tool_dev_url: "https://github.com/agordon/fastx_toolkit" + licence: ["AGPL"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - fastx: + type: file + description: Decompressed FASTA/FASTQ input file + pattern: "*.{fastq,fasta}" + +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + + - fasta: + type: file + description: Collapsed FASTA file + pattern: "*.fasta" + +authors: + - "@jvfe" +maintainers: + - "@jvfe" diff --git a/modules/nf-core/fastx/collapser/tests/main.nf.test b/modules/nf-core/fastx/collapser/tests/main.nf.test new file mode 100644 index 0000000..c3a4f09 --- /dev/null +++ b/modules/nf-core/fastx/collapser/tests/main.nf.test @@ -0,0 +1,61 @@ +// nf-core modules test fastx/collapser +nextflow_process { + + name "Test Process FASTX_COLLAPSER" + script "../main.nf" + process "FASTX_COLLAPSER" + + tag "modules" + tag "modules_nfcore" + tag "fastx" + tag "fastx/collapser" + + test("homo_sapiens - fasta") { + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.test_data['homo_sapiens']['pacbio']['ccs_fa'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert path(process.out.fasta[0][1]).text.contains(">1-1") }, + { assert process.out.fasta[0][1] ==~ ".*/test.fasta" }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("homo_sapiens - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test'], // meta map + file(params.test_data['homo_sapiens']['pacbio']['ccs_fa'], checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} \ No newline at end of file diff --git a/modules/nf-core/fastx/collapser/tests/main.nf.test.snap b/modules/nf-core/fastx/collapser/tests/main.nf.test.snap new file mode 100644 index 0000000..3765b47 --- /dev/null +++ b/modules/nf-core/fastx/collapser/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "homo_sapiens - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ], + "fasta": [ + [ + { + "id": "test" + }, + "test.fasta:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T10:14:28.765300067" + }, + "homo_sapiens - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fasta:md5,b6b46831557eab6fe7a51419823fb079" + ] + ], + "1": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ], + "fasta": [ + [ + { + "id": "test" + }, + "test.fasta:md5,b6b46831557eab6fe7a51419823fb079" + ] + ], + "versions": [ + "versions.yml:md5,398e38403d1f6ea2dc8f7595aa41254f" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-19T10:17:46.177654196" + } +} \ No newline at end of file diff --git a/modules/nf-core/fastx/collapser/tests/tags.yml b/modules/nf-core/fastx/collapser/tests/tags.yml new file mode 100644 index 0000000..75f33bf --- /dev/null +++ b/modules/nf-core/fastx/collapser/tests/tags.yml @@ -0,0 +1,2 @@ +fastx/collapser: + - "modules/nf-core/fastx/collapser/**" diff --git a/workflows/euryale.nf b/workflows/euryale.nf index 2df1a88..7f899ab 100644 --- a/workflows/euryale.nf +++ b/workflows/euryale.nf @@ -36,7 +36,6 @@ ch_multiqc_custom_methods_description = params.multiqc_methods_description ? fil // // MODULES // -include { FASTX_COLLAPSER } from '../modules/local/fastx_toolkit/collapser' // // SUBWORKFLOW: Consisting of a mix of local and nf-core/modules @@ -59,6 +58,7 @@ include { FUNCTIONAL } from '../subworkflows/local/functional' // MODULE: Installed directly from nf-core/modules // include { GUNZIP } from '../modules/nf-core/gunzip/main' +include { FASTX_COLLAPSER } from '../modules/nf-core/fastx/collapser' include { MULTIQC } from '../modules/nf-core/multiqc/main' include { CUSTOM_DUMPSOFTWAREVERSIONS } from '../modules/nf-core/custom/dumpsoftwareversions/main' @@ -143,7 +143,7 @@ workflow EURYALE { decompressed_reads ) - FASTX_COLLAPSER.out.collapsed.set { clean_reads } + FASTX_COLLAPSER.out.fasta.set { clean_reads } } if (!params.skip_alignment) {