CG tag and SEQ/CIGAR consistency. - #2089
Merged
Merged
Conversation
BAM has this check at the end, but SAM checks after reading SEQ and before checking if we'll overwrite CIGAR with a CG tag. CRAM uses bam_set1, which checks for SEQ/CIGAR consistency, but this is also prior to aux tag parsing and CG->CIGAR migration. The nature of the bam_set1 API though is such that aux tags haven't yet been parsed, so it is up to the caller to perform this test itself later or to parse aux and replace cigar before calling bam_set1. CRAM does however call bam_tag2cigar as even though it doesn't need it, it's there for consistency of what takes priority. sam_parse1 calls that function too, and potentially third party code, so checking has been added there as well. Credit to OSS_Fuzz Fixes oss-fuzz issue 560967311 Signed-off-by: James Bonfield <jkb@sanger.ac.uk>
Normally this is detected and filtered out earlier, but see the previous commit. So we take the belt and braces approach and fix it here too. Signed-off-by: James Bonfield <jkb@sanger.ac.uk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BAM moves the CG: cigar tag to the CIGAR field prior to validating sequence length and the cigar fields are logically consistent.
SAM does the consistency check before parsing CG, so it could fail. CRAM likewise. (Although technically both formats do not need to parse the tag, they do so for consistency with BAM.)