Learn R Programming

gaston (version 1.2)

set.stats: 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

Value

A bed.matrix similar to x, with slots updated as described above.

Details

If set.ped_stats = TRUE, the following variables are updated in x@ped :
  • N0,N1,N2andNAsgive for each individual the number of SNPs with a genotype equal to 0, 1, 2 and missing, respectively
  • callrateis the individual callrate.

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

  • N0,N1,N2andNAsgive for each SNP the number of individuals with a genotype equal to 0, 1, 2 and missing, respectively
  • callrateis the SNP callrate
  • mafis the Minor Allele Frequency
  • hzis 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).

See Also

set.hwe

Examples

Run this code
# Load data
data(TTN)
x <- as.bed.matrix(TTN.gen, TTN.fam, TTN.bim)

# Compute statistics
x <- set.stats(x)
str(x@ped)
str(x@snps)

Run the code above in your browser using DataLab