generate\(algorithm\)LDpred2

LDpred2 algorithm specification

Description

Configure a single LDpred2 algorithm specification.

Usage

`generate$algorithm$LDpred2`(reference.panel, mode = c("auto", "grid", "inf"), h2.est = NULL, p.causal = 10 ^ seq(log10(1e-4), log10(0.2), length.out = 30), pval = 1, use.MLE = FALSE, ld.size = 3000, ld.thr = 0.002, alpha = 1, allow.jump.sign = FALSE, shrink.corr = 0.95, ncores = 1)

Arguments

reference.panel

Character scalar reference-panel name used for LD.

variant.space

Optional variant-space name. When supplied, PolyGenius first creates a restricted reference panel from reference.panel and this variant space, then builds LD from that derived panel. Do not pass the name of an already restricted reference panel together with variant.space.

mode

Character scalar; one of “auto”, “grid”, “inf”.

h2.est

Optional numeric vector of heritability candidates.

p.causal

Numeric vector of causal-fraction candidates. Default is a tutorial-style log-spaced sequence from 1e-4 to 0.2.

pval

Numeric scalar in ⁠[0, 1]⁠; GWAS p-value filter before fitting.

use.MLE

Logical; forwarded to LDpred2-auto.

ld.size

Integer LD construction control mapped to bigsnpr window.

ld.thr

Numeric LD construction control mapped to bigsnpr threshold.

alpha

Numeric LDpred2 parameter.

allow.jump.sign

Logical; forwarded to LDpred2-auto.

shrink.corr

Numeric shrinkage for LD correlations in LDpred2-auto.

ncores

Integer worker cores to request for this algorithm.

Details

This algorithm creates and consumes the following reactive resources:

  • polygenius.model (final output)

  • gwas.sumstats (input GWAS summary statistics)

  • ld.bigsnpr (bigsnpr-family LD storage)

ld.size and ld.thr are LD-construction controls used by the LDpred2 workflow. They are mapped onto bigsnpr LD storage fields:

  • ld.size -> window

  • ld.thr -> threshold

These are separate from LDpred2 fitting hyperparameters such as mode, h2.est, p.causal, alpha, use.MLE, and shrink.corr.

The current LDpred2 wrapper fixes the bigsnpr LD fields statistic = “r”, signed = TRUE, and phased = FALSE.

In mode = “auto”, p.causal is forwarded as the tutorial-style vector of initial p values for bigsnpr::snp_ldpred2_auto(). The returned chains are combined as recommended in the bigsnpr tutorial: compute range <- sapply(chains, function(auto) diff(range(auto$corr_est))), keep chains where range > 0.95 * quantile(range, 0.95, na.rm = TRUE), and use the row mean of beta_est across the kept chains as the final effect vector.

In mode = “grid”, LDpred2 returns a grid of effect vectors. The bigsnpr tutorial chooses the final grid model using prediction performance in a validation set. generate$algorithm$LDpred2() does not receive validation genotypes or outcomes, so validation-set model choice should be handled downstream when such data are available.

For LDpred2 parameter guidance, refer to the bigsnpr LDpred2 tutorial and extended polygenic-score documentation: https://privefl.github.io/bigsnpr/articles/LDpred2.html and https://privefl.github.io/bigsnpr-extdoc/polygenic-scores-pgs.html.

Value

ResourceSpecSet of generate algorithm resources.