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 = tree_name, tree_name = "phylo") <- value

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

combineTreeData(x, other.fields = other_fields, other_fields = list())

combineTreeData(x, other.fields = other_fields, other_fields = list())

# S4 method for class 'TreeSummarizedExperiment'
colTreeData(x, tree.name = tree_name, tree_name = "phylo")

# S4 method for class 'TreeSummarizedExperiment'
rowTreeData(x, tree.name = tree_name, tree_name = "phylo")

# S4 method for class 'TreeSummarizedExperiment'
colTreeData(x, tree.name = tree_name, tree_name = "phylo") <- value

# S4 method for class 'TreeSummarizedExperiment'
rowTreeData(x, tree.name = tree_name, tree_name = "phylo") <- value

# S4 method for class 'phylo'
combineTreeData(x, other.fields = other_fields, other_fields = list())

# S4 method for class 'treedata'
combineTreeData(x, other.fields = other_fields, other_fields = list())

Arguments

x

a TreeSummarizedExperiment object.

...

additional arguments, currently not used.

tree.name

Character scalar. Specifies a rowTree/colTree from x. (Default: "phylo")

tree_name

Deprecated. Use tree.name instead.

other.fields, value

a data.frame or coercible to one, with at least one type of id information. See details.(Default: list())

other_fields

Deprecated. Use other.fields instead.

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.847
#>  2     2 522457 TRUE  -0.442
#>  3     3 951    TRUE   0.989
#>  4     4 244423 TRUE   0.459
#>  5     5 586076 TRUE  -3.58 
#>  6     6 246140 TRUE  -0.473
#>  7     7 143239 TRUE   2.13 
#>  8     8 244960 TRUE   0.732
#>  9     9 255340 TRUE  -1.68 
#> 10    10 144887 TRUE   0.343
#> # ℹ 38,421 more rows