Skip to contents

This function takes a gating tree object and constructs a graphical representation using the DiagrammeR package. It visually represents the enrichment, entropy, and optionally the average proportion of nodes in the gating tree.

Usage

convert_to_diagrammer(
  root,
  size_factor = 1,
  average_proportion = FALSE,
  all_labels = TRUE
)

Arguments

root

The root node of the gating tree object, which must have properties like `isRoot`, `name`, `CurrentEnrichment`, `CurrentEntropy`, and optionally `AverageProportion`.

size_factor

A multiplier for node sizes in the graph, allowing customization based on enrichment or average proportion values.

average_proportion

A logical flag indicating whether to use the average proportion of nodes to adjust node sizes and color gradient based on enrichment values.

all_labels

Logical. If TRUE, all parameters are included in each node within the output graph.

Value

Returns a DiagrammeR graph object representing the gating tree with nodes colored and sized according to specified metrics.

Details

The function recursively traverses the gating tree, starting from the root, adding nodes to the graph with labels that include relevant metrics. Node size and color are determined by either the enrichment or entropy values, depending on the `average_proportion` flag.

Examples

if (FALSE) { # \dontrun{
  # Assuming 'root' is your gating tree root node
  graph <- convert_to_diagrammer(root, size_factor = 1, average_proportion = TRUE)
  # To view the graph
  DiagrammeR::render_graph(graph)
} # }