set.stats {gaston} | R Documentation |
Basic statistics for a bed.matrix
Description
Return an updated bed.matrix
with new variables for
several basic statistics.
Usage
set.stats(x, set.p = TRUE, set.mu_sigma = TRUE,
verbose = getOption("gaston.verbose",TRUE))
set.stats.snps(x, set.p = TRUE, set.mu_sigma = TRUE,
verbose = getOption("gaston.verbose",TRUE))
set.stats.ped(x, verbose = getOption("gaston.verbose",TRUE))
Arguments
x |
|
set.p |
If |
set.mu_sigma |
If |
verbose |
If |
Details
set.stats
is called by default by all functions that create a bed.matrix, unless
the global option gaston.auto.set.stats
is FALSE
(cf example below).
set.stats
and set.stats.ped
update x@ped
, adding the following variables:
-
N0
,N1
,N2
andNAs
give for each individual the number of autosomal SNPs with a genotype equal to 0, 1, 2 and missing, respectively -
N0.x
,N1.x
,N2.x
andNAs.x
idem for chromosome X -
N0.y
,N1.y
,N2.y
andNAs.y
idem for chromosome Y -
N0.mt
,N1.mt
,N2.mt
andNAs.mt
idem for mitochondrial SNPs -
callrate
,callrate.x
,callrate.y
,callrate.mt
is the individual callrate for autosomal, X, Y, mitochondrial SNPs -
hz
,hz.x
,hz.y
,hz.mt
is the individual heterozygosity for autosomal, X, Y, mitochondrial SNPs
set.stats
and set.stats.snps
update x@snps
, adding the following variables:
-
N0
,N1
,N2
andNAs
give for each SNP the number of individuals with a genotype equal to 0, 1, 2 and missing, respectively -
N0.f
,N1.f
,N2.f
andNAs.f
give, only for SNPs on chromosome X, the number of female individuals with a genotype equal to 0, 1, 2 and missing, respectively -
callrate
is the SNP callrate (for Y linked SNPs, the callrate is computed usin males only). -
maf
is the Minor Allele Frequency -
hz
is the SNP heterozygosity (for X linked SNPs, the heterozygosity is computed using females only).
If set.p = TRUE
, x@p
is updated with the alternate allele frequency.
If set.mu_sigma = TRUE
, x@mu
is updated with the genotype mean (equal to 2*x@p
)
and x@sigma
with the genotype standard deviation (should be approximately sqrt(2*x@p*(1-x@p))
under Hardy-Weinberg Equilibrium).
Value
A bed.matrix
similar to x
, with slots updated as described above.
Author(s)
Hervé Perdry and Claire Dandine-Roulland
See Also
Examples
# Disable auto set stats :
options(gaston.auto.set.stats = FALSE)
# Load data
data(TTN)
x <- as.bed.matrix(TTN.gen, TTN.fam, TTN.bim)
str(x@ped)
str(x@snps)
# Compute statistics
x <- set.stats(x)
str(x@ped)
str(x@snps)
# restore default behavior
options(gaston.auto.set.stats = TRUE)