Skip to content

Commit

Permalink
Added pbtk/pbindex (#5901)
Browse files Browse the repository at this point in the history
* Added pbtk/pbindex

* Removed prefix
  • Loading branch information
GallVp authored Jul 3, 2024
1 parent 2fc7438 commit 859ab06
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modules/nf-core/pbtk/pbindex/environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
name: "pbtk_pbindex"
channels:
- conda-forge
- bioconda
- defaults
dependencies:
- "bioconda::pbtk=3.1.1"
41 changes: 41 additions & 0 deletions modules/nf-core/pbtk/pbindex/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
process PBTK_PBINDEX {
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/pbtk:3.1.1--h9ee0642_0':
'biocontainers/pbtk:3.1.1--h9ee0642_0' }"

input:
tuple val(meta), path(bam)

output:
tuple val(meta), path("*.pbi"), emit: pbi
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:
"""
pbindex \\
-j $task.cpus \\
$bam
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pbindex: \$(pbindex --version | sed -n 's/pbindex \\(.*\\)/\\1/p')
END_VERSIONS
"""

stub:
"""
touch ${bam}.pbi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
pbindex: \$(pbindex --version | sed -n 's/pbindex \\(.*\\)/\\1/p')
END_VERSIONS
"""
}
48 changes: 48 additions & 0 deletions modules/nf-core/pbtk/pbindex/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "pbtk_pbindex"
description: Minimalistic tool which creates an index file that enables random access into PacBio BAM files
keywords:
- genomics
- bam
- index
- pacbio
tools:
- "pbtk":
description: "pbtk - PacBio BAM toolkit"
homepage: "https://github.com/PacificBiosciences/pbtk"
documentation: "https://github.com/PacificBiosciences/pbtk"
tool_dev_url: "https://github.com/PacificBiosciences/pbtk"
licence: ["BSD-3-clause-Clear"]

input:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- bam:
type: file
description: Input BAM file
pattern: "*.bam"

output:
- meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1', single_end:false ]`
- versions:
type: file
description: File containing software versions
pattern: "versions.yml"
- pbi:
type: file
description: Index file
pattern: "*.bam.pbi"

authors:
- "@GallVp"
maintainers:
- "@GallVp"
58 changes: 58 additions & 0 deletions modules/nf-core/pbtk/pbindex/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
nextflow_process {

name "Test Process PBTK_PBINDEX"
script "../main.nf"
process "PBTK_PBINDEX"

tag "modules"
tag "modules_nfcore"
tag "pbtk"
tag "pbtk/pbindex"

test("homo_sapiens - bam") {

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/alz.bam', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

test("homo_sapiens - bam - stub") {

options "-stub"

when {
process {
"""
input[0] = [
[ id:'test' ], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/alz.bam', checkIfExists: true)
]
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}

}

}
68 changes: 68 additions & 0 deletions modules/nf-core/pbtk/pbindex/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"homo_sapiens - bam": {
"content": [
{
"0": [
[
{
"id": "test"
},
"alz.bam.pbi:md5,085d6c04da9daa5f984767b158a879f4"
]
],
"1": [
"versions.yml:md5,a162e157c7ce09585c86cb390d00f94e"
],
"pbi": [
[
{
"id": "test"
},
"alz.bam.pbi:md5,085d6c04da9daa5f984767b158a879f4"
]
],
"versions": [
"versions.yml:md5,a162e157c7ce09585c86cb390d00f94e"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-02T12:16:24.358838"
},
"homo_sapiens - bam - stub": {
"content": [
{
"0": [
[
{
"id": "test"
},
"alz.bam.pbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,a162e157c7ce09585c86cb390d00f94e"
],
"pbi": [
[
{
"id": "test"
},
"alz.bam.pbi:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"versions": [
"versions.yml:md5,a162e157c7ce09585c86cb390d00f94e"
]
}
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.2"
},
"timestamp": "2024-07-02T12:16:29.083998"
}
}

0 comments on commit 859ab06

Please sign in to comment.