estimGenRel: Genomic relatedness

View source: R/quantgen.R

estimGenRelR Documentation

Genomic relatedness

Description

Estimate genetic relationships between genotypes from their SNP genotypes. Note that this function estimates "relationships" and not "coancestries". See Toro et al (2011): "for diploid individuals, twice the coancestry coefficient is the additive relationship coefficient, which describes the ratio between the genetic covariance between individuals and the genetic variance of the base population".

Usage

estimGenRel(
  X,
  afs = NULL,
  thresh = NULL,
  relationships = "additive",
  method = "vanraden1",
  theta = 0.5,
  verbose = 1
)

Arguments

X

matrix of bi-allelic SNP genotypes encoded in allele doses in 0,1,2, with genotypes in rows and SNPs in columns; missing values should be encoded as NA

afs

vector of allele frequencies, corresponding to the alleles whose copies are counted in X (if NULL, will be calculated with estimSnpAf)

thresh

threshold on minor allele frequencies below which SNPs are ignored (e.g. 0.01; NULL to skip this step)

relationships

relationship to estimate (additive/dominant/gaussian) where "gaussian" corresponds to the Gaussian kernel from Endelman (2011)

method
theta

smoothing parameter for "gauss"

verbose

verbosity level (0/1)

Value

symmetric matrix with the number of SNPs used as an attribute

Author(s)

Timothee Flutre

Examples

## Not run: set.seed(1859)
nb.genos <- 200
Ne <- 10^4
chrom.len <- 10^5
mu <- 10^(-8)
c <- 10^(-8)
genomes <- simulCoalescent(nb.inds=nb.genos,
                           pop.mut.rate=4 * Ne * mu * chrom.len,
                           pop.recomb.rate=4 * Ne * c * chrom.len,
                           chrom.len=chrom.len)
X <- genomes$genos

A.vr <- estimGenRel(X=X, relationships="additive", method="vanraden1")
mean(diag(A.vr)) # should be 1 in a base population at HWE
mean(A.vr[upper.tri(A.vr)]) # should be 0 in a base population at HWE

D.v <- estimGenRel(X=X, relationships="dominant", method="vitezica")
mean(diag(D.v)) # should be 1 in a base population at HWE
mean(D.v[upper.tri(D.v)]) # should be 0 in a base population at HWE

## End(Not run)

timflutre/rutilstimflutre documentation built on Feb. 7, 2024, 8:17 a.m.