estimGenRel | R Documentation |
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".
estimGenRel(
X,
afs = NULL,
thresh = NULL,
relationships = "additive",
method = "vanraden1",
theta = 0.5,
alpha = NULL,
verbose = 1
)
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 |
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" |
alpha |
if not NULL, weight to make the matrix invertible as it often is singular because two genotypes are clones or because the centered-coding of SNP genotypes makes the last row predictable from the other ones (see Stranden and Christensen, 2011); otherwise use |
verbose |
verbosity level (0/1) |
symmetric matrix with the number of SNPs used as an attribute
Timothee Flutre
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.