PolyGenius
Contents

BuildLDBlocksRule

Build block-dense LD storage rule

BuildLDBlocksRule materializes a block-dense ld.blocks reference layout (per-block dense LD matrices in PRS-CS HDF5 format).

Details

The rule materializes an ld.blocks resource from a concrete pfile reference.panel. Blocks are defined by one of two strategies:

  • berisa.pickrell (default): recombination-based approximately-independent LD blocks, selected by the reference panel's population through the workspace$catalogs$LDblocks catalog. Statistically equivalent to the official PRS-CS LD panels.
  • window: fixed-size windows of block.size consecutive reference variants.

The rule builds the neutral PolyGenius block-dense reference layout:

  • snpinfo
  • ldblk_chr<chrom>.hdf5

The snpinfo file uses the columns consumed by PRS-CS (CHR, SNP, BP, A1, A2, MAF) without embedding any HM3, 1KG, or UKBB naming assumption. HDF5 chromosome files contain blk_<n> groups with ldblk and snplist datasets, matching the structure consumed by PRS-CS.

This rule receives an already resolved reference panel. User-facing variant.space selection is handled by algorithm binding before this rule is requested, so the ld.blocks identity only needs the concrete panel, genome build, and blocking strategy.

The persisted resource is relocatable: data.rds stores only relative manifest information and variant indexes, while the canonical LD matrices live beside it as PRS-CS HDF5 chromosome files. Absolute paths are always derived from the resource store at load/runtime.

Dense LD blocks are computed through the GenotypeSource LD interface so this rule does not convert the reference panel to bigsnpr/SFBM storage. The HDF5 structure written here follows the layout consumed by the PolyGenius PRS-CS Python wrapper: one ldblk_chr<chrom>.hdf5 file per chromosome with blk_<n>/ldblk and blk_<n>/snplist datasets.

Super class

PolyGenius::Rule -> BuildLDBlocksRule

Methods

Public methods

  • BuildLDBlocksRule$new()
  • BuildLDBlocksRule$matches()
  • BuildLDBlocksRule$inputs()
  • BuildLDBlocksRule$requirements()
  • BuildLDBlocksRule$run()
  • BuildLDBlocksRule$clone()

Method new()

Create the block-dense LD storage rule.

Usage

BuildLDBlocksRule$new()

Method matches()

Check whether this rule can produce the requested output.

Usage

BuildLDBlocksRule$matches(output.spec)

Arguments

output.spec — Output resource specification.

Returns

TRUE for ld.blocks outputs.

Method inputs()

Build required inputs (reference panel, plus block boundaries for the Berisa-Pickrell strategy).

Usage

BuildLDBlocksRule$inputs(output.spec)

Arguments

output.spec — Output resource specification.

Returns

Named list of input specifications.

Method requirements()

Declare resource requirements for this rule.

Usage

BuildLDBlocksRule$requirements(output.spec, inputs)

Arguments

output.spec — Output resource specification.

inputs — Bound input values/specifications.

Returns

Named list with cores and memory.

Method run()

Execute block-dense LD materialization.

Usage

BuildLDBlocksRule$run(output.spec, inputs, logger = pg.logger())

Arguments

output.spec — Output resource specification.

inputs — Named list of bound input values.

logger — Rule logger.

Returns

Rule result list.

Method clone()

The objects of this class are cloneable with this method.

Usage

BuildLDBlocksRule$clone(deep = FALSE)

Arguments

deep — Whether to make a deep clone.

See Also