heterozygosity: Compute the Heterozygosity of a Sample of Genes

Description Usage Arguments Details Value Examples

View source: R/coalesceR.R

Description

Compute Nei's unbiased heterozygosity of a sample of genes.

Usage

1
  heterozygosity(tree.with.mutations)

Arguments

tree.with.mutations

an object generated by the add.mutations command

Details

Once the sim.tree and add.mutations command lines have been executed, heterozygosity can be used to compute Nei's heterozygosity of the sample

Value

Nei's unbiased heterozygosity of the sample contained in the object ‘history’

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## This is to simulate a coalescent tree using the Hudson's algorithm, 
## with 20 sampled lineages. In this example, the current population size
## is 100. It was 1000 before a bottleneck that occurred 50 generations ago

tree <- sim.tree(method = "hudson",sample = 20,current = 100,ancestral = 1000,time = 50)

## This is to generate a history, with a graphical outputs with labels,
## using a mutation rate of 0.001

history <- add.mutations(tree,mu = 0.001,graphics = TRUE, labels = TRUE)

## This is to compute Nei's unbiased heterozygosity for that sample

heterozygosity(history)

coalesceR documentation built on May 2, 2019, 4:42 p.m.