Skip to content

Fix operator-precedence bug in pseudobulk VAF computation - #1

Merged
JohannesGawron merged 2 commits into
mainfrom
worktree-mighty-sleeping-floyd
Jul 22, 2026
Merged

Fix operator-precedence bug in pseudobulk VAF computation#1
JohannesGawron merged 2 commits into
mainfrom
worktree-mighty-sleeping-floyd

Conversation

@JohannesGawron

Copy link
Copy Markdown
Collaborator

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.

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 globalVAFs formula to compute numerator / (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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

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)
)
@JohannesGawron
JohannesGawron merged commit cc0b7a2 into main Jul 22, 2026
1 check failed
@JohannesGawron
JohannesGawron deleted the worktree-mighty-sleeping-floyd branch July 22, 2026 13:27
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.

3 participants