This function updates a simulation based on an event table, which contains information about genomic events such as Whole Genome Duplications (WGD), Copy Number Variations (CNV), and sub-CNVs. It traverses a tree structure and applies the events to the segments and chromosome lengths accordingly. Events are processed in depth-first search order from root to leaves.
update_sim_from_event_table(
tree,
event_table,
initial_chr_arm_seg_list,
initial_sub_seg_list = NULL,
initial_chr_lengths
)An igraph object representing the phylogenetic tree structure
A data frame containing events with columns:
parent - parent node name
child - child node name
event_type - type of event ("WGD", "CNV", or "sub_CNV")
other event-specific columns
List containing initial chromosome arm segment information
List containing initial sub-segment information. Optional, required only if sub_CNV events are present in event_table
Vector or list containing initial chromosome lengths
A list containing:
all_node_events - List of events occurring on each tree edge
all_node_segments - List of segment states for each node
all_node_chr_lengths - List of chromosome lengths for each node
update_wgd_seg, update_cnv_seg, update_sub_seg