Skip to content

Commit

Permalink
pbmm2/align (nf-core#6903)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* Update modules/nf-core/pbmm2/align/main.nf

Co-authored-by: Felix Lenner <[email protected]>

* Update modules/nf-core/pbmm2/align/main.nf

Co-authored-by: Felix Lenner <[email protected]>

* Update modules/nf-core/pbmm2/align/main.nf

Co-authored-by: Felix Lenner <[email protected]>

* resolving comments

* fixing the meta to match update

---------

Co-authored-by: nf-core-bot <[email protected]>
Co-authored-by: Felix Lenner <[email protected]>
  • Loading branch information
3 people authored Oct 31, 2024
1 parent cab0b8f commit 7f3ea5d
Show file tree
Hide file tree
Showing 5 changed files with 254 additions and 0 deletions.
7 changes: 7 additions & 0 deletions modules/nf-core/pbmm2/align/environment.yml
Original file line number Diff line number Diff line change
@@ -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"
51 changes: 51 additions & 0 deletions modules/nf-core/pbmm2/align/main.nf
Original file line number Diff line number Diff line change
@@ -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
"""
}
61 changes: 61 additions & 0 deletions modules/nf-core/pbmm2/align/meta.yml
Original file line number Diff line number Diff line change
@@ -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"
67 changes: 67 additions & 0 deletions modules/nf-core/pbmm2/align/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -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() }
)
}

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/pbmm2/align/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 7f3ea5d

Please sign in to comment.