diff --git a/modules/nf-core/bcftools/index/main.nf b/modules/nf-core/bcftools/index/main.nf index 16ff775a00d4..ad1feb1c04fc 100644 --- a/modules/nf-core/bcftools/index/main.nf +++ b/modules/nf-core/bcftools/index/main.nf @@ -20,7 +20,6 @@ process BCFTOOLS_INDEX { script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" """ bcftools \\ @@ -37,7 +36,6 @@ process BCFTOOLS_INDEX { stub: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" def extension = args.contains("--tbi") || args.contains("-t") ? "tbi" : "csi" """ diff --git a/modules/nf-core/beagle5/beagle/main.nf b/modules/nf-core/beagle5/beagle/main.nf index e66c9e40b019..b9b21554e73f 100644 --- a/modules/nf-core/beagle5/beagle/main.nf +++ b/modules/nf-core/beagle5/beagle/main.nf @@ -1,11 +1,11 @@ process BEAGLE5_BEAGLE { - tag "$meta.id" + tag "${meta.id}" label 'process_high' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/beagle:5.5_27Feb25.75f--hdfd78af_0': - 'biocontainers/beagle:5.5_27Feb25.75f--hdfd78af_0' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/beagle:5.5_27Feb25.75f--hdfd78af_0' + : 'biocontainers/beagle:5.5_27Feb25.75f--hdfd78af_0'}" input: // Including `val(region)` to prevent errors with multi-chromosome VCFs and single-chromosome reference panels. @@ -21,26 +21,28 @@ process BEAGLE5_BEAGLE { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}.bglout" - def ref_command = refpanel ? "ref=$refpanel" : "" - def map_command = genmap ? "map=$genmap" : "" - def region_cmd = region ? "chrom=$region" : "" - def excludesamples_command = exclsamples ? "excludesamples=$exclsamples" : "" - def excludemarkers_command = exclmarkers ? "excludemarkers=$exclmarkers" : "" + + def ref_command = refpanel ? "ref=${refpanel}" : "" + def map_command = genmap ? "map=${genmap}" : "" + def region_cmd = region ? "chrom=${region}" : "" + + def excludesamples_command = exclsamples ? "excludesamples=${exclsamples}" : "" + def excludemarkers_command = exclmarkers ? "excludemarkers=${exclmarkers}" : "" def avail_mem = 3072 if (!task.memory) { - log.info '[beagle] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.' + log.info('[beagle] Available memory not known - defaulting to 3GB. Specify process memory requirements to change this.') } else { - avail_mem = (task.memory.mega*0.8).intValue() + avail_mem = (task.memory.mega * 0.8).intValue() } """ beagle -Xmx${avail_mem}M \\ gt=${vcf} \\ out=${prefix} \\ - $args \\ + ${args} \\ ${ref_command} \\ ${map_command} \\ ${region_cmd} \\ diff --git a/modules/nf-core/glimpse/chunk/main.nf b/modules/nf-core/glimpse/chunk/main.nf index c8d92f472997..aead3b96af51 100644 --- a/modules/nf-core/glimpse/chunk/main.nf +++ b/modules/nf-core/glimpse/chunk/main.nf @@ -1,32 +1,32 @@ process GLIMPSE_CHUNK { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--h2ce4488_2': - 'biocontainers/glimpse-bio:1.1.1--hce55b13_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--h2ce4488_2' + : 'biocontainers/glimpse-bio:1.1.1--hce55b13_1'}" input: tuple val(meta), path(input), path(input_index), val(region) output: tuple val(meta), path("*.txt"), emit: chunk_chr - path "versions.yml" , emit: versions + path "versions.yml", emit: versions when: task.ext.when == null || task.ext.when script: - def prefix = task.ext.prefix ?: "${meta.id}" - def args = task.ext.args ?: "" + def prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: "" """ GLIMPSE_chunk \\ - $args \\ - --input $input \\ - --region $region \\ - --thread $task.cpus \\ + ${args} \\ + --input ${input} \\ + --region ${region} \\ + --thread ${task.cpus} \\ --output ${prefix}.txt cat <<-END_VERSIONS > versions.yml @@ -36,7 +36,7 @@ process GLIMPSE_CHUNK { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" + def prefix = task.ext.prefix ?: "${meta.id}" """ touch ${prefix}.txt diff --git a/modules/nf-core/glimpse/chunk/tests/nextflow.config b/modules/nf-core/glimpse/chunk/tests/nextflow.config index 8f4c838e95c4..21c77a9fab77 100644 --- a/modules/nf-core/glimpse/chunk/tests/nextflow.config +++ b/modules/nf-core/glimpse/chunk/tests/nextflow.config @@ -1,6 +1,6 @@ process { withName: GLIMPSE_CHUNK { - ext.args = { "${params.glimpse_args}" } + ext.args = { "${params.glimpse_args}" } ext.prefix = { "${meta.id}" } } } diff --git a/modules/nf-core/glimpse/concordance/main.nf b/modules/nf-core/glimpse/concordance/main.nf index 4a70a6afffed..045582e69b66 100644 --- a/modules/nf-core/glimpse/concordance/main.nf +++ b/modules/nf-core/glimpse/concordance/main.nf @@ -1,17 +1,17 @@ process GLIMPSE_CONCORDANCE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--h0303221_3': - 'biocontainers/glimpse-bio:1.1.1--h0303221_3' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--h0303221_3' + : 'biocontainers/glimpse-bio:1.1.1--h0303221_3'}" input: tuple val(meta), path(estimate), path(estimate_index), path(freq), path(freq_index), path(truth), path(truth_index), val(region) - val(min_prob) - val(min_dp) - val(bins) + val min_prob + val min_dp + val bins output: tuple val(meta), path("*.error.cal.txt.gz") , emit: errors_cal @@ -20,6 +20,7 @@ process GLIMPSE_CONCORDANCE { tuple val(meta), path("*.rsquare.grp.txt.gz"), emit: rsquare_grp tuple val(meta), path("*.rsquare.spl.txt.gz"), emit: rsquare_spl path "versions.yml" , emit: versions + when: task.ext.when == null || task.ext.when @@ -30,15 +31,15 @@ process GLIMPSE_CONCORDANCE { def min_dp_cmd = min_dp ? "--minDP ${min_dp}" : "--minDP 8" def bins_cmd = bins ? "--bins ${bins}" : "--bins 0.00000 0.00100 0.00200 0.00500 0.01000 0.05000 0.10000 0.20000 0.50000" """ - echo $region $freq $truth $estimate > input.txt + echo ${region} ${freq} ${truth} ${estimate} > input.txt GLIMPSE_concordance \\ - $args \\ + ${args} \\ --input input.txt \\ - --thread $task.cpus \\ + --thread ${task.cpus} \\ --output ${prefix} \\ - $min_prob_cmd \\ - $min_dp_cmd \\ - $bins_cmd + ${min_prob_cmd} \\ + ${min_dp_cmd} \\ + ${bins_cmd} cat <<-END_VERSIONS > versions.yml "${task.process}": @@ -47,7 +48,7 @@ process GLIMPSE_CONCORDANCE { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" + def prefix = task.ext.prefix ?: "${meta.id}" """ echo "" | gzip > ${prefix}.error.cal.txt.gz diff --git a/modules/nf-core/glimpse/ligate/main.nf b/modules/nf-core/glimpse/ligate/main.nf index 885f5d5ddd5e..f60db9d6efa0 100644 --- a/modules/nf-core/glimpse/ligate/main.nf +++ b/modules/nf-core/glimpse/ligate/main.nf @@ -1,11 +1,11 @@ process GLIMPSE_LIGATE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--hce55b13_1': - 'biocontainers/glimpse-bio:1.1.1--hce55b13_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--hce55b13_1' + : 'biocontainers/glimpse-bio:1.1.1--hce55b13_1'}" input: tuple val(meta), path(input_list), path(input_index) @@ -22,12 +22,12 @@ process GLIMPSE_LIGATE { def prefix = task.ext.prefix ?: "${meta.id}" def suffix = task.ext.suffix ?: "vcf.gz" """ - printf "%s\\n" $input_list | tr -d '[],' | sort -V > all_files.txt + printf "%s\\n" ${input_list} | tr -d '[],' | sort -V > all_files.txt GLIMPSE_ligate \\ - $args \\ + ${args} \\ --input all_files.txt \\ - --thread $task.cpus \\ + --thread ${task.cpus} \\ --output ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/glimpse/phase/main.nf b/modules/nf-core/glimpse/phase/main.nf index e5ba79718880..e695ced05589 100644 --- a/modules/nf-core/glimpse/phase/main.nf +++ b/modules/nf-core/glimpse/phase/main.nf @@ -1,40 +1,40 @@ process GLIMPSE_PHASE { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--hce55b13_1': - 'biocontainers/glimpse-bio:1.1.1--hce55b13_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--hce55b13_1' + : 'biocontainers/glimpse-bio:1.1.1--hce55b13_1'}" input: - tuple val(meta) , path(input), path(input_index), path(samples_file), val(input_region), val(output_region), path(reference), path(reference_index), path(map) + tuple val(meta), path(input), path(input_index), path(samples_file), val(input_region), val(output_region), path(reference), path(reference_index), path(map) output: - tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: phased_variants - path "versions.yml" , emit: versions + tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: phased_variants + path "versions.yml" , emit: versions when: - task.ext.when == null || task.ext.when + task.ext.when == null || task.ext.when script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}_${input_region.replace(":","_")}" + def prefix = task.ext.prefix ?: "${meta.id}_${input_region.replace(":", "_")}" def suffix = task.ext.suffix ?: "vcf.gz" - def map_command = map ? "--map $map" :"" - def samples_file_command = samples_file ? "--samples-file $samples_file" :"" + def map_command = map ? "--map ${map}" : "" + def samples_file_command = samples_file ? "--samples-file ${samples_file}" : "" """ GLIMPSE_phase \\ - $args \\ - --input $input \\ - --reference $reference \\ - $map_command \\ - $samples_file_command \\ - --input-region $input_region \\ - --output-region $output_region \\ - --thread $task.cpus \\ + ${args} \\ + --input ${input} \\ + --reference ${reference} \\ + ${map_command} \\ + ${samples_file_command} \\ + --input-region ${input_region} \\ + --output-region ${output_region} \\ + --thread ${task.cpus} \\ --output ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml @@ -44,7 +44,7 @@ process GLIMPSE_PHASE { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}_${input_region.replace(":","_")}" + def prefix = task.ext.prefix ?: "${meta.id}_${input_region.replace(":", "_")}" def suffix = task.ext.suffix ?: "vcf.gz" """ diff --git a/modules/nf-core/glimpse/sample/main.nf b/modules/nf-core/glimpse/sample/main.nf index 0fcfb6b4f2f9..9198732d2dac 100644 --- a/modules/nf-core/glimpse/sample/main.nf +++ b/modules/nf-core/glimpse/sample/main.nf @@ -1,11 +1,11 @@ process GLIMPSE_SAMPLE { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--hce55b13_1': - 'biocontainers/glimpse-bio:1.1.1--hce55b13_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:1.1.1--hce55b13_1' + : 'biocontainers/glimpse-bio:1.1.1--hce55b13_1'}" input: tuple val(meta), path(input), path(index) @@ -24,9 +24,9 @@ process GLIMPSE_SAMPLE { """ GLIMPSE_sample \\ - $args \\ - --input $input \\ - --thread $task.cpus \\ + ${args} \\ + --input ${input} \\ + --thread ${task.cpus} \\ --output ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/glimpse2/chunk/main.nf b/modules/nf-core/glimpse2/chunk/main.nf index 16e361eef034..fd65613d92ac 100644 --- a/modules/nf-core/glimpse2/chunk/main.nf +++ b/modules/nf-core/glimpse2/chunk/main.nf @@ -1,8 +1,8 @@ process GLIMPSE2_CHUNK { - tag "$meta.id" + tag "${meta.id}" label 'process_low' - beforeScript """ + beforeScript """ if cat /proc/cpuinfo | grep avx2 -q then echo "Feature AVX2 present on host" @@ -12,13 +12,13 @@ process GLIMPSE2_CHUNK { fi """ conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1': - 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1' + : 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1'}" input: tuple val(meta), path(input), path(input_index), val(region), path(map) - val(model) + val model output: tuple val(meta), path("*.txt"), emit: chunk_chr @@ -28,18 +28,18 @@ process GLIMPSE2_CHUNK { task.ext.when == null || task.ext.when script: - def prefix = task.ext.prefix ?: "${meta.id}" - def args = task.ext.args ?: "" - def map_cmd = map ? "--map ${map}":"" + def prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: "" + def map_cmd = map ? "--map ${map}" : "" """ GLIMPSE2_chunk \\ - $args \\ - $map_cmd \\ + ${args} \\ + ${map_cmd} \\ --${model} \\ - --input $input \\ - --region $region \\ - --threads $task.cpus \\ + --input ${input} \\ + --region ${region} \\ + --threads ${task.cpus} \\ --output ${prefix}.txt cat <<-END_VERSIONS > versions.yml @@ -49,7 +49,7 @@ process GLIMPSE2_CHUNK { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" + def prefix = task.ext.prefix ?: "${meta.id}" """ echo "${meta.id}\t${region}\t0\t0\t0\t0\t0\t0" > ${prefix}.txt diff --git a/modules/nf-core/glimpse2/chunk/tests/nextflow.config b/modules/nf-core/glimpse2/chunk/tests/nextflow.config index adaa0b252987..3684f001f4e2 100644 --- a/modules/nf-core/glimpse2/chunk/tests/nextflow.config +++ b/modules/nf-core/glimpse2/chunk/tests/nextflow.config @@ -1,14 +1,14 @@ process { withName: GLIMPSE2_CHUNK { - // Necessary to work on a small region - ext.args = [ + ext.args = [ "--seed 1", "--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", - "--buffer-count 30"].join(' ') + "--buffer-count 30", + ].join(' ') ext.prefix = { "${meta.id}" } } } diff --git a/modules/nf-core/glimpse2/concordance/main.nf b/modules/nf-core/glimpse2/concordance/main.nf index 945c3dd6a0e4..d343ae407c7c 100644 --- a/modules/nf-core/glimpse2/concordance/main.nf +++ b/modules/nf-core/glimpse2/concordance/main.nf @@ -1,11 +1,11 @@ process GLIMPSE2_CONCORDANCE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1': - 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1' + : 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1'}" input: tuple val(meta), path(estimate), path(estimate_index), path(truth), path(truth_index), path(freq), path(freq_index), path(samples), val(region) @@ -35,26 +35,28 @@ process GLIMPSE2_CONCORDANCE { 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 (((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 + printf '${region_str}' > regions.txt + sed 's/\$/ ${freq} ${truth} ${estimate}/' regions.txt > input.txt GLIMPSE2_concordance \\ - $args \\ - $samples_cmd \\ - $groups_cmd \\ - $bins_cmd \\ - $ac_bins_cmd \\ - $ale_ct_cmd \\ - $min_val_gl_cmd \\ - $min_val_dp_cmd \\ + ${args} \\ + ${samples_cmd} \\ + ${groups_cmd} \\ + ${bins_cmd} \\ + ${ac_bins_cmd} \\ + ${ale_ct_cmd} \\ + ${min_val_gl_cmd} \\ + ${min_val_dp_cmd} \\ --input input.txt \\ - --thread $task.cpus \\ + --thread ${task.cpus} \\ --output ${prefix} cat <<-END_VERSIONS > versions.yml @@ -64,8 +66,9 @@ process GLIMPSE2_CONCORDANCE { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" - def args = task.ext.args ?: "" + def prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: "" + def rsquare_per_site_cmd = args.contains("--out-r2-per-site") ? "touch ${prefix}_r2_sites.txt.gz" : "" """ echo "" | gzip > ${prefix}.error.cal.txt.gz diff --git a/modules/nf-core/glimpse2/concordance/tests/nextflow.config b/modules/nf-core/glimpse2/concordance/tests/nextflow.config index df8f4f67a604..00b50dd49a63 100644 --- a/modules/nf-core/glimpse2/concordance/tests/nextflow.config +++ b/modules/nf-core/glimpse2/concordance/tests/nextflow.config @@ -1,6 +1,6 @@ process { withName: GLIMPSE2_CONCORDANCE { - ext.args = { params.glimpse2_concordance_args} + ext.args = { params.glimpse2_concordance_args } ext.prefix = { "${meta.id}" } } } diff --git a/modules/nf-core/glimpse2/ligate/main.nf b/modules/nf-core/glimpse2/ligate/main.nf index 40559de297b1..eea6141c9b34 100644 --- a/modules/nf-core/glimpse2/ligate/main.nf +++ b/modules/nf-core/glimpse2/ligate/main.nf @@ -1,11 +1,11 @@ process GLIMPSE2_LIGATE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1': - 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1' + : 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1'}" input: tuple val(meta), path(input_list), path(input_index) @@ -22,12 +22,12 @@ process GLIMPSE2_LIGATE { def prefix = task.ext.prefix ?: "${meta.id}" def suffix = task.ext.suffix ?: "vcf.gz" """ - printf "%s\\n" $input_list | tr -d '[],' | sort -V > all_files.txt + printf "%s\\n" ${input_list} | tr -d '[],' | sort -V > all_files.txt GLIMPSE2_ligate \\ - $args \\ + ${args} \\ --input all_files.txt \\ - --thread $task.cpus \\ + --thread ${task.cpus} \\ --output ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/glimpse2/phase/main.nf b/modules/nf-core/glimpse2/phase/main.nf index 05f8fbc266e2..d22fdde22cbd 100644 --- a/modules/nf-core/glimpse2/phase/main.nf +++ b/modules/nf-core/glimpse2/phase/main.nf @@ -1,8 +1,8 @@ process GLIMPSE2_PHASE { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' - beforeScript """ + beforeScript """ if cat /proc/cpuinfo | grep avx2 -q then echo "Feature AVX2 present on host" @@ -13,82 +13,83 @@ process GLIMPSE2_PHASE { """ conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1': - 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1' + : 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1'}" input: - tuple val(meta) , path(input, arity: '1..*'), path(input_index), path(bamlist), path(samples_file), val(input_region), val(output_region), path(reference), path(reference_index), path(map) - tuple val(meta2), path(fasta_reference), path(fasta_reference_index) + tuple val(meta), path(input, arity: '1..*'), path(input_index), path(bamlist), path(samples_file), val(input_region), val(output_region), path(reference), path(reference_index), path(map) + tuple val(meta2), path(fasta_reference), path(fasta_reference_index) output: - tuple val(meta), path("*.{vcf,vcf.gz,bcf,bgen}"), emit: phased_variants - tuple val(meta), path("*.txt.gz") , emit: stats_coverage, optional: true - path "versions.yml" , emit: versions + tuple val(meta), path("*.{vcf,vcf.gz,bcf,bgen}"), emit: phased_variants + tuple val(meta), path("*.txt.gz") , emit: stats_coverage, optional: true + path "versions.yml" , emit: versions when: - task.ext.when == null || task.ext.when + task.ext.when == null || task.ext.when script: - def region = input_region ? "${output_region.replace(":","_")}" : "${reference}" + def region = input_region ? "${output_region.replace(":", "_")}" : "${reference}" def args = task.ext.args ?: "" def prefix = task.ext.prefix ?: "${meta.id}_${region}" def suffix = task.ext.suffix ?: "vcf.gz" - def map_command = map ? "--map $map" : "" - def samples_file_command = samples_file ? "--samples-file $samples_file" : "" - def fasta_command = fasta_reference ? "--fasta $fasta_reference" : "" - def input_region_cmd = input_region ? "--input-region $input_region" : "" - def output_region_cmd = output_region ? "--output-region $output_region": "" + def map_command = map ? "--map ${map}" : "" + def samples_file_command = samples_file ? "--samples-file ${samples_file}" : "" + def fasta_command = fasta_reference ? "--fasta ${fasta_reference}" : "" + def input_region_cmd = input_region ? "--input-region ${input_region}" : "" + def output_region_cmd = output_region ? "--output-region ${output_region}" : "" - def input_type = input.collect{ - it.toString().endsWithAny("cram", "bam") ? "bam" : - it.toString().endsWithAny("vcf", "bcf", "vcf.gz") ? "gl" : + def input_type = input.collect{ + it.toString().endsWithAny("cram", "bam") ? "bam" : + it.toString().endsWithAny("vcf", "bcf", "vcf.gz") ? "gl" : it.getExtension() }.unique() if (input_type.size() > 1 | !(input_type.contains("gl") | input_type.contains("bam"))) { - error "Input files must be of the same type and either .bam/.cram or .vcf/.vcf.gz/.bcf format. Found: ${input_type}" - } else { + error("Input files must be of the same type and either .bam/.cram or .vcf/.vcf.gz/.bcf format. Found: ${input_type}") + } + else { input_type = input_type[0] } if (input_type == "gl" & input.size() > 1) { - error "Only one input .vcf/.vcf.gz/.bcf file can be provided" + error("Only one input .vcf/.vcf.gz/.bcf file can be provided") } def input_list = input.size() > 1 """ - if [ -n "$bamlist" ] ; + if [ -n "${bamlist}" ] ; then - input_command="--bam-list $bamlist" - elif $input_list ; + input_command="--bam-list ${bamlist}" + elif ${input_list} ; then ls -1 | grep '\\.cram\$\\|\\.bam\$' | sort > all_bam.txt input_command="--bam-list all_bam.txt" else - if [ "$input_type" == "bam" ]; + if [ "${input_type}" == "bam" ]; then - input_command="--bam-file $input" - elif [ "$input_type" == "gl" ]; + input_command="--bam-file ${input}" + elif [ "${input_type}" == "gl" ]; then - input_command="--input-gl $input" + input_command="--input-gl ${input}" else echo "Input file type not recognised" - echo "$input_type" + echo "${input_type}" exit 1 fi fi GLIMPSE2_phase \\ - $args \\ + ${args} \\ \$input_command \\ - --reference $reference \\ - $map_command \\ - $fasta_command \\ - $samples_file_command \\ - $input_region_cmd \\ - $output_region_cmd \\ - --thread $task.cpus \\ + --reference ${reference} \\ + ${map_command} \\ + ${fasta_command} \\ + ${samples_file_command} \\ + ${input_region_cmd} \\ + ${output_region_cmd} \\ + --thread ${task.cpus} \\ --output ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml @@ -98,7 +99,7 @@ process GLIMPSE2_PHASE { """ stub: - def region = input_region ? "${output_region.replace(":","_")}" : "${reference}" + def region = input_region ? "${output_region.replace(":", "_")}" : "${reference}" def prefix = task.ext.prefix ?: "${meta.id}_${region}" def suffix = task.ext.suffix ?: "vcf.gz" def create_cmd = suffix.endsWith(".gz") ? "echo | gzip > ${prefix}.${suffix}" : "touch ${prefix}.${suffix}" diff --git a/modules/nf-core/glimpse2/phase/tests/main.nf.test b/modules/nf-core/glimpse2/phase/tests/main.nf.test index c7dfcd7ed827..5475f308a581 100644 --- a/modules/nf-core/glimpse2/phase/tests/main.nf.test +++ b/modules/nf-core/glimpse2/phase/tests/main.nf.test @@ -179,7 +179,6 @@ nextflow_process { } test("homo_sapiens - [bam, bam] region - panel") { - tag "test" when { process { """ @@ -301,7 +300,6 @@ nextflow_process { } test("homo_sapiens - [bam, bam] region sample rename - panel") { - tag "test" when { process { """ diff --git a/modules/nf-core/glimpse2/phase/tests/nextflow.config b/modules/nf-core/glimpse2/phase/tests/nextflow.config index 310c7f220dd7..8710a5688bf7 100644 --- a/modules/nf-core/glimpse2/phase/tests/nextflow.config +++ b/modules/nf-core/glimpse2/phase/tests/nextflow.config @@ -1,11 +1,11 @@ process { withName: GLIMPSE2_PHASE { - cpus = 1 - ext.args = "--seed 1" + cpus = 1 // needed for deterministic output + ext.args = "--seed 1" ext.suffix = "vcf" } withName: SAMTOOLS_VIEW { - ext.args = "--output-fmt cram" + ext.args = "--output-fmt cram" ext.args2 = "embed-ref=2" } } diff --git a/modules/nf-core/glimpse2/splitreference/main.nf b/modules/nf-core/glimpse2/splitreference/main.nf index 0311e09dabc2..84ec88721566 100644 --- a/modules/nf-core/glimpse2/splitreference/main.nf +++ b/modules/nf-core/glimpse2/splitreference/main.nf @@ -1,8 +1,8 @@ process GLIMPSE2_SPLITREFERENCE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' - beforeScript """ + beforeScript """ if cat /proc/cpuinfo | grep avx2 -q then echo "Feature AVX2 present" @@ -13,34 +13,33 @@ process GLIMPSE2_SPLITREFERENCE { """ conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1': - 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/glimpse-bio:2.0.1--h46b9e50_1' + : 'biocontainers/glimpse-bio:2.0.1--h46b9e50_1'}" input: - tuple val(meta) , path(reference), path(reference_index), val(input_region), val(output_region), path(map) - + tuple val(meta), path(reference), path(reference_index), val(input_region), val(output_region), path(map) output: - tuple val(meta), path("*.bin"), emit: bin_ref - path "versions.yml" , emit: versions + tuple val(meta), path("*.bin"), emit: bin_ref + path "versions.yml" , emit: versions when: - task.ext.when == null || task.ext.when + task.ext.when == null || task.ext.when script: def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}_${output_region.replace(":","_")}" - def map_command = map ? "--map $map" : "" + def prefix = task.ext.prefix ?: "${meta.id}_${output_region.replace(":", "_")}" + def map_command = map ? "--map ${map}" : "" """ GLIMPSE2_split_reference \\ - $args \\ - --reference $reference \\ - $map_command \\ - --input-region $input_region \\ - --output-region $output_region \\ - --thread $task.cpus \\ + ${args} \\ + --reference ${reference} \\ + ${map_command} \\ + --input-region ${input_region} \\ + --output-region ${output_region} \\ + --thread ${task.cpus} \\ --output ${prefix} cat <<-END_VERSIONS > versions.yml @@ -50,7 +49,7 @@ process GLIMPSE2_SPLITREFERENCE { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}_${output_region.replace(":","_")}" + def prefix = task.ext.prefix ?: "${meta.id}_${output_region.replace(":", "_")}" """ touch ${prefix}.bin diff --git a/modules/nf-core/glimpse2/splitreference/tests/nextflow.config b/modules/nf-core/glimpse2/splitreference/tests/nextflow.config index 5dc286695cc9..5f347b20d3a4 100644 --- a/modules/nf-core/glimpse2/splitreference/tests/nextflow.config +++ b/modules/nf-core/glimpse2/splitreference/tests/nextflow.config @@ -1,8 +1,8 @@ process { withName: GLIMPSE2_SPLITREFERENCE { - ext.args = [ + ext.args = [ "--sparse-maf 0.01", - "--keep-monomorphic-ref-sites" + "--keep-monomorphic-ref-sites", ].join(' ') ext.prefix = { "${meta.id}" } } diff --git a/modules/nf-core/minimac4/compressref/main.nf b/modules/nf-core/minimac4/compressref/main.nf index 8a69ab4d40e4..cb1483b4d32e 100644 --- a/modules/nf-core/minimac4/compressref/main.nf +++ b/modules/nf-core/minimac4/compressref/main.nf @@ -1,11 +1,11 @@ process MINIMAC4_COMPRESSREF { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/minimac4:4.1.6--hcb620b3_1': - 'biocontainers/minimac4:4.1.6--hcb620b3_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/minimac4:4.1.6--hcb620b3_1' + : 'biocontainers/minimac4:4.1.6--hcb620b3_1'}" input: tuple val(meta), path(ref), path(ref_index) // Reference index is autodetected from reference file name @@ -22,9 +22,9 @@ process MINIMAC4_COMPRESSREF { def prefix = task.ext.prefix ?: "${meta.id}" """ minimac4 \\ - --compress-reference $ref\\ - $args \\ - --threads $task.cpus \\ + --compress-reference ${ref}\\ + ${args} \\ + --threads ${task.cpus} \\ -o ${prefix}.msav cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/minimac4/impute/main.nf b/modules/nf-core/minimac4/impute/main.nf index c26454cc4dab..8b2af40f2adb 100644 --- a/modules/nf-core/minimac4/impute/main.nf +++ b/modules/nf-core/minimac4/impute/main.nf @@ -1,11 +1,11 @@ process MINIMAC4_IMPUTE { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/minimac4:4.1.6--hcb620b3_1': - 'biocontainers/minimac4:4.1.6--hcb620b3_1' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/minimac4:4.1.6--hcb620b3_1' + : 'biocontainers/minimac4:4.1.6--hcb620b3_1'}" input: tuple val(meta), path(target_vcf), path(target_index), path(ref_msav), path(sites_vcf), path(sites_index), path(map), val(region) @@ -32,13 +32,13 @@ process MINIMAC4_IMPUTE { def region_cmd = region ? "--region $region" : "" """ minimac4 \\ - $ref_msav \\ - $target_vcf \\ - $args \\ - $sites_cmd \\ - $map_cmd \\ - $region_cmd \\ - --threads $task.cpus \\ + ${ref_msav} \\ + ${target_vcf} \\ + ${args} \\ + ${sites_cmd} \\ + ${map_cmd} \\ + ${region_cmd} \\ + --threads ${task.cpus} \\ -o ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/minimac4/impute/tests/nextflow.config b/modules/nf-core/minimac4/impute/tests/nextflow.config index 79d5afd87e05..ec1172342b26 100644 --- a/modules/nf-core/minimac4/impute/tests/nextflow.config +++ b/modules/nf-core/minimac4/impute/tests/nextflow.config @@ -1,5 +1,5 @@ process { - withName: 'MINIMAC4_IMPUTE' { - ext.args = {"${params.minimac4_args}"} + withName: MINIMAC4_IMPUTE { + ext.args = { "${params.minimac4_args}" } } } diff --git a/modules/nf-core/quilt/quilt/main.nf b/modules/nf-core/quilt/quilt/main.nf index 3003ce3c12d6..2054f824fe16 100644 --- a/modules/nf-core/quilt/quilt/main.nf +++ b/modules/nf-core/quilt/quilt/main.nf @@ -1,70 +1,75 @@ process QUILT_QUILT { - tag "$meta.id" + tag "${meta.id}" label 'process_single' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/r-quilt:1.0.5--r43h06b5641_0': - 'biocontainers/r-quilt:1.0.5--r43h06b5641_0' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/r-quilt:1.0.5--r43h06b5641_0' + : 'biocontainers/r-quilt:1.0.5--r43h06b5641_0'}" input: tuple val(meta), path(bams), path(bais), path(bamlist), path(samplename), path(reference_haplotype_file), path(reference_legend_file), path(posfile), path(phasefile), path(genfile), val(chr), val(regions_start), val(regions_end), val(ngen), val(buffer), path(genetic_map) tuple val(meta2), path(fasta), path(fasta_fai) output: - tuple val(meta), path("*.vcf.gz"), emit: vcf - tuple val(meta), path("*.vcf.gz.tbi"), emit: tbi, optional:true - tuple val(meta), path("RData", type: "dir"), emit: rdata, optional:true - tuple val(meta), path("plots", type: "dir"), emit: plots, optional:true - path "versions.yml", emit: versions + tuple val(meta), path("*.vcf.gz") , emit: vcf + tuple val(meta), path("*.vcf.gz.tbi") , emit: tbi , optional: true + tuple val(meta), path("RData", type: "dir"), emit: rdata, optional: true + tuple val(meta), path("plots", type: "dir"), emit: plots, optional: true + path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def suffix = task.ext.suffix ?: "vcf.gz" - def extensions = bams.collect { path -> path.extension } - def extension = extensions.flatten().unique() - def list_command = extension == ["bam"] ? "--bamlist=" : - extension == ["cram"] ? "--reference=${fasta} --cramlist=" : "" - def genetic_map_command = genetic_map ? "--genetic_map_file=${genetic_map}" : "" - def posfile_command = posfile ? "--posfile=${posfile}" : "" - def phasefile_command = phasefile ? "--phasefile=${phasefile}" : "" - def samplename_command = samplename ? "--sampleNames_file=${samplename}" : "" - def start_command = regions_start ? "--regionStart=$regions_start" : "" - def end_command = regions_end ? "--regionEnd=$regions_end" : "" - def buffer_command = buffer ? "--buffer=$buffer" : "" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.suffix ?: "vcf.gz" - if (!(args ==~ /.*--seed.*/)) {args += " --seed=1"} + def extensions = bams.collect { path -> path.extension } + def extension = extensions.flatten().unique() + def list_command = extension == ["bam"] + ? "--bamlist=" + : extension == ["cram"] ? "--reference=${fasta} --cramlist=" : "" + + def genetic_map_command = genetic_map ? "--genetic_map_file=${genetic_map}" : "" + def posfile_command = posfile ? "--posfile=${posfile}" : "" + def phasefile_command = phasefile ? "--phasefile=${phasefile}" : "" + def samplename_command = samplename ? "--sampleNames_file=${samplename}" : "" + def start_command = regions_start ? "--regionStart=${regions_start}" : "" + def end_command = regions_end ? "--regionEnd=${regions_end}" : "" + def buffer_command = buffer ? "--buffer=${buffer}" : "" + + if (!(args ==~ /.*--seed.*/)) { + args += " --seed=1" + } """ - if [ -n "$bamlist" ] ; + if [ -n "${bamlist}" ] ; then - BAM_LIST="$bamlist" + BAM_LIST="${bamlist}" else - printf "%s\\n" $bams | tr -d '[],' > all_files.txt + printf "%s\\n" ${bams} | tr -d '[],' > all_files.txt BAM_LIST="all_files.txt" fi QUILT.R \\ ${list_command}\$BAM_LIST \\ - $genetic_map_command \\ - $posfile_command \\ - $phasefile_command \\ - $samplename_command \\ - --chr=$chr \\ - $start_command \\ - $end_command \\ - $buffer_command \\ - --nGen=$ngen \\ - --nCores=$task.cpus \\ + ${genetic_map_command} \\ + ${posfile_command} \\ + ${phasefile_command} \\ + ${samplename_command} \\ + --chr=${chr} \\ + ${start_command} \\ + ${end_command} \\ + ${buffer_command} \\ + --nGen=${ngen} \\ + --nCores=${task.cpus} \\ --outputdir="." \\ - --reference_haplotype_file=$reference_haplotype_file \\ - --reference_legend_file=$reference_legend_file \\ + --reference_haplotype_file=${reference_haplotype_file} \\ + --reference_legend_file=${reference_legend_file} \\ --output_filename=${prefix}.${suffix} \\ - $args + ${args} cat <<-END_VERSIONS > versions.yml diff --git a/modules/nf-core/quilt/quilt/tests/nextflow.config b/modules/nf-core/quilt/quilt/tests/nextflow.config index 55300fd5d60a..bee66cb5174c 100644 --- a/modules/nf-core/quilt/quilt/tests/nextflow.config +++ b/modules/nf-core/quilt/quilt/tests/nextflow.config @@ -4,13 +4,13 @@ process { cpus: 1 ] withName: QUILT_QUILT { - ext.args = {"${params.quilt_args}"} + ext.args = { "${params.quilt_args}" } } withName: BCFTOOLS_QUERY { - ext.args = {"${params.bcftools_query_args}"} - ext.suffix = {"${params.bcftools_query_suffix}"} + ext.args = { "${params.bcftools_query_args}" } + ext.suffix = { "${params.bcftools_query_suffix}" } } withName: GAWK_NAME { - ext.suffix = {"${params.gawk_name_suffix}"} + ext.suffix = { "${params.gawk_name_suffix}" } } } diff --git a/modules/nf-core/shapeit5/ligate/main.nf b/modules/nf-core/shapeit5/ligate/main.nf index 66c13225f207..9522d8bf1c9a 100644 --- a/modules/nf-core/shapeit5/ligate/main.nf +++ b/modules/nf-core/shapeit5/ligate/main.nf @@ -1,11 +1,11 @@ process SHAPEIT5_LIGATE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0': - 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0' + : 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" input: tuple val(meta), path(input_list), path(input_list_index) @@ -22,12 +22,12 @@ process SHAPEIT5_LIGATE { def prefix = task.ext.prefix ?: "${meta.id}" def suffix = task.ext.suffix ?: "vcf.gz" """ - printf "%s\\n" $input_list | tr -d '[],' | sort -V > all_files.txt + printf "%s\\n" ${input_list} | tr -d '[],' | sort -V > all_files.txt SHAPEIT5_ligate \\ - $args \\ + ${args} \\ --input all_files.txt \\ - --thread $task.cpus \\ + --thread ${task.cpus} \\ --output ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml @@ -37,8 +37,9 @@ process SHAPEIT5_LIGATE { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" - def suffix = task.ext.suffix ?: "vcf.gz" + def prefix = task.ext.prefix ?: "${meta.id}" + def suffix = task.ext.suffix ?: "vcf.gz" + def create_cmd = suffix.endsWith(".gz") ? "echo '' | gzip >" : "touch" """ ${create_cmd} ${prefix}.${suffix} diff --git a/modules/nf-core/shapeit5/ligate/tests/nextflow.config b/modules/nf-core/shapeit5/ligate/tests/nextflow.config index c72ccf4ef3a0..3e65f4848b50 100644 --- a/modules/nf-core/shapeit5/ligate/tests/nextflow.config +++ b/modules/nf-core/shapeit5/ligate/tests/nextflow.config @@ -1,5 +1,5 @@ process { - withName: "BCFTOOLS_VIEW" { + withName: BCFTOOLS_VIEW { ext.args = { "--regions ${meta.region} -Ob --write-index=csi -e 'GT=\"./.\"||GT=\".\"'" } ext.prefix = { "${meta.id}_${meta.region}" } } diff --git a/modules/nf-core/shapeit5/phasecommon/main.nf b/modules/nf-core/shapeit5/phasecommon/main.nf index df22b868617f..e21117750d4b 100644 --- a/modules/nf-core/shapeit5/phasecommon/main.nf +++ b/modules/nf-core/shapeit5/phasecommon/main.nf @@ -1,24 +1,24 @@ process SHAPEIT5_PHASECOMMON { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0': - 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0' + : 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" input: - tuple val(meta), path(input), path(input_index), path(pedigree), val(region), path(reference), path(reference_index), path(scaffold), path(scaffold_index), path(map) + tuple val(meta), path(input), path(input_index), path(pedigree), val(region), path(reference), path(reference_index), path(scaffold), path(scaffold_index), path(map) output: - tuple val(meta), path("*.{bcf,graph,bh}"), emit: phased_variant - path "versions.yml" , emit: versions + tuple val(meta), path("*.{bcf,graph,bh}"), emit: phased_variant + path "versions.yml" , emit: versions when: - task.ext.when == null || task.ext.when + task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def extension = args.contains("--output-format bcf") ? "bcf" : @@ -26,23 +26,25 @@ process SHAPEIT5_PHASECOMMON { args.contains("--output-format bh") ? "bh" : "bcf" - if ("$input" == "${prefix}.${extension}") error "Input and output names are the same, set prefix in module configuration to disambiguate!" + if ("${input}" == "${prefix}.${extension}") { + error("Input and output names are the same, set prefix in module configuration to disambiguate!") + } - def map_command = map ? "--map $map" : "" - def reference_command = reference ? "--reference $reference" : "" - def scaffold_command = scaffold ? "--scaffold $scaffold" : "" - def pedigree_command = pedigree ? "--pedigree $pedigree" : "" + def map_command = map ? "--map ${map}" : "" + def reference_command = reference ? "--reference ${reference}" : "" + def scaffold_command = scaffold ? "--scaffold ${scaffold}" : "" + def pedigree_command = pedigree ? "--pedigree ${pedigree}" : "" """ SHAPEIT5_phase_common \\ - $args \\ - --input $input \\ - $map_command \\ - $reference_command \\ - $scaffold_command \\ - $pedigree_command \\ - --region $region \\ - --thread $task.cpus \\ + ${args} \\ + --input ${input} \\ + ${map_command} \\ + ${reference_command} \\ + ${scaffold_command} \\ + ${pedigree_command} \\ + --region ${region} \\ + --thread ${task.cpus} \\ --output ${prefix}.${extension} cat <<-END_VERSIONS > versions.yml @@ -52,8 +54,9 @@ process SHAPEIT5_PHASECOMMON { """ stub: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + def extension = args.contains("--output-format bcf") ? "bcf" : args.contains("--output-format graph") ? "graph" : args.contains("--output-format bh") ? "bh" : diff --git a/modules/nf-core/shapeit5/phasecommon/tests/nextflow.config b/modules/nf-core/shapeit5/phasecommon/tests/nextflow.config index 28775613ce50..6d3b72fcc140 100644 --- a/modules/nf-core/shapeit5/phasecommon/tests/nextflow.config +++ b/modules/nf-core/shapeit5/phasecommon/tests/nextflow.config @@ -1,6 +1,6 @@ process { withName: SHAPEIT5_PHASECOMMON { - cpus = 1 // needed for deterministic output + cpus = 1 // needed for deterministic output ext.args = params.shapeit5_phasecommon_args } } diff --git a/modules/nf-core/shapeit5/phaserare/main.nf b/modules/nf-core/shapeit5/phaserare/main.nf index 313d5be475b7..01a5238e4462 100644 --- a/modules/nf-core/shapeit5/phaserare/main.nf +++ b/modules/nf-core/shapeit5/phaserare/main.nf @@ -1,8 +1,8 @@ process SHAPEIT5_PHASERARE { - tag "$meta.id" + tag "${meta.id}" label 'process_low' - beforeScript """ + beforeScript """ if cat /proc/cpuinfo | grep avx2 -q then echo "Feature AVX2 present on host" @@ -13,12 +13,12 @@ process SHAPEIT5_PHASERARE { """ conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0': - 'biocontainers/shapeit5:5.1.1--hb60d31d_0' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0' + : 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" input: - tuple val(meta), path(input), path(input_index), path(pedigree), val(input_region), path(scaffold), path(scaffold_index), val(scaffold_region), path(map) + tuple val(meta), path(input), path(input_index), path(pedigree), val(input_region), path(scaffold), path(scaffold_index), val(scaffold_region), path(map) output: tuple val(meta), path("*.{vcf,bcf,vcf.gz,bcf.gz}"), emit: phased_variant @@ -28,26 +28,30 @@ process SHAPEIT5_PHASERARE { task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' + def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" def suffix = task.ext.suffix ?: "vcf.gz" - if ("$input" == "${prefix}.${suffix}") error "Input and output names are the same, set prefix in module configuration to disambiguate!" - if ("$scaffold" == "${prefix}.${suffix}") error "Scaffold and output names are the same, set prefix in module configuration to disambiguate!" + if ("${input}" == "${prefix}.${suffix}") { + error("Input and output names are the same, set prefix in module configuration to disambiguate!") + } + if ("${scaffold}" == "${prefix}.${suffix}") { + error("Scaffold and output names are the same, set prefix in module configuration to disambiguate!") + } - def map_command = map ? "--map $map" : "" - def pedigree_command = pedigree ? "--pedigree $pedigree" : "" + def map_command = map ? "--map ${map}" : "" + def pedigree_command = pedigree ? "--pedigree ${pedigree}" : "" """ SHAPEIT5_phase_rare \\ - $args \\ - --input $input \\ - --scaffold $scaffold \\ - $map_command \\ - $pedigree_command \\ - --input-region $input_region \\ - --scaffold-region $scaffold_region \\ - --thread $task.cpus \\ + ${args} \\ + --input ${input} \\ + --scaffold ${scaffold} \\ + ${map_command} \\ + ${pedigree_command} \\ + --input-region ${input_region} \\ + --scaffold-region ${scaffold_region} \\ + --thread ${task.cpus} \\ --output ${prefix}.${suffix} cat <<-END_VERSIONS > versions.yml @@ -59,6 +63,7 @@ process SHAPEIT5_PHASERARE { stub: def prefix = task.ext.prefix ?: "${meta.id}" def suffix = task.ext.suffix ?: "vcf.gz" + def create_cmd = suffix.endsWith(".gz") ? "echo '' | gzip >" : "touch" """ ${create_cmd} ${prefix}.${suffix} diff --git a/modules/nf-core/shapeit5/phaserare/tests/nextflow.config b/modules/nf-core/shapeit5/phaserare/tests/nextflow.config index 9e5e8dbe4115..cf1799b552a2 100644 --- a/modules/nf-core/shapeit5/phaserare/tests/nextflow.config +++ b/modules/nf-core/shapeit5/phaserare/tests/nextflow.config @@ -1,11 +1,11 @@ process { withName: SHAPEIT5_PHASECOMMON { - cpus = 1 // Needed for deterministic output + cpus = 1 // needed for deterministic output ext.args = params.shapeit5_phasecommon_args } withName: SHAPEIT5_PHASERARE { - cpus = 1 // Needed for deterministic output + cpus = 1 // needed for deterministic output ext.args = params.shapeit5_phaserare_args } } diff --git a/modules/nf-core/shapeit5/switch/main.nf b/modules/nf-core/shapeit5/switch/main.nf index 2c26271a9e7a..20dc271551c5 100644 --- a/modules/nf-core/shapeit5/switch/main.nf +++ b/modules/nf-core/shapeit5/switch/main.nf @@ -1,37 +1,38 @@ process SHAPEIT5_SWITCH { - tag "$meta.id" + tag "${meta.id}" label 'process_low' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0': - 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/shapeit5:5.1.1--hb60d31d_0' + : 'biocontainers/shapeit5:5.1.1--hb60d31d_0'}" input: - tuple val(meta), path(estimate), path(estimate_index), val(region), path(pedigree), path(truth), path(truth_index), path(freq) , path(freq_index) + tuple val(meta), path(estimate), path(estimate_index), val(region), path(pedigree), path(truth), path(truth_index), path(freq), path(freq_index) output: tuple val(meta), path("*.txt.gz"), emit: errors path "versions.yml" , emit: versions when: - task.ext.when == null || task.ext.when + task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def prefix = task.ext.prefix ?: "${meta.id}" - def freq_cmd = freq ? "--frequency ${freq}" : "" - def pedigree_cmd = pedigree ? "--pedigree ${pedigree}": "" + def args = task.ext.args ?: '' + def prefix = task.ext.prefix ?: "${meta.id}" + + def freq_cmd = freq ? "--frequency ${freq}" : "" + def pedigree_cmd = pedigree ? "--pedigree ${pedigree}" : "" """ SHAPEIT5_switch \\ - $args \\ - --estimation $estimate \\ - --region $region \\ - --validation $truth \\ - $freq_cmd \\ - $pedigree_cmd \\ - --thread $task.cpus \\ + ${args} \\ + --estimation ${estimate} \\ + --region ${region} \\ + --validation ${truth} \\ + ${freq_cmd} \\ + ${pedigree_cmd} \\ + --thread ${task.cpus} \\ --output ${prefix} cat <<-END_VERSIONS > versions.yml @@ -41,8 +42,9 @@ process SHAPEIT5_SWITCH { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" - def create_cmd = "echo '' | gzip >" + def prefix = task.ext.prefix ?: "${meta.id}" + + def create_cmd = "echo '' | gzip >" """ ${create_cmd} ${prefix}.block.switch.txt.gz ${create_cmd} ${prefix}.calibration.switch.txt.gz diff --git a/modules/nf-core/shapeit5/switch/tests/nextflow.config b/modules/nf-core/shapeit5/switch/tests/nextflow.config index 28775613ce50..6d3b72fcc140 100644 --- a/modules/nf-core/shapeit5/switch/tests/nextflow.config +++ b/modules/nf-core/shapeit5/switch/tests/nextflow.config @@ -1,6 +1,6 @@ process { withName: SHAPEIT5_PHASECOMMON { - cpus = 1 // needed for deterministic output + cpus = 1 // needed for deterministic output ext.args = params.shapeit5_phasecommon_args } } diff --git a/modules/nf-core/stitch/main.nf b/modules/nf-core/stitch/main.nf index d76f10ecd836..4a213fa1c1a2 100644 --- a/modules/nf-core/stitch/main.nf +++ b/modules/nf-core/stitch/main.nf @@ -1,16 +1,16 @@ process STITCH { - tag "$meta.id" + tag "${meta.id}" label 'process_medium' conda "${moduleDir}/environment.yml" - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/r-stitch:1.7.3--r44h64f727c_0': - 'biocontainers/r-stitch:1.7.3--r44h64f727c_0' }" + container "${workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container + ? 'https://depot.galaxyproject.org/singularity/r-stitch:1.7.3--r44h64f727c_0' + : 'biocontainers/r-stitch:1.7.3--r44h64f727c_0'}" input: tuple val(meta), path(collected_crams), path(collected_crais), path(cramlist), path(samplename), path(posfile), path(input, stageAs: "input"), path(genetic_map), path(rdata, stageAs: "RData_in"), val(chromosome_name), val(start), val(end), val(K), val(nGen) tuple val(meta2), path(fasta), path(fasta_fai) - val(seed) + val seed output: tuple val(meta), path("input", type: "dir") , emit: input @@ -24,19 +24,19 @@ process STITCH { task.ext.when == null || task.ext.when script: - def prefix = task.ext.prefix ?: "${meta.id}" - def args = task.ext.args ?: "" - def args2 = task.ext.args2 ?: "" + def prefix = task.ext.prefix ?: "${meta.id}" + def args = task.ext.args ?: "" + def args2 = task.ext.args2 ?: "" - generate_input_only = args2.contains( "--generateInputOnly TRUE" ) - bgen_output = args2.contains( "--output_format bgen" ) - def suffix = bgen_output ? "bgen" : "vcf.gz" + generate_input_only = args2.contains("--generateInputOnly TRUE") + bgen_output = args2.contains("--output_format bgen") + def suffix = bgen_output ? "bgen" : "vcf.gz" def crams_list = collected_crams instanceof Collection ? collected_crams : [collected_crams] - def reads_ext = crams_list ? crams_list.collect {path -> path.extension }.unique() : [] + def reads_ext = crams_list ? crams_list.collect { path -> path.extension }.unique() : [] - if ( reads_ext.size() > 1 ) { - error "STITCH process: Mixed input read file types detected: ${reads_ext}. Please provide either all BAM or all CRAM files." + if (reads_ext.size() > 1) { + error("STITCH process: Mixed input read file types detected: ${reads_ext}. Please provide either all BAM or all CRAM files.") } def cramlist_cmd = cramlist && reads_ext == ["cram"] ? "--cramlist ${cramlist}" : "" def bamlist_cmd = cramlist && reads_ext == ["bam" ] ? "--bamlist ${cramlist}" : "" @@ -79,18 +79,20 @@ process STITCH { """ stub: - def prefix = task.ext.prefix ?: "${meta.id}" - def _args = task.ext.args ?: "" - def args2 = task.ext.args2 ?: "" - def nb_samples = collected_crams.size() - generate_input_only = args2.contains( "--generateInputOnly TRUE" ) - bgen_output = args2.contains( "--output_format bgen" ) - def generate_plots_cmd = !generate_input_only - def generate_file_cmd = !generate_input_only ? bgen_output ? "touch ${prefix}.bgen" : "echo '' | gzip > ${prefix}.vcf.gz" : "" - def rsync_version_cmd = rdata ? "rsync: \$(rsync --version | head -n1 | sed 's/^rsync version //; s/ .*\$//')" : "" + def prefix = task.ext.prefix ?: "${meta.id}" + def _args = task.ext.args ?: "" + def args2 = task.ext.args2 ?: "" + + def nb_samples = collected_crams.size() + generate_input_only = args2.contains("--generateInputOnly TRUE") + bgen_output = args2.contains("--output_format bgen") + + def generate_plots_cmd = !generate_input_only + def generate_file_cmd = !generate_input_only ? bgen_output ? "touch ${prefix}.bgen" : "echo '' | gzip > ${prefix}.vcf.gz" : "" + def rsync_version_cmd = rdata ? "rsync: \$(rsync --version | head -n1 | sed 's/^rsync version //; s/ .*\$//')" : "" """ mkdir -p input - for i in {1..$nb_samples} + for i in {1..${nb_samples}} do touch "input/sample.\$i.input.${chromosome_name}.RData" done diff --git a/modules/nf-core/stitch/tests/main.nf.test b/modules/nf-core/stitch/tests/main.nf.test index 24df439f24fd..0581221502a3 100644 --- a/modules/nf-core/stitch/tests/main.nf.test +++ b/modules/nf-core/stitch/tests/main.nf.test @@ -90,8 +90,8 @@ nextflow_process { meta, file(vcf).name, path(vcf).vcf.header.getGenotypeSamples().sort(), - path(vcf).vcf.summary, - path(vcf).vcf.variantsMD5 + path(vcf).vcf.summary + // path(vcf).vcf.variantsMD5 // Not reproducible without seed ]}, process.out.versions ).match() } diff --git a/modules/nf-core/stitch/tests/main.nf.test.snap b/modules/nf-core/stitch/tests/main.nf.test.snap index f6039ee0dd09..65fd19531aad 100644 --- a/modules/nf-core/stitch/tests/main.nf.test.snap +++ b/modules/nf-core/stitch/tests/main.nf.test.snap @@ -91,8 +91,7 @@ "normal", "tumour" ], - "VcfFile [chromosomes=[chr21], sampleCount=2, variantCount=10, phased=false, phasedAutodetect=false]", - "e41c51d08be2cdacd81fc8800cffb156" + "VcfFile [chromosomes=[chr21], sampleCount=2, variantCount=10, phased=false, phasedAutodetect=false]" ] ], [ diff --git a/modules/nf-core/stitch/tests/nextflow.config b/modules/nf-core/stitch/tests/nextflow.config index 4c593d71f968..c87ae2a0cf15 100644 --- a/modules/nf-core/stitch/tests/nextflow.config +++ b/modules/nf-core/stitch/tests/nextflow.config @@ -1,8 +1,8 @@ process { withName: STITCH { - ext.args2 = {"${params.stitch_args2}"} ?: "" + ext.args2 = { "${params.stitch_args2}" } ?: "" } withName: STITCH_GENERATE_INPUTS { - ext.args2 = {"${params.stitch_args2}"} ?: "" + ext.args2 = { "${params.stitch_args2}" } ?: "" } } diff --git a/subworkflows/nf-core/bam_impute_quilt/main.nf b/subworkflows/nf-core/bam_impute_quilt/main.nf index ffae2fe7fcc7..6a1e35971f5d 100644 --- a/subworkflows/nf-core/bam_impute_quilt/main.nf +++ b/subworkflows/nf-core/bam_impute_quilt/main.nf @@ -3,20 +3,19 @@ include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate' include { BCFTOOLS_INDEX } from '../../../modules/nf-core/bcftools/index' workflow BAM_IMPUTE_QUILT { - take: - ch_input // channel (mandatory): [ [id], [bam], [bai], bampaths, bamnames ] - ch_hap_legend // channel (mandatory): [ [panel, chr], hap, legend ] - ch_posfile // channel (mandatory): [ [panel, chr], posfile ] - ch_chunks // channel (optional) : [ [panel, chr], chr, start, end ] - ch_map // channel (optional) : [ [panel, chr], map ] - ch_fasta // channel (optional) : [ [genome], fa, fai ] - n_gen // integer: Number of generations since founding or mixing - buffer // integer: Buffer of region to perform imputation over + ch_input // channel (mandatory): [ [id], [bam], [bai], bampaths, bamnames ] + ch_hap_legend // channel (mandatory): [ [panel, chr], hap, legend ] + ch_posfile // channel (mandatory): [ [panel, chr], posfile ] + ch_chunks // channel (optional) : [ [panel, chr], chr, start, end ] + ch_map // channel (optional) : [ [panel, chr], map ] + ch_fasta // channel (optional) : [ [genome], fa, fai ] + n_gen // integer: Number of generations since founding or mixing + buffer // integer: Buffer of region to perform imputation over main: - ch_versions = channel.empty() + ch_versions = channel.empty() // Make final channel with parameters ch_parameters = ch_hap_legend @@ -24,14 +23,13 @@ workflow BAM_IMPUTE_QUILT { .combine(ch_map, by: 0) .combine(ch_chunks, by: 0) - ch_parameters.ifEmpty{ - error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input." + ch_parameters.ifEmpty { + error("ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input.") } ch_bam_params = ch_input .combine(ch_parameters) - .map{ - metaI, bam, bai, bampath, bamname, metaPC, hap, legend, posfile, gmap, chr, start, end -> + .map { metaI, bam, bai, bampath, bamname, metaPC, hap, legend, posfile, gmap, chr, start, end -> def regionout = "${chr}" if (start != [] && end != []) { regionout = "${chr}:${start}-${end}" @@ -45,33 +43,32 @@ workflow BAM_IMPUTE_QUILT { ] } - QUILT_QUILT( ch_bam_params, ch_fasta ) - ch_versions = ch_versions.mix( QUILT_QUILT.out.versions.first() ) + QUILT_QUILT(ch_bam_params, ch_fasta) + ch_versions = ch_versions.mix(QUILT_QUILT.out.versions.first()) // Ligate all phased files in one and index it ligate_input = QUILT_QUILT.out.vcf - .join( QUILT_QUILT.out.tbi ) - .map{ meta, vcf, index -> + .join(QUILT_QUILT.out.tbi) + .map { meta, vcf, index -> def keysToKeep = meta.keySet() - ['regionout'] - [ meta.subMap(keysToKeep), vcf, index ] + [meta.subMap(keysToKeep), vcf, index] } .groupTuple() - GLIMPSE2_LIGATE( ligate_input ) - ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) + GLIMPSE2_LIGATE(ligate_input) + ch_versions = ch_versions.mix(GLIMPSE2_LIGATE.out.versions.first()) - BCFTOOLS_INDEX( GLIMPSE2_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX.out.versions.first() ) + BCFTOOLS_INDEX(GLIMPSE2_LIGATE.out.merged_variants) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX.out.versions.first()) // Join imputed and index files - ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants - .join( - BCFTOOLS_INDEX.out.tbi - .mix(BCFTOOLS_INDEX.out.csi) - ) + ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants.join( + BCFTOOLS_INDEX.out.tbi.mix(BCFTOOLS_INDEX.out.csi), + failOnMismatch: true, + failOnDuplicate: true, + ) emit: - vcf_index = ch_vcf_index // channel: [ [id, chr], vcf, tbi ] - versions = ch_versions // channel: [ versions.yml ] - + vcf_index = ch_vcf_index // channel: [ [id, chr], vcf, tbi ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/bam_impute_quilt/tests/nextflow.config b/subworkflows/nf-core/bam_impute_quilt/tests/nextflow.config index 628ea54b1e8b..7ab7994735f9 100644 --- a/subworkflows/nf-core/bam_impute_quilt/tests/nextflow.config +++ b/subworkflows/nf-core/bam_impute_quilt/tests/nextflow.config @@ -1,9 +1,9 @@ process { withName: QUILT_QUILT { - cpus = 1 // Needed to have deterministic output for testing + cpus = 1 // needed for deterministic output ext.args = { "${params.quilt_args}" } ext.prefix = { "${meta.id}_${meta.chr}_${meta.regionout}.quilt" } - tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } + tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } } withName: GLIMPSE2_LIGATE { @@ -13,7 +13,7 @@ process { withName: BCFTOOLS_INDEX { ext.args = '--csi' - tag = { "${meta.id} ${meta.chr}" } + tag = { "${meta.id} ${meta.chr}" } publishDir = [enabled: false] } } diff --git a/subworkflows/nf-core/bam_impute_stitch/main.nf b/subworkflows/nf-core/bam_impute_stitch/main.nf index 2dc7843991c4..bcae1b9840d9 100644 --- a/subworkflows/nf-core/bam_impute_stitch/main.nf +++ b/subworkflows/nf-core/bam_impute_stitch/main.nf @@ -1,39 +1,37 @@ -include { STITCH } from '../../../modules/nf-core/stitch/main' -include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index/main' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index/main' +include { STITCH } from '../../../modules/nf-core/stitch/main' +include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_PHASE } from '../../../modules/nf-core/bcftools/index/main' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index/main' workflow BAM_IMPUTE_STITCH { - take: - ch_input // channel (mandatory): [ [id], [bam], [bai], bampaths, bamnames ] - ch_posfile // channel (mandatory): [ [panel, chr], posfile ] - ch_chunks // channel (optional) : [ [panel, chr], chr, start, end ] - ch_map // channel (optional) : [ [panel, chr], map ] - ch_fasta // channel (optional) : [ [genome], fa, fai ] - k_val // integer: k value for STITCH - n_gen // integer: number of generations for STITCH - seed // value : seed for random number generator + ch_input // channel (mandatory): [ [id], [bam], [bai], bampaths, bamnames ] + ch_posfile // channel (mandatory): [ [panel, chr], posfile ] + ch_chunks // channel (optional) : [ [panel, chr], chr, start, end ] + ch_map // channel (optional) : [ [panel, chr], map ] + ch_fasta // channel (optional) : [ [genome], fa, fai ] + k_val // integer: k value for STITCH + n_gen // integer: number of generations for STITCH + seed // value : seed for random number generator main: - ch_versions = channel.empty() + ch_versions = channel.empty() // Make final channel with parameters ch_parameters = ch_posfile .combine(ch_map, by: 0) .combine(ch_chunks, by: 0) - ch_parameters.ifEmpty{ - error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input." + ch_parameters.ifEmpty { + error("ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input.") } ch_bam_params = ch_input .combine(ch_parameters) - .map{ - metaI, bam, bai, bampath, bamname, metaPC, posfile, gmap, chr, start, end -> + .map { metaI, bam, bai, bampath, bamname, metaPC, posfile, gmap, chr, start, end -> if (!chr) { - error "ERROR: chromosome is not provided in ch_chunks." + error("ERROR: chromosome is not provided in ch_chunks.") } def regionout = "${chr}" if (start != [] && end != []) { @@ -41,43 +39,48 @@ workflow BAM_IMPUTE_STITCH { } [ metaPC + metaI + ["regionout": regionout], - bam, bai, bampath, bamname, posfile, [], gmap, [], chr, start, end, k_val, n_gen + bam, bai, bampath, bamname, + posfile, [], + gmap, [], + chr, start, end, + k_val, n_gen ] } - STITCH( ch_bam_params, ch_fasta, seed ) + STITCH(ch_bam_params, ch_fasta, seed) ch_versions = ch_versions.mix(STITCH.out.versions.first()) // Index imputed annotated VCF - BCFTOOLS_INDEX_1(STITCH.out.vcf) - ch_versions = ch_versions.mix(BCFTOOLS_INDEX_1.out.versions.first()) + BCFTOOLS_INDEX_PHASE(STITCH.out.vcf) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_PHASE.out.versions.first()) // Ligate all phased files in one and index it ligate_input = STITCH.out.vcf - .join( BCFTOOLS_INDEX_1.out.tbi - .mix(BCFTOOLS_INDEX_1.out.csi) + .join( + BCFTOOLS_INDEX_PHASE.out.tbi.mix(BCFTOOLS_INDEX_PHASE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, ) - .map{ meta, vcf, index -> + .map { meta, vcf, index -> def keysToKeep = meta.keySet() - ['regionout'] - [ meta.subMap(keysToKeep), vcf, index ] + [meta.subMap(keysToKeep), vcf, index] } .groupTuple() - GLIMPSE2_LIGATE( ligate_input ) - ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) + GLIMPSE2_LIGATE(ligate_input) + ch_versions = ch_versions.mix(GLIMPSE2_LIGATE.out.versions.first()) - BCFTOOLS_INDEX_2( GLIMPSE2_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_2.out.versions.first() ) + BCFTOOLS_INDEX_LIGATE(GLIMPSE2_LIGATE.out.merged_variants) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_LIGATE.out.versions.first()) // Join imputed and index files - ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants - .join( - BCFTOOLS_INDEX_2.out.tbi - .mix(BCFTOOLS_INDEX_2.out.csi) - ) + ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants.join( + BCFTOOLS_INDEX_LIGATE.out.tbi.mix(BCFTOOLS_INDEX_LIGATE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, + ) emit: - vcf_index = ch_vcf_index // channel: [ [id, chr], vcf, tbi ] - versions = ch_versions // channel: [ versions.yml ] - + vcf_index = ch_vcf_index // channel: [ [id, chr], vcf, tbi ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/bam_impute_stitch/tests/main.nf.test.snap b/subworkflows/nf-core/bam_impute_stitch/tests/main.nf.test.snap index 38244832ff5a..0e70d6beac65 100644 --- a/subworkflows/nf-core/bam_impute_stitch/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_impute_stitch/tests/main.nf.test.snap @@ -17,30 +17,30 @@ ] ], [ - "versions.yml:md5,597985efae796d9efe8b1005c4b0bb18", "versions.yml:md5,8b0020b997bad45e9e3cf0d9b868a3b2", + "versions.yml:md5,a4f599fd82e75ff0d0d523a0b0c519ea", "versions.yml:md5,c32cdf9d543fe0fe8f0cfeade5ceade2", - "versions.yml:md5,d9282aba3ae921597b3a7387e17e220d" + "versions.yml:md5,fad02b5beb8bf43963d49e3b1e79f51d" ], [ - { - "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, { "BAM_IMPUTE_STITCH:STITCH": { "r-base": "4.4.2", "r-stitch": "1.7.3" } }, + { + "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_LIGATE": { + "bcftools": 1.22 + } + }, { "BAM_IMPUTE_STITCH:GLIMPSE2_LIGATE": { "glimpse2": "2.0.0" } }, { - "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_1": { + "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_PHASE": { "bcftools": 1.22 } } @@ -50,7 +50,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-27T09:22:32.971453937" + "timestamp": "2025-12-12T17:56:15.184463537" }, "homo_sapiens - empty channels - stub": { "content": [ @@ -74,10 +74,10 @@ ] ], "1": [ - "versions.yml:md5,597985efae796d9efe8b1005c4b0bb18", "versions.yml:md5,8b0020b997bad45e9e3cf0d9b868a3b2", + "versions.yml:md5,a4f599fd82e75ff0d0d523a0b0c519ea", "versions.yml:md5,c32cdf9d543fe0fe8f0cfeade5ceade2", - "versions.yml:md5,d9282aba3ae921597b3a7387e17e220d" + "versions.yml:md5,fad02b5beb8bf43963d49e3b1e79f51d" ], "vcf_index": [ [ @@ -98,31 +98,31 @@ ] ], "versions": [ - "versions.yml:md5,597985efae796d9efe8b1005c4b0bb18", "versions.yml:md5,8b0020b997bad45e9e3cf0d9b868a3b2", + "versions.yml:md5,a4f599fd82e75ff0d0d523a0b0c519ea", "versions.yml:md5,c32cdf9d543fe0fe8f0cfeade5ceade2", - "versions.yml:md5,d9282aba3ae921597b3a7387e17e220d" + "versions.yml:md5,fad02b5beb8bf43963d49e3b1e79f51d" ] }, [ - { - "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, { "BAM_IMPUTE_STITCH:STITCH": { "r-base": "4.4.2", "r-stitch": "1.7.3" } }, + { + "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_LIGATE": { + "bcftools": 1.22 + } + }, { "BAM_IMPUTE_STITCH:GLIMPSE2_LIGATE": { "glimpse2": "2.0.0" } }, { - "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_1": { + "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_PHASE": { "bcftools": 1.22 } } @@ -132,7 +132,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-21T22:32:30.735092649" + "timestamp": "2025-12-12T17:57:16.113125809" }, "Impute with stitch two individual bam, renaming, posfile, chunks, map, no fasta": { "content": [ @@ -167,24 +167,24 @@ ] ], [ - { - "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_2": { - "bcftools": 1.22 - } - }, { "BAM_IMPUTE_STITCH:STITCH": { "r-base": "4.4.2", "r-stitch": "1.7.3" } }, + { + "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_LIGATE": { + "bcftools": 1.22 + } + }, { "BAM_IMPUTE_STITCH:GLIMPSE2_LIGATE": { "glimpse2": "2.0.0" } }, { - "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_1": { + "BAM_IMPUTE_STITCH:BCFTOOLS_INDEX_PHASE": { "bcftools": 1.22 } } @@ -194,6 +194,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-27T10:28:44.112173975" + "timestamp": "2025-12-12T17:56:52.597711102" } } \ No newline at end of file diff --git a/subworkflows/nf-core/bam_impute_stitch/tests/nextflow.config b/subworkflows/nf-core/bam_impute_stitch/tests/nextflow.config index 976f2b6fe9e1..ffd2682816ab 100644 --- a/subworkflows/nf-core/bam_impute_stitch/tests/nextflow.config +++ b/subworkflows/nf-core/bam_impute_stitch/tests/nextflow.config @@ -1,6 +1,6 @@ process { withName: STITCH { - cpus = 1 // Needed to have deterministic output for testing + cpus = 1 // needed for deterministic output ext.prefix = { "${meta.id}_${meta.chr}_${meta.regionout}.stitch" } } @@ -8,11 +8,11 @@ process { ext.prefix = { "${meta.id}_${meta.chr}.ligate" } } - withName: BCFTOOLS_INDEX_1 { - ext.args = '--tbi' + withName: BCFTOOLS_INDEX_PHASE { + ext.args = '--tbi' } - withName: BCFTOOLS_INDEX_2 { - ext.args = '--csi' + withName: BCFTOOLS_INDEX_LIGATE { + ext.args = '--csi' } } diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf b/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf index db11d1f534b3..c6062a1033c3 100644 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/main.nf @@ -1,12 +1,11 @@ -include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk/main' -include { GLIMPSE2_SPLITREFERENCE } from '../../../modules/nf-core/glimpse2/splitreference/main' -include { GLIMPSE2_PHASE } from '../../../modules/nf-core/glimpse2/phase/main' -include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index/main.nf' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index/main.nf' +include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk/main' +include { GLIMPSE2_SPLITREFERENCE } from '../../../modules/nf-core/glimpse2/splitreference/main' +include { GLIMPSE2_PHASE } from '../../../modules/nf-core/glimpse2/phase/main' +include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate/main' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_PHASE } from '../../../modules/nf-core/bcftools/index/main.nf' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index/main.nf' workflow BAM_VCF_IMPUTE_GLIMPSE2 { - take: ch_input // channel (mandatory): [ meta, vcf, csi, list, infos ] ch_ref // channel (mandatory): [ meta, vcf, csi, region ] @@ -21,59 +20,73 @@ workflow BAM_VCF_IMPUTE_GLIMPSE2 { ch_versions = channel.empty() - if ( chunk == true ){ + if (chunk == true) { // Error if pre-defined chunks are provided when chunking is activated ch_chunks .filter { _meta, regionin, regionout -> regionin.size() == 0 && regionout.size() == 0 } .ifEmpty { - error "ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking." + error("ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking.") } // Chunk reference panel - ch_ref_map = ch_ref - .combine(ch_map, by: 0) - GLIMPSE2_CHUNK ( ch_ref_map, chunk_model ) - ch_versions = ch_versions.mix( GLIMPSE2_CHUNK.out.versions.first() ) + ch_ref_map = ch_ref.combine(ch_map, by: 0) + GLIMPSE2_CHUNK(ch_ref_map, chunk_model) + ch_versions = ch_versions.mix(GLIMPSE2_CHUNK.out.versions.first()) ch_chunks = GLIMPSE2_CHUNK.out.chunk_chr - .splitCsv(header: [ - 'ID', 'Chr', 'RegionBuf', 'RegionCnk', 'WindowCm', - 'WindowMb', 'NbTotVariants', 'NbComVariants' - ], sep: "\t", skip: 0) - .map { meta, it -> [meta, it["RegionBuf"], it["RegionCnk"]]} + .splitCsv( + header: [ + 'ID', 'Chr', + 'RegionBuf', 'RegionCnk', + 'WindowCm', 'WindowMb', + 'NbTotVariants', 'NbComVariants', + ], + sep: "\t", + skip: 0, + ) + .map { meta, it -> [meta, it["RegionBuf"], it["RegionCnk"]] } } ch_chunks .filter { _meta, regionin, regionout -> regionin.size() > 0 && regionout.size() > 0 } - .ifEmpty { error "ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true." } + .ifEmpty { error("ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true.") } - if ( splitreference == true ) { + if (splitreference == true) { // Split reference panel in bin files split_input = ch_ref .combine(ch_chunks, by: 0) .combine(ch_map, by: 0) - .map{ meta, ref, index, _region, regionin, regionout, gmap -> [ - meta + ["regionin": regionin, "regionout": regionout], - ref, index, regionin, regionout, gmap - ] } + .map { meta, ref, index, _region, regionin, regionout, gmap -> + [ + meta + ["regionin": regionin, "regionout": regionout], + ref, index, + regionin, regionout, + gmap, + ] + } - GLIMPSE2_SPLITREFERENCE( split_input ) - ch_versions = ch_versions.mix( GLIMPSE2_SPLITREFERENCE.out.versions.first() ) + GLIMPSE2_SPLITREFERENCE(split_input) + ch_versions = ch_versions.mix(GLIMPSE2_SPLITREFERENCE.out.versions.first()) + // Everything is provided by the bin file so no additional file ch_chunks_panel_map = GLIMPSE2_SPLITREFERENCE.out.bin_ref - .map{ meta, bin_ref -> [ meta, [], [], bin_ref, [], [] ] } // Everything is provided by the bin file + .map { meta, bin_ref -> [meta, [], [], bin_ref, [], []] } } else { ch_chunks_panel_map = ch_chunks - .combine(ch_ref, by:0) - .combine(ch_map, by:0) - .map{ meta, regionin, regionout, ref, ref_index, _region, gmap -> [ - meta + ["regionin": regionin, "regionout": regionout], - regionin, regionout, ref, ref_index, gmap - ] } + .combine(ch_ref, by: 0) + .combine(ch_map, by: 0) + .map { meta, regionin, regionout, ref, ref_index, _region, gmap -> + [ + meta + ["regionin": regionin, "regionout": regionout], + regionin, regionout, + ref, ref_index, + gmap, + ] + } } - ch_chunks_panel_map.ifEmpty{ - error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input." + ch_chunks_panel_map.ifEmpty { + error("ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input.") } ch_phase_input = ch_input @@ -87,37 +100,40 @@ workflow BAM_VCF_IMPUTE_GLIMPSE2 { // Impute with Glimpse2 GLIMPSE2_PHASE(ch_phase_input, ch_fasta) - ch_versions = ch_versions.mix( GLIMPSE2_PHASE.out.versions.first() ) + ch_versions = ch_versions.mix(GLIMPSE2_PHASE.out.versions.first()) // Index phased file - BCFTOOLS_INDEX_1(GLIMPSE2_PHASE.out.phased_variants) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_1.out.versions.first() ) + BCFTOOLS_INDEX_PHASE(GLIMPSE2_PHASE.out.phased_variants.view()) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_PHASE.out.versions.first()) // Ligate all phased files in one and index it ligate_input = GLIMPSE2_PHASE.out.phased_variants - .join( BCFTOOLS_INDEX_1.out.csi ) - .map{ meta, vcf, index -> + .join( + BCFTOOLS_INDEX_PHASE.out.tbi.mix(BCFTOOLS_INDEX_PHASE.out.csi).view(), + failOnMismatch: true, + failOnDuplicate: true, + ) + .map { meta, vcf, index -> def keysToKeep = meta.keySet() - ['regionin', 'regionout'] - [ meta.subMap(keysToKeep), vcf, index ] + [meta.subMap(keysToKeep), vcf, index] } .groupTuple() - GLIMPSE2_LIGATE( ligate_input ) - ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) + GLIMPSE2_LIGATE(ligate_input) + ch_versions = ch_versions.mix(GLIMPSE2_LIGATE.out.versions.first()) - BCFTOOLS_INDEX_2( GLIMPSE2_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_2.out.versions.first() ) + BCFTOOLS_INDEX_LIGATE(GLIMPSE2_LIGATE.out.merged_variants) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_LIGATE.out.versions.first()) // Join imputed and index files - ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants - .join( - BCFTOOLS_INDEX_2.out.tbi - .mix(BCFTOOLS_INDEX_2.out.csi) - ) + ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants.join( + BCFTOOLS_INDEX_LIGATE.out.tbi.mix(BCFTOOLS_INDEX_LIGATE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, + ) emit: - ch_chunks = ch_chunks // channel: [ val(meta), regionin, regionout ] - ch_vcf_index = ch_vcf_index // channel: [ val(meta), vcf, csi ] - - versions = ch_versions // channel: [ versions.yml ] + chunks = ch_chunks // channel: [ val(meta), regionin, regionout ] + vcf_index = ch_vcf_index // channel: [ val(meta), vcf, csi ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test index 15ed651546b1..8dfcd024f8aa 100644 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test @@ -55,8 +55,8 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ + workflow.out.chunks, + workflow.out.vcf_index.collect{[ it[0], path(it[1]).getFileName().toString(), path(it[2]).getFileName().toString(), @@ -109,8 +109,8 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ + workflow.out.chunks, + workflow.out.vcf_index.collect{[ it[0], path(it[1]).getFileName().toString(), path(it[2]).getFileName().toString(), @@ -163,8 +163,8 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ + workflow.out.chunks, + workflow.out.vcf_index.collect{[ it[0], path(it[1]).getFileName().toString(), path(it[2]).getFileName().toString(), @@ -214,8 +214,8 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ + workflow.out.chunks, + workflow.out.vcf_index.collect{[ it[0], path(it[1]).getFileName().toString(), path(it[2]).getFileName().toString(), @@ -282,8 +282,8 @@ nextflow_workflow { assertAll( { assert workflow.success }, { assert snapshot( - workflow.out.ch_chunks, - workflow.out.ch_vcf_index.collect{[ + workflow.out.chunks, + workflow.out.vcf_index.collect{[ it[0], path(it[1]).getFileName().toString(), path(it[2]).getFileName().toString(), diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap index d7e3e862c1e0..bea3ca6317ca 100644 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/main.nf.test.snap @@ -36,6 +36,11 @@ ] ], [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 + } + }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { "glimpse2": "2.0.0" @@ -47,7 +52,7 @@ } }, { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -56,11 +61,6 @@ "glimpse2": "2.0.0" } }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { "glimpse2": "2.0.0" @@ -72,7 +72,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-21T12:07:17.825740137" + "timestamp": "2025-12-12T17:46:53.105738111" }, "homo_sapiens - bam no list and no sample, panel vcf region, no chunks, no map, no fasta, chunk sequential + splitreference": { "content": [ @@ -111,6 +111,11 @@ ] ], [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 + } + }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { "glimpse2": "2.0.0" @@ -122,7 +127,7 @@ } }, { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -131,11 +136,6 @@ "glimpse2": "2.0.0" } }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { "glimpse2": "2.0.0" @@ -147,7 +147,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-21T12:08:29.707313034" + "timestamp": "2025-12-12T17:47:45.080376306" }, "homo_sapiens - empty channels, chunk sequential + splitreference - stub": { "content": [ @@ -191,14 +191,14 @@ ] ], "2": [ + "versions.yml:md5,127e1dce80da79a92d0b685e82095c4a", "versions.yml:md5,302281bbff76712870c031340d3819ff", "versions.yml:md5,3500318c881e3f24e9dd2fddc593142a", - "versions.yml:md5,9422ca169a15fd68878396c2837bc185", + "versions.yml:md5,6f1e64d5b987d61d5a718c0fba06e230", "versions.yml:md5,c6ff81aa44fb2fdcc08db6062731d0d9", - "versions.yml:md5,cb51e18b4296c3791ade5f6f2737bd24", "versions.yml:md5,ed6ebcf6ca30c2cdc39ec1dd535a2695" ], - "ch_chunks": [ + "chunks": [ [ { "panel": "ref_panel", @@ -216,7 +216,7 @@ "0" ] ], - "ch_vcf_index": [ + "vcf_index": [ [ { "id": "allid", @@ -237,15 +237,20 @@ ] ], "versions": [ + "versions.yml:md5,127e1dce80da79a92d0b685e82095c4a", "versions.yml:md5,302281bbff76712870c031340d3819ff", "versions.yml:md5,3500318c881e3f24e9dd2fddc593142a", - "versions.yml:md5,9422ca169a15fd68878396c2837bc185", + "versions.yml:md5,6f1e64d5b987d61d5a718c0fba06e230", "versions.yml:md5,c6ff81aa44fb2fdcc08db6062731d0d9", - "versions.yml:md5,cb51e18b4296c3791ade5f6f2737bd24", "versions.yml:md5,ed6ebcf6ca30c2cdc39ec1dd535a2695" ] }, [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 + } + }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_CHUNK": { "glimpse2": "2.0.0" @@ -257,7 +262,7 @@ } }, { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -266,11 +271,6 @@ "glimpse2": "2.0.0" } }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { "glimpse2": "2.0.0" @@ -282,7 +282,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-21T12:10:17.321588787" + "timestamp": "2025-12-12T17:48:24.153179179" }, "homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + no splitreference": { "content": [ @@ -321,13 +321,18 @@ ] ], [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 + } + }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { "glimpse2": "2.0.0" } }, { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -335,11 +340,6 @@ "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_LIGATE": { "glimpse2": "2.0.0" } - }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } } ] ], @@ -347,7 +347,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-21T12:08:13.222110779" + "timestamp": "2025-12-12T17:47:25.417111147" }, "homo_sapiens - vcf no list with sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference": { "content": [ @@ -386,13 +386,18 @@ ] ], [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 + } + }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { "glimpse2": "2.0.0" } }, { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -401,11 +406,6 @@ "glimpse2": "2.0.0" } }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { "glimpse2": "2.0.0" @@ -417,7 +417,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-11-21T12:07:58.812913099" + "timestamp": "2025-12-12T17:47:10.50028164" }, "homo_sapiens - bam list and sample, panel vcf region, chunks, map, no fasta, no chunking + splitreference": { "content": [ @@ -488,13 +488,18 @@ ] ], [ + { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 + } + }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_PHASE": { "glimpse2": "2.0.0" } }, { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_2": { + "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_LIGATE": { "bcftools": 1.22 } }, @@ -503,11 +508,6 @@ "glimpse2": "2.0.0" } }, - { - "BAM_VCF_IMPUTE_GLIMPSE2:BCFTOOLS_INDEX_1": { - "bcftools": 1.22 - } - }, { "BAM_VCF_IMPUTE_GLIMPSE2:GLIMPSE2_SPLITREFERENCE": { "glimpse2": "2.0.0" @@ -519,6 +519,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-08T19:39:08.135355223" + "timestamp": "2025-12-12T17:48:08.11043848" } } \ No newline at end of file diff --git a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config index 9cd201b85a2a..7aea8a877175 100644 --- a/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config +++ b/subworkflows/nf-core/bam_vcf_impute_glimpse2/tests/nextflow.config @@ -1,41 +1,41 @@ process { - withName: "GLIMPSE2_CHUNK" { + withName: GLIMPSE2_CHUNK { ext.prefix = { "${meta.panel}_${meta.chr}" } - tag = { "${meta.panel} ${meta.chr}}" } - ext.args = [ + tag = { "${meta.panel} ${meta.chr}}" } + ext.args = [ "--window-mb 0.01", "--window-cm 0.01", "--window-count 200", "--buffer-mb 0.005", "--buffer-cm 0.005", "--buffer-count 30", - "--seed 1" + "--seed 1", ].join(' ') } - withName: "GLIMPSE2_SPLITREFERENCE" { + withName: GLIMPSE2_SPLITREFERENCE { ext.prefix = { "${meta.panel}_${meta.chr}_${meta.regionout}" } - tag = { "${meta.panel} ${meta.chr} ${meta.regionout}" } - ext.args = "--seed 1" + tag = { "${meta.panel} ${meta.chr} ${meta.regionout}" } + ext.args = "--seed 1" } - withName: "GLIMPSE2_PHASE" { + withName: GLIMPSE2_PHASE { ext.prefix = { "${meta.id}_${meta.chr}_${meta.regionout}" } - tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } - cpus = 1 - ext.args = "--keep-monomorphic-ref-sites --seed 1" + tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } + cpus = 1 // needed for deterministic output + ext.args = "--keep-monomorphic-ref-sites --seed 1" } - withName: "BCFTOOLS_INDEX_1" { + withName: BCFTOOLS_INDEX_PHASE { tag = { "${meta.id} ${meta.chr} ${meta.regionout}" } } - withName: "GLIMPSE2_LIGATE" { + withName: GLIMPSE2_LIGATE { ext.prefix = { "${meta.id}_${meta.chr}" } - tag = { "${meta.id} ${meta.chr}" } + tag = { "${meta.id} ${meta.chr}" } } - withName: "BCFTOOLS_INDEX_2" { + withName: BCFTOOLS_INDEX_LIGATE { tag = { "${meta.id} ${meta.chr}" } } } diff --git a/subworkflows/nf-core/vcf_impute_beagle5/main.nf b/subworkflows/nf-core/vcf_impute_beagle5/main.nf index 3ccb03229b61..2f79dec4afb0 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/main.nf +++ b/subworkflows/nf-core/vcf_impute_beagle5/main.nf @@ -1,11 +1,10 @@ include { BEAGLE5_BEAGLE } from '../../../modules/nf-core/beagle5/beagle' include { BCFTOOLS_VIEW } from '../../../modules/nf-core/bcftools/view' include { GLIMPSE2_LIGATE } from '../../../modules/nf-core/glimpse2/ligate' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_BEAGLE } from '../../../modules/nf-core/bcftools/index' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_PHASE } from '../../../modules/nf-core/bcftools/index' include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index' workflow VCF_IMPUTE_BEAGLE5 { - take: ch_input // channel (mandatory): [ [id], vcf, tbi ] ch_panel // channel (mandatory): [ [panel, chr], vcf, tbi ] @@ -24,8 +23,8 @@ workflow VCF_IMPUTE_BEAGLE5 { } .set { ch_input_branched } - ch_input_branched.other.map{ _meta, vcf, _tbi -> - error "ERROR: ${vcf.name} in ch_input channel must be in VCF or BCF format." + ch_input_branched.other.map { _meta, vcf, _tbi -> + error("ERROR: ${vcf.name} in ch_input channel must be in VCF or BCF format.") } // Convert BCF to VCF if necessary @@ -36,13 +35,13 @@ workflow VCF_IMPUTE_BEAGLE5 { ch_versions = ch_versions.mix(BCFTOOLS_VIEW.out.versions.first()) // Combine VCF files - ch_ready_vcf = ch_input_branched.vcf - .mix(BCFTOOLS_VIEW.out.vcf - .join( - BCFTOOLS_VIEW.out.csi - .mix(BCFTOOLS_VIEW.out.tbi) - ) + ch_ready_vcf = ch_input_branched.vcf.mix( + BCFTOOLS_VIEW.out.vcf.join( + BCFTOOLS_VIEW.out.tbi.mix(BCFTOOLS_VIEW.out.csi), + failOnMismatch: true, + failOnDuplicate: true, ) + ) // Prepare input channels for BEAGLE5 by combining VCF, panel, and map files ch_chunks_counts = ch_chunks @@ -56,61 +55,66 @@ workflow VCF_IMPUTE_BEAGLE5 { .combine(ch_chunks, by: 0) .combine(ch_chunks_counts, by: 0) - ch_panel_map.ifEmpty{ - error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_panel and ch_map channel as input." + ch_panel_map.ifEmpty { + error("ERROR: join operation resulted in an empty channel. Please provide a valid ch_panel and ch_map channel as input.") } ch_beagle_input = ch_ready_vcf .combine(ch_panel_map) - .map { metaI, input_vcf, input_index, metaPC, panel_vcf, panel_index, map, regionout, regionsize -> [ - metaI + metaPC + ["regionout": regionout, "regionsize": regionsize], - input_vcf, input_index, - panel_vcf, panel_index, - map, [], [], regionout - ]} + .map { metaI, input_vcf, input_index, metaPC, panel_vcf, panel_index, map, regionout, regionsize -> + [ + metaI + metaPC + ["regionout": regionout, "regionsize": regionsize], + input_vcf, input_index, + panel_vcf, panel_index, + map, + [], [], + regionout, + ] + } // Run BEAGLE5 imputation BEAGLE5_BEAGLE(ch_beagle_input) ch_versions = ch_versions.mix(BEAGLE5_BEAGLE.out.versions.first()) // Index the imputed VCF files - BCFTOOLS_INDEX_BEAGLE(BEAGLE5_BEAGLE.out.vcf) - ch_versions = ch_versions.mix(BCFTOOLS_INDEX_BEAGLE.out.versions.first()) + BCFTOOLS_INDEX_PHASE(BEAGLE5_BEAGLE.out.vcf) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_PHASE.out.versions.first()) // Ligate all phased files in one and index it ligate_input = BEAGLE5_BEAGLE.out.vcf .join( - BCFTOOLS_INDEX_BEAGLE.out.tbi - .mix(BCFTOOLS_INDEX_BEAGLE.out.csi) + BCFTOOLS_INDEX_PHASE.out.tbi.mix(BCFTOOLS_INDEX_PHASE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, ) - .map{ meta, vcf, index -> + .map { meta, vcf, index -> def keysToKeep = meta.keySet() - ['regionout', 'regionsize'] [ groupKey(meta.subMap(keysToKeep), meta.regionsize), - vcf, index + vcf, index, ] } .groupTuple() - .map{ groupKeyObj, vcf, index -> + .map { groupKeyObj, vcf, index -> // Extract the actual meta from the groupKey def meta = groupKeyObj.getGroupTarget() [meta, vcf, index] } - GLIMPSE2_LIGATE( ligate_input ) - ch_versions = ch_versions.mix( GLIMPSE2_LIGATE.out.versions.first() ) + GLIMPSE2_LIGATE(ligate_input) + ch_versions = ch_versions.mix(GLIMPSE2_LIGATE.out.versions.first()) - BCFTOOLS_INDEX_LIGATE( GLIMPSE2_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_LIGATE.out.versions.first() ) + BCFTOOLS_INDEX_LIGATE(GLIMPSE2_LIGATE.out.merged_variants) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_LIGATE.out.versions.first()) // Join imputed and index files - ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants - .join( - BCFTOOLS_INDEX_LIGATE.out.tbi - .mix(BCFTOOLS_INDEX_LIGATE.out.csi) - ) + ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants.join( + BCFTOOLS_INDEX_LIGATE.out.tbi.mix(BCFTOOLS_INDEX_LIGATE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, + ) emit: - vcf_index = ch_vcf_index // channel: [ [id, chr, tools], vcf, index ] - versions = ch_versions // channel: [ versions.yml ] + vcf_index = ch_vcf_index // channel: [ [id, chr, tools], vcf, index ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap index 36c113694362..035cee7fbad9 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/main.nf.test.snap @@ -18,20 +18,20 @@ ] ], [ - "versions.yml:md5,055ba50f00b32df929e0e147ba6d4408", "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", + "versions.yml:md5,a4740debfa9b03fbd4cd094f1d5ff5d0", "versions.yml:md5,e4c10555396b9a57ef3aafc9a4707963", "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" ], [ { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_BEAGLE": { - "bcftools": 1.22 + "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { + "beagle": "5.5rev27Feb25.75f" } }, { - "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { - "beagle": "5.5rev27Feb25.75f" + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 } }, { @@ -50,7 +50,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-11T10:40:58.515114119" + "timestamp": "2025-12-12T18:12:49.389456693" }, "homo_sapiens - empty channels - stub": { "content": [ @@ -76,8 +76,8 @@ ] ], "1": [ - "versions.yml:md5,055ba50f00b32df929e0e147ba6d4408", "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", + "versions.yml:md5,a4740debfa9b03fbd4cd094f1d5ff5d0", "versions.yml:md5,e4c10555396b9a57ef3aafc9a4707963", "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" ], @@ -102,21 +102,21 @@ ] ], "versions": [ - "versions.yml:md5,055ba50f00b32df929e0e147ba6d4408", "versions.yml:md5,3ba3affc995d9a03ef59f8cf9e7fac38", + "versions.yml:md5,a4740debfa9b03fbd4cd094f1d5ff5d0", "versions.yml:md5,e4c10555396b9a57ef3aafc9a4707963", "versions.yml:md5,ff3101d4f934dc550b466d79e092707c" ] }, [ { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_BEAGLE": { - "bcftools": 1.22 + "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { + "beagle": "5.5rev27Feb25.75f" } }, { - "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { - "beagle": "5.5rev27Feb25.75f" + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 } }, { @@ -135,7 +135,7 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-11T10:37:59.303608442" + "timestamp": "2025-12-12T18:14:04.06517785" }, "Impute with beagle5 one bcf gz - panel - map - chunks - two chrosomes": { "content": [ @@ -171,13 +171,13 @@ ], [ { - "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_BEAGLE": { - "bcftools": 1.22 + "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { + "beagle": "5.5rev27Feb25.75f" } }, { - "VCF_IMPUTE_BEAGLE5:BEAGLE5_BEAGLE": { - "beagle": "5.5rev27Feb25.75f" + "VCF_IMPUTE_BEAGLE5:BCFTOOLS_INDEX_PHASE": { + "bcftools": 1.22 } }, { @@ -201,6 +201,6 @@ "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-11T10:41:17.021023357" + "timestamp": "2025-12-12T18:13:48.934880404" } } \ No newline at end of file diff --git a/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config index 9be75a1c7cb9..5b205b5e388a 100644 --- a/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config +++ b/subworkflows/nf-core/vcf_impute_beagle5/tests/nextflow.config @@ -1,6 +1,6 @@ process { withName: BCFTOOLS_VIEW { - ext.args = { "--write-index=tbi --output-type z" } + ext.args = { "--write-index=tbi --output-type z" } } withName: BEAGLE5_BEAGLE { @@ -11,15 +11,15 @@ process { ext.prefix = { "${meta.id}_${meta.chr}.ligate" } } - withName: BCFTOOLS_INDEX_BEAGLE { - ext.args = '--tbi' + withName: BCFTOOLS_INDEX_PHASE { + ext.args = '--tbi' } withName: BCFTOOLS_INDEX_LIGATE { - ext.args = '--csi' + ext.args = '--csi' } withName: BCFTOOLS_VIEW_BCF { - ext.args = { params.bcftools_view_args ?: "" } + ext.args = { params.bcftools_view_args ?: "" } } } diff --git a/subworkflows/nf-core/vcf_impute_glimpse/main.nf b/subworkflows/nf-core/vcf_impute_glimpse/main.nf index 9bfce0652756..f1dc049c722d 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/main.nf +++ b/subworkflows/nf-core/vcf_impute_glimpse/main.nf @@ -1,46 +1,45 @@ -include { GLIMPSE_CHUNK } from '../../../modules/nf-core/glimpse/chunk/main' -include { GLIMPSE_PHASE } from '../../../modules/nf-core/glimpse/phase/main' -include { GLIMPSE_LIGATE } from '../../../modules/nf-core/glimpse/ligate/main' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_PHASE } from '../../../modules/nf-core/bcftools/index/main.nf' +include { GLIMPSE_CHUNK } from '../../../modules/nf-core/glimpse/chunk/main' +include { GLIMPSE_PHASE } from '../../../modules/nf-core/glimpse/phase/main' +include { GLIMPSE_LIGATE } from '../../../modules/nf-core/glimpse/ligate/main' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_PHASE } from '../../../modules/nf-core/bcftools/index/main.nf' include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index/main.nf' workflow VCF_IMPUTE_GLIMPSE { - take: - ch_vcf // channel (mandatory): [ meta, vcf, csi, infos ] - ch_ref // channel (mandatory): [ meta, vcf, csi, region ] - ch_chunks // channel (optional) : [ meta, regionin, regionout ] - ch_map // channel (optional) : [ meta, map ] - chunk // val (optional) : boolean to activate/deactivate chunking step + ch_vcf // channel (mandatory): [ meta, vcf, csi, infos ] + ch_ref // channel (mandatory): [ meta, vcf, csi, region ] + ch_chunks // channel (optional) : [ meta, regionin, regionout ] + ch_map // channel (optional) : [ meta, map ] + chunk // val (optional) : boolean to activate/deactivate chunking step main: ch_versions = channel.empty() - if ( chunk == true ){ + if (chunk == true) { // Error if pre-defined chunks are provided when chunking is activated ch_chunks .filter { _meta, regionin, regionout -> regionin.size() == 0 && regionout.size() == 0 } - .ifEmpty { error "ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking." } + .ifEmpty { error("ERROR: Cannot provide pre-defined chunks (regionin) when chunk=true. Please either set chunk=false to use provided chunks, or remove input chunks to enable automatic chunking.") } - GLIMPSE_CHUNK ( ch_ref ) - ch_versions = ch_versions.mix( GLIMPSE_CHUNK.out.versions.first() ) + GLIMPSE_CHUNK(ch_ref) + ch_versions = ch_versions.mix(GLIMPSE_CHUNK.out.versions.first()) ch_chunks = GLIMPSE_CHUNK.out.chunk_chr .splitCsv(header: ['ID', 'Chr', 'RegionIn', 'RegionOut', 'Size1', 'Size2'], sep: "\t", skip: 0) - .map { meta, it -> [meta, it["RegionIn"], it["RegionOut"]]} + .map { meta, it -> [meta, it["RegionIn"], it["RegionOut"]] } } ch_chunks .filter { _meta, regionin, regionout -> regionin.size() > 0 && regionout.size() > 0 } - .ifEmpty { error "ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true." } + .ifEmpty { error("ERROR: ch_chunks channel is empty. Please provide a valid channel or set chunk parameter to true.") } ch_chunks_panel_map = ch_chunks .combine(ch_ref, by: 0) .combine(ch_map, by: 0) - ch_chunks_panel_map.ifEmpty{ - error "ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input." + ch_chunks_panel_map.ifEmpty { + error("ERROR: join operation resulted in an empty channel. Please provide a valid ch_chunks and ch_map channel as input.") } phase_input = ch_vcf @@ -52,39 +51,40 @@ workflow VCF_IMPUTE_GLIMPSE { ref, ref_index, map // reference panel ]} - GLIMPSE_PHASE ( phase_input ) - ch_versions = ch_versions.mix(GLIMPSE_PHASE.out.versions.first() ) + GLIMPSE_PHASE(phase_input) + ch_versions = ch_versions.mix(GLIMPSE_PHASE.out.versions.first()) - BCFTOOLS_INDEX_PHASE ( GLIMPSE_PHASE.out.phased_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_PHASE.out.versions.first() ) + BCFTOOLS_INDEX_PHASE(GLIMPSE_PHASE.out.phased_variants) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_PHASE.out.versions.first()) // Ligate all phased files in one and index it ligate_input = GLIMPSE_PHASE.out.phased_variants - .join( BCFTOOLS_INDEX_PHASE.out.csi - .mix(BCFTOOLS_INDEX_PHASE.out.tbi) + .join( + BCFTOOLS_INDEX_PHASE.out.tbi.mix(BCFTOOLS_INDEX_PHASE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, ) - .map{ meta, vcf, index -> + .map { meta, vcf, index -> def keysToKeep = meta.keySet() - 'regionout' - [ meta.subMap(keysToKeep), vcf, index ] + [meta.subMap(keysToKeep), vcf, index] } .groupTuple() - GLIMPSE_LIGATE ( ligate_input ) - ch_versions = ch_versions.mix(GLIMPSE_LIGATE.out.versions.first() ) + GLIMPSE_LIGATE(ligate_input) + ch_versions = ch_versions.mix(GLIMPSE_LIGATE.out.versions.first()) - BCFTOOLS_INDEX_LIGATE ( GLIMPSE_LIGATE.out.merged_variants ) - ch_versions = ch_versions.mix( BCFTOOLS_INDEX_LIGATE.out.versions.first() ) + BCFTOOLS_INDEX_LIGATE(GLIMPSE_LIGATE.out.merged_variants) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_LIGATE.out.versions.first()) // Join imputed and index files - ch_vcf_index = GLIMPSE_LIGATE.out.merged_variants - .join( - BCFTOOLS_INDEX_LIGATE.out.tbi - .mix(BCFTOOLS_INDEX_LIGATE.out.csi) - ) + ch_vcf_index = GLIMPSE_LIGATE.out.merged_variants.join( + BCFTOOLS_INDEX_LIGATE.out.tbi.mix(BCFTOOLS_INDEX_LIGATE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, + ) emit: - chunk_chr = ch_chunks // channel: [ val(meta), regionin, regionout ] - vcf_index = ch_vcf_index // channel: [ val(meta), vcf, index ] - - versions = ch_versions // channel: [ versions.yml ] + chunks = ch_chunks // channel: [ val(meta), regionin, regionout ] + vcf_index = ch_vcf_index // channel: [ val(meta), vcf, index ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test index 8cc3387d17d7..3656070ec8af 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test +++ b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test @@ -51,7 +51,7 @@ nextflow_workflow { { assert workflow.success }, { assert snapshot( workflow.out.versions, - workflow.out.chunk_chr, + workflow.out.chunks, workflow.out.vcf_index.collect{ meta, vcf, index -> [ meta, path(vcf).getFileName().toString(), @@ -103,7 +103,7 @@ nextflow_workflow { { assert workflow.success }, { assert snapshot( workflow.out.versions, - workflow.out.chunk_chr, + workflow.out.chunks, workflow.out.vcf_index.collect{ meta, vcf, index -> [ meta, path(vcf).getFileName().toString(), diff --git a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap index d6371b1f5d4b..4807e250d6aa 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap +++ b/subworkflows/nf-core/vcf_impute_glimpse/tests/main.nf.test.snap @@ -128,7 +128,7 @@ "versions.yml:md5,9fbf16c8cc7fbd7c71287273e4574c63", "versions.yml:md5,aaac5faff61fcbf4cc1aea0fdbd824ee" ], - "chunk_chr": [ + "chunks": [ [ { "panel": "ref_panel", diff --git a/subworkflows/nf-core/vcf_impute_glimpse/tests/nextflow.config b/subworkflows/nf-core/vcf_impute_glimpse/tests/nextflow.config index 8f4ae66f5bc4..30f9e1d3d566 100644 --- a/subworkflows/nf-core/vcf_impute_glimpse/tests/nextflow.config +++ b/subworkflows/nf-core/vcf_impute_glimpse/tests/nextflow.config @@ -1,10 +1,10 @@ process { withName: GLIMPSE_CHUNK { ext.prefix = { "${meta.panel}_${meta.chr}_chunk" } - ext.args = "--window-size 50000 --buffer-size 1000" + ext.args = "--window-size 50000 --buffer-size 1000" } withName: GLIMPSE_PHASE { - ext.prefix = { "${meta.id}_${meta.regionout? meta.regionout.replace(":","_") : meta.chr}" } + ext.prefix = { "${meta.id}_${meta.regionout ? meta.regionout.replace(":", "_") : meta.chr}" } } withName: GLIMPSE_LIGATE { ext.prefix = { "${meta.id}_${meta.chr}_ligate" } diff --git a/subworkflows/nf-core/vcf_impute_minimac4/main.nf b/subworkflows/nf-core/vcf_impute_minimac4/main.nf index 0fcc3dd98ea1..758233dd8933 100644 --- a/subworkflows/nf-core/vcf_impute_minimac4/main.nf +++ b/subworkflows/nf-core/vcf_impute_minimac4/main.nf @@ -6,11 +6,11 @@ include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-co workflow VCF_IMPUTE_MINIMAC4 { take: - ch_input // channel (mandatory): [ [id, chr], vcf, tbi ] - ch_panel // channel (mandatory): [ [panel, chr], vcf, tbi ] + ch_input // channel (mandatory): [ [id, chr], vcf, tbi ] + ch_panel // channel (mandatory): [ [panel, chr], vcf, tbi ] ch_posfile // channel (optional) : [ [panel, chr], sites_vcf, sites_index ] - ch_chunks // channel (optional) : [ [panel, chr], regionout ] - ch_map // channel (optional) : [ [panel, chr], map] + ch_chunks // channel (optional) : [ [panel, chr], regionout ] + ch_map // channel (optional) : [ [panel, chr], map] main: @@ -52,11 +52,9 @@ workflow VCF_IMPUTE_MINIMAC4 { .map { metaI, target_vcf, target_tbi, metaPC, ref_msav, sites_vcf, sites_index, regionout, map -> [ metaPC + metaI + ["regionout": regionout], - target_vcf, - target_tbi, + target_vcf, target_tbi, ref_msav, - sites_vcf, - sites_index, + sites_vcf, sites_index, map, regionout, ] @@ -72,7 +70,9 @@ workflow VCF_IMPUTE_MINIMAC4 { // Ligate all phased files in one and index it ligate_input = MINIMAC4_IMPUTE.out.vcf .join( - BCFTOOLS_INDEX_PHASE.out.tbi.mix(BCFTOOLS_INDEX_PHASE.out.csi) + BCFTOOLS_INDEX_PHASE.out.tbi.mix(BCFTOOLS_INDEX_PHASE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, ) .map { meta, vcf, index -> def keysToKeep = meta.keySet() - ['regionout'] @@ -88,10 +88,12 @@ workflow VCF_IMPUTE_MINIMAC4 { // Join imputed and index files ch_vcf_index = GLIMPSE2_LIGATE.out.merged_variants.join( - BCFTOOLS_INDEX_LIGATE.out.tbi.mix(BCFTOOLS_INDEX_LIGATE.out.csi) + BCFTOOLS_INDEX_LIGATE.out.tbi.mix(BCFTOOLS_INDEX_LIGATE.out.csi), + failOnMismatch: true, + failOnDuplicate: true, ) emit: vcf_index = ch_vcf_index // channel: [ [id, panel, chr], vcf, index ] - versions = ch_versions // channel: [ versions.yml ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/vcf_phase_shapeit5/main.nf b/subworkflows/nf-core/vcf_phase_shapeit5/main.nf index c1303d99667c..ce8637aee05f 100644 --- a/subworkflows/nf-core/vcf_phase_shapeit5/main.nf +++ b/subworkflows/nf-core/vcf_phase_shapeit5/main.nf @@ -1,19 +1,19 @@ -include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk' -include { SHAPEIT5_PHASECOMMON } from '../../../modules/nf-core/shapeit5/phasecommon' -include { SHAPEIT5_LIGATE } from '../../../modules/nf-core/shapeit5/ligate' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_1 } from '../../../modules/nf-core/bcftools/index' -include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_2 } from '../../../modules/nf-core/bcftools/index' +include { GLIMPSE2_CHUNK } from '../../../modules/nf-core/glimpse2/chunk' +include { SHAPEIT5_PHASECOMMON } from '../../../modules/nf-core/shapeit5/phasecommon' +include { SHAPEIT5_LIGATE } from '../../../modules/nf-core/shapeit5/ligate' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_PHASE } from '../../../modules/nf-core/bcftools/index' +include { BCFTOOLS_INDEX as BCFTOOLS_INDEX_LIGATE } from '../../../modules/nf-core/bcftools/index' workflow VCF_PHASE_SHAPEIT5 { take: - ch_vcf // channel (mandatory) : [ [id, chr], vcf, index, pedigree, region ] - ch_chunks // channel (optional) : [ [id, chr], regionout ] - ch_ref // channel (optional) : [ [id, chr], vcf, index ] - ch_scaffold // channel (optional) : [ [id, chr], vcf, index ] - ch_map // channel (optional) : [ [id, chr], map] - chunk // val (mandatory) : boolean to activate/deactivate chunking step - chunk_model // channel (mandatory) : [ model ] + ch_vcf // channel (mandatory) : [ [id, chr], vcf, index, pedigree, region ] + ch_chunks // channel (optional) : [ [id, chr], regionout ] + ch_ref // channel (optional) : [ [id, chr], vcf, index ] + ch_scaffold // channel (optional) : [ [id, chr], vcf, index ] + ch_map // channel (optional) : [ [id, chr], map] + chunk // val (mandatory) : boolean to activate/deactivate chunking step + chunk_model // channel (mandatory) : [ model ] main: @@ -76,13 +76,12 @@ workflow VCF_PHASE_SHAPEIT5 { SHAPEIT5_PHASECOMMON (ch_phase_input) ch_versions = ch_versions.mix(SHAPEIT5_PHASECOMMON.out.versions.first()) - BCFTOOLS_INDEX_1(SHAPEIT5_PHASECOMMON.out.phased_variant) - ch_versions = ch_versions.mix(BCFTOOLS_INDEX_1.out.versions.first()) + BCFTOOLS_INDEX_PHASE(SHAPEIT5_PHASECOMMON.out.phased_variant) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_PHASE.out.versions.first()) ch_ligate_input = SHAPEIT5_PHASECOMMON.out.phased_variant .join( - BCFTOOLS_INDEX_1.out.csi - .mix(BCFTOOLS_INDEX_1.out.tbi), + BCFTOOLS_INDEX_PHASE.out.tbi.mix(BCFTOOLS_INDEX_PHASE.out.csi), failOnMismatch:true, failOnDuplicate:true ) .map{ meta, vcf, index -> @@ -94,17 +93,17 @@ workflow VCF_PHASE_SHAPEIT5 { SHAPEIT5_LIGATE(ch_ligate_input) ch_versions = ch_versions.mix(SHAPEIT5_LIGATE.out.versions.first()) - BCFTOOLS_INDEX_2(SHAPEIT5_LIGATE.out.merged_variants) - ch_versions = ch_versions.mix(BCFTOOLS_INDEX_2.out.versions.first()) + BCFTOOLS_INDEX_LIGATE(SHAPEIT5_LIGATE.out.merged_variants) + ch_versions = ch_versions.mix(BCFTOOLS_INDEX_LIGATE.out.versions.first()) ch_vcf_index = SHAPEIT5_LIGATE.out.merged_variants .join( - BCFTOOLS_INDEX_2.out.csi.mix(BCFTOOLS_INDEX_2.out.tbi), + BCFTOOLS_INDEX_LIGATE.out.tbi.mix(BCFTOOLS_INDEX_LIGATE.out.csi), failOnMismatch:true, failOnDuplicate:true ) emit: - chunks = ch_chunks // channel: [ [id, chr], regionout] - vcf_index = ch_vcf_index // channel: [ [id, chr], vcf, csi ] - versions = ch_versions // channel: [ versions.yml ] + chunks = ch_chunks // channel: [ [id, chr], regionout] + vcf_index = ch_vcf_index // channel: [ [id, chr], vcf, csi ] + versions = ch_versions // channel: [ versions.yml ] } diff --git a/subworkflows/nf-core/vcf_phase_shapeit5/tests/main.nf.test.snap b/subworkflows/nf-core/vcf_phase_shapeit5/tests/main.nf.test.snap index a385cb7ecd1d..f4e5614b0d6b 100644 --- a/subworkflows/nf-core/vcf_phase_shapeit5/tests/main.nf.test.snap +++ b/subworkflows/nf-core/vcf_phase_shapeit5/tests/main.nf.test.snap @@ -60,17 +60,17 @@ ] ], [ + "versions.yml:md5,215cf66a55581e79fb28eaf10cfa2010", "versions.yml:md5,254449d2f1f8b59fd027d7dd4a79a986", - "versions.yml:md5,7b8268b08a3d5105126bc590d3348379", - "versions.yml:md5,9109283c8ca50c507c4b77329cc0ba79", - "versions.yml:md5,e5ace4193f44f483d16d945b9eeae318" + "versions.yml:md5,54cb297b56e211ede9108417b3ed057a", + "versions.yml:md5,7b8268b08a3d5105126bc590d3348379" ] ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-04T14:44:18.920849936" + "timestamp": "2025-12-12T18:30:15.299570431" }, "homo_sapiens - target - no error -- stub": { "content": [ @@ -95,11 +95,11 @@ ] ], "2": [ + "versions.yml:md5,215cf66a55581e79fb28eaf10cfa2010", "versions.yml:md5,254449d2f1f8b59fd027d7dd4a79a986", + "versions.yml:md5,54cb297b56e211ede9108417b3ed057a", "versions.yml:md5,714bb0db6e2d39cf0042359a64915bc6", - "versions.yml:md5,7b8268b08a3d5105126bc590d3348379", - "versions.yml:md5,9109283c8ca50c507c4b77329cc0ba79", - "versions.yml:md5,e5ace4193f44f483d16d945b9eeae318" + "versions.yml:md5,7b8268b08a3d5105126bc590d3348379" ], "chunks": [ [ @@ -121,26 +121,26 @@ ] ], "versions": [ + "versions.yml:md5,215cf66a55581e79fb28eaf10cfa2010", "versions.yml:md5,254449d2f1f8b59fd027d7dd4a79a986", + "versions.yml:md5,54cb297b56e211ede9108417b3ed057a", "versions.yml:md5,714bb0db6e2d39cf0042359a64915bc6", - "versions.yml:md5,7b8268b08a3d5105126bc590d3348379", - "versions.yml:md5,9109283c8ca50c507c4b77329cc0ba79", - "versions.yml:md5,e5ace4193f44f483d16d945b9eeae318" + "versions.yml:md5,7b8268b08a3d5105126bc590d3348379" ] }, [ + "versions.yml:md5,215cf66a55581e79fb28eaf10cfa2010", "versions.yml:md5,254449d2f1f8b59fd027d7dd4a79a986", + "versions.yml:md5,54cb297b56e211ede9108417b3ed057a", "versions.yml:md5,714bb0db6e2d39cf0042359a64915bc6", - "versions.yml:md5,7b8268b08a3d5105126bc590d3348379", - "versions.yml:md5,9109283c8ca50c507c4b77329cc0ba79", - "versions.yml:md5,e5ace4193f44f483d16d945b9eeae318" + "versions.yml:md5,7b8268b08a3d5105126bc590d3348379" ] ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-04T14:44:31.05363112" + "timestamp": "2025-12-12T18:30:31.471379595" }, "homo_sapiens - target - no chunks, no ref, no scaffold, no map - one chromosome": { "content": [ @@ -166,17 +166,17 @@ ] ], [ + "versions.yml:md5,215cf66a55581e79fb28eaf10cfa2010", "versions.yml:md5,254449d2f1f8b59fd027d7dd4a79a986", + "versions.yml:md5,54cb297b56e211ede9108417b3ed057a", "versions.yml:md5,714bb0db6e2d39cf0042359a64915bc6", - "versions.yml:md5,7b8268b08a3d5105126bc590d3348379", - "versions.yml:md5,9109283c8ca50c507c4b77329cc0ba79", - "versions.yml:md5,e5ace4193f44f483d16d945b9eeae318" + "versions.yml:md5,7b8268b08a3d5105126bc590d3348379" ] ], "meta": { "nf-test": "0.9.3", "nextflow": "25.10.0" }, - "timestamp": "2025-12-04T14:43:58.500525154" + "timestamp": "2025-12-12T18:29:49.942165959" } } \ No newline at end of file diff --git a/subworkflows/nf-core/vcf_phase_shapeit5/tests/nextflow.config b/subworkflows/nf-core/vcf_phase_shapeit5/tests/nextflow.config index e578757ec5c1..1907408e0c22 100644 --- a/subworkflows/nf-core/vcf_phase_shapeit5/tests/nextflow.config +++ b/subworkflows/nf-core/vcf_phase_shapeit5/tests/nextflow.config @@ -5,12 +5,12 @@ process { } withName: SHAPEIT5_PHASECOMMON { - cpus = 1 // Needed to have deterministic output for testing + cpus = 1 // needed for deterministic output ext.args = "--seed 1" ext.prefix = { "${meta.id}_${meta.chr}_${meta.regionout.replace(':', '-')}.phased" } } - withName: BCFTOOLS_INDEX_1 { + withName: BCFTOOLS_INDEX_PHASE { ext.args = '--csi' } @@ -18,7 +18,7 @@ process { ext.prefix = { "${meta.id}_${meta.chr}.ligate" } } - withName: BCFTOOLS_INDEX_2 { + withName: BCFTOOLS_INDEX_LIGATE { ext.args = '--csi' }