changeTree: Change the row or column tree

Description Usage Arguments Value Author(s) Examples

View source: R/changeTree.R

Description

changeTree changes a row or column tree in a TreeSummarizedExperiment object.

Usage

1
2
3
4
5
6
7
changeTree(
  x,
  rowTree = NULL,
  rowNodeLab = NULL,
  colTree = NULL,
  colNodeLab = NULL
)

Arguments

x

A TreeSummarizedExperiment object

rowTree

A phylo object. A new row tree.

rowNodeLab

A character string. It provides the labels of nodes that the rows of assays tables corresponding to. If NULL (default), the row names of the assays tables are used.

colTree

A phylo object. A new column tree.

colNodeLab

A character string. It provides the labels of nodes that the columns of assays tables corresponding to. If NULL (default), the column names of the assays tables are used.

Value

A TreeSummarizedExperiment object

Author(s)

Ruizhu Huang

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(ape)
set.seed(1)
treeR <- ape::rtree(10)

# the count table
count <- matrix(rpois(160, 50), nrow = 20)
rownames(count) <- paste0("entity", 1:20)
colnames(count) <- paste("sample", 1:8, sep = "_")
# The sample information
sampC <- data.frame(condition = rep(c("control", "trt"), 
                                    each = 4),
                    gender = sample(x = 1:2, size = 8, 
                                    replace = TRUE))
rownames(sampC) <- colnames(count)
# build a TreeSummarizedExperiment object
tse <- TreeSummarizedExperiment(assays = list(count),
                                colData = sampC,
                                rowTree = treeR,
                                rowNodeLab = rep(treeR$tip.label, each =2))

treeR2 <- drop.tip(phy = treeR, tip = c("t10", "t9", "t8"))

use <- changeTree(x = tse, rowTree = treeR2)
use

TreeSummarizedExperiment documentation built on Dec. 8, 2020, 2 a.m.