compute_ld: Linkage disequilibrium computation

View source: R/compute_ld.R

compute_ldR Documentation

Linkage disequilibrium computation

Description

This function computes linkage disequilibrium (LD) for a set of selected loci. The measure can be either r2, r2v, r2s, or r2vs. Function ld from package snpStats is used when computing r2, whereas r2 values corrected with kinship data (r2v), population structure (r2s), or both (r2vs) make use of function LD.Measures from package LDcorSV.

Usage

compute_ld(snp_data, measure, kinship = NULL, structure = NULL)

Arguments

snp_data

A list of SNP data comprising at least an element called Genotypes, a SnpMatrix object containing the genotype of individuals included in the analysis.

measure

A character of length one. The r2 measure that was used for computing the linkage disequilibrium values in LD. Can be either "r2", "r2v", "r2s", "r2vs".

kinship

A square numeric matrix of kinship values with as many rows and columns as there are individuals included in the analysis. More specifically, kinship must have as many rows and columns as there are rows in snp_data$Genotypes.

structure

A numeric matrix with as many rows as there are individuals in the analysis and as many columns as there are putative subpopulations in the dataset.

Details

An error will be thrown if the function is asked to compute an r2 measure without all required inputs (kinship and/or structure data). If kinship and/or structure data are given as input but the computed measure makes no use of these data, they will be ignored with a warning.

Value

A list with two components :

  • LD A symmetric Matrix of class dsCMatrix containing linkage disequilibrium values for all marker pairs.

  • LD_measure A character of length one. The r2 measure that was used for computing the linkage disequilibrium values in LD. Can be either "r2", "r2v", "r2s", "r2vs".

Examples

NULL


malemay/HaplotypeMiner documentation built on Feb. 6, 2024, 3:29 a.m.