ldmat {hibayes}R Documentation

LD variance-covariance matrix calculation

Description

To calculate density or sparse LD variance-covariance matrix with genotype in bigmemory format.

Usage

ldmat(
  geno,
  map = NULL,
  gwas.geno = NULL,
  gwas.map = NULL,
  chisq = NULL,
  ldchr = FALSE,
  threads = 4,
  verbose = FALSE
)

Arguments

geno

the reference genotype panel in bigmemory format.

map

the map information of reference genotype panel, columns are: SNPs, chromosome, physical position.

gwas.geno

(optional) the genotype of gwas samples which were used to generate the summary data.

gwas.map

(optional) the map information of the genotype of gwas samples, columns are: SNPs, chromosome, physical position.

chisq

chi-squre value for generating sparse matrix, if n*r2 < chisq, it would be set to zero.

ldchr

lpgical, whether to calulate the LD between chromosomes.

threads

the number of threads used in computation.

verbose

whether to print the information.

Value

For full ld matrix, it returns a standard R matrix, for sparse matrix, it returns a 'dgCMatrix'.

Examples

bfile_path = system.file("extdata", "demo", package = "hibayes")
data = read_plink(bfile_path)
geno = data$geno
map = data$map

xx = ldmat(geno, threads=4, verbose=FALSE)   #chromosome wide full ld matrix
# xx = ldmat(geno, chisq=5, threads=4)   #chromosome wide sparse ld matrix
# xx = ldmat(geno, map, ldchr=FALSE, threads=4)   #chromosome block ld matrix
# xx = ldmat(geno, map, ldchr=FALSE, chisq=5, threads=4)   #chromosome block + sparse ld matrix



[Package hibayes version 3.0.3 Index]