Learn R Programming

aphylo (version 0.3-3)

aphylo_from_data_frame: Create an aphylo object with partial annotations

Description

Create an aphylo object with partial annotations

Usage

aphylo_from_data_frame(tree, annotations, types = NULL)

Value

An object of class aphylo.

Arguments

tree

An object of class phylo.

annotations

A data.frame with annotations. The first column should be the gene id (see details).

types

A data.frame with types. Just like the annotations, the first column should be the gene id.

Details

Each row in the the annotations data frame passed to this function must have a unique row per gene, and one column per function (GO term). The id of each gene must match the labels in the tree object. Missing genes are annotated with NA (9).

In the case of types, while tips can also be annotated with a type, which should be either 0, duplication, or 1, speciation, only internal nodes are required. Tip types are ignored.

See Also

Other Data management functions: aphylo-class

Examples

Run this code
# Generating a test dataset
set.seed(1371)
x <- raphylo(20)

# Extracting the tree and annotations
tree <- x$tree

anno <- with(x, rbind(tip.annotation, node.annotation))
anno <- data.frame(id = with(tree, c(tip.label, node.label)), anno)

types <- data.frame(id = tree$node.label, x$node.type)

# Creating a aphylo tree without node types
aphylo_from_data_frame(tree, anno)

# Now including types
aphylo_from_data_frame(tree, anno, types)

# Dropping some data
aphylo_from_data_frame(tree, anno[sample.int(nrow(anno), 10),])

Run the code above in your browser using DataLab