diff --git a/modules/nf-core/priorcons/build_priors/environment.yml b/modules/nf-core/priorcons/build_priors/environment.yml new file mode 100644 index 00000000000..b803e54b32c --- /dev/null +++ b/modules/nf-core/priorcons/build_priors/environment.yml @@ -0,0 +1,7 @@ +--- +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json +channels: + - conda-forge + - bioconda +dependencies: + - "bioconda::priorcons=0.1.0" diff --git a/modules/nf-core/priorcons/build_priors/main.nf b/modules/nf-core/priorcons/build_priors/main.nf new file mode 100644 index 00000000000..d4f9cabf675 --- /dev/null +++ b/modules/nf-core/priorcons/build_priors/main.nf @@ -0,0 +1,49 @@ +process PRIORCONS_BUILDPRIORS { + tag "$meta.id" + label 'process_low' + + // TODO pending the container and singularity image being available with priorcons installed. + conda "${moduleDir}/environment.yml" + // container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + // 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE': + // 'biocontainers/YOUR-TOOL-HERE' }" + + input: + tuple val(meta), path(alignment) // Input alignment FASTA file + val ref_id // Reference sequence ID + + output: + tuple val(meta), path("*.parquet"), emit: priors + 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}" + """ + priorcons \\ + build-priors \\ + --input ${alignment} \\ + --ref ${ref_id} \\ + --output ${prefix}.parquet \\ + $args + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + priorcons: \$(priorcons --version 2>&1 | sed 's/priorcons //') + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.parquet + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + priorcons: \$(priorcons --version 2>&1 | sed 's/priorcons //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/priorcons/build_priors/meta.yml b/modules/nf-core/priorcons/build_priors/meta.yml new file mode 100644 index 00000000000..4405f8c4445 --- /dev/null +++ b/modules/nf-core/priorcons/build_priors/meta.yml @@ -0,0 +1,58 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "priorcons_buildpriors" +description: Build empirical priors from alignment data for consensus sequence + generation +keywords: + - alignment + - priors + - consensus + - genomics +tools: + - "priorcons": + description: "Tool for integrating consensus sequences using prior information." + homepage: "https://github.com/zhliUU/PriorCons" + documentation: "https://github.com/zhliUU/PriorCons" + tool_dev_url: "https://github.com/zhliUU/PriorCons" + licence: ["MIT"] + identifier: "" + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - alignment: + type: file + description: Multiple sequence alignment file + pattern: "*.aln" + ontologies: + - edam: "http://edamontology.org/format_1984" # Plain text alignment format + - ref_id: + type: string + description: Reference sequence ID within the alignment file + +output: + priors: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1' ]` + - "*.parquet": + type: file + description: Empirical priors data in Parquet format + pattern: "*.parquet" + ontologies: [] + versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + ontologies: + - edam: "http://edamontology.org/format_3750" # YAML + +authors: + - "@zhliUU" +maintainers: + - "@zhliUU" diff --git a/modules/nf-core/priorcons/build_priors/tests/main.nf.test b/modules/nf-core/priorcons/build_priors/tests/main.nf.test new file mode 100644 index 00000000000..ce42b362fa3 --- /dev/null +++ b/modules/nf-core/priorcons/build_priors/tests/main.nf.test @@ -0,0 +1,72 @@ +nextflow_process { + + name "Test Process PRIORCONS_BUILDPRIORS" + script "../main.nf" + process "PRIORCONS_BUILDPRIORS" + + tag "modules" + tag "modules_nfcore" + tag "priorcons" + tag "priorcons/buildpriors" + + test("build_priors_testfiles") { + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ + [ id:'rsv_test' ], + file('https://raw.githubusercontent.com/GERMAN00VP/PriorCons/b518f3725b2cc8820222ea52024a0a63f9e6dfe1/rsv_files/build_priors_testfiles/build_priors_test.aln', checkIfExists: true) + ] + input[1] = 'RSV_BD' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.priors + ).match() } + ) + } + + } + + test("build_priors_testfiles - stub") { + + options "-stub" + + when { + params { + outdir = "$outputDir" + } + process { + """ + input[0] = [ + [ id:'rsv_test' ], + file('https://raw.githubusercontent.com/GERMAN00VP/PriorCons/b518f3725b2cc8820222ea52024a0a63f9e6dfe1/rsv_files/build_priors_testfiles/build_priors_test.aln', checkIfExists: true) + ] + input[1] = 'RSV_BD' + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot( + process.out.versions, + process.out.priors + ).match() } + ) + } + + } + +} diff --git a/modules/nf-core/priorcons/build_priors/tests/main.nf.test.snap b/modules/nf-core/priorcons/build_priors/tests/main.nf.test.snap new file mode 100644 index 00000000000..d0b51d85a61 --- /dev/null +++ b/modules/nf-core/priorcons/build_priors/tests/main.nf.test.snap @@ -0,0 +1,42 @@ +{ + "build_priors_testfiles - stub": { + "content": [ + [ + "versions.yml:md5,7555426e5737f1dc9bc4f261c31536e2" + ], + [ + [ + { + "id": "rsv_test" + }, + "rsv_test.parquet:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-10-29T15:05:15.403088" + }, + "build_priors_testfiles": { + "content": [ + [ + "versions.yml:md5,7555426e5737f1dc9bc4f261c31536e2" + ], + [ + [ + { + "id": "rsv_test" + }, + "rsv_test.parquet:md5,c10fe51463dd23c5aa34fb39ccac9586" + ] + ] + ], + "meta": { + "nf-test": "0.9.3", + "nextflow": "25.10.0" + }, + "timestamp": "2025-10-29T15:04:13.584116" + } +} \ No newline at end of file