getLD: Retrieve Sparse LD Matrix for a Given Chromosome

View source: R/genomic_matrix.R

getLDR Documentation

Retrieve Sparse LD Matrix for a Given Chromosome

Description

Extracts and returns a sparse LD (Linkage Disequilibrium) matrix for the specified chromosome based on genotypic data provided in 'Glist'.

Usage

getLD(Glist = NULL, chr = NULL, rsids = NULL)

Arguments

Glist

A list structure containing genotypic data, including rsids for LD calculation ('rsidsLD'), LD file locations ('ldfiles'), and 'msize' which indicates the size for surrounding region to consider for LD.

chr

A specific chromosome from which LD sets need to be extracted.

rsids

A vector of rsids that need to be included in the sparse LD matrix. Default is NULL, implying all rsids in the chromosome will be used.

Details

The function constructs the LD matrix by reading LD values from binary files stored in 'Glist$ldfiles'. Each column of the matrix represents a SNP from 'rsidsLD', and rows represent LD values for surrounding SNPs. The main diagonal (msize + 1 row) is set to 1 for all SNPs.

Value

A matrix containing LD values. The matrix is of size (msize * 2 + 1) x mchr, where mchr is the number of rsids in the chromosome. The returned matrix has column names corresponding to rsids in the chromosome, and row names representing relative positions to the current SNP, from -msize to msize.


psoerensen/qgg documentation built on March 9, 2024, 10:02 p.m.