This function generates a visual representation of an event tree using the provided edge event table and tree structure. The tree is plotted with edges labeled by event information and nodes colored by their type (normal or tumor). The function returns both the graph object and the plot for further customization or analysis.

plot_event_tree(edge_event_table, tree)

Arguments

edge_event_table

A data frame containing edge event information. This is typically generated by the create_edge_event_table function:

  • edge_name: Edge identifier ("parent_child" format)

  • edge_label: Event labels for the edge

  • n_events: Number of events on the edge

tree

An igraph tree object representing the phylogenetic structure

Value

A list containing two elements:

  • graph_ob: The igraph object with added event information

  • tree_plot: A ggplot2 object showing the rendered tree

Details

The function performs these steps:

  1. Converts tree to edge list format

  2. Creates node table with clone types (normal/tumor)

  3. Merges edge event information with tree structure

  4. Creates a dendrogram layout visualization with:

    • Edges labeled with copy number events

    • Nodes colored by clone type

    • Node labels showing clone names

Note

The visualization uses:

  • Node size of 20

  • Text size of 5

  • Grey edges

  • 2.5mm label dodge for edge labels

  • void theme for clean background

Examples

if (FALSE) { # \dontrun{
library(igraph)
library(ggraph)

# Create sample tree and edge events
tree <- make_tree(3, 2)
edge_events <- create_edge_event_table(your_events, tree)

# Create plot
result <- plot_event_tree(edge_events, tree)
print(result$tree_plot)
} # }