Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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::pb-cpg-tools=3.0.0"
61 changes: 61 additions & 0 deletions modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES {
tag "$meta.id"
label 'process_medium'

conda "${moduleDir}/environment.yml"
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/pb-cpg-tools:3.0.0--h9ee0642_0':
'biocontainers/pb-cpg-tools:3.0.0--h9ee0642_0' }"

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

output:
tuple val(meta), path("*.bed.gz"), emit: bed
tuple val(meta), path("*.bed.gz.tbi"), emit: bed_index
tuple val(meta), path("*.bw"), emit: bigwig
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}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

"""
aligned_bam_to_cpg_scores \\
--bam ${bam} \\
--output-prefix ${prefix} \\
--threads ${task.cpus} \\
${args}

cat <<-END_VERSIONS > versions.yml
"${task.process}":
pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/aligned_bam_to_cpg_scores //')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

"""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

echo "" | gzip > ${prefix}.combined.bed.gz
touch ${prefix}.combined.bed.gz.tbi
touch ${prefix}.combined.bw

echo "" | gzip > ${prefix}.hap1.bed.gz
touch ${prefix}.hap1.bed.gz.tbi
touch ${prefix}.hap1.bw

echo "" | gzip > ${prefix}.hap2.bed.gz
touch ${prefix}.hap2.bed.gz.tbi
touch ${prefix}.hap2.bw

cat <<-END_VERSIONS > versions.yml
"${task.process}":
pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/aligned_bam_to_cpg_scores //')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/aligned_bam_to_cpg_scores //')
pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/.* //')

END_VERSIONS
"""
}
77 changes: 77 additions & 0 deletions modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
name: "pbcpgtools_alignedbamtocpgscores"
description: Converts aligned BAM files into CpG methylation scores using pb-cpg-tools.
keywords:
- methylation
- cpg
- pacbio
tools:
- "pbcpgtools":
description: "Collection of tools for the analysis of CpG data"
homepage: "https://github.com/PacificBiosciences/pb-CpG-tools"
documentation: "https://github.com/PacificBiosciences/pb-CpG-tools#readme"
tool_dev_url: "https://github.com/PacificBiosciences/pb-CpG-tools"
licence: ["Pacific Biosciences Software License Agreement"]

input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- bam:
type: file
description: BAM/CRAM file
pattern: "*.{bam,cram}"
ontologies: []
- bai:
type: file
description: Index of BAM/CRAM file
pattern: "*.{bai,crai,csi}"
ontologies: []

output:
bed:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*.bed.gz":
type: file
description: Zipped BED file with CpG methylation scores
pattern: "*.{bed.gz}"
ontologies: []
bed_index:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*.bed.gz.tbi":
type: file
description: Index of zipped BED file
pattern: "*.{.bed.gz.tbi}"
ontologies: []
bigwig:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'sample1' ]`
- "*.bw":
type: file
description: Bigwig file for visualization in IGV
pattern: "*.{bw}"
ontologies: []
versions:
- "versions.yml":
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies: []

authors:
- "@inemesb"
maintainers:
- "@inemesb"
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
nextflow_process {

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

tag "modules"
tag "modules_nfcore"
tag "pbcpgtools"
tag "pbcpgtools/alignedbamtocpgscores"

test("pacbio - bam - notphased") {

when {
process {
"""

input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true)

]
"""
}
}

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

}

test("pacbio - bam - phased") {

when {
process {
"""

input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam.bai', checkIfExists: true)

]
"""
}
}

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

}

test("pacbio - bam - phased - stub") {

options "-stub"

when {
process {
"""

input[0] = [
[ id:'test'], // meta map
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam.bai', checkIfExists: true)
]
"""
}
}

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

}

}
Loading
Loading