Utility functions to check the existence of specific elements in a
TreeSummarizedExperiment
that are compulsory when using certain panels.
.check_all_panels(se, initial)
.check_panel(se, initial, panel.class, panel.fun, wtext)a
SummarizedExperiment
object.
Panel vector. A list of panel objects to check.
Character vector. A list of panel names
corresponding to panel objects in initial.
Function scalar. The element of se whose
existence should be checked.
Character scalar. Text of the warning message returned
if panel.fun does not exist or is empty.
.check_panel returns the input initial list of panels excluding
the checked panel if panel.fun is NULL or empty.
.check_all_panels applies .check_panel to multiple panels and
returns the a filtered version of initial.
# Import libraries
library(mia)
library(TreeSummarizedExperiment)
# Import TreeSE
data("Tengeler2020", package = "mia")
tse <- Tengeler2020
# Create list of panels
initial <- c(RowTreePlot(), ColumnTreePlot())
# If RowTreePlot is in initial, check whether rowLinks is defined
initial <- .check_panel(tse, initial, "RowTreePlot", rowLinks)
# If ColumnTreePlot is in initial, check whether colLinks is defined
initial <- .check_panel(tse, initial, "ColumnTreePlot", colLinks)
#> Warning: no valid colLinks fields for ColumnTreePlot
# View filtered list of panels
initial
#> [[1]]
#> Panel object of class RowTreePlot
#> Get or set individual parameters with ‘[[’
#> Available parameters:
#> DataBoxOpen: FALSE
#> PanelHeight: 500
#> PanelId: NA
#> PanelWidth: 4
#> RowSelectionDynamicSource: FALSE
#> RowSelectionRestrict: FALSE
#> RowSelectionSource: ---
#> SelectionBoxOpen: FALSE
#> VersionInfo: list of length 1
#> add.legend: TRUE
#> add.node.lab: FALSE
#> add.tip.lab: FALSE
#> branch.length: FALSE
#> collapse: NA
#> colour_parameters: NA
#> edge.colour.by: NA
#> edge.size.by: NA
#> layout: fan
#> node.colour.by: NA
#> node.shape.by: NA
#> node.size.by: NA
#> open.angle: 0
#> order.tree: FALSE
#> rotate.angle: 0
#> shape_parameters: NA
#> size_parameters: NA
#> tip.colour.by: NA
#> tip.shape.by: NA
#> tip.size.by: NA
#> visual_parameters: NA
#>