Creates a dendrogram visualization of cell lineage data from simulation results, showing the relationships between cells and their clonal evolution over time.

create_sc_tree_plot(
  dynamic_sim_ob,
  clone_colors,
  title = "SC Dynamics Dendrogram"
)

Arguments

dynamic_sim_ob

List object returned by simulate_sc_dynamics function

clone_colors

Named vector of colors where names match clone types in the simulation

title

Character string for the plot title, defaults to "SC Dynamics Dendrogram"

Value

A ggraph plot object displaying the cell lineage tree with customized styling

Details

This function creates a dendrogram visualization of cell lineage data where:

  1. The vertical axis represents time

  2. Edges represent cells' lifespans

  3. Edge colors indicate the clone type of each cell

  4. Branch lengths correspond to cell lifetimes

The function first prepares the cell information data using the prepare_tree_data function, then creates a graph object and finally generates a dendrogram visualization using ggraph. The resulting plot has publication-ready styling with customized title, legend, and axis labels.

Examples

# Define colors for each clone type
clone_colors <- c(A = "blue", B = "red")

# Create and display the lineage tree
tree_plot <- create_sc_tree_plot(dynamic_sim_ob, clone_colors, "Cell Lineage Evolution")
#> Error: object 'dynamic_sim_ob' not found
print(tree_plot)
#> Error: object 'tree_plot' not found

# Save the plot
ggsave("cell_lineage_tree.png", tree_plot, width = 10, height = 8)
#> Error in ggsave("cell_lineage_tree.png", tree_plot, width = 10, height = 8): could not find function "ggsave"