Constructs a clone's genome by applying sequential genomic alterations (CNVs, WGDs) and mutations (SNVs) starting from a nearest ancestral genome. Processes events along the evolutionary path between the nearest ancestor and target clone.

synth_clone_genome(
  target_clone,
  nearest_genome,
  nearest_clone,
  tree,
  seg_list,
  mut_table,
  verbose = TRUE
)

Arguments

target_clone

Character. Name of the clone whose genome is to be synthesized.

nearest_genome

Nested list containing the nearest ancestor's genome sequences:

  • First level: haplotypes (maternal/paternal)

  • Second level: chromosomes with nucleotide sequences

nearest_clone

Character. Name of the nearest ancestor clone.

tree

igraph object. Phylogenetic tree structure.

seg_list

Nested list containing segment information for all clones:

  • First level: clone names

  • Second level: haplotypes

  • Each haplotype contains segment information (data frame)

mut_table

Data frame containing mutation information with columns:

  • edge_name - Tree edge identifier

  • other mutation-specific columns required by introduce_snv

Value

A nested list containing the synthesized genome with the same structure as nearest_genome, but updated with all genomic changes.

Details

The function:

  1. Identifies edges between nearest ancestor and target clone

  2. For each edge:

    • Processes segment changes (copy number variations)

    • Handles segment losses (marks with "N")

    • Adds new segments for gains

    • Applies SNVs if present

  3. Maintains separate tracking for maternal and paternal haplotypes