Fixes bug in assigning MAPQ 60 to reads that are not proper pairs.#596
Merged
Conversation
Previously the individual best non-proper pair would get a mapq of 60, regardless if it had multiple best scoring chains or not. This commit fixes the bug. If the best pair is individual: check for each read if second best chain has the same score, if so, assign mapq 0, otherwise compute mapq from our formula. If there is no second chain the read gets 60.
d9c0577 to
e9cb278
Compare
Collaborator
|
Nice, looks good! I have added a changelog entry and simplified the MAPQ computation by removing one nested |
Owner
Author
|
great. I am ok to merge if you are. |
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.
Previously, the best non-proper pair would get a mapq of 60, regardless of whether it had multiple best scoring chains or not. This commit fixes the bug.
If the best pair is not proper: check for each read if the second-best chain has the same score, if so, assign mapq 0, otherwise compute mapq from our formula. If there is no second chain, the read gets 60.
The fix is quite modular. But we may want to watch out for conflicts or to reintroduce the faulty behavior when merging PR
#584 (based on PR #576)
This issue was detected when I was running samdiff.py for the 2bit-ref-rs PR (see end of this comment #595 (comment)), which had 4170 that had a MAPQ score of > 0 and logged under "changed in another way", but further assessment of those 4170 gave:
3,940 (94.5%) — same AS between versions, but mapped to a different but equally-scored location (should be MAPQ=0).