odelaneau / shapeit5

Segmented HAPlotype Estimation and Imputation Tool
https://odelaneau.github.io/shapeit5/
MIT License
61 stars 9 forks source link

using phase_common_static: loosing phase with bcftools convert #41

Open droeatumn opened 1 year ago

droeatumn commented 1 year ago

I'm having a problem with loss of phase after running bcftools 'convert --hapsample' on a bcf created via phase_common_static --thread 12 --input chr19.19.filtered.vcf.gz --map map.txt.gz --output chr19.19.phased.bcf --region 19 --pbwt-depth 8 --pbwt-modulo 8 --log chr19.19.shapeit.log 2> chr19.19.shapeit.err

Unfortunately, the system won't let me upload the bcf file, but I think it can be recreated from any bop output from phase_common_static.

When I run this using the bcftools 1.15 (also tested on1.17-56-g402de74a) bcftools convert --hapsample test6b test6.bcf The phase is lost in the hap file

19 19:171762_T_C 171762 T C 0* 0* 0* 0*
19 19:209360_G_T 209360 G T 0* 0* 0* 0*
19 19:229783_G_A 229783 G A 1* 0* 1* 0*

When I convert that same bcf to vcf, the phase is preserved test6b.vcf.txt

When I convert that vcf to bcf and convert to hapsample

    bcftools convert --output-type b -o test6b2.bcf test6.vcf
    bcftools convert --hapsample test6b2 test6b2.bcf

The phase is preserved in the hap file.

19 19:171762_T_C 171762 T C 0 0 0 0
19 19:209360_G_T 209360 G T 0 0 0 0
19 19:229783_G_A 229783 G A 1 0 1 0

When I try converting the original bcf to hap using bcftools 1.3.1 (based on this thread) bcftools-1.3.1/bcftools convert --hapsample test6b131 test6.bcf The phase is preserved in the hap file.

So, it seems the way phase_common_static creates phase in bcf is compatible with bcftools 1.3.1, but not the recent versions.(?) Or maybe it is a bcftools issue?

droeatumn commented 1 year ago

Using 5.1.1

odelaneau commented 1 year ago

Thanks for this. What about recompiling S5 linking with the last HTSlib version?

droeatpm commented 7 months ago

I'm sorry, but I don't have time to help further on this.