samtools / bcftools

This is the official development repository for BCFtools. See installation instructions and other documentation here http://samtools.github.io/bcftools/howtos/install.html
http://samtools.github.io/bcftools/
Other
634 stars 241 forks source link

bcftools reheader Incomplete File if Output Same as Input #2140

Open DarioS opened 3 months ago

DarioS commented 3 months ago

It sounds like it should be possible to modify file in-place:

bcftools reheader [OPTIONS] file.vcf.gz Modify header of VCF/BCF files, change sample names.

However, if -o path is same as input file path, the result is a corrupted file. Why not an error message or work as expected?

pd3 commented 2 months ago

I am reluctant to add checks like that, certain awareness is required from users when working with command line tools.

Few notes if such check should be added:

So although seemingly simple, it's not an easy decision to make.