ancestral.pml: Ancestral character reconstruction.

View source: R/ancestral.R

ancestral.pmlR Documentation

Ancestral character reconstruction.

Description

Marginal reconstruction of the ancestral character states.

Usage

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

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

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

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

Arguments

object

an object of class pml

type

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

...

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.

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").

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.

Author(s)

Klaus Schliep klaus.schliep@gmail.com

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, ltg2amb, latag2n, gap_as_state, root, makeNodeLabel

Examples


example(NJ)
# generate node labels to ensure plotting will work
tree <- makeNodeLabel(tree)
fit <- pml(tree, Laurasiatherian)
anc.ml <- ancestral.pml(fit, type = "ml")
anc.p <- ancestral.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)


KlausVigo/phangorn documentation built on June 23, 2024, 10:49 p.m.