Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nf-core/modules
Browse files Browse the repository at this point in the history
  • Loading branch information
mashehu committed Feb 9, 2022
2 parents ef18984 + 45acc79 commit 54687c8
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 16 deletions.
43 changes: 34 additions & 9 deletions modules/mosdepth/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ process MOSDEPTH {
tag "$meta.id"
label 'process_medium'

conda (params.enable_conda ? 'bioconda::mosdepth=0.3.2' : null)
conda (params.enable_conda ? 'bioconda::mosdepth=0.3.3' : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/mosdepth:0.3.2--h01d7912_0' :
'quay.io/biocontainers/mosdepth:0.3.2--h01d7912_0' }"
'https://depot.galaxyproject.org/singularity/mosdepth:0.3.3--hdfd78af_1' :
'quay.io/biocontainers/mosdepth:0.3.3--hdfd78af_1'}"

input:
tuple val(meta), path(bam), path(bai)
Expand All @@ -14,12 +14,13 @@ process MOSDEPTH {

output:
tuple val(meta), path('*.global.dist.txt') , emit: global_txt
tuple val(meta), path('*.region.dist.txt') , emit: regions_txt
tuple val(meta), path('*.region.dist.txt') , emit: regions_txt , optional:true
tuple val(meta), path('*.summary.txt') , emit: summary_txt
tuple val(meta), path('*.per-base.bed.gz') , emit: per_base_bed
tuple val(meta), path('*.per-base.bed.gz.csi'), emit: per_base_csi
tuple val(meta), path('*.regions.bed.gz') , emit: regions_bed
tuple val(meta), path('*.regions.bed.gz.csi') , emit: regions_csi
tuple val(meta), path('*.per-base.d4') , emit: d4 , optional:true
tuple val(meta), path('*.per-base.bed.gz') , emit: per_base_bed, optional:true
tuple val(meta), path('*.per-base.bed.gz.csi'), emit: per_base_csi, optional:true
tuple val(meta), path('*.regions.bed.gz') , emit: regions_bed , optional:true
tuple val(meta), path('*.regions.bed.gz.csi') , emit: regions_csi , optional:true
path "versions.yml" , emit: versions

when:
Expand All @@ -28,7 +29,13 @@ process MOSDEPTH {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def interval = window_size ? "--by ${window_size}" : "--by ${bed}"
if (window_size) {
interval = "--by ${window_size}"
} else if ( bed ) {
interval = "--by ${bed}"
} else {
interval = ""
}
"""
mosdepth \\
$interval \\
Expand All @@ -40,4 +47,22 @@ process MOSDEPTH {
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
END_VERSIONS
"""

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
"""
touch ${prefix}.global.dist.txt
touch ${prefix}.region.dist.txt
touch ${prefix}.summary.txt
touch ${prefix}.per-base.d4
touch ${prefix}.per-base.bed.gz
touch ${prefix}.per-base.bed.gz.csi
touch ${prefix}.regions.bed.gz
touch ${prefix}.regions.bed.gz.csi
cat <<-END_VERSIONS > versions.yml
"${task.process}":
mosdepth: \$(mosdepth --version 2>&1 | sed 's/^.*mosdepth //; s/ .*\$//')
END_VERSIONS
"""
}
1 change: 1 addition & 0 deletions modules/mosdepth/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,4 @@ output:
authors:
- "@joseespinosa"
- "@drpatelh"
- "@ramprasadn"
26 changes: 23 additions & 3 deletions tests/modules/mosdepth/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,30 @@ include { MOSDEPTH } from '../../../modules/mosdepth/main.nf'
workflow test_mosdepth {
input = [ [ id:'test', single_end:true ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ]
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ]
]

MOSDEPTH ( input, [], [] )
}


workflow test_mosdepth_window {
input = [ [ id:'test', single_end:true ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ]
]
dummy = file("dummy_file.txt")
window = 100

MOSDEPTH ( input, dummy, window )
MOSDEPTH ( input, [], window )
}


workflow test_mosdepth_bed {
input = [ [ id:'test', single_end:true ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ],
[ file(params.test_data['sarscov2']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ]
]
bed = [ file(params.test_data['sarscov2']['genome']['test_bed'], checkIfExists: true) ]

MOSDEPTH ( input, bed, [] )
}
42 changes: 38 additions & 4 deletions tests/modules/mosdepth/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,50 @@
- mosdepth
files:
- path: ./output/mosdepth/test.per-base.bed.gz.csi
md5sum: aa68536f55883aa60f4e68ac9b108358
md5sum: b2aad62c41a7146680d31df505fcc8c5
- path: ./output/mosdepth/test.per-base.bed.gz
md5sum: b5f9c8ca49be6128a486f6b56514a6d0
md5sum: 11b3f649072c2c7453febb085b1a9c33
- path: ./output/mosdepth/test.mosdepth.global.dist.txt
md5sum: 2a1de1b0ecc361a21cd296ec4e1efd6a
- path: ./output/mosdepth/test.mosdepth.summary.txt
md5sum: 7b249dd3b3e58cc122fbd25ea84aa25d

- name: mosdepth window
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_window -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
tags:
- mosdepth
files:
- path: ./output/mosdepth/test.per-base.bed.gz.csi
md5sum: b2aad62c41a7146680d31df505fcc8c5
- path: ./output/mosdepth/test.per-base.bed.gz
md5sum: 11b3f649072c2c7453febb085b1a9c33
- path: ./output/mosdepth/test.mosdepth.global.dist.txt
md5sum: 2a1de1b0ecc361a21cd296ec4e1efd6a
- path: ./output/mosdepth/test.regions.bed.gz
md5sum: 8e020ec602c02d240e0458642cf5ac5a
md5sum: 64e1ced01c4443d7c1796ef553992f0c
- path: ./output/mosdepth/test.regions.bed.gz.csi
md5sum: 44aec43fc34785fcbe6d830c907c617a
md5sum: 9e312b4b0784bd46dfbd23b3a8afed6a
- path: ./output/mosdepth/test.mosdepth.region.dist.txt
md5sum: 65fbc824c4212c6884354d8ac72ad37e
- path: ./output/mosdepth/test.mosdepth.summary.txt
md5sum: 11804907dab069ddb99ca97bf2698572

- name: mosdepth bed
command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_bed -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config
tags:
- mosdepth
files:
- path: ./output/mosdepth/test.per-base.bed.gz.csi
md5sum: b2aad62c41a7146680d31df505fcc8c5
- path: ./output/mosdepth/test.per-base.bed.gz
md5sum: 11b3f649072c2c7453febb085b1a9c33
- path: ./output/mosdepth/test.mosdepth.global.dist.txt
md5sum: 2a1de1b0ecc361a21cd296ec4e1efd6a
- path: ./output/mosdepth/test.regions.bed.gz
md5sum: 347f877700d1dc42c95157199eff25d5
- path: ./output/mosdepth/test.regions.bed.gz.csi
md5sum: ed5fbf46e3bdcbf60094df295bc40356
- path: ./output/mosdepth/test.mosdepth.region.dist.txt
md5sum: 295564628113d2ec0ca34d7f661cfea8
- path: ./output/mosdepth/test.mosdepth.summary.txt
md5sum: b07817412fd17819c14541e63bc4926c

0 comments on commit 54687c8

Please sign in to comment.