diff --git a/modules/nf-core/deeptools/alignmentsieve/environment.yml b/modules/nf-core/deeptools/alignmentsieve/environment.yml new file mode 100644 index 00000000000..d8e208ca830 --- /dev/null +++ b/modules/nf-core/deeptools/alignmentsieve/environment.yml @@ -0,0 +1,6 @@ +channels: + - conda-forge + - bioconda +dependencies: + - bioconda::deeptools=3.5.5 + - bioconda::samtools=1.20 diff --git a/modules/nf-core/deeptools/alignmentsieve/main.nf b/modules/nf-core/deeptools/alignmentsieve/main.nf new file mode 100644 index 00000000000..3223399c243 --- /dev/null +++ b/modules/nf-core/deeptools/alignmentsieve/main.nf @@ -0,0 +1,49 @@ +process DEEPTOOLS_ALIGNMENTSIEVE { + 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/mulled-v2-eb9e7907c7a753917c1e4d7a64384c047429618a:41defd13a6f2ce014549fcc05d0b051f655777f9-0': + 'biocontainers/mulled-v2-eb9e7907c7a753917c1e4d7a64384c047429618a:41defd13a6f2ce014549fcc05d0b051f655777f9-0' }" + + input: + tuple val(meta), path(input), path(input_index) + + output: + tuple val(meta), path("*_as.bam") , emit: bam + path "versions.yml" , emit: versions + path "*_log.txt" , emit: logs + + when: + task.ext.when == null || task.ext.when + + script: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + alignmentSieve \\ + $args \\ + -b $input \\ + -o ${prefix}_as.bam \\ + --filterMetrics ${prefix}_log.txt \\ + --numberOfProcessors $task.cpus + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deeptools: \$(alignmentSieve --version | sed -e "s/alignmentSieve //g") + END_VERSIONS + """ + + stub: + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}_as.bam + touch ${prefix}_log.txt + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + deeptools: \$(alignmentSieve --version | sed -e "s/alignmentSieve //g") + END_VERSIONS + """ +} diff --git a/modules/nf-core/deeptools/alignmentsieve/meta.yml b/modules/nf-core/deeptools/alignmentsieve/meta.yml new file mode 100644 index 00000000000..37d381ca41d --- /dev/null +++ b/modules/nf-core/deeptools/alignmentsieve/meta.yml @@ -0,0 +1,56 @@ +name: deeptools_alignmentSieve +description: This tool filters alignments in a BAM/CRAM file according the the specified parameters. +keywords: + - ATACseq + - filter + - shift + - ATACshift +tools: + - deeptools: + description: A set of user-friendly tools for normalization and visualzation of + deep-sequencing data + homepage: https://deeptools.readthedocs.io/en/develop/content/tools/alignmentSieve.html + documentation: https://deeptools.readthedocs.io/en/develop/content/tools/alignmentSieve.html + tool_dev_url: https://github.com/deeptools/deepTools/ + doi: "10.1093/nar/gkw257" + licence: ["GPL v3"] + identifier: biotools:deeptools +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - input: + type: file + description: BAM file + pattern: "*.{bam}" + - input_index: + type: file + description: BAM index file + pattern: "*.{bai}" +output: + - bam: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. [ id:'test', single_end:false ] + - "*_as.bam": + type: file + description: BAM file + pattern: "*.bam" + - logs: + - "*_log.txt": + type: file + description: TXT file + pattern: "*.txt" + - versions: + - versions.yml: + type: file + description: File containing software versions + pattern: "versions.yml" +authors: + - "@lpantano" +maintainers: + - "@lpantano" diff --git a/modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test b/modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test new file mode 100644 index 00000000000..2d3b61b93d8 --- /dev/null +++ b/modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test @@ -0,0 +1,60 @@ +nextflow_process { + + name "Test Process DEEPTOOLS_ALIGNMENTSIEVE" + script "../main.nf" + process "DEEPTOOLS_ALIGNMENTSIEVE" + + tag "modules" + tag "modules_nfcore" + tag "deeptools" + tag "deeptools/alignmentsieve" + + test("homo_sampiens - bam") { + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out.logs, + bam(process.out.bam[0][1]).getReadsMD5(), + process.out.versions) + .match() + } + ) + } + } + test("homo_sampiens - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test', single_end:false ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true), + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + } +} diff --git a/modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test.snap b/modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test.snap new file mode 100644 index 00000000000..ad1c635d92d --- /dev/null +++ b/modules/nf-core/deeptools/alignmentsieve/tests/main.nf.test.snap @@ -0,0 +1,59 @@ +{ + "homo_sampiens - bam": { + "content": [ + [ + "test_log.txt:md5,39f97a6a2ff83330d5c93411113df63a" + ], + "463ac3b905fbf4ddf113a94dbfa8d69f", + [ + "versions.yml:md5,baf8080ab016b89a27483809252bc803" + ] + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-26T12:59:06.183167" + }, + "homo_sampiens - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test", + "single_end": false + }, + "test_as.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,baf8080ab016b89a27483809252bc803" + ], + "2": [ + "test_log.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "bam": [ + [ + { + "id": "test", + "single_end": false + }, + "test_as.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "logs": [ + "test_log.txt:md5,d41d8cd98f00b204e9800998ecf8427e" + ], + "versions": [ + "versions.yml:md5,baf8080ab016b89a27483809252bc803" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-09-26T12:59:10.273315" + } +} \ No newline at end of file diff --git a/modules/nf-core/deeptools/alignmentsieve/tests/tags.yml b/modules/nf-core/deeptools/alignmentsieve/tests/tags.yml new file mode 100644 index 00000000000..fd24baa97d1 --- /dev/null +++ b/modules/nf-core/deeptools/alignmentsieve/tests/tags.yml @@ -0,0 +1,2 @@ +deeptools/bamcoverage: + - "modules/nf-core/deeptools/alignmentsieve/**"