number.of.alleles: Compute the Number of Alleles in a Sample

Description Usage Arguments Details Value Examples

View source: R/coalesceR.R

Description

Compute the total number of alleles in a sample.

Usage

1
	number.of.alleles(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, number.of.alleles can be used to compute the number of alleles in the sample

Value

Total number of alleles in 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 the total number of alleles in the sample for that history

number.of.alleles(history)

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