diff --git a/modules/mosdepth/main.nf b/modules/mosdepth/main.nf index a5218286..39586797 100644 --- a/modules/mosdepth/main.nf +++ b/modules/mosdepth/main.nf @@ -31,7 +31,7 @@ process MOSDEPTH { def prefix = task.ext.prefix ?: "${meta.id}" def reference = fasta ? "--fasta ${fasta}" : "" def interval = bed ? "--by ${bed}" : "" - if (bed && ext.args.contains("--by")) { + if (bed && args.contains("--by")) { exit 1, "--by can only be specified once." } diff --git a/tests/modules/mosdepth/main.nf b/tests/modules/mosdepth/main.nf index 86ca0e86..eab47e89 100644 --- a/tests/modules/mosdepth/main.nf +++ b/tests/modules/mosdepth/main.nf @@ -2,7 +2,8 @@ nextflow.enable.dsl = 2 -include { MOSDEPTH } from '../../../modules/mosdepth/main.nf' +include { MOSDEPTH } from '../../../modules/mosdepth/main.nf' +include { MOSDEPTH as MOSDEPTH_FAIL } from '../../../modules/mosdepth/main.nf' workflow test_mosdepth { input = [ @@ -47,3 +48,14 @@ workflow test_mosdepth_cram_bed { MOSDEPTH ( input, bed, fasta ) } + +workflow test_mosdepth_fail { + 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_FAIL ( input, bed, [] ) +} diff --git a/tests/modules/mosdepth/nextflow.config b/tests/modules/mosdepth/nextflow.config index 8730f1c4..85674a3c 100644 --- a/tests/modules/mosdepth/nextflow.config +++ b/tests/modules/mosdepth/nextflow.config @@ -1,5 +1,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - + withName: MOSDEPTH_FAIL { + ext.args = "--by 100" + } } diff --git a/tests/modules/mosdepth/test.yml b/tests/modules/mosdepth/test.yml index 2cacb185..4eaf9bf1 100644 --- a/tests/modules/mosdepth/test.yml +++ b/tests/modules/mosdepth/test.yml @@ -65,3 +65,9 @@ md5sum: 5d398caf7171ec4406278e2add3009ae - path: output/mosdepth/test.regions.bed.gz.csi md5sum: 47669cfe41f3e222e74d81e1b1be191f + +- 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: + - mosdepth + exitcode: 1