print-methods: print a phylogeny

printR Documentation

print a phylogeny

Description

Prints a phylo4 or phylo4d object in data.frame format with user-friendly column names

Usage

print(x, ...)

## S4 method for signature 'phylo4'
print(x, edgeOrder = c("pretty", "real"), printall = TRUE)

show(object)

## S4 method for signature 'phylo4'
show(object)

names(x)

## S4 method for signature 'phylo4'
names(x)

head(x, ...)

## S4 method for signature 'phylo4'
head(x, n = 20)

tail(x, ...)

## S4 method for signature 'phylo4'
tail(x, n = 20)

Arguments

x

a phylo4 tree or phylo4d tree+data object

...

optional additional arguments (not in use)

edgeOrder

in the data frame returned, the option 'pretty' returns the internal nodes followed by the tips, the option 'real' returns the nodes in the order they are stored in the edge matrix.

printall

default prints entire tree. printall=FALSE returns the first 6 rows

object

a phylo4 or phylo4d object

n

for head() and tail(), the number of lines to print

Details

This is a user-friendly version of the tree representation, useful for checking that objects were read in completely and translated correctly. The phylogenetic tree is represented as a list of numbered nodes, linked in a particular way through time (or rates of evolutionary change). The topology is given by the pattern of links from each node to its ancestor. Also given are the taxon names, node type (root/internal/tip) and phenotypic data (if any) associated with the node, and the branch length from the node to its ancestor. A list of nodes (descendants) and ancestors is minimally required for a phylo4 object.

Value

A data.frame with a row for each node (descendant), sorted as follows: root first, then other internal nodes, and finally tips.
The returned data.frame has the following columns:

label

Label for the taxon at the node (usually species name).

node

Node number, i.e. the number identifying the node in edge matrix.

ancestor

Node number of the node's ancestor.

branch.length

The branch length connecting the node to its ancestor (NAs if missing).

node.type

"root", "internal", or "tip". (internally generated)

data

phenotypic data associated with the nodes, with separate columns for each variable.

Note

This is the default show() method for phylo4, phylo4d. It prints the user-supplied information for building a phylo4 object. For a full description of the phylo4 S4 object and slots, see phylo4.

Author(s)

Marguerite Butler, Thibaut Jombart jombart@biomserv.univ-lyon1.fr, Steve Kembel

Examples



tree.phylo <- ape::read.tree(text="((a,b),c);")
tree <- as(tree.phylo, "phylo4")
##plot(tree,show.node=TRUE) ## plotting broken with empty node labels: FIXME
tip.data <- data.frame(size=c(1,2,3), row.names=c("a", "b", "c"))
treedata <- phylo4d(tree, tip.data)
plot(treedata)
print(treedata)



phylobase documentation built on May 29, 2024, 11:24 a.m.