From 72ff2732e3177b041234aa49c1775376a00d59f4 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 25 May 2022 19:19:39 +0200 Subject: [PATCH] add all remaining outputs to mosdepth --- modules/mosdepth/main.nf | 29 ++++++++++++------ modules/mosdepth/meta.yml | 16 ++++++++++ tests/modules/mosdepth/main.nf | 30 ++++++++++++++++-- tests/modules/mosdepth/nextflow.config | 6 ++++ tests/modules/mosdepth/test.yml | 42 ++++++++++++++++++++++++++ 5 files changed, 111 insertions(+), 12 deletions(-) diff --git a/modules/mosdepth/main.nf b/modules/mosdepth/main.nf index 5f6538e7..96471cfc 100644 --- a/modules/mosdepth/main.nf +++ b/modules/mosdepth/main.nf @@ -13,15 +13,19 @@ process MOSDEPTH { path fasta output: - tuple val(meta), path('*.global.dist.txt') , emit: global_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.d4') , emit: per_base_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 + tuple val(meta), path('*.global.dist.txt') , emit: global_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.d4') , emit: per_base_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 + tuple val(meta), path('*.quantized.bed.gz') , emit: quantized_bed , optional:true + tuple val(meta), path('*.quantized.bed.gz.csi') , emit: quantized_csi , optional:true + tuple val(meta), path('*.thresholds.bed.gz') , emit: thresholds_bed , optional:true + tuple val(meta), path('*.thresholds.bed.gz.csi'), emit: thresholds_csi , optional:true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when @@ -34,6 +38,9 @@ process MOSDEPTH { if (bed && args.contains("--by")) { exit 1, "'--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")) { + exit 1, "'--thresholds' can only be specified in conjunction with '--by'" + } """ mosdepth \\ @@ -61,6 +68,10 @@ process MOSDEPTH { touch ${prefix}.per-base.bed.gz.csi touch ${prefix}.regions.bed.gz touch ${prefix}.regions.bed.gz.csi + touch ${prefix}.quantized.bed.gz + touch ${prefix}.quantized.bed.gz.csi + touch ${prefix}.thresholds.bed.gz + touch ${prefix}.thresholds.bed.gz.csi cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/mosdepth/meta.yml b/modules/mosdepth/meta.yml index 6e9e34c9..d1e33447 100644 --- a/modules/mosdepth/meta.yml +++ b/modules/mosdepth/meta.yml @@ -72,6 +72,22 @@ output: type: file description: Index file for BED file with per-region coverage pattern: "*.{regions.bed.gz.csi}" + - quantized_bed: + type: file + description: BED file with binned coverage + pattern: "*.{quantized.bed.gz}" + - quantized_csi: + type: file + description: Index file for BED file with binned coverage + pattern: "*.{quantized.bed.gz.csi}" + - thresholds_bed: + type: file + description: BED file with the number of bases in each region that are covered at or above each threshold + pattern: "*.{thresholds.bed.gz}" + - thresholds_csi: + type: file + description: Index file for BED file with threshold coverage + pattern: "*.{thresholds.bed.gz.csi}" - versions: type: file description: File containing software versions diff --git a/tests/modules/mosdepth/main.nf b/tests/modules/mosdepth/main.nf index 96a9ef20..dd4a01c4 100644 --- a/tests/modules/mosdepth/main.nf +++ b/tests/modules/mosdepth/main.nf @@ -2,9 +2,12 @@ nextflow.enable.dsl = 2 -include { MOSDEPTH } from '../../../modules/mosdepth/main.nf' -include { MOSDEPTH as MOSDEPTH_FAIL } from '../../../modules/mosdepth/main.nf' -include { MOSDEPTH as MOSDEPTH_WINDOW } from '../../../modules/mosdepth/main.nf' +include { MOSDEPTH } from '../../../modules/mosdepth/main.nf' +include { MOSDEPTH as MOSDEPTH_FAIL } from '../../../modules/mosdepth/main.nf' +include { MOSDEPTH as MOSDEPTH_WINDOW } from '../../../modules/mosdepth/main.nf' +include { MOSDEPTH as MOSDEPTH_THRESHOLD } from '../../../modules/mosdepth/main.nf' +include { MOSDEPTH as MOSDEPTH_QUANTIZED } from '../../../modules/mosdepth/main.nf' + workflow test_mosdepth { input = [ @@ -61,6 +64,27 @@ workflow test_mosdepth_window { MOSDEPTH_WINDOW ( input, [], [] ) } +workflow test_mosdepth_quantized { + input = [ + [ id:'test', single_end:true ], + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ], + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ] + ] + + MOSDEPTH_QUANTIZED ( input, [], [] ) +} + +workflow test_mosdepth_thresholds { + input = [ + [ id:'test', single_end:true ], + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam'], checkIfExists: true) ], + [ file(params.test_data['homo_sapiens']['illumina']['test_paired_end_sorted_bam_bai'], checkIfExists: true) ] + ] + bed = [ file(params.test_data['homo_sapiens']['genome']['genome_bed'], checkIfExists: true) ] + + MOSDEPTH_THRESHOLD ( input, bed, [] ) +} + workflow test_mosdepth_fail { input = [ [ id:'test', single_end:true ], diff --git a/tests/modules/mosdepth/nextflow.config b/tests/modules/mosdepth/nextflow.config index 4a6153e6..66e9291f 100644 --- a/tests/modules/mosdepth/nextflow.config +++ b/tests/modules/mosdepth/nextflow.config @@ -7,4 +7,10 @@ process { withName: MOSDEPTH_WINDOW { ext.args = "--by 100" } + withName: MOSDEPTH_QUANTIZED { + ext.args = "--quantize 0:1:4:100:200" + } + withName: MOSDEPTH_THRESHOLD { + ext.args = "--thresholds 1,10,20,30" + } } diff --git a/tests/modules/mosdepth/test.yml b/tests/modules/mosdepth/test.yml index a3115d6e..8efadb9d 100644 --- a/tests/modules/mosdepth/test.yml +++ b/tests/modules/mosdepth/test.yml @@ -86,6 +86,48 @@ - path: output/mosdepth/test.regions.bed.gz.csi md5sum: 257d67678136963d9dd904330079609d +- name: mosdepth test_mosdepth_quantized + command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_quantized -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config + tags: + - mosdepth + files: + - path: output/mosdepth/test.mosdepth.global.dist.txt + md5sum: e82e90c7d508a135b5a8a7cd6933452e + - path: output/mosdepth/test.mosdepth.summary.txt + md5sum: 4f0d231060cbde4efdd673863bd2fb59 + - path: output/mosdepth/test.per-base.bed.gz + md5sum: bc1df47d46f818fee5275975925d769a + - path: output/mosdepth/test.per-base.bed.gz.csi + md5sum: 9e649ac749ff6c6073bef5ab63e8aaa4 + - path: output/mosdepth/test.quantized.bed.gz + md5sum: 3e434a8bafcf59a67841ae3d4d752838 + - path: output/mosdepth/test.quantized.bed.gz.csi + md5sum: be9617f551f19a33923f1e886eaefb93 + +- name: mosdepth test_mosdepth_thresholds + command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_thresholds -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config + tags: + - mosdepth + files: + - path: output/mosdepth/test.mosdepth.global.dist.txt + md5sum: e82e90c7d508a135b5a8a7cd6933452e + - path: output/mosdepth/test.mosdepth.region.dist.txt + md5sum: e82e90c7d508a135b5a8a7cd6933452e + - path: output/mosdepth/test.mosdepth.summary.txt + md5sum: 96c037f769974b904beb53edc4f56d82 + - path: output/mosdepth/test.per-base.bed.gz + md5sum: bc1df47d46f818fee5275975925d769a + - path: output/mosdepth/test.per-base.bed.gz.csi + md5sum: 9e649ac749ff6c6073bef5ab63e8aaa4 + - path: output/mosdepth/test.regions.bed.gz + md5sum: 5d398caf7171ec4406278e2add3009ae + - path: output/mosdepth/test.regions.bed.gz.csi + md5sum: 47669cfe41f3e222e74d81e1b1be191f + - path: output/mosdepth/test.thresholds.bed.gz + md5sum: 13101e326eea3cbfa1d569b69f494f4c + - path: output/mosdepth/test.thresholds.bed.gz.csi + md5sum: 912055ee9452229439df6fae95644196 + - name: mosdepth test_mosdepth_fail command: nextflow run ./tests/modules/mosdepth -entry test_mosdepth_fail -c ./tests/config/nextflow.config -c ./tests/modules/mosdepth/nextflow.config tags: