diff --git a/modules/nf-core/crabz/compress/environment.yml b/modules/nf-core/crabz/compress/environment.yml new file mode 100644 index 00000000000..65ce81e02da --- /dev/null +++ b/modules/nf-core/crabz/compress/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "crabz_compress" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - conda-forge::crabz=0.9.0 diff --git a/modules/nf-core/crabz/compress/main.nf b/modules/nf-core/crabz/compress/main.nf new file mode 100644 index 00000000000..2e8c69930b6 --- /dev/null +++ b/modules/nf-core/crabz/compress/main.nf @@ -0,0 +1,49 @@ +process CRABZ_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/crabz:0.9.0': + 'biocontainers/crabz:0.9.0' }" + + input: + tuple val(meta), path(file) + + output: + tuple val(meta), path("*.gz"), emit: archive + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${file}" + """ + crabz \\ + $args \\ + -p $task.cpus \\ + -o ${prefix}.gz \\ + $file + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + crabz: \$(crabz --version |& sed 's/[^:]*://') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${file}" + """ + echo "" | gzip > ${prefix}.gz + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + crabz: \$(crabz --version |& sed 's/[^:]*://') + + + END_VERSIONS + """ +} diff --git a/modules/nf-core/crabz/compress/meta.yml b/modules/nf-core/crabz/compress/meta.yml new file mode 100644 index 00000000000..bd7cc8a6a87 --- /dev/null +++ b/modules/nf-core/crabz/compress/meta.yml @@ -0,0 +1,50 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "crabz_compress" +description: Compress files with crabz +keywords: + - compression + - gzip + - zlib +tools: + - crabz: + description: "Like pigz, but rust" + homepage: "https://github.com/sstadick/crabz" + documentation: "https://github.com/sstadick/crabz" + tool_dev_url: "https://github.com/sstadick/crabz" + licence: ["MIT"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - file: + type: file + description: File to be compressed + pattern: "*.*" + +output: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - archive: + type: file + description: The compressed file + pattern: "*.gz" + +authors: + - "@camlloyd" +maintainers: + - "@camlloyd" diff --git a/modules/nf-core/crabz/compress/tests/main.nf.test b/modules/nf-core/crabz/compress/tests/main.nf.test new file mode 100644 index 00000000000..8e34809c849 --- /dev/null +++ b/modules/nf-core/crabz/compress/tests/main.nf.test @@ -0,0 +1,61 @@ +nextflow_process { + + name "Test Process CRABZ_COMPRESS" + script "../main.nf" + process "CRABZ_COMPRESS" + + tag "modules" + tag "modules_nfcore" + tag "crabz" + tag "crabz/compress" + + test("sarscov2 - genome - fasta") { + + + when { + process { + """ + + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("sarscov2 - genome - fasta - stub") { + + options "-stub" + + when { + process { + """ + + input[0] = [ + [ id:'test'], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/crabz/compress/tests/main.nf.test.snap b/modules/nf-core/crabz/compress/tests/main.nf.test.snap new file mode 100644 index 00000000000..cf326dd22e9 --- /dev/null +++ b/modules/nf-core/crabz/compress/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "sarscov2 - genome - fasta": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "genome.fasta.gz:md5,6e9fe4042a72f2345f644f239272b7e6" + ] + ], + "1": [ + "versions.yml:md5,9373554d583e736a1298a62f058cc38e" + ], + "archive": [ + [ + { + "id": "test" + }, + "genome.fasta.gz:md5,6e9fe4042a72f2345f644f239272b7e6" + ] + ], + "versions": [ + "versions.yml:md5,9373554d583e736a1298a62f058cc38e" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T08:40:52.942022048" + }, + "sarscov2 - genome - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "genome.fasta.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "1": [ + "versions.yml:md5,2b6ce6457b0740d8de7a3d649bbfb1e5" + ], + "archive": [ + [ + { + "id": "test" + }, + "genome.fasta.gz:md5,68b329da9893e34099c7d8ad5cb9c940" + ] + ], + "versions": [ + "versions.yml:md5,2b6ce6457b0740d8de7a3d649bbfb1e5" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T08:41:04.554361005" + } +} \ No newline at end of file diff --git a/modules/nf-core/crabz/compress/tests/tags.yml b/modules/nf-core/crabz/compress/tests/tags.yml new file mode 100644 index 00000000000..8e4b85985d5 --- /dev/null +++ b/modules/nf-core/crabz/compress/tests/tags.yml @@ -0,0 +1,2 @@ +crabz/compress: + - "modules/nf-core/crabz/compress/**" diff --git a/modules/nf-core/crabz/decompress/environment.yml b/modules/nf-core/crabz/decompress/environment.yml new file mode 100644 index 00000000000..158559c9db5 --- /dev/null +++ b/modules/nf-core/crabz/decompress/environment.yml @@ -0,0 +1,9 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +name: "crabz_decompress" +channels: + - conda-forge + - bioconda + - defaults +dependencies: + - conda-forge::crabz=0.9.0 diff --git a/modules/nf-core/crabz/decompress/main.nf b/modules/nf-core/crabz/decompress/main.nf new file mode 100644 index 00000000000..618ce328ff2 --- /dev/null +++ b/modules/nf-core/crabz/decompress/main.nf @@ -0,0 +1,47 @@ +process CRABZ_DECOMPRESS { + 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/crabz:0.9.0': + 'biocontainers/crabz:0.9.0' }" + + input: + tuple val(meta), path(archive) + + output: + tuple val(meta), path("*.*"), emit: file + path "versions.yml" , emit: versions + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${archive}" + """ + crabz \\ + $args \\ + -p $task.cpus \\ + -o ${prefix} \\ + $archive + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + crabz: \$(crabz --version |& sed 's/[^:]*://') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${archive}" + """ + touch ${prefix} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + crabz: \$(crabz --version |& sed 's/[^:]*://') + END_VERSIONS + """ +} diff --git a/modules/nf-core/crabz/decompress/meta.yml b/modules/nf-core/crabz/decompress/meta.yml new file mode 100644 index 00000000000..9072694c2a7 --- /dev/null +++ b/modules/nf-core/crabz/decompress/meta.yml @@ -0,0 +1,50 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "crabz_decompress" +description: Decompress files with crabz +keywords: + - decompression + - gzip + - zlib +tools: + - crabz: + description: "Like pigz, but rust" + homepage: "https://github.com/sstadick/crabz" + documentation: "https://github.com/sstadick/crabz" + tool_dev_url: "https://github.com/sstadick/crabz" + licence: ["MIT"] + +input: + # Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - archive: + type: file + description: File to be decompressed + pattern: "*.gz" + +output: + #Only when we have meta + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - file: + type: file + description: The decompressed file + pattern: "*.*" + +authors: + - "@camlloyd" +maintainers: + - "@camlloyd" diff --git a/modules/nf-core/crabz/decompress/tests/main.nf.test b/modules/nf-core/crabz/decompress/tests/main.nf.test new file mode 100644 index 00000000000..00dc01dfb6d --- /dev/null +++ b/modules/nf-core/crabz/decompress/tests/main.nf.test @@ -0,0 +1,62 @@ +nextflow_process { + + name "Test Process CRABZ_DECOMPRESS" + script "../main.nf" + process "CRABZ_DECOMPRESS" + + tag "modules" + tag "modules_nfcore" + tag "crabz" + tag "crabz/decompress" + + test("sarscov2 - genome - fasta.gz") { + + + when { + process { + """ + + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + // See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples. + ) + } + + } + + test("sarscov2 - genome - fasta.gz - stub") { + + options "-stub" + + when { + process { + """ + + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/sarscov2/genome/genome.fasta.gz', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/crabz/decompress/tests/main.nf.test.snap b/modules/nf-core/crabz/decompress/tests/main.nf.test.snap new file mode 100644 index 00000000000..b8a9e165360 --- /dev/null +++ b/modules/nf-core/crabz/decompress/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "sarscov2 - genome - fasta.gz - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ] + ], + "1": [ + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ], + "file": [ + [ + { + "id": "test" + }, + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ] + ], + "versions": [ + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T22:28:29.696013524" + }, + "sarscov2 - genome - fasta.gz": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ] + ], + "1": [ + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ], + "file": [ + [ + { + "id": "test" + }, + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ] + ], + "versions": [ + "versions.yml:md5,a030ab04ae7e2b0d971c7ad614d0d6c3" + ] + } + ], + "meta": { + "nf-test": "0.8.4", + "nextflow": "23.10.1" + }, + "timestamp": "2024-03-21T22:28:20.286164258" + } +} \ No newline at end of file diff --git a/modules/nf-core/crabz/decompress/tests/tags.yml b/modules/nf-core/crabz/decompress/tests/tags.yml new file mode 100644 index 00000000000..092edcb5919 --- /dev/null +++ b/modules/nf-core/crabz/decompress/tests/tags.yml @@ -0,0 +1,2 @@ +crabz/decompress: + - "modules/nf-core/crabz/decompress/**"