PolyGenius
Contents

generate$algorithms$PRScs

PRS-CS algorithm specification

Declares a PRS-CS algorithm for generate$models(). Fitting is delegated to the PRS-CS Python implementation and happens during execution, not here.

Usage

generate$algorithms$PRScs(
  reference.panel,
  variant.space = NULL,
  pval = 1,
  phi = NULL,
  a = 1,
  b = 0.5,
  n.iter = 1000,
  n.burnin = 500,
  thin = 5,
  beta.std = FALSE,
  write.psi = FALSE,
  write.pst = FALSE,
  ld.blocking = "berisa-pickrell",
  ld.block.size = 1000,
  python = NULL,
  seed = 1L,
  ncores = 1
)

Arguments

ArgumentDescription
reference.panelCharacter scalar. Reference panel LD blocks are built from, named as in workspace$catalogs$referencePanels$view().
variant.spaceCharacter scalar or NULL (default). Variant space narrowing reference.panel into the effective panel used for LD blocks. Either the display name shown by workspace$catalogs$variantSpaces$view() or the catalog key selects the same space and the same cached panel; an unknown name, or a reference.panel that is already restricted, aborts.
pvalNumeric scalar in [0, 1], default 1. GWAS p-value filter applied before fitting. A vector aborts.
phiNumeric scalar, numeric vector, or NULL (default). Global shrinkage parameter; each value becomes its own model. NULL requests PRS-CS auto-phi, which learns it from the data.
aNumeric scalars, defaults 1 and 0.5. Shape parameters of the PRS-CS gamma-gamma prior.
bNumeric scalars, defaults 1 and 0.5. Shape parameters of the PRS-CS gamma-gamma prior.
n.iterInteger scalars, defaults 1000, 500 and 5. Total MCMC iterations, burn-in iterations, and thinning interval.
n.burninInteger scalars, defaults 1000, 500 and 5. Total MCMC iterations, burn-in iterations, and thinning interval.
thinInteger scalars, defaults 1000, 500 and 5. Total MCMC iterations, burn-in iterations, and thinning interval.
beta.stdLogical scalar, default FALSE. Forwarded to PRS-CS as its standardised-effect flag.
write.psiLogical scalar, default FALSE. Forwarded to PRS-CS to also write per-variant posterior shrinkage estimates.
write.pstLogical scalar, default FALSE. TRUE aborts: posterior samples are not a single effect vector and cannot become a model.
ld.blockingCharacter scalar, default "berisa-pickrell". LD blocking strategy: "berisa-pickrell" uses recombination-based approximately independent blocks matched to the panel population (equivalent to the official PRS-CS LD panels), "window" uses fixed-size windows of ld.block.size consecutive variants. Matching ignores case and treats - and . alike; any other value aborts.
ld.block.sizeInteger scalar, default 1000. Reference variants per LD block, used only when ld.blocking = "window". Must be a positive integer.
pythonCharacter scalar or NULL (default). Python executable to run PRS-CS with; NULL uses python3 or python from PATH. A runtime hint that does not enter model cache identity.
seedInteger scalar or NULL, default 1L. Random seed passed to PRS-CS; NULL records no seed.
ncoresInteger scalar, default 1. Worker cores requested for LD-block construction and the PRS-CS run. A runtime hint that does not enter model cache identity; a value above the workspace core budget aborts generate$models() before anything is scheduled.

Value

A ResourceSpecSet holding one unresolved generate-algorithm specification per phi value, for generate$models(algorithms = ). A NULL phi yields a single auto-phi specification.

Details

The rule consumes ld.blocks storage built from the effective reference panel. When variant.space is supplied PolyGenius resolves the restricted panel first and builds the LD blocks from it; the ld.blocks rule itself only ever sees the effective panel.

Fitting runs through the package's Python wrapper, which requires the upstream PRS-CS modules to be importable in the selected Python environment.

Rules behind this algorithm

BuildLDBlocksRule materializes the block-dense ld.blocks storage from the reference panel and the block boundaries, then RunPrscsRule runs the sampler against it.

Prerequisites, resolved and cached on demand: a pfile reference panel, LD block boundaries, and the PRS-CS Python environment (SetupPrscsRule).

Examples

models <- generate$models(
  sources    = generate$sources$opengwas("ieu-b-2"),
  algorithms = generate$algorithms$PRScs(
    reference.panel = "EUR",
    phi             = c(1e-2, 1e-4)
  )
)

See Also

Aliases: generate-prscs, generate.algorithm.PRScs, generate$algorithms$PRScs