Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 1 addition & 2 deletions modules/nf-core/mosdepth/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ channels:
- bioconda
dependencies:
# renovate: datasource=conda depName=bioconda/mosdepth
- mosdepth=0.3.11=h0ec343a_1
# renovate: datasource=conda depName=bioconda/htslib
- htslib=1.22.1
- mosdepth=0.3.11=h0ec343a_1
19 changes: 8 additions & 11 deletions modules/nf-core/mosdepth/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ process MOSDEPTH {
tuple val(meta), path('*.quantized.bed.gz.csi') , optional:true, emit: quantized_csi
tuple val(meta), path('*.thresholds.bed.gz') , optional:true, emit: thresholds_bed
tuple val(meta), path('*.thresholds.bed.gz.csi'), optional:true, emit: thresholds_csi
path "versions.yml" , emit: versions
tuple val("${task.process}"), val('mosdepth'), eval("mosdepth --version | sed 's/mosdepth //g'"), topic: versions, emit: versions_mosdepth

when:
task.ext.when == null || task.ext.when
Expand All @@ -49,15 +49,17 @@ process MOSDEPTH {
$args \\
$prefix \\
$bam

cat <<-END_VERSIONS > versions.yml
"${task.process}":
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
END_VERSIONS
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
if (bed && args.contains("--by")) {
error "'--by' can only be specified once when running mosdepth! Either remove input BED file definition or remove '--by' from 'ext.args' definition"
}
if (!bed && args.contains("--thresholds")) {
error "'--thresholds' can only be specified in conjunction with '--by'"
}
"""
touch ${prefix}.global.dist.txt
touch ${prefix}.region.dist.txt
Expand All @@ -71,10 +73,5 @@ process MOSDEPTH {
touch ${prefix}.quantized.bed.gz.csi
echo "" | gzip > ${prefix}.thresholds.bed.gz
touch ${prefix}.thresholds.bed.gz.csi

cat <<-END_VERSIONS > versions.yml
"${task.process}":
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
END_VERSIONS
"""
}
28 changes: 21 additions & 7 deletions modules/nf-core/mosdepth/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -178,20 +178,34 @@ output:
description: Index file for BED file with threshold coverage
pattern: "*.{thresholds.bed.gz.csi}"
ontologies: []
versions_mosdepth:
- - ${task.process}:
type: string
description: The process the versions were collected from
- mosdepth:
type: string
description: The tool name
- "mosdepth --version | sed 's/mosdepth //g'":
type: string
description: The command used to generate 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 process the versions were collected from
- mosdepth:
type: string
description: The tool name
- "mosdepth --version | sed 's/mosdepth //g'":
type: string
description: The command used to generate the version of the tool
authors:
- "@joseespinosa"
- "@drpatelh"
- "@ramprasadn"
- "@matthdsm"
maintainers:
- "@joseespinosa"
- "@drpatelh"
- "@ramprasadn"
- "@matthdsm"
68 changes: 45 additions & 23 deletions modules/nf-core/mosdepth/tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@ nextflow_process {
tag "modules"
tag "modules_nfcore"
tag "mosdepth"
config "./nextflow.config"

test("homo_sapiens - bam, bai, []") {

when {
params {
module_args = ""
}
process {
"""
input[0] = [
Expand All @@ -25,9 +29,9 @@ nextflow_process {
}

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

Expand All @@ -36,6 +40,9 @@ nextflow_process {
test("homo_sapiens - bam, bai, bed") {

when {
params {
module_args = ""
}
process {
"""
input[0] = [
Expand All @@ -50,9 +57,9 @@ nextflow_process {
}

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

Expand All @@ -61,6 +68,9 @@ nextflow_process {
test("homo_sapiens - cram, crai, []") {

when {
params {
module_args = ""
}
process {
"""
input[0] = [
Expand All @@ -78,9 +88,9 @@ nextflow_process {
}

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

Expand All @@ -89,6 +99,9 @@ nextflow_process {
test("homo_sapiens - cram, crai, bed") {

when {
params {
module_args = ""
}
process {
"""
input[0] = [
Expand All @@ -106,18 +119,20 @@ nextflow_process {
}

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

}

test("homo_sapiens - bam, bai, [] - window") {

config "./window.config"
when {
params {
module_args = "--by 100"
}
process {
"""
input[0] = [
Expand All @@ -132,18 +147,20 @@ nextflow_process {
}

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

}

test("homo_sapiens - bam, bai, [] - quantized") {

config "./quantized.config"
when {
params {
module_args = "--quantize 0:1:4:100:200"
}
process {
"""
input[0] = [
Expand All @@ -158,18 +175,20 @@ nextflow_process {
}

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

}

test("homo_sapiens - bam, bai, bed - thresholds") {

config "./threshold.config"
when {
params {
module_args = "--thresholds 1,10,20,30"
}
process {
"""
input[0] = [
Expand All @@ -184,18 +203,20 @@ nextflow_process {
}

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

}

test("homo_sapiens - bam, bai, bed - fail") {

config "./window.config"
when {
params {
module_args = "--by 100"
}
process {
"""
input[0] = [
Expand All @@ -210,9 +231,7 @@ nextflow_process {
}

then {
assertAll(
{ assert process.failed }
)
assert process.failed
}

}
Expand All @@ -221,6 +240,9 @@ nextflow_process {

options "-stub"
when {
params {
module_args = ""
}
process {
"""
input[0] = [
Expand All @@ -235,9 +257,9 @@ nextflow_process {
}

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

Expand Down
Loading
Loading