Skip to contents

Bundle pre-computed LD scores with the variants they describe.

Usage

LdScore(
  snpInfo,
  ldScores,
  ldScoreWeights,
  ldBlocks,
  nRef,
  inSample = FALSE,
  genome = NA_character_,
  ldMatrixList = list()
)

Arguments

snpInfo

A data.frame with columns SNP, CHR, BP, A1, A2 (and optionally MAF).

ldScores

A numeric matrix, one row per variant. The first column is the base LD score (sum of r^2); further columns are annotation-stratified scores.

ldScoreWeights

Numeric regression weights, one per variant.

ldBlocks

A GRanges of LD block intervals.

nRef

Integer, sample size of the LD reference panel.

inSample

Logical, whether the reference is the GWAS cohort.

genome

Character, genome build; recorded in seqinfo().

ldMatrixList

Optional list of per-block LD matrices (g-LDSC only).

Value

An LdScore.

Examples

snpInfo <- data.frame(SNP = paste0("rs", 1:4), CHR = "chr1",
  BP = c(50L, 150L, 250L, 350L), A1 = "A", A2 = "G")
blocks <- GenomicRanges::GRanges("chr1",
  IRanges::IRanges(c(1L, 200L), c(199L, 400L)))
ls <- LdScore(snpInfo = snpInfo,
  ldScores = matrix(runif(4), ncol = 1, dimnames = list(NULL, "base_l2")),
  ldScoreWeights = rep(1, 4), ldBlocks = blocks, nRef = 100L,
  inSample = FALSE, genome = "hg19")
length(ls)
#> [1] 4
head(getLdScores(ls))
#>         base_l2
#> [1,] 0.20417834
#> [2,] 0.71339728
#> [3,] 0.06521611
#> [4,] 0.35420680