Compute the Heterozygosity of a Sample of Genes
Compute Nei's unbiased heterozygosity of a sample of genes.
an object generated by the
add.mutations command lines have been executed,
heterozygosity can be used to compute Nei's heterozygosity of the sample
Nei's unbiased heterozygosity of the sample contained in the object ‘history’
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)