Generates complete genome sequences for all clones in a phylogenetic tree, starting from the root genome and applying sequential genomic alterations following the tree structure.

synth_tree_genomes(tree, root_genome, seg_list, mut_table)

Arguments

tree

An igraph object representing the phylogenetic tree structure

root_genome

A nested list containing the initial genome sequences:

  • First level: haplotypes (maternal/paternal)

  • Second level: chromosomes with nucleotide sequences

seg_list

A nested list containing segment information for all clones:

  • First level: clone names

  • Second level: haplotypes

  • Each haplotype contains segment information (data frame)

mut_table

A data frame containing mutation information for all clones

Value

A list where:

  • Names are clone names from the tree

  • Values are genome sequences for each clone

Details

The function:

  1. Identifies the root node of the tree

  2. Processes nodes in depth-first search order

  3. For each node:

    • Identifies its parent node

    • Synthesizes its genome based on parent's genome

    • Applies all genomic changes along the branch

  4. Tracks progress with print statements