From 45acc79667b58b5888cdea7327e76c728e94d6df Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Wed, 9 Feb 2022 13:45:55 +0100 Subject: [PATCH] Update mosdepth (#1256) * nf-core create * svdb merge module and test * remove to-do from test.yml * version * update meta.yml * mosdepth update * update md5sums * add stub * add stub * remove svdb * remove merge * Add tests * code linting fix * undo previous commit * revert code linting fix --- modules/mosdepth/main.nf | 43 ++++++++++++++++++++++++++------- modules/mosdepth/meta.yml | 1 + tests/modules/mosdepth/main.nf | 26 +++++++++++++++++--- tests/modules/mosdepth/test.yml | 42 +++++++++++++++++++++++++++++--- 4 files changed, 96 insertions(+), 16 deletions(-) diff --git a/modules/mosdepth/main.nf b/modules/mosdepth/main.nf index cc7bc86b..ff91e06f 100644 --- a/modules/mosdepth/main.nf +++ b/modules/mosdepth/main.nf @@ -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) @@ -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: @@ -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 \\ @@ -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 + """ } diff --git a/modules/mosdepth/meta.yml b/modules/mosdepth/meta.yml index be568aa6..0ca7bce9 100644 --- a/modules/mosdepth/meta.yml +++ b/modules/mosdepth/meta.yml @@ -75,3 +75,4 @@ output: authors: - "@joseespinosa" - "@drpatelh" + - "@ramprasadn" diff --git a/tests/modules/mosdepth/main.nf b/tests/modules/mosdepth/main.nf index 8862204d..ddd68129 100644 --- a/tests/modules/mosdepth/main.nf +++ b/tests/modules/mosdepth/main.nf @@ -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, [] ) } diff --git a/tests/modules/mosdepth/test.yml b/tests/modules/mosdepth/test.yml index e264ef3b..c66e0b89 100644 --- a/tests/modules/mosdepth/test.yml +++ b/tests/modules/mosdepth/test.yml @@ -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