To facilitate the dressing of the tree data stored in a TreeSummarizedExperiment object, rowTreeData and colTreeData can be used.

rowTreeData(x, ...)

colTreeData(x, ...)

rowTreeData(x, tree_name = "phylo") <- value

colTreeData(x, tree_name = "phylo") <- value

combineTreeData(x, other_fields = list())

combineTreeData(x, other_fields = list())

# S4 method for TreeSummarizedExperiment
colTreeData(x, tree_name = "phylo")

# S4 method for TreeSummarizedExperiment
rowTreeData(x, tree_name = "phylo")

# S4 method for TreeSummarizedExperiment
colTreeData(x, tree_name = "phylo") <- value

# S4 method for TreeSummarizedExperiment
rowTreeData(x, tree_name = "phylo") <- value

# S4 method for phylo
combineTreeData(x, other_fields = list())

# S4 method for treedata
combineTreeData(x, other_fields = list())

Arguments

x

a TreeSummarizedExperiment object.

...

additional arguments, currently not used.

tree_name

a single character value specifying a rowTree/colTree from x. (By default: tree_name = "phylo")

other_fields, value

a data.frame or coercible to one, with at least one type of id information. See details.

Value

a data.frame for the accessor and the modified TreeSummarizedExperiment

object

Details

To match information to nodes, the id information in other_fields are used. These can either be a column, named ‘node’ or ‘label’ (‘node’ taking precedent), or rownames. If all rownames can be coerced to integer, they are considered as ‘node’ values, otherwise as ‘label’ values. The id information must be unique and match available values of rowTreeData(c)

The result of the accessors, rowTreeData and colTreeData, contain at least a ‘node’ and ‘label’ column.

Examples

data(GlobalPatterns)
td <- rowTreeData(GlobalPatterns)
#>  invalid tbl_tree object. Missing column: parent.
td
#> # A tibble: 38,431 × 2
#>     node label 
#>    <int> <chr> 
#>  1     1 549322
#>  2     2 522457
#>  3     3 951   
#>  4     4 244423
#>  5     5 586076
#>  6     6 246140
#>  7     7 143239
#>  8     8 244960
#>  9     9 255340
#> 10    10 144887
#> # ℹ 38,421 more rows
td$test <- rnorm(nrow(td))
rowTreeData(GlobalPatterns) <- td
rowTreeData(GlobalPatterns)
#>  invalid tbl_tree object. Missing column: parent.
#> # A tibble: 38,431 × 2
#>     node label 
#>    <int> <chr> 
#>  1     1 549322
#>  2     2 522457
#>  3     3 951   
#>  4     4 244423
#>  5     5 586076
#>  6     6 246140
#>  7     7 143239
#>  8     8 244960
#>  9     9 255340
#> 10    10 144887
#> # ℹ 38,421 more rows
combineTreeData(rowTree(GlobalPatterns), td)
#> 'treedata' S4 object'.
#> 
#> ...@ phylo:
#> 
#> Phylogenetic tree with 19216 tips and 19215 internal nodes.
#> 
#> Tip labels:
#>   549322, 522457, 951, 244423, 586076, 246140, ...
#> Node labels:
#>   , 0.858.4, 1.000.154, 0.764.3, 0.995.2, 1.000.2, ...
#> 
#> Rooted; includes branch lengths.
#> 
#> with the following features available:
#>   'test'.
#> 
#> # The associated data tibble abstraction: 38,431 × 4
#> # The 'node', 'label' and 'isTip' are from the phylo tree.
#>     node label  isTip   test
#>    <int> <chr>  <lgl>  <dbl>
#>  1     1 549322 TRUE  -0.517
#>  2     2 522457 TRUE  -0.527
#>  3     3 951    TRUE   0.872
#>  4     4 244423 TRUE  -0.447
#>  5     5 586076 TRUE   2.04 
#>  6     6 246140 TRUE   1.56 
#>  7     7 143239 TRUE   0.586
#>  8     8 244960 TRUE  -2.59 
#>  9     9 255340 TRUE  -1.72 
#> 10    10 144887 TRUE  -0.451
#> # ℹ 38,421 more rows