Ignore first phasing bit in process_gt_to_hap / process_gt_to_hap2 #2443
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
HTSlib version 1.22 introduced prefixed phasing support for VCF files with version 4.4 or later. Prior to this the first GT phase (when reading VCF) was always zero; after it is set either explicitly or when all other alleles are phased. This updates
process_gt_to_hap()
andprocess_gt_to_hap2()
to ignore the first phase bit, removing an assumption it is always zero.Fixes incorrect reporting of phase when using HTSlib 1.22 to read VCF files with version 4.4 or 4.5.
To reproduce the issue:
After applying this patch:
Pull request samtools/htslib#1938 will change HTSlib to set the first phase bit for all VCF files irrespective of version, after which this problem will become rather more obvious. It would be useful to merge this change before the HTSlib one goes in.