Skip to content

Derive Wald z from beta/se when z is absent - #559

Merged
gaow merged 2 commits into
StatFunGen:mainfrom
Yining97:rss-beta-se-input
Jul 30, 2026
Merged

Derive Wald z from beta/se when z is absent#559
gaow merged 2 commits into
StatFunGen:mainfrom
Yining97:rss-beta-se-input

Conversation

@Yining97

Copy link
Copy Markdown
Contributor

What

Many case/control GWAS publish beta+se with no z. The shared sumstats reader .resolveSumstatCols required z, so those inputs errored and had to be pre-processed.

Now it requires z or (beta+se): when z is absent it derives Z = beta/se (the Wald z, matching susie_rss's z_method="wald"). A supplied z takes precedence; it errors only when neither is available. beta/se still attach as optional columns.

Pure pecotmr change — the protocol's gwas_sumstats_construct.R delegates reading to loadGwasSumStatsFromManifest, and beta/se are already mappable, so no protocol change is needed.

Testing

Against main (post-#557/#558) + susieR 0.16.6, real chr21 AD_Bellenguez:

  • test_manifestLoaders (142, +4 new) + test_sumstatsQc (819) green — beta/se derivation coexists with Study-level nSample fallback for per-variant N #558's N-handling in .resolveSumstatCols.
  • Real chr21: beta/se-only → Z=beta/se (max err 1.7e-14), QC completes; z present → z used, not beta/se (precedence).
  • Full sos run on a beta/se-only input completes end-to-end.

Yining97 added 2 commits July 30, 2026 12:39
.resolveSumstatCols now requires a z column OR beta+se: when z is
absent but beta and se are present it sets Z = beta/se (the Wald
z-score, matching susie_rss z_method=wald). A supplied z takes
precedence and is never overwritten; it still errors when neither is
available. Lets beta/se-only GWAS sumstats run without a precomputed z
(the protocol construct step delegates reading to this loader, so no
protocol change is needed).
The .fmFitSusieRss rssControl-forwarding test mocks susie_rss_control(),
which only exists in susieR >= 0.16.6; on the CI r44 env (susieR 0.16.4)
local_mocked_bindings() can't find the binding and errors. Skip it when
susieR lacks susie_rss_control - rssControl is a 0.16.6-only feature
anyway. (Test came in with StatFunGen#557; it also fails CI here on this branch.)
@gaow
gaow merged commit 039ee01 into StatFunGen:main Jul 30, 2026
4 of 5 checks passed
@Yining97
Yining97 deleted the rss-beta-se-input branch July 30, 2026 18:39
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