Fix bcftools/stats module (#1953)

* test verified commit bcftools

* adjust tests

* add suggestions

* test for actual file content
master
SusiJo 2 years ago committed by GitHub
parent ab4c2e440d
commit 41dfa13929
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -8,8 +8,10 @@ process BCFTOOLS_STATS {
'quay.io/biocontainers/bcftools:1.15.1--h0ea216a_0' }"
input:
tuple val(meta), path(vcf)
path(target_bed)
tuple val(meta), path(vcf), path(tbi)
path regions
path targets
path samples
output:
tuple val(meta), path("*stats.txt"), emit: stats
@ -21,11 +23,15 @@ process BCFTOOLS_STATS {
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def target = target_bed ? "--regions-file ${target_bed}" : ""
def regions_file = regions ? "--regions-file ${regions}" : ""
def targets_file = targets ? "--targets-file ${targets}" : ""
def samples_file = samples ? "--samples-file ${samples}" : ""
"""
bcftools stats \\
$args \\
$target \\
$regions_file \\
$targets_file \\
$samples_file \\
$vcf > ${prefix}.bcftools_stats.txt
cat <<-END_VERSIONS > versions.yml

@ -19,14 +19,28 @@ input:
description: |
Groovy Map containing sample information
e.g. [ id:'test', single_end:false ]
- target_bed:
type: file
description: target bed file
pattern: "*.{bed}"
- vcf:
type: file
description: VCF input file
pattern: "*.{vcf}"
- tbi:
type: file
description: |
The tab index for the VCF file to be inspected. Optional: only required when parameter regions is chosen.
pattern: "*.tbi"
- regions:
type: file
description: |
Optionally, restrict the operation to regions listed in this file. (VCF, BED or tab-delimited)
- targets:
type: file
description: |
Optionally, restrict the operation to regions listed in this file (doesn't rely upon tbi index files)
- samples:
type: file
description: |
Optional, file of sample names to be included or excluded.
e.g. 'file.tsv'
output:
- meta:
type: map

@ -6,8 +6,33 @@ include { BCFTOOLS_STATS } from '../../../../modules/bcftools/stats/main.nf'
workflow test_bcftools_stats {
input = [ [ id:'test' ], // meta map
[ file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true) ],
]
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
[]]
regions = []
targets = []
samples = []
BCFTOOLS_STATS ( input, [] )
BCFTOOLS_STATS ( input, regions, targets, samples )
}
workflow test_bcftools_stats_regions {
input = [ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
file(params.test_data['sarscov2']['illumina']['test_vcf_gz_tbi'], checkIfExists: true)]
regions = file(params.test_data['sarscov2']['illumina']['test3_vcf_gz'], checkIfExists: true)
targets = []
samples = []
BCFTOOLS_STATS ( input, regions, targets, samples )
}
workflow test_bcftools_stats_targets {
input = [ [ id:'test' ], // meta map
file(params.test_data['sarscov2']['illumina']['test_vcf_gz'], checkIfExists: true),
[]]
regions = []
targets = file(params.test_data['sarscov2']['illumina']['test2_vcf_targets_tsv_gz'], checkIfExists: true)
samples = []
BCFTOOLS_STATS ( input, regions, targets, samples )
}

@ -1,8 +1,26 @@
- name: bcftools stats test_bcftools_stats
command: nextflow run ./tests/modules/bcftools/stats -entry test_bcftools_stats -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/stats/nextflow.config
command: nextflow run ./tests/modules/bcftools/stats -entry test_bcftools_stats -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/stats/nextflow.config
tags:
- bcftools/stats
- bcftools
files:
- path: output/bcftools/test.bcftools_stats.txt
contains: ["TSTV 0 6 2 3.00 6 2 3.00", "DP 0 1 0 0.000000 5 55.555556"]
- name: bcftools stats test_bcftools_stats_regions
command: nextflow run ./tests/modules/bcftools/stats -entry test_bcftools_stats_regions -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/stats/nextflow.config
tags:
- bcftools/stats
- bcftools
files:
- path: output/bcftools/test.bcftools_stats.txt
contains: ["TSTV 0 5 1 5.00 5 1 5.00", "DP 0 1 0 0.000000 3 42.857143"]
- name: bcftools stats test_bcftools_stats_targets
command: nextflow run ./tests/modules/bcftools/stats -entry test_bcftools_stats_targets -c ./tests/config/nextflow.config -c ./tests/modules/bcftools/stats/nextflow.config
tags:
- bcftools/stats
- bcftools
files:
- path: output/bcftools/test.bcftools_stats.txt
md5sum: b7b9abecf0f6a77c1472a380feca708b
contains: ["TSTV 0 6 2 3.00 6 2 3.00", "DP 0 1 0 0.000000 5 55.555556"]

Loading…
Cancel
Save