Skip to contents

Extracts coefficients from an existing single-effect fit, as produced by fineMappingPipeline(..., methods = "ser") on summary statistics. The SER model carries the same alpha / mu / X_column_scale_factors structure as a SuSiE fit — with a single effect, so alpha has one row — so extraction is identical.

Usage

serWeights(
  X = NULL,
  y = NULL,
  serFit = NULL,
  fitRetention = c("none", "slim", "full")
)

Arguments

X

Optional genotype matrix; when supplied it is only used to check that the fit covers the same number of variants.

y

Unused; retained for signature compatibility.

serFit

Optional fitted SER object.

fitRetention

How much of the fit is kept on the returned weights: "none" attaches nothing, "slim" and "full" attach it as the "fit" attribute. These extractors hold no trimmable intermediates, so the two retaining levels behave alike here.

Value

Numeric vector of variant weights.

Details

SER fits only exist on the summary-statistics path, because susieR::susie_ser is the only implementation fineMappingPipeline has for the "ser" method. That does not restrict the weights: a fit is a fit, and weights read off an RSS fit are as usable for TWAS as any from penalized regression.

Examples

data(eqtlRegionExample)
X <- eqtlRegionExample$X[, 1:30]
y <- eqtlRegionExample$yRes
z <- apply(X, 2, function(g) summary(stats::lm(y ~ g))$coefficients[2, 3])
fit <- suppressWarnings(susieR::susie_ser(z = z, n = nrow(X)))
#> HINT: susie_ser() uses a one-effect credible-set model as in Maller et al. 2012. Because no LD reference is supplied, credible sets are reported without purity filtering; susie_ser() applies the attainable-coverage filter from SparsePro (Zhang et al. 2023). Set coverage = NULL to skip CS construction and silence this hint, or call susie_get_cs(fit, Xcorr = R, ...) afterward to apply a purity filter.
serWeights(serFit = fit)
#> chr22:32119788:T:C chr22:32119867:T:G chr22:32119961:T:G chr22:32120053:T:C 
#>                  0                  0                  0                  0 
#> chr22:32120593:A:G chr22:32120636:T:C chr22:32120932:G:A chr22:32120975:A:G 
#>                  0                  0                  0                  0 
#> chr22:32121290:C:T chr22:32121498:A:C chr22:32121635:T:G chr22:32121702:A:G 
#>                  0                  0                  0                  0 
#> chr22:32121936:G:A chr22:32122351:A:G chr22:32122676:A:G chr22:32123055:A:G 
#>                  0                  0                  0                  0 
#> chr22:32123164:T:C chr22:32123383:T:C chr22:32123461:T:C chr22:32123806:C:T 
#>                  0                  0                  0                  0 
#> chr22:32124049:G:A chr22:32124126:C:T chr22:32124147:A:C chr22:32124381:G:A 
#>                  0                  0                  0                  0 
#> chr22:32124644:A:G chr22:32124683:T:C chr22:32124952:C:A chr22:32125308:A:G 
#>                  0                  0                  0                  0 
#> chr22:32125638:A:C chr22:32125730:G:A 
#>                  0                  0