Skip to contents

Reduce the dimension of covariance matrix by converting z (D) to zr (Dr).

Usage

sHDL.reduct.dim(
  LD.path,
  z = NULL,
  D = NULL,
  lam.cut = NULL,
  Dr.path = NULL,
  overwrite = FALSE,
  mode = c("disk", "memory"),
  nthreads = 1,
  pattern = ".*chr(\\d{1,2})\\.(\\d{1,2})[_\\.].*",
  norm.method = c("minmax", "scaled", "none"),
  log.file = ""
)

Arguments

LD.path

Path to the .rda file where the Eigen decomposition of LD matrix is stored.

z

A matrix of Z-scores with rownames of SNP IDs. Supporting multiple columns for multiple traits.

D

A vector of genomic annotations with vector names of SNP IDs.

lam.cut

Eigenvalue cutoff for LD matrices, default lam.cut = NULL, which means no cutoff.

Dr.path

Path to the directory where the Dr matrices are stored, default Dr.path = NULL, which means do not store Dr to disk.

overwrite

Whether to overwrite the existing Dr matrices, default overwrite = FALSE.

mode

Whether to store Dr to disk or memory, default mode = "disk". If mode = "disk", Dr is stored to disk (path returned only) and lam are not returned. If mode = "memory", Dr and lam are returned.

nthreads

Number of threads to use for matrix operations, default nthreads = 1.

pattern

Chromosome and picece pattern of LD files, default is ".*chr(\d{1,2})\.(\d{1,2})[_\.].*".

norm.method

The normalization method, either "minmax" (default), "scaled" or "none". If "minmax", the annotation weight vector D is normalized to [0, 1]. If "scaled", the sum of normalized vector D is scaled to the number of annotated SNPs. If "none", the annotation weight vector D is not normalized.

log.file

Where the log should be written. If you do not specify a file, the log will be printed on the console.

Value

A list is returned with:

  • Dr The reduct RDR matrix.

  • zr The reduct z-score vector.

  • lam The eigenvalues of LD matrix.

  • Md The sum of annotation weights of SNPs in given LD matrix.

  • M The number of SNPs in given LD matrix.