Skip to content
Merged
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"
64 changes: 64 additions & 0 deletions modules/nf-core/pbcpgtools/alignedbamtocpgscores/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
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("*.combined.bed.gz") , emit: combined_bed
tuple val(meta), path("*.combined.bed.gz.tbi"), emit: combined_bed_index
tuple val(meta), path("*.combined.bw") , emit: combined_bigwig
tuple val(meta), path("*.hap1.bed.gz") , emit: hap1_bed , optional: true
tuple val(meta), path("*.hap1.bed.gz.tbi") , emit: hap1_bed_index , optional: true
tuple val(meta), path("*.hap1.bw") , emit: hap1_bigwig , optional: true
tuple val(meta), path("*.hap2.bed.gz") , emit: hap2_bed , optional: true
tuple val(meta), path("*.hap2.bed.gz.tbi") , emit: hap2_bed_index , optional: true
tuple val(meta), path("*.hap2.bw") , emit: hap2_bigwig , optional: true
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}"
"""
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/.* //')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
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/.* //')
END_VERSIONS
"""
}
142 changes: 142 additions & 0 deletions modules/nf-core/pbcpgtools/alignedbamtocpgscores/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# 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
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"]
identifier: ""
input:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- 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:
combined_bed:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.combined.bed.gz":
type: file
description: Zipped BED file with CpG methylation scores for both haplotypes
pattern: "*.{combined.bed.gz}"
ontologies: []
combined_bed_index:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.combined.bed.gz.tbi":
type: file
description: Index of combined zipped BED file
pattern: "*.{combined.bed.gz.tbi}"
ontologies: []
combined_bigwig:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.combined.bw":
type: file
description: Bigwig file for visualization in IGV
pattern: "*.{combined.bw}"
ontologies: []
hap1_bed:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.hap1.bed.gz":
type: file
description: Zipped BED file with CpG methylation scores for haplotype 1
pattern: "*.{hap1.bed.gz}"
ontologies: []
hap1_bed_index:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.hap1.bed.gz.tbi":
type: file
description: Index of hap1 zipped BED file
pattern: "*.{hap1.bed.gz.tbi}"
ontologies: []
hap1_bigwig:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.hap1.bw":
type: file
description: Bigwig file for visualization in IGV
pattern: "*.{hap1.bw}"
ontologies: []
hap2_bed:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.hap2.bed.gz":
type: file
description: Zipped BED file with CpG methylation scores for haplotype 2
pattern: "*.{hap2.bed.gz}"
ontologies: []
hap2_bed_index:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.hap2.bed.gz.tbi":
type: file
description: Index of hap2 zipped BED file
pattern: "*.{hap2.bed.gz.tbi}"
ontologies: []
hap2_bigwig:
- - meta:
type: map
description: |
Groovy Map containing sample information
e.g. `[ id:'test' ]`
- "*.hap2.bw":
type: file
description: Bigwig file for visualization in IGV
pattern: "*.{hap2.bw}"
ontologies: []
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
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