Rev Language Reference


maximumTree - Maximum tree function to build a species tree.

Builds the maximum species tree given several ultrametric gene trees.

Usage

maximumTree(TimeTree[] geneTrees)

Arguments

geneTrees : TimeTree[] (pass by const reference)
The vector of trees from which to pick the maximum.

Return Type

Details

The maximum species tree is a consistent estimate of the species tree under the multispecies coalescent model, if the gene trees are correct and the effective population size constant along the species tree.

Example

# We simulate a species tree and gene trees and reconstruct a species tree using maximum tree:
# Let's simulate a species tree with 10 taxa, 5 gene trees, 1 alleles per species:
n_species <- 10
n_genes <- 5
n_alleles <- 2

# We simulate an ultrametric species tree.
# Species names:
for (i in 1:n_species) {
    species[i] <- taxon(taxonName="Species_"+i, speciesName="Species_"+i)
}
spTree ~ dnBirthDeath(lambda=0.3, mu=0.2, rootAge=10, rho=1, samplingStrategy="uniform", condition="nTaxa", taxa=species)
print(spTree)

# Let's pick a constant effective population size of 50:
popSize <- 50

# Let's simulate gene trees now.
# Taxon names:
for (g in 1:n_genes) {
    for (i in 1:n_species) {
        for (j in 1:n_alleles) {
            taxa[g][(i-1)*n_alleles+j] <- taxon(taxonName="Species_"+i, speciesName="Species_"+i)
        }
    }
    geneTrees[g] ~ dnMultiSpeciesCoalescent(speciesTree=spTree, Ne=popSize, taxa=taxa[g])
}

# Let's compute the maximum tree:
recTree <- maximumTree(geneTrees)
print(recTree)