Learn R Programming

phangorn (version 2.12.1)

ancestral.pml: Ancestral character reconstruction.

Description

Marginal reconstruction of the ancestral character states.

Usage

ancestral.pml(object, type = "marginal", return = "prob", ...)

anc_pml(object, type = "marginal", ...)

# S3 method for ancestral as.phyDat(x, ...)

# S3 method for ancestral as.data.frame(x, ...)

ancestral.pars(tree, data, type = c("MPR", "ACCTRAN", "POSTORDER"), cost = NULL, return = "prob", ...)

anc_pars(tree, data, type = c("MPR", "ACCTRAN", "POSTORDER"), cost = NULL, ...)

pace(tree, data, type = c("MPR", "ACCTRAN", "POSTORDER"), cost = NULL, return = "prob", ...)

Value

An object of class ancestral. This is a list containing the tree with node labels, the original alignment as an phyDat object, a data.frame containing the probabilities belonging to a state for all (internal nodes) and the most likely state.

Arguments

object

an object of class pml

type

method used to assign characters to internal nodes, see details.

return

return a phyDat object or matrix of probabilities.

...

Further arguments passed to or from other methods.

x

an object of class ancestral

tree

a tree, i.e. an object of class pml

data

an object of class phyDat

cost

A cost matrix for the transitions between two states.

Author

Klaus Schliep klaus.schliep@gmail.com

Details

The argument "type" defines the criterion to assign the internal nodes. For ancestral.pml so far "ml and marginal (empirical) "bayes" and for ancestral.pars "MPR" and "ACCTRAN" are possible.

The function return a list containing the tree with node labels, the original alignment as an phyDat object, a data.frame containing the probabilities belonging to a state for all (internal nodes) and the most likely state. For parsimony and nucleotide data the most likely state might be ambiguous. For ML this is very unlikely to be the case.

If the input tree does not contain unique node labels the function ape::MakeNodeLabel is used to create them.

With parsimony reconstruction one has to keep in mind that there will be often no unique solution.

The functions use the node labels of the provided tree (also if part of the pml object) if these are unique. Otherwise the function ape::MakeNodeLabel is used to create them.

For further details see vignette("Ancestral").

References

Felsenstein, J. (2004). Inferring Phylogenies. Sinauer Associates, Sunderland.

Swofford, D.L., Maddison, W.P. (1987) Reconstructing ancestral character states under Wagner parsimony. Math. Biosci. 87: 199--229

Yang, Z. (2006). Computational Molecular evolution. Oxford University Press, Oxford.

See Also

pml, parsimony, ace, plotAnc, latag2n.phyDat, latag2n, gap_as_state, root, makeNodeLabel

Examples

Run this code

example(NJ)
# generate node labels to ensure plotting will work
tree <- makeNodeLabel(tree)
fit <- pml(tree, Laurasiatherian)
anc.ml <- anc_pml(fit)
anc.p <- anc_pars(tree, Laurasiatherian)
# plot ancestral sequences at the root
plotSeqLogo( anc.ml, 48, 1, 20)
plotSeqLogo( anc.p, 48, 1, 20)
# plot the first character
plotAnc(anc.ml)
# plot the third character
plotAnc(anc.ml, 3)

Run the code above in your browser using DataLab