Skip to content

Validate BCF contig identifiers before writing - #673

Open
thierrygosselin wants to merge 1 commit into
ANGSD:masterfrom
thierrygosselin:fix-bcf-contig-validation
Open

thierrygosselin wants to merge 1 commit into
ANGSD:masterfrom
thierrygosselin:fix-bcf-contig-validation

Conversation

@thierrygosselin

Copy link
Copy Markdown

The BCF writer looked up each contig with bcf_hdr_name2id() but did not check whether the lookup succeeded.

If the contig is absent from the BCF header, HTSlib receives an invalid record identifier and may fail later with an opaque error or produce unusable output.

This change checks the contig identifier before writing the record and returns a clear failure message when the contig dictionary is inconsistent.

No genotype, allele or likelihood calculations are changed.

Related to #402 and #630.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant