Skip to content

fix(scripts): count Venn overlap by distinct variant key#99

Merged
ameynert merged 1 commit into
mainfrom
chore/config-and-script-nits
Jun 3, 2026
Merged

fix(scripts): count Venn overlap by distinct variant key#99
ameynert merged 1 commit into
mainfrom
chore/config-and-script-nits

Conversation

@ameynert

@ameynert ameynert commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Analysis-script robustness fix (#88). compare_divref_gnomad.R computed n_gnomad_only = nrow(gnomad) - nrow(divref_in_gnomad), where the subtrahend is a left-join row count. A duplicate variant key in the gnomAD TSV would inflate the overlap and could make n_gnomad_only negative, which euler() 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 enum is 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

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@ameynert, we couldn't start this review because you've reached your PR review rate limit.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e19cf1ac-65c4-4f4c-90a8-757212772684

📥 Commits

Reviewing files that changed from the base of the PR and between 1736c06 and 370b7a1.

📒 Files selected for processing (1)
  • scripts/compare_divref_gnomad.R

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Base automatically changed from am_review to main June 3, 2026 21:26
`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>
@ameynert
ameynert force-pushed the chore/config-and-script-nits branch from ab526fe to 370b7a1 Compare June 3, 2026 22:23
@ameynert
ameynert temporarily deployed to github-actions-snakemake-linting June 3, 2026 22:23 — with GitHub Actions Inactive
@ameynert

ameynert commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ameynert
ameynert merged commit 0fc23c8 into main Jun 3, 2026
4 checks passed
@ameynert
ameynert deleted the chore/config-and-script-nits branch June 3, 2026 23:44
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.

compare_divref_gnomad.R: robust n_gnomad_only against duplicate variant keys

1 participant