Skip to content

Commit

Permalink
Update bcftools view script (nf-core#4850)
Browse files Browse the repository at this point in the history
* update test

* vcf output

* update snap
  • Loading branch information
ramprasadn authored Feb 6, 2024
1 parent 9a07a12 commit 7157328
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
18 changes: 14 additions & 4 deletions modules/nf-core/bcftools/view/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ process BCFTOOLS_VIEW {
path(samples)

output:
tuple val(meta), path("*.gz") , emit: vcf
path "versions.yml" , emit: versions
tuple val(meta), path("*.{vcf,vcf.gz,bcf,bcf.gz}"), emit: vcf
path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when
Expand All @@ -26,9 +26,14 @@ process BCFTOOLS_VIEW {
def regions_file = regions ? "--regions-file ${regions}" : ""
def targets_file = targets ? "--targets-file ${targets}" : ""
def samples_file = samples ? "--samples-file ${samples}" : ""
def extension = args.contains("--output-type b") || args.contains("-Ob") ? "bcf.gz" :
args.contains("--output-type u") || args.contains("-Ou") ? "bcf" :
args.contains("--output-type z") || args.contains("-Oz") ? "vcf.gz" :
args.contains("--output-type v") || args.contains("-Ov") ? "vcf" :
"vcf"
"""
bcftools view \\
--output ${prefix}.vcf.gz \\
--output ${prefix}.${extension} \\
${regions_file} \\
${targets_file} \\
${samples_file} \\
Expand All @@ -44,8 +49,13 @@ process BCFTOOLS_VIEW {

stub:
def prefix = task.ext.prefix ?: "${meta.id}"
def extension = args.contains("--output-type b") || args.contains("-Ob") ? "bcf.gz" :
args.contains("--output-type u") || args.contains("-Ou") ? "bcf" :
args.contains("--output-type z") || args.contains("-Oz") ? "vcf.gz" :
args.contains("--output-type v") || args.contains("-Ov") ? "vcf" :
"vcf"
"""
touch ${prefix}.vcf.gz
touch ${prefix}.${extension}
cat <<-END_VERSIONS > versions.yml
"${task.process}":
Expand Down
2 changes: 1 addition & 1 deletion modules/nf-core/bcftools/view/meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ output:
- vcf:
type: file
description: VCF normalized output file
pattern: "*.{vcf.gz}"
pattern: "*.{vcf,vcf.gz,bcf,bcf.gz}"
- versions:
type: file
description: File containing software versions
Expand Down
12 changes: 6 additions & 6 deletions modules/nf-core/bcftools/view/tests/main.nf.test.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions modules/nf-core/bcftools/view/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
process {
ext.args = '--no-version'
}
ext.args = '--no-version --output-type v'
}

0 comments on commit 7157328

Please sign in to comment.