diff --git a/modules/nf-core/crabs/insilicopcr/environment.yml b/modules/nf-core/crabs/insilicopcr/environment.yml new file mode 100644 index 00000000000..c9761a2d14b --- /dev/null +++ b/modules/nf-core/crabs/insilicopcr/environment.yml @@ -0,0 +1,5 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::crabs=1.0.7 diff --git a/modules/nf-core/crabs/insilicopcr/main.nf b/modules/nf-core/crabs/insilicopcr/main.nf new file mode 100644 index 00000000000..ef1e9ffa20f --- /dev/null +++ b/modules/nf-core/crabs/insilicopcr/main.nf @@ -0,0 +1,46 @@ +process CRABS_INSILICOPCR { + 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/crabs:1.0.7--pyhdfd78af_0': + 'biocontainers/crabs:1.0.7--pyhdfd78af_0' }" + + input: + tuple val(meta), path(fasta) + + output: + tuple val(meta), path("*.{fa,fasta}"), emit: fasta + 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}" + """ + crabs --in-silico-pcr \\ + --input $fasta \\ + --output ${prefix}.crabs.fa \\ + --threads ${task.cpus} \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + crabs: \$(crabs --help | grep 'CRABS |' | sed 's/.*CRABS | \\(v[0-9.]*\\).*/\\1/') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.fa + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + crabs: \$(crabs --help | grep 'CRABS |' | sed 's/.*CRABS | \\(v[0-9.]*\\).*/\\1/') + END_VERSIONS + """ +} diff --git a/modules/nf-core/crabs/insilicopcr/meta.yml b/modules/nf-core/crabs/insilicopcr/meta.yml new file mode 100644 index 00000000000..3510f2f7b87 --- /dev/null +++ b/modules/nf-core/crabs/insilicopcr/meta.yml @@ -0,0 +1,52 @@ +name: crabs_insilicopcr +description: CRABS extracts the amplicon region of the primer set by conducting an + in silico PCR. +keywords: + - insilico + - PCR + - amplicon + - sequencing +tools: + - crabs: + description: | + Crabs (Creating Reference databases for Amplicon-Based Sequencing) + is a program to download and curate reference databases + for eDNA metabarcoding analyses + homepage: https://github.com/gjeunen/reference_database_creator + documentation: https://github.com/gjeunen/reference_database_creator?tab=readme-ov-file#running-crabs + tool_dev_url: https://github.com/gjeunen/reference_database_creator + doi: 10.1111/1755-0998.13741 + licence: ["MIT License"] + identifier: "" +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - fasta: + type: file + description: Sequence to conduct in silico PCR on + pattern: "*.{fa,fasta}" +output: + - fasta: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.{fa,fasta}": + type: file + description: Reverse complemented amplified Sequence + pattern: "*.{fa,fasta}" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@famosab" + - "@a4000" +maintainers: + - "@famosab" + - "@a4000" diff --git a/modules/nf-core/crabs/insilicopcr/tests/main.nf.test b/modules/nf-core/crabs/insilicopcr/tests/main.nf.test new file mode 100644 index 00000000000..26b5b0ba93c --- /dev/null +++ b/modules/nf-core/crabs/insilicopcr/tests/main.nf.test @@ -0,0 +1,71 @@ +nextflow_process { + + name "Test Process CRABS_INSILICOPCR" + script "../main.nf" + process "CRABS_INSILICOPCR" + + tag "modules" + tag "modules_nfcore" + tag "crabs" + tag "crabs/insilicopcr" + + test("sarscov2 - fasta") { + + config "./nextflow.config" + + when { + params { + module_args = '--forward "GTCGGTAAAACTCGTGCCAGC" --reverse "CATAGTGGGGTATCTAATCCCAGTTTG"' + } + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome-ena.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + file(process.out.fasta[0][1]).name, + ).match() + } + ) + } + + } + + test("sarscov2 - fasta - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path +'genomics/sarscov2/genome/genome-ena.fasta', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out, + path(process.out.versions[0]).yaml + ).match() + } + ) + } + + } + +} diff --git a/modules/nf-core/crabs/insilicopcr/tests/main.nf.test.snap b/modules/nf-core/crabs/insilicopcr/tests/main.nf.test.snap new file mode 100644 index 00000000000..8e7460f1058 --- /dev/null +++ b/modules/nf-core/crabs/insilicopcr/tests/main.nf.test.snap @@ -0,0 +1,53 @@ +{ + "sarscov2 - fasta - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,adee442c0437fa5a481ff3e3b9760a44" + ], + "fasta": [ + [ + { + "id": "test" + }, + "test.fa:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,adee442c0437fa5a481ff3e3b9760a44" + ] + }, + { + "CRABS_INSILICOPCR": { + "crabs": "v1.0.7" + } + } + ], + "meta": { + "nf-test": "0.9.2", + "nextflow": "24.10.4" + }, + "timestamp": "2025-02-03T14:34:58.943001" + }, + "sarscov2 - fasta": { + "content": [ + [ + "versions.yml:md5,688cca24ee493f8c07e5e069e20fea10" + ], + "test.crabs.fa" + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-05T15:22:12.207826" + } +} \ No newline at end of file diff --git a/modules/nf-core/crabs/insilicopcr/tests/nextflow.config b/modules/nf-core/crabs/insilicopcr/tests/nextflow.config new file mode 100644 index 00000000000..9fdb9ed9351 --- /dev/null +++ b/modules/nf-core/crabs/insilicopcr/tests/nextflow.config @@ -0,0 +1,7 @@ +process { + + withName: CRABS_INSILICOPCR { + ext.args = params.module_args + } + +}