Skip to content

Study-level nSample fallback for per-variant N - #558

Merged
gaow merged 2 commits into
StatFunGen:mainfrom
Yining97:rss-study-n
Jul 30, 2026
Merged

Study-level nSample fallback for per-variant N#558
gaow merged 2 commits into
StatFunGen:mainfrom
Yining97:rss-study-n

Conversation

@Yining97

Copy link
Copy Markdown
Contributor

What

GwasSumStats() gains an optional nSample slot (per-study total sample size), and summaryStatsQc() resolves per-variant N by a 4-level priority:

  1. per-variant N_CASE/N_CONTROL → effective N
  2. study-level nCase/nControl → effective N
  3. per-variant N column → as-is
  4. study-level nSample → filled for every variant

Levels 1–3 are the existing behavior; level 4 is new. When a region has no per-variant N and no case/control counts, df$N is filled from the study scalar instead of the study dropping out at the N-cutoff filter. nSource records which level was used (effective/column/total/study-n).

Testing

  • test_sumstatsQc.R precedence matrix + study-n fallback tests, green against the modified pecotmr + susieR 0.16.6
  • Full suites: sumstatsQc / fineMappingPipeline / fineMappingWrappers / ld, plus colocboost
  • Real-data validation on chr21 AD_Bellenguez: study-n only → nSource=study-n; per-variant counts present → counts win

Yining97 added 2 commits July 28, 2026 17:23
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).
@gaow
gaow merged commit f0ee227 into StatFunGen:main Jul 30, 2026
4 of 5 checks passed
@Yining97
Yining97 deleted the rss-study-n branch July 30, 2026 16:13
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.

2 participants