Compute the Number of Alleles in a Sample
Compute the total number of alleles in a sample.
an object generated by the
add.mutations command lines have been executed,
number.of.alleles can be used to compute the number of alleles in the sample
Total number of alleles in 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 the total number of alleles in the sample for that history number.of.alleles(history)