From 69306d93e1c63f444651aee39f9f55926d73fb1e Mon Sep 17 00:00:00 2001 From: Louis Le Nezet Date: Mon, 2 Dec 2024 17:01:54 +0100 Subject: [PATCH] Fix glimpse2 concordance usage --- modules/nf-core/glimpse2/concordance/main.nf | 30 +++++++++++-------- .../local/vcf_concordance_glimpse2/main.nf | 3 +- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/modules/nf-core/glimpse2/concordance/main.nf b/modules/nf-core/glimpse2/concordance/main.nf index 06eb139b..f96f5c38 100644 --- a/modules/nf-core/glimpse2/concordance/main.nf +++ b/modules/nf-core/glimpse2/concordance/main.nf @@ -9,9 +9,7 @@ process GLIMPSE2_CONCORDANCE { input: tuple val(meta), path(estimate), path(estimate_index), path(truth), path(truth_index), path(freq), path(freq_index), path(samples), val(region) - tuple val(meta2), path(groups), val(bins), val(ac_bins), val(allele_counts) - val(min_val_gl) - val(min_val_dp) + tuple val(meta2), path(groups), val(bins), val(ac_bins), val(allele_counts), val(min_val_gl), val(min_val_dp) output: tuple val(meta), path("*.error.cal.txt.gz") , emit: errors_cal @@ -26,17 +24,23 @@ process GLIMPSE2_CONCORDANCE { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def samples_cmd = samples ? "--samples ${samples}" : "" - def groups_cmd = groups ? "--groups ${groups}" : "" - def bins_cmd = bins ? "--bins ${bins}" : "" - def ac_bins_cmd = ac_bins ? "--ac-bins ${ac_bins}" : "" - def ale_ct_cmd = allele_counts ? "--allele-counts ${allele_counts}" : "" - def region_str = region instanceof List ? region.join('\\n') : region + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def samples_cmd = samples ? "--samples ${samples}" : "" + def groups_cmd = groups ? "--groups ${groups}" : "" + def bins_cmd = bins ? "--bins ${bins}" : "" + def ac_bins_cmd = ac_bins ? "--ac-bins ${ac_bins}" : "" + def ale_ct_cmd = allele_counts ? "--allele-counts ${allele_counts}" : "" + def min_val_gl_cmd = min_val_gl ? "--min-val-gl ${min_val_gl}" : "" + def min_val_dp_cmd = min_val_dp ? "--min-val-dp ${min_val_dp}" : "" + def region_str = region instanceof List ? region.join('\\n') : region if (((groups ? 1:0) + (bins ? 1:0) + (ac_bins ? 1:0) + (allele_counts ? 1:0)) != 1) error "One and only one argument should be selected between groups, bins, ac_bins, allele_counts" + if (args.contains("--gt-val")) { + assert !(min_val_gl || min_val_dp) : "If --gt-val is set, --min-val-gl nor --min-val-dp must be set" + } + """ printf '$region_str' > regions.txt sed 's/\$/ $freq $truth $estimate/' regions.txt > input.txt @@ -47,8 +51,8 @@ process GLIMPSE2_CONCORDANCE { $bins_cmd \\ $ac_bins_cmd \\ $ale_ct_cmd \\ - --min-val-gl $min_val_gl \\ - --min-val-dp $min_val_dp \\ + $min_val_gl_cmd \\ + $min_val_dp_cmd \\ --input input.txt \\ --thread $task.cpus \\ --output ${prefix} diff --git a/subworkflows/local/vcf_concordance_glimpse2/main.nf b/subworkflows/local/vcf_concordance_glimpse2/main.nf index ec4b04a0..8545d6a0 100644 --- a/subworkflows/local/vcf_concordance_glimpse2/main.nf +++ b/subworkflows/local/vcf_concordance_glimpse2/main.nf @@ -32,8 +32,7 @@ workflow VCF_CONCORDANCE_GLIMPSE2 { GLIMPSE2_CONCORDANCE ( ch_concordance, - [[], [], params.bins, [], []], - params.min_val_gl, params.min_val_dp + [[], [], params.bins, [], [], params.min_val_gl, params.min_val_dp] ) ch_versions = ch_versions.mix(GLIMPSE2_CONCORDANCE.out.versions.first())