Estimates genetic covariance matrix (S), sampling covariance matrix (V), and intercept matrix (I) from GWAS summary statistics using LD Score Regression with block jackknife.
Usage
ldsc(
traits,
sample.prev,
population.prev,
ld,
wld,
trait.names = NULL,
sep_weights = FALSE,
chr = 22,
n.blocks = 200,
ldsc.log = NULL,
stand = FALSE,
select = FALSE,
chisq.max = NA,
parallel = TRUE,
cores = NULL
)Arguments
- traits
Character vector of paths to .sumstats.gz files
- sample.prev
Numeric vector of sample prevalences (NA for continuous traits)
- population.prev
Numeric vector of population prevalences (NA for continuous)
- ld
Path to LD score directory (containing
<chr>.l2.ldscore.gzfiles)- wld
Path to weight LD score directory (defaults to
ld)- trait.names
Character vector of trait names (defaults to V1, V2, ...)
- sep_weights
Use separate weight LD scores (ignored in gsemr)
- chr
Number of chromosomes (default 22)
- n.blocks
Number of jackknife blocks (default 200)
- ldsc.log
Log file path (ignored in gsemr)
- stand
Standardize output (default FALSE)
- select
Variable selection method (default FALSE)
- chisq.max
Maximum chi-square filter (default NA = auto)
- parallel
Use a parallel rayon worker pool for the per-pair regression loop (default
TRUE). Set toFALSEto force single-threaded execution.- cores
Integer cap on the rayon pool size. When
NULL(the default) rayon honoursRAYON_NUM_THREADSif set, else it uses the number of logical cores reported by the OS. On many-core machines (32+) or when the underlying BLAS is multithreaded, set this explicitly to avoid oversubscribing CPUs with nested BLAS threads.
Value
A list with components:
- S
Genetic covariance matrix (k x k)
- V
Sampling covariance matrix of S (k* x k*, where k* = k(k+1)/2)
- I
LDSC intercept matrix (k x k)
- N
Sample size vector
- m
Number of SNPs used
Examples
if (FALSE) { # \dontrun{
covstruc <- ldsc(
traits = c("T1.sumstats.gz", "T2.sumstats.gz", "T3.sumstats.gz"),
sample.prev = c(NA, NA, NA),
population.prev = c(NA, NA, NA),
ld = "eur_w_ld_chr/",
wld = "eur_w_ld_chr/",
trait.names = c("V1", "V2", "V3")
)
covstruc$S # genetic covariance matrix
covstruc$I # LDSC intercept matrix
} # }