Skip to contents

Assemble a per-condition QtlSumStats from an aligned pair of variants x conditions effect-size (Bhat) and standard-error (Shat) matrices – the beta-scale (EE) counterpart of qtlSumStatsFromZMatrix. Each entry carries BETA, SE, and (derived) Z = BETA / SE mcols, so the result feeds mashPipeline / mashModelFit on either scale (inputScale = "beta" or "z"). Chromosome / position are decoded from the row (variant) ids exactly as in qtlSumStatsFromZMatrix.

Usage

qtlSumStatsFromBetaMatrix(
  bhat,
  shat,
  study,
  ldSketch = NULL,
  context = colnames(bhat),
  trait = "mash",
  genome = "GRCh38",
  n = 1000L,
  a1 = "A",
  a2 = "G",
  role = "mash"
)

Arguments

bhat

Numeric matrix (variants x conditions) of effect sizes. rownames(bhat) are variant ids; colnames(bhat) label the conditions.

shat

Numeric matrix of standard errors, aligned with bhat (identical dimensions and row/column order).

study

Study identifier (recycled across conditions).

ldSketch

A genotype panel (see readGenotypes) embedded in the collection, or NULL (default) – mash operates across conditions per variant and needs no LD reference.

context, trait

Condition labels; see qtlSumStatsFromZMatrix. Defaults context = colnames(bhat), trait = "mash".

genome

Genome build. Default "GRCh38".

n

Placeholder per-variant sample size. Default 1000.

a1, a2

Placeholder alleles. Defaults "A" / "G".

role

Tag stored in the qcInfo record. Default "mash".

Value

A QtlSumStats with one entry per condition (column).

Examples

panel <- readGenotypes(
  system.file("extdata", "toy_ref.bed", package = "pecotmr"))
bhat <- matrix(rnorm(6), 2, 3, dimnames = list(
  c("chr22:1:A:G", "chr22:2:A:G"), c("brain", "blood", "muscle")))
shat <- matrix(0.1, 2, 3, dimnames = dimnames(bhat))
qtlSumStatsFromBetaMatrix(bhat = bhat, shat = shat, study = "s1",
  ldSketch = panel, context = colnames(bhat), trait = "g1",
    genome = "hg38", n = 100)
#> QtlSumStats: 3 entries, genome build hg38
#>   1 studies, 3 contexts, 1 traits
#>   LD sketch: plink1 @ /tmp/RtmppU8QTb/temp_libpath984aa04109/pecotmr/extdata/toy_ref