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
640 stars 241 forks source link

bcftools merge: support single-file edge case [enhancement] #2100

Closed jan-glx closed 5 months ago

jan-glx commented 5 months ago

If bcftools merge is called with only a single vcf file, it fails with:

About:   Merge multiple VCF/BCF files from non-overlapping sample sets to create one multi-sample file
Note that only records from different files can be merged, never from the same file. For "vertical" merge
take a look at "bcftools norm" instead.  
Usage:   bcftools merge [options] <A.vcf.gz> <B.vcf.gz> [...] 

This is quite a useful error message. However, since I have to merge a varying number of vcf files for a large number of sets of vcf files with various cardinality, including 1 but thankfully not 0, I currently need check the number of files for each set upfront and use cp /bcftools view instead if the current set has only one file. Therefore, I thik it would be great if bcftools merge would only warn, not error in the single file case, i.e if usage was relaxed to Usage: bcftools merge [options] <A.vcf.gz> [<B.vcf.gz>] [...]

pd3 commented 5 months ago

There is now a new option --force-single which allows to run a single file through merge.

Note this could be further enhanced by allowing PL to LPL conversion as requested by #2105. (Not done by this commit)