View source: R/aphylo_from_data_frame.R
aphylo_from_data_frame | R Documentation |
aphylo
object with partial annotationsCreate an aphylo
object with partial annotations
aphylo_from_data_frame(tree, annotations, types = NULL)
tree |
An object of class |
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. |
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.
An object of class aphylo.
Other Data management functions:
aphylo-class
# 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),])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.