Skip to content

bcftools view does not return an error code when invalid character in FORMAT field #588

Closed
@jkmatila

Description

When there is an invalid character in a FORMAT field, bcftools will print an error message but will exit with status code 0, indicating success.

I would expect there be to an error code returned, since encountering this error will result in partial output.

A small VCF file for reproducing the problem can be found in repro.zip

Steps to reproduce:

$ bcftools --version
bcftools 1.4
Using htslib 1.4
Copyright (C) 2016 Genome Research Ltd.
License Expat: The MIT/Expat license
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ bcftools view repro.vcf
[E::vcf_parse_format] Invalid character '.' in 'SB' FORMAT field at 1:115256530
##fileformat=VCFv4.1
##FILTER=<ID=PASS,Description="All filters passed">
##FORMAT=<ID=GT,Number=1,Type=String,Description="Genotype">
##FORMAT=<ID=SB,Number=4,Type=Integer,Description="Per-sample component statistics which comprise the Fisher's Exact Test to detect strand bias.">
##contig=<ID=1,length=249250621,assembly=b37>
##bcftools_viewVersion=1.4+htslib-1.4
##bcftools_viewCommand=view repro.vcf; Date=Wed Apr  5 19:10:19 2017
#CHROM	POS	ID	REF	ALT	QUAL	FILTER	INFO	FORMAT	sample

$ echo $?
0

Observed: zero exit code. Expected: a non-zero exit code.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions