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
1 change: 1 addition & 0 deletions modules/nf-core/pmdtools/filter/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ channels:
dependencies:
- bioconda::pmdtools=0.60
- bioconda::samtools=1.14
- conda-forge::python=3.9.7
31 changes: 10 additions & 21 deletions modules/nf-core/pmdtools/filter/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ process PMDTOOLS_FILTER {

output:
tuple val(meta), path("*.bam"), emit: bam
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('pmdtools'), eval("pmdtools --version | sed 's/.*v//'") , topic: versions, emit: versions_pmdtools
tuple val("${task.process}"), val('samtools'), eval("samtools version | sed '1!d;s/.* //'"), topic: versions, emit: versions_samtools

when:
task.ext.when == null || task.ext.when
Expand All @@ -25,45 +26,33 @@ process PMDTOOLS_FILTER {
def args3 = task.ext.args3 ?: ''
def split_cpus = Math.floor(task.cpus/2)
def prefix = task.ext.prefix ?: "${meta.id}"
if ("$bam" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
if ("${bam}" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
//threshold and header flags activate filtering function of pmdtools
"""
samtools \\
calmd \\
$bam \\
$reference \\
$args \\
${bam} \\
${reference} \\
${args} \\
-@ ${split_cpus} \\
| pmdtools \\
--threshold $threshold \\
--threshold ${threshold} \\
--header \\
$args2 \\
${args2} \\
| samtools \\
view \\
$args3 \\
${args3} \\
-Sb \\
- \\
-@ ${split_cpus} \\
-o ${prefix}.bam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
pmdtools: \$( pmdtools --version | cut -f2 -d ' ' | sed 's/v//')
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
if ("$bam" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
if ("${bam}" == "${prefix}.bam") error "[pmdtools/filter] Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
//threshold and header flags activate filtering function of pmdtools
"""
touch ${prefix}.bam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
pmdtools: \$( pmdtools --version | cut -f2 -d ' ' | sed 's/v//')
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//')
END_VERSIONS
"""
}
52 changes: 45 additions & 7 deletions modules/nf-core/pmdtools/filter/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ tools:
documentation: https://github.com/pontussk/PMDtools
tool_dev_url: https://github.com/pontussk/PMDtools
doi: "10.1073/pnas.1318934111"
licence: ["GPL v3"]
licence:
- "GPL v3"
identifier: ""
input:
- - meta:
Expand Down Expand Up @@ -50,13 +51,50 @@ output:
description: Filtered BAM file
pattern: "*.bam"
ontologies: []
versions_pmdtools:
- - ${task.process}:
type: string
description: The name of the process
- pmdtools:
type: string
description: The name of the tool
- pmdtools --version | sed 's/.*v//':
type: eval
description: The expression to obtain the version of the tool

versions_samtools:
- - ${task.process}:
type: string
description: The name of the process
- samtools:
type: string
description: The name of the tool
- samtools version | sed '1!d;s/.* //':
type: eval
description: The expression to obtain the version of the tool

topics:
versions:
- versions.yml:
type: file
description: File containing software versions
pattern: "versions.yml"
ontologies:
- edam: http://edamontology.org/format_3750 # YAML
- - ${task.process}:
type: string
description: The name of the process
- pmdtools:
type: string
description: The name of the tool
- pmdtools --version | sed 's/.*v//':
type: eval
description: The expression to obtain the version of the tool

- - ${task.process}:
type: string
description: The name of the process
- samtools:
type: string
description: The name of the tool
- samtools version | sed '1!d;s/.* //':
type: eval
description: The expression to obtain the version of the tool

authors:
- "@alexandregilardet"
maintainers:
Expand Down
32 changes: 14 additions & 18 deletions modules/nf-core/pmdtools/filter/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ nextflow_process {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) ],
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) ]
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
]
input[1] = 3
input[2] = [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ]

input[1] = 3
input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
"""
}
}
Expand All @@ -31,11 +30,9 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(
bam(process.out.bam[0][1]).getReadsMD5(),
process.out.versions,
file(process.out.versions[0]).readLines()[1..2].collect { it.trim() } // Trap to catch conda version mismatches
).match()
}
bam(process.out.bam[0][1]).getReadsMD5(),
sanitizeOutput(process.out, unstableKeys:["bam"])
).match()}
)
}
}
Expand All @@ -47,21 +44,20 @@ nextflow_process {
process {
"""
input[0] = [
[ id:'test', single_end:false ], // meta map
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true) ],
[ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true) ]
[ id:'test' ],
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam', checkIfExists: true),
file(params.modules_testdata_base_path + 'genomics/homo_sapiens/illumina/bam/test.paired_end.sorted.bam.bai', checkIfExists: true)
]
input[1] = 3
input[2] = [ file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true) ]

input[1] = 3
input[2] = file(params.modules_testdata_base_path + 'genomics/homo_sapiens/genome/genome.fasta', checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
{ assert snapshot(sanitizeOutput(process.out)).match() }
)
}
}
Expand Down
73 changes: 44 additions & 29 deletions modules/nf-core/pmdtools/filter/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,68 @@
"test-pmdtools-filter": {
"content": [
"665610db11378e0a02ab7d407a9d54c1",
[
"versions.yml:md5,877c304e79e6d045661081ddd47bddd6"
],
[
"pmdtools: 0.50",
"samtools: 1.14"
]
{
"bam": [
[
{
"id": "test"
},
"test.bam"
]
],
"versions_pmdtools": [
[
"PMDTOOLS_FILTER",
"pmdtools",
"0.50"
]
],
"versions_samtools": [
[
"PMDTOOLS_FILTER",
"samtools",
"1.14"
]
]
}
],
"timestamp": "2026-08-06T15:52:16.062661885",
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-29T12:54:08.428303"
"nf-test": "0.9.5",
"nextflow": "26.04.6"
}
},
"test-pmdtools-filter-stub": {
"content": [
{
"0": [
"bam": [
[
{
"id": "test",
"single_end": false
"id": "test"
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"1": [
"versions.yml:md5,877c304e79e6d045661081ddd47bddd6"
],
"bam": [
"versions_pmdtools": [
[
{
"id": "test",
"single_end": false
},
"test.bam:md5,d41d8cd98f00b204e9800998ecf8427e"
"PMDTOOLS_FILTER",
"pmdtools",
"0.50"
]
],
"versions": [
"versions.yml:md5,877c304e79e6d045661081ddd47bddd6"
"versions_samtools": [
[
"PMDTOOLS_FILTER",
"samtools",
"1.14"
]
]
}
],
"timestamp": "2026-08-06T15:52:22.821082671",
"meta": {
"nf-test": "0.8.4",
"nextflow": "24.04.4"
},
"timestamp": "2024-08-29T12:40:43.138953"
"nf-test": "0.9.5",
"nextflow": "26.04.6"
}
}
}