From 8039493ba9c36fe893af938a31cda61e7a3951f9 Mon Sep 17 00:00:00 2001 From: shahirnm Date: Mon, 7 Oct 2024 13:48:36 -0400 Subject: [PATCH] adding amplicov modules. Issue nf-test has not been run yet for module --- modules/ph-core/amplicov/enviromental.yml | 7 +++ modules/ph-core/amplicov/main.nf | 58 +++++++++++++++++++++ modules/ph-core/amplicov/meta.yml | 53 +++++++++++++++++++ modules/ph-core/amplicov/tests/main.nf.test | 34 ++++++++++++ 4 files changed, 152 insertions(+) create mode 100644 modules/ph-core/amplicov/enviromental.yml create mode 100644 modules/ph-core/amplicov/main.nf create mode 100644 modules/ph-core/amplicov/meta.yml create mode 100644 modules/ph-core/amplicov/tests/main.nf.test diff --git a/modules/ph-core/amplicov/enviromental.yml b/modules/ph-core/amplicov/enviromental.yml new file mode 100644 index 0000000..c3f5be3 --- /dev/null +++ b/modules/ph-core/amplicov/enviromental.yml @@ -0,0 +1,7 @@ +name: amplicov +channels: + - conda-forge + - bioconda + - defaults +dependencies: + -bioconda::amplicon_coverage_plot=0.3.3 \ No newline at end of file diff --git a/modules/ph-core/amplicov/main.nf b/modules/ph-core/amplicov/main.nf new file mode 100644 index 0000000..c5d97cc --- /dev/null +++ b/modules/ph-core/amplicov/main.nf @@ -0,0 +1,58 @@ + +process AMPLICOV { + 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/amplicon_coverage_plot:0.3.3--pyhdfd78af_0': + 'biocontainers/amplicon_coverage_plot:0.3.3--pyhdfd78af_0' }" + + + + input: + + tuple val(meta), path(bam) + tuple val(meta), val(irma_type) + path bedpe + + output: + +// output of amplicov is not a sorted bam but just coverage files. + + tuple val(meta), path("*amplicon_coverage.txt"), emit: coverage + tuple val(meta), path("*amplicon_coverage.html"), emit: coverage_html + 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}" + def refname = irma_type + + """ + amplicov --bedpe ${bedpe} --bam ${bam} --count_primer -o . -p ${bam.BaseName} -r ${refname} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + amplicov: \$(amplicov --version |& sed '1!d ; s/amplicov //') + END_VERSIONS + + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + """ + mkdir -p ${meta}/ + touch ${meta}/stub.amplicon_coverage.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + amplicov: \$(samtools --version |& sed '1!d ; s/samtools //') + END_VERSIONS + """ +} diff --git a/modules/ph-core/amplicov/meta.yml b/modules/ph-core/amplicov/meta.yml new file mode 100644 index 0000000..bb4218a --- /dev/null +++ b/modules/ph-core/amplicov/meta.yml @@ -0,0 +1,53 @@ +name: amplicov +description: Script to generate amplicon coverage +keywords: + - amplicon + - genome + - coverage +tools: + - amplicov: + description: | + Will generate information around amplicon coverage given a bam file and amplicon information provided in a bedpe/bed6 format + homepage: https://pypi.org/project/amplicov/0.3.3/ + documentation: https://github.com/chienchi/amplicon_coverage_plot + doi: 10.1093/bioinformatics/btp352 ** + license: ["MIT"] +input: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - bam: + type: file + description: BAM/CRAM/SAM file(s) + pattern: "*.{bam,cram,sam}" + - bedpe: + type: file + description: | + file format that concisely describe disjoint genome features, such as structural variations or paired-end sequence alignments + pattern: "*.{bedpe,bed6}" +output: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - coverage: + type: file + description: amplicon coverage information in tsv format + pattern: "*.{txt}" + - coverage_html: + type: file + description: amplicon coverage information in html format + pattern: "*.{html}" + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@chienchi" + - "@pvanheus" +maintainers: + - "@chienchi" + - "@pvanheus" diff --git a/modules/ph-core/amplicov/tests/main.nf.test b/modules/ph-core/amplicov/tests/main.nf.test new file mode 100644 index 0000000..a9972b4 --- /dev/null +++ b/modules/ph-core/amplicov/tests/main.nf.test @@ -0,0 +1,34 @@ +nextflow_process { + + name "Test Process AMPLICOV" + script "../main.nf" + process "AMPLICOV" + + test("Test Process AMPLICOV") { + config "./nextflow.config" + when { + process { + """ + input[0] = Channel.of([ + [ id:'test', single_end:false ], // meta map + file("https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/illumina/bam/test.paired_end.bam", checkIfExists: true) + ]) + input[1] = Channel.of([ + [ id:'test', single_end:false ], // meta map + "SARS-CoV-2"]) + input[2] = Channel.of([ + file('https://raw.githubusercontent.com/nf-core/test-datasets/modules/data/genomics/sarscov2/genome/bed/test.bedpe', checkIfExists: true) + ]) + """ + } + } + + then { + assert process.success + assert process.trace.tasks().size() == 1 + + } + + } + +} \ No newline at end of file