Skip to content

Commit

Permalink
Add header compatibility check to concat --naive command
Browse files Browse the repository at this point in the history
and add a new --naive-force option.
  • Loading branch information
pd3 committed Jul 21, 2019
1 parent f1f261b commit 55363e0
Show file tree
Hide file tree
Showing 3 changed files with 174 additions and 46 deletions.
12 changes: 7 additions & 5 deletions doc/bcftools.txt
Original file line number Diff line number Diff line change
Expand Up @@ -714,8 +714,7 @@ concatenate chromosome VCFs into one VCF, or combine a SNP VCF and an indel
VCF into one. The input files must be sorted by chr and position. The files
must be given in the correct order to produce sorted VCF on output unless
the *-a, --allow-overlaps* option is specified. With the --naive option, the files
are concatenated without being recompressed, which is very fast but dangerous
if the BCF headers differ.
are concatenated without being recompressed, which is very fast..


*-a, --allow-overlaps*::
Expand Down Expand Up @@ -745,9 +744,12 @@ if the BCF headers differ.
*-n, --naive*::
Concatenate VCF or BCF files without recompression. This is very fast but requires
that all files are of the same type (all VCF or all BCF) and have the same headers.
This is because all tags and chromosome names in the BCF body rely on the implicit
order of the contig and tag definitions in the header. Currently no sanity checks
are in place. Dangerous, use with caution.
This is because all tags and chromosome names in the BCF body rely on the order
of the contig and tag definitions in the header. A header check compatibility
is performed and the program throws an error if it is not safe to use the option.

*--naive-force*::
Same as --naive, but header compatibility is not checked. Dangerous, use with caution.

*-o, --output* 'FILE'::
see *<<common_options,Common Options>>*
Expand Down
2 changes: 1 addition & 1 deletion test/test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,7 @@ sub test_naive_concat
}
my $bcfs = join('.bcf ',@files).'.bcf';
test_cmd($opts,exp=>$exp,out=>"concat.naive.bcf.out",cmd=>"$$opts{bin}/bcftools concat --naive $bcfs | $$opts{bin}/bcftools view -H");
test_cmd($opts,exp=>$exp,out=>"concat.naive.bcf.out",cmd=>"$$opts{bin}/bcftools concat --naive-force $bcfs | $$opts{bin}/bcftools view -H");
my $vcfs = join('.vcf.gz ',@files).'.vcf.gz';
test_cmd($opts,exp=>$exp,out=>"concat.naive.vcf.out",cmd=>"$$opts{bin}/bcftools concat --naive $vcfs | $$opts{bin}/bcftools view -H");
Expand Down
Loading

0 comments on commit 55363e0

Please sign in to comment.