Fix operator-precedence bug in pseudobulk VAF computation - #1
Merged
Conversation
globalVAFs was computed as (numerator / 2) * denominator instead of numerator / (2 * denominator), inflating VAFs by a factor equal to the number of genotyped cells (values of 50-100 instead of 0.0-1.0). This matches the previously-flagged but unresolved warning describing "values may exceed 1", which is now removed since it's fixed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes an operator-precedence error in pseudobulk variant allele frequency (VAF) computation that previously inflated globalVAFs by multiplying by the number of genotyped cells instead of dividing by it, bringing VAFs back into the expected 0.0–1.0 range.
Changes:
- Corrected the
globalVAFsformula to computenumerator / (2 * denominator)(instead of(numerator / 2) * denominator). - Removed a commented-out/disabled warning block about VAFs exceeding 1, which should no longer be applicable after the fix.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+683
to
685
| globalVAFs = (np.sum((gt1 == 1), axis=1) + 2 * np.sum((gt1 == 2), axis=1)) / ( | ||
| 2 * np.sum(gt1 != 3, axis=1) | ||
| ) |
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.
globalVAFs was computed as (numerator / 2) * denominator instead of numerator / (2 * denominator), inflating VAFs by a factor equal to the number of genotyped cells (values of 50-100 instead of 0.0-1.0). This matches the previously-flagged but unresolved warning describing "values may exceed 1", which is now removed since it's fixed.