diff --git a/modules/nf-core/pbmm2/align/environment.yml b/modules/nf-core/pbmm2/align/environment.yml new file mode 100644 index 00000000000..241a59c7501 --- /dev/null +++ b/modules/nf-core/pbmm2/align/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::pbmm2=1.14.99" diff --git a/modules/nf-core/pbmm2/align/main.nf b/modules/nf-core/pbmm2/align/main.nf new file mode 100644 index 00000000000..2e75306bd66 --- /dev/null +++ b/modules/nf-core/pbmm2/align/main.nf @@ -0,0 +1,51 @@ +process PBMM2_ALIGN { + tag "$meta.id" + label 'process_large' + + + conda "${moduleDir}/environment.yml" + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/pbmm2:1.14.99--h9ee0642_0': + 'biocontainers/pbmm2:1.14.99--h9ee0642_0' }" + + input: + tuple val(meta), path(bam) + tuple val(meta2), path(fasta) + + output: + tuple val(meta), path("*.bam"), emit: bam + 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}" + """ + pbmm2 \\ + align \\ + $args \\ + $fasta \\ + $bam \\ + ${prefix}.bam \\ + --num-threads ${task.cpus} + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbmm2: \$(pbmm2 --version |& sed '1!d ; s/pbmm2 //') + END_VERSIONS + """ + + stub: + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + """ + touch ${prefix}.bam + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + pbmm2: \$(pbmm2 --version |& sed '1!d ; s/pbmm2 //') + END_VERSIONS + """ +} diff --git a/modules/nf-core/pbmm2/align/meta.yml b/modules/nf-core/pbmm2/align/meta.yml new file mode 100644 index 00000000000..d63a83bacb3 --- /dev/null +++ b/modules/nf-core/pbmm2/align/meta.yml @@ -0,0 +1,61 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json +name: "pbmm2_align" +description: Alignment with PacBio's minimap2 frontend +keywords: + - align + - pacbio + - genomics +tools: + - "pbmm2": + description: "A minimap2 frontend for PacBio native data formats" + homepage: "https://github.com/PacificBiosciences/pbmm2" + documentation: "https://github.com/PacificBiosciences/pbmm2" + tool_dev_url: "https://github.com/PacificBiosciences/pbmm2" + licence: ["BSD-3-clause-Clear"] + identifier: biotools:pbmm2 + +input: + - - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - bam: + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + - - meta2: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - fasta: + type: file + description: fasta file to align bam to + pattern: "*.{fasta}" +output: + - bam: + - meta: + type: map + description: | + Groovy Map containing sample information + e.g. `[ id:'sample1', single_end:false ]` + - "*.bam": + type: file + description: Sorted BAM/CRAM/SAM file + pattern: "*.{bam,cram,sam}" + ontologies: + - edam: "http://edamontology.org/format_2572" + - edam: "http://edamontology.org/format_2573" + - edam: "http://edamontology.org/format_3462" + + - versions: + - "versions.yml": + type: file + description: File containing software versions + pattern: "versions.yml" + +authors: + - "@tanyasarkjain" +maintainers: + - "@tanyasarkjain" diff --git a/modules/nf-core/pbmm2/align/tests/main.nf.test b/modules/nf-core/pbmm2/align/tests/main.nf.test new file mode 100644 index 00000000000..8b15d60265d --- /dev/null +++ b/modules/nf-core/pbmm2/align/tests/main.nf.test @@ -0,0 +1,67 @@ +nextflow_process { + + name "Test Process PBMM2_ALIGN" + script "../main.nf" + process "PBMM2_ALIGN" + + tag "modules" + tag "modules_nfcore" + tag "pbmm2" + tag "pbmm2/align" + + test("pbmm2 - bam") { + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + + test("pbmm2 - bam - stub") { + + options "-stub" + + when { + process { + """ + input[0] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA03697B2_downsampled.pbmm2.repeats.bam', checkIfExists: true), + ] + + input[1] = [ + [ id:'test' ], // meta map + file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome3.fasta', checkIfExists: true), + ] + """ + } + } + + then { + assertAll( + { assert process.success }, + { assert snapshot(process.out).match() } + ) + } + + } + +} diff --git a/modules/nf-core/pbmm2/align/tests/main.nf.test.snap b/modules/nf-core/pbmm2/align/tests/main.nf.test.snap new file mode 100644 index 00000000000..430851ebb2c --- /dev/null +++ b/modules/nf-core/pbmm2/align/tests/main.nf.test.snap @@ -0,0 +1,68 @@ +{ + "pbmm2 - bam": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bam:md5,b1d6b50f20ba0389435c6a51de26d836" + ] + ], + "1": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ], + "bam": [ + [ + { + "id": "test" + }, + "test.bam:md5,b1d6b50f20ba0389435c6a51de26d836" + ] + ], + "versions": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T10:53:18.838135" + }, + "pbmm2 - bam - stub": { + "content": [ + { + "0": [ + [ + { + "id": "test" + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "1": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ], + "bam": [ + [ + { + "id": "test" + }, + "test.bam:md5,d41d8cd98f00b204e9800998ecf8427e" + ] + ], + "versions": [ + "versions.yml:md5,e8aa0696ac2bf135b5f88e6cb7e7b18a" + ] + } + ], + "meta": { + "nf-test": "0.9.0", + "nextflow": "24.04.4" + }, + "timestamp": "2024-10-30T10:53:31.992125" + } +} \ No newline at end of file