Study-level nSample fallback for per-variant N - #558
Merged
Conversation
GwasSumStats() gains an optional nSample slot (per-study total sample size). summaryStatsQc() now resolves N by a 4-level priority: per-variant case/control -> study case/control -> per-variant N -> study nSample. The new level fills df$N from the study scalar when a region carries no per-variant N and no case/control counts, so those studies no longer drop out at the N-cutoff filter.
loadGwasSumStatsFromManifest now forwards an nSample manifest column to GwasSumStats(nSample=), and builds a study's entry with no per-variant N when the manifest supplies a study-level scalar (nCase/nControl or nSample) - threaded as an allowNoN flag down to .resolveSumstatCols. The no-N error still fires when neither a per-variant source nor a study scalar exists. This lets the study-N fallback run end-to-end (construct.R delegates entry construction to this loader).
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.
What
GwasSumStats()gains an optionalnSampleslot (per-study total sample size), andsummaryStatsQc()resolves per-variantNby a 4-level priority:N_CASE/N_CONTROL→ effective NnCase/nControl→ effective NNcolumn → as-isnSample→ filled for every variantLevels 1–3 are the existing behavior; level 4 is new. When a region has no per-variant
Nand no case/control counts,df$Nis filled from the study scalar instead of the study dropping out at the N-cutoff filter.nSourcerecords which level was used (effective/column/total/study-n).Testing
test_sumstatsQc.Rprecedence matrix + study-n fallback tests, green against the modified pecotmr + susieR 0.16.6nSource=study-n; per-variant counts present → counts win