Skip to contents

Loads genotype data for a region via loadLdMatrix(returnGenotype=TRUE) and removes monomorphic variants. Returns the raw genotype matrix and metadata, which callers can use to derive either a correlation matrix R (for summary-based weight training or fine-mapping) or an SVD (for TWAS z-score computation).

Usage

loadLdSketch(ldMetaFilePath, region, nSample = NULL)

Arguments

ldMetaFilePath

Path to the LD metadata TSV file.

region

Region of interest: "chr:start-end" string or data.frame with chrom/start/end.

nSample

Optional original panel sample size for computing variance (= 2*p*(1-p)*n/(n-1)). Passed through to loadLdMatrix().

Value

An LdData S4 object with monomorphic variants removed. Consumers should use S4 accessors: getGenotypes(), getRefPanel(), getVariantIds(). The number of sketch samples is nrow(getGenotypes(result)).

Examples

meta <- system.file("extdata", "ld_reference", "ld_meta_file.tsv",
  package = "pecotmr")
loadLdSketch(ldMetaFilePath = meta, region = "chr22:16000000-18000000")
#> LdData: 130 variants
#>   Correlation: NULL, Genotype handle: available
#>   Reference N: 1000