fix(scripts): count Venn overlap by distinct variant key#99
Conversation
|
Warning Review limit reached
More reviews will be available in 1 minute and 39 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`n_gnomad_only` was `nrow(gnomad) - nrow(divref_in_gnomad)`, where the latter is a left-join row count; a duplicate `variant` in the gnomAD table would inflate the overlap and could make `n_gnomad_only` negative (which `euler()` rejects). Compute all three Venn counts from distinct variant-key set operations instead. Identical on clean inputs; the joined frames are still used for the AF-difference plots. Closes #88 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ab526fe to
370b7a1
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Analysis-script robustness fix (#88).
compare_divref_gnomad.Rcomputedn_gnomad_only = nrow(gnomad) - nrow(divref_in_gnomad), where the subtrahend is a left-join row count. A duplicatevariantkey in the gnomAD TSV would inflate the overlap and could maken_gnomad_onlynegative, whicheuler()rejects.Now all three Venn counts come from distinct variant-key set operations (
intersect/setdiff), which is robust to duplicate keys and identical on clean inputs. The joined frames are still used for the per-variant AF-difference plots.Verification
pixi run --environment analysis Rscript -e 'parse(...)'— parses cleanly.Note
#86 (the other item originally grouped here) is being closed as won't-do per discussion: the untracked sweep config is left as-is, and the population
enumis skipped (an incomplete enum would risk rejecting valid runs without an authoritative gnomAD ancestry-code list). So this PR is #88 only.Closes #88
🤖 Generated with Claude Code