Skip to content

Commit e67cda6

Browse files
authored
Add pbcpgtools/alignedbamtocpgscores module (#9312)
* Add files * Update test paths * Update versions.yml and stub * Add more optional output channels
1 parent ea3e4d5 commit e67cda6

File tree

5 files changed

+726
-0
lines changed

5 files changed

+726
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/environment-schema.json
3+
channels:
4+
- conda-forge
5+
- bioconda
6+
dependencies:
7+
- "bioconda::pb-cpg-tools=3.0.0"
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES {
2+
tag "$meta.id"
3+
label 'process_medium'
4+
5+
conda "${moduleDir}/environment.yml"
6+
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
7+
'https://depot.galaxyproject.org/singularity/pb-cpg-tools:3.0.0--h9ee0642_0':
8+
'biocontainers/pb-cpg-tools:3.0.0--h9ee0642_0' }"
9+
10+
input:
11+
tuple val(meta), path(bam), path(bai)
12+
13+
output:
14+
tuple val(meta), path("*.combined.bed.gz") , emit: combined_bed
15+
tuple val(meta), path("*.combined.bed.gz.tbi"), emit: combined_bed_index
16+
tuple val(meta), path("*.combined.bw") , emit: combined_bigwig
17+
tuple val(meta), path("*.hap1.bed.gz") , emit: hap1_bed , optional: true
18+
tuple val(meta), path("*.hap1.bed.gz.tbi") , emit: hap1_bed_index , optional: true
19+
tuple val(meta), path("*.hap1.bw") , emit: hap1_bigwig , optional: true
20+
tuple val(meta), path("*.hap2.bed.gz") , emit: hap2_bed , optional: true
21+
tuple val(meta), path("*.hap2.bed.gz.tbi") , emit: hap2_bed_index , optional: true
22+
tuple val(meta), path("*.hap2.bw") , emit: hap2_bigwig , optional: true
23+
path "versions.yml" , emit: versions
24+
25+
when:
26+
task.ext.when == null || task.ext.when
27+
28+
script:
29+
def args = task.ext.args ?: ''
30+
def prefix = task.ext.prefix ?: "${meta.id}"
31+
"""
32+
aligned_bam_to_cpg_scores \\
33+
--bam ${bam} \\
34+
--output-prefix ${prefix} \\
35+
--threads ${task.cpus} \\
36+
${args}
37+
38+
cat <<-END_VERSIONS > versions.yml
39+
"${task.process}":
40+
pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/.* //')
41+
END_VERSIONS
42+
"""
43+
44+
stub:
45+
def prefix = task.ext.prefix ?: "${meta.id}"
46+
"""
47+
echo "" | gzip > ${prefix}.combined.bed.gz
48+
touch ${prefix}.combined.bed.gz.tbi
49+
touch ${prefix}.combined.bw
50+
51+
echo "" | gzip > ${prefix}.hap1.bed.gz
52+
touch ${prefix}.hap1.bed.gz.tbi
53+
touch ${prefix}.hap1.bw
54+
55+
echo "" | gzip > ${prefix}.hap2.bed.gz
56+
touch ${prefix}.hap2.bed.gz.tbi
57+
touch ${prefix}.hap2.bw
58+
59+
cat <<-END_VERSIONS > versions.yml
60+
"${task.process}":
61+
pbcpgtools: \$(aligned_bam_to_cpg_scores --version | sed 's/.* //')
62+
END_VERSIONS
63+
"""
64+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
# yaml-language-server: $schema=https://raw.githubusercontent.com/nf-core/modules/master/modules/meta-schema.json
2+
name: "pbcpgtools_alignedbamtocpgscores"
3+
description: Converts aligned BAM files into CpG methylation scores
4+
keywords:
5+
- methylation
6+
- cpg
7+
- pacbio
8+
tools:
9+
- pbcpgtools:
10+
description: "Collection of tools for the analysis of CpG data"
11+
homepage: "https://github.com/PacificBiosciences/pb-CpG-tools"
12+
documentation: "https://github.com/PacificBiosciences/pb-CpG-tools#readme"
13+
tool_dev_url: "https://github.com/PacificBiosciences/pb-CpG-tools"
14+
licence: ["Pacific Biosciences Software License Agreement"]
15+
identifier: ""
16+
input:
17+
- - meta:
18+
type: map
19+
description: |
20+
Groovy Map containing sample information
21+
e.g. `[ id:'test' ]`
22+
- bam:
23+
type: file
24+
description: BAM/CRAM file
25+
pattern: "*.{bam,cram}"
26+
ontologies: []
27+
- bai:
28+
type: file
29+
description: Index of BAM/CRAM file
30+
pattern: "*.{bai,crai,csi}"
31+
ontologies: []
32+
output:
33+
combined_bed:
34+
- - meta:
35+
type: map
36+
description: |
37+
Groovy Map containing sample information
38+
e.g. `[ id:'test' ]`
39+
- "*.combined.bed.gz":
40+
type: file
41+
description: Zipped BED file with CpG methylation scores for both haplotypes
42+
pattern: "*.{combined.bed.gz}"
43+
ontologies: []
44+
combined_bed_index:
45+
- - meta:
46+
type: map
47+
description: |
48+
Groovy Map containing sample information
49+
e.g. `[ id:'test' ]`
50+
- "*.combined.bed.gz.tbi":
51+
type: file
52+
description: Index of combined zipped BED file
53+
pattern: "*.{combined.bed.gz.tbi}"
54+
ontologies: []
55+
combined_bigwig:
56+
- - meta:
57+
type: map
58+
description: |
59+
Groovy Map containing sample information
60+
e.g. `[ id:'test' ]`
61+
- "*.combined.bw":
62+
type: file
63+
description: Bigwig file for visualization in IGV
64+
pattern: "*.{combined.bw}"
65+
ontologies: []
66+
hap1_bed:
67+
- - meta:
68+
type: map
69+
description: |
70+
Groovy Map containing sample information
71+
e.g. `[ id:'test' ]`
72+
- "*.hap1.bed.gz":
73+
type: file
74+
description: Zipped BED file with CpG methylation scores for haplotype 1
75+
pattern: "*.{hap1.bed.gz}"
76+
ontologies: []
77+
hap1_bed_index:
78+
- - meta:
79+
type: map
80+
description: |
81+
Groovy Map containing sample information
82+
e.g. `[ id:'test' ]`
83+
- "*.hap1.bed.gz.tbi":
84+
type: file
85+
description: Index of hap1 zipped BED file
86+
pattern: "*.{hap1.bed.gz.tbi}"
87+
ontologies: []
88+
hap1_bigwig:
89+
- - meta:
90+
type: map
91+
description: |
92+
Groovy Map containing sample information
93+
e.g. `[ id:'test' ]`
94+
- "*.hap1.bw":
95+
type: file
96+
description: Bigwig file for visualization in IGV
97+
pattern: "*.{hap1.bw}"
98+
ontologies: []
99+
hap2_bed:
100+
- - meta:
101+
type: map
102+
description: |
103+
Groovy Map containing sample information
104+
e.g. `[ id:'test' ]`
105+
- "*.hap2.bed.gz":
106+
type: file
107+
description: Zipped BED file with CpG methylation scores for haplotype 2
108+
pattern: "*.{hap2.bed.gz}"
109+
ontologies: []
110+
hap2_bed_index:
111+
- - meta:
112+
type: map
113+
description: |
114+
Groovy Map containing sample information
115+
e.g. `[ id:'test' ]`
116+
- "*.hap2.bed.gz.tbi":
117+
type: file
118+
description: Index of hap2 zipped BED file
119+
pattern: "*.{hap2.bed.gz.tbi}"
120+
ontologies: []
121+
hap2_bigwig:
122+
- - meta:
123+
type: map
124+
description: |
125+
Groovy Map containing sample information
126+
e.g. `[ id:'test' ]`
127+
- "*.hap2.bw":
128+
type: file
129+
description: Bigwig file for visualization in IGV
130+
pattern: "*.{hap2.bw}"
131+
ontologies: []
132+
versions:
133+
- versions.yml:
134+
type: file
135+
description: File containing software versions
136+
pattern: "versions.yml"
137+
ontologies:
138+
- edam: http://edamontology.org/format_3750 # YAML
139+
authors:
140+
- "@inemesb"
141+
maintainers:
142+
- "@inemesb"
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
nextflow_process {
2+
3+
name "Test Process PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES"
4+
script "../main.nf"
5+
process "PBCPGTOOLS_ALIGNEDBAMTOCPGSCORES"
6+
7+
tag "modules"
8+
tag "modules_nfcore"
9+
tag "pbcpgtools"
10+
tag "pbcpgtools/alignedbamtocpgscores"
11+
12+
test("pacbio - bam - notphased") {
13+
14+
when {
15+
process {
16+
"""
17+
18+
input[0] = [
19+
[ id:'test'], // meta map
20+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam', checkIfExists: true),
21+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.bam.bai', checkIfExists: true)
22+
23+
]
24+
"""
25+
}
26+
}
27+
28+
then {
29+
assertAll(
30+
{ assert process.success },
31+
{ assert snapshot(process.out).match() }
32+
)
33+
}
34+
35+
}
36+
37+
test("pacbio - bam - phased") {
38+
39+
when {
40+
process {
41+
"""
42+
43+
input[0] = [
44+
[ id:'test'], // meta map
45+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam', checkIfExists: true),
46+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam.bai', checkIfExists: true)
47+
48+
]
49+
"""
50+
}
51+
}
52+
53+
then {
54+
assertAll(
55+
{ assert process.success },
56+
{ assert snapshot(process.out).match() }
57+
)
58+
}
59+
60+
}
61+
62+
test("pacbio - bam - phased - stub") {
63+
64+
options "-stub"
65+
66+
when {
67+
process {
68+
"""
69+
70+
input[0] = [
71+
[ id:'test'], // meta map
72+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam', checkIfExists: true),
73+
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/pacbio/bam/NA037562_downsampled.pbmm2.repeats.phased.bam.bai', checkIfExists: true)
74+
]
75+
"""
76+
}
77+
}
78+
79+
then {
80+
assertAll(
81+
{ assert process.success },
82+
{ assert snapshot(process.out).match() }
83+
)
84+
}
85+
86+
}
87+
88+
}

0 commit comments

Comments
 (0)