Skip to contents

Bundles the in-memory outputs of the S-LDSC readers into a single object for sldscPostprocessingPipeline. Performs no file I/O.

Usage

SldscData(annot, frq = NULL, traits = list())

# S4 method for class 'SldscData'
show(object)

Arguments

annot

A target-annotation data.frame (e.g. from readSldscAnnot): CHR, SNP, and one or more annotation columns.

frq

Optional reference-panel allele-frequency data.frame (e.g. from readSldscFrq): SNP, MAF. NULL (the default) stores an empty frame, which disables MAF-based filtering.

traits

A named list of per-trait runs; each entry a list with a single list (per-target readSldscTrait outputs) and an optional joint run.

object

An SldscData object (used by the show method).

Value

An SldscData object.

Examples

mkRun <- function(cats) {
  n <- length(cats)
  list(categories = cats, tau = setNames(rep(1e-7, n), cats),
    tauSe = setNames(rep(3e-8, n), cats),
    enrichment = setNames(rep(2, n), cats),
    enrichmentSe = setNames(rep(0.4, n), cats),
    enrichmentP = setNames(rep(0.01, n), cats),
    propH2 = setNames(rep(0.2, n), cats),
    propSnps = setNames(rep(0.1, n), cats), h2g = 0.3,
    tauBlocks = matrix(1e-7, 10, n, dimnames = list(NULL, cats)),
    nBlocks = 10L)
}
annot <- data.frame(CHR = c(1, 1, 1, 2, 2, 2), SNP = paste0("rs", 1:6),
  annot_A = c(1, 0, 1, 0, 1, 0), annot_B = c(2.1, 1.8, 2.5, 1.9, 2.3, 2))
frq <- data.frame(CHR = c(1, 1, 1, 2, 2, 2), SNP = paste0("rs", 1:6),
  MAF = rep(0.2, 6))
mkTrait <- function() {
  list(single = list(mkRun(c("annot_A_0", "baselineLD_0")),
    mkRun(c("annot_B_0", "baselineLD_0"))),
    joint = mkRun(c("annot_A_0", "annot_B_0", "baselineLD_0")))
}
traits <- setNames(list(mkTrait(), mkTrait()), c("traitX", "traitY"))
sd <- SldscData(annot = annot, frq = frq, traits = traits)
sd
#> SldscData
#>   annotations (2): annot_A, annot_B
#>   annot SNPs: 6 | frq SNPs: 6
#>   traits (2): traitX, traitY