Last data update: 2014.03.03

R: Basic statistics for a 'bed.matrix'
set.statsR 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.ped_stats=TRUE, set.snps_stats=TRUE, set.p = TRUE, 
          set.mu_sigma = TRUE, verbose = getOption("gaston.verbose", TRUE))

Arguments

x

A bed.matrix

set.ped_stats

If TRUE, x@ped is updated

set.snps_stats

If TRUE, x@snps is updated

set.p

If TRUE, x@p is updated

set.mu_sigma

If TRUE, x@mu and x@sigma are updated

verbose

If TRUE, display information on the function actions

Details

This function 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).

If set.ped_stats = TRUE, the following variables are updated in x@ped :

  • N0, N1, N2 and NAs give for each individual the number of SNPs with a genotype equal to 0, 1, 2 and missing, respectively

  • callrate is the individual callrate.

If set.snps_stats = TRUE, the following variables are updated in x@snps :

  • N0, N1, N2 and NAs give for each SNP the number of individuals with a genotype equal to 0, 1, 2 and missing, respectively

  • callrate is the SNP callrate

  • maf is the Minor Allele Frequency

  • hz is the heterozygosity

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<c3><83><c2><a9> Perdry and Claire Dandine-Roulland

See Also

set.hwe, set.genomic.sex

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)

Results