From 7f3ea5df279fa051bec9bade1798a58ba35b1196 Mon Sep 17 00:00:00 2001 From: tanyasarkjain <67300971+tanyasarkjain@users.noreply.github.com> Date: Thu, 31 Oct 2024 04:48:56 -0700 Subject: [PATCH] pbmm2/align (#6903) * pbsv * [automated] Fix linting with Prettier * version of pbsv module where all the tests pass * getting rid of un-need comments * updated: * changed website: * update * deleting accidental file * small tweak * updating the meta description * pretty * removing trailing space * space * newline * should pass version test * changed pbsv to pbsv/discover - seperating functionality * module pbmm2 * removing pbsv because this specific PR is for pbmm2 only * updating to allow for threading * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * Update modules/nf-core/pbmm2/align/main.nf Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> * resolving comments * fixing the meta to match update --------- Co-authored-by: nf-core-bot Co-authored-by: Felix Lenner <52530259+fellen31@users.noreply.github.com> --- modules/nf-core/pbmm2/align/environment.yml | 7 ++ modules/nf-core/pbmm2/align/main.nf | 51 ++++++++++++++ modules/nf-core/pbmm2/align/meta.yml | 61 +++++++++++++++++ .../nf-core/pbmm2/align/tests/main.nf.test | 67 ++++++++++++++++++ .../pbmm2/align/tests/main.nf.test.snap | 68 +++++++++++++++++++ 5 files changed, 254 insertions(+) create mode 100644 modules/nf-core/pbmm2/align/environment.yml create mode 100644 modules/nf-core/pbmm2/align/main.nf create mode 100644 modules/nf-core/pbmm2/align/meta.yml create mode 100644 modules/nf-core/pbmm2/align/tests/main.nf.test create mode 100644 modules/nf-core/pbmm2/align/tests/main.nf.test.snap 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