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
)

Arguments

tree

An igraph object representing the phylogenetic tree structure

event_table

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

initial_chr_arm_seg_list

List containing initial chromosome arm segment information

initial_sub_seg_list

List containing initial sub-segment information. Optional, required only if sub_CNV events are present in event_table

initial_chr_lengths

Vector or list containing initial chromosome lengths

Value

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

See also

update_wgd_seg, update_cnv_seg, update_sub_seg