gpiUtil: Utility functions for gpi()

Description Usage Arguments Details Value Author(s) See Also Examples

Description

gpLong2Wide changes data.frame with genotype probabilities in long form (one genotype per row) to wide form (one individual per row) for use in gpi.

hwp calculates genotype probabilities according to Hardy-Weinberg law for use in gpi.

Usage

1
2
  gpLong2Wide(x, id, genotype, prob, trim=TRUE)
  hwp(x, trim=TRUE)

Arguments

x

data.frame for gpLong2Wide, genotype for hwp

id

character, column name in x holding individual identifications

genotype

character, column name in x holding genotypes

prob

character, column name in x holding genotype probabilities

trim

logical, remove last column (for gpLong2Wide) or value (for hwp) of a result

Details

Hardy-Weinberg probabilities for a gene with two alleles A and B, with probabilities Pr(A) and Pr(B) are:

Value

gpLong2Wide returns a matrix with number of rows equal to number of individuals and number of columns equal to number of possible genotypes.

hwp returns a vector with Hardy-Weinberg genotype probabilities.

Author(s)

Gregor Gorjanc

See Also

gpi, genotype, expectedGenotypes

Examples

1
2
3
4
5
  if(require(genetics)) {
    gen <- genotype(c("A/A", "A/B"))
    hwp(x=gen)
    hwp(x=gen, trim=FALSE)
  }

GeneticsPed documentation built on Nov. 8, 2020, 5:54 p.m.