Skip to contents

Construct an LdData from a correlation matrix and/or genotype handle, plus variant metadata as a GRanges.

Usage

LdData(
  correlation = NULL,
  genotypeHandle = NULL,
  snpIdx = NULL,
  variants,
  blockMetadata,
  nRef = 0L,
  mixtureWeights = NULL
)

Arguments

correlation

A correlation matrix, list of matrices, or NULL.

genotypeHandle

A genotype panel (see readGenotypes), a list of panels for a mixture reference, a matrix of already-extracted dosages, or NULL.

snpIdx

Vector of 1-based SNP indices, coerced to integer, or NULL.

variants

A GRanges with variant metadata (must have variant_id in mcols, plus A1, A2).

blockMetadata

GRanges of blocks, or data.frame with block info.

nRef

Integer, reference panel sample size.

mixtureWeights

Optional numeric vector of mixing proportions, one per panel in genotypeHandle when it is a list. Must be non-negative and sum to 1. Required whenever genotypeHandle is a list and downstream code will call getCorrelation().

Value

An LdData object.

Examples

data(eqtlRegionExample)
X <- eqtlRegionExample$X[, 1:8]
gr <- GenomicRanges::GRanges("22",
  IRanges::IRanges(seq(1L, by = 100L, length.out = 8), width = 1L))
ld <- LdData(correlation = cor(X), variants = gr,
  blockMetadata = S4Vectors::DataFrame(
    chrom = "22", start = 1L, end = 1000L))
ld
#> LdData: 8 variants
#>   Correlation: single, Genotype handle: NULL
#>   Reference N: 0