R/genome_relevant_functions.R
synth_tree_genomes.RdGenerates 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)An igraph object representing the phylogenetic tree structure
A nested list containing the initial genome sequences:
First level: haplotypes (maternal/paternal)
Second level: chromosomes with nucleotide sequences
A nested list containing segment information for all clones:
First level: clone names
Second level: haplotypes
Each haplotype contains segment information (data frame)
A data frame containing mutation information for all clones
A list where:
Names are clone names from the tree
Values are genome sequences for each clone
The function:
Identifies the root node of the tree
Processes nodes in depth-first search order
For each node:
Identifies its parent node
Synthesizes its genome based on parent's genome
Applies all genomic changes along the branch
Tracks progress with print statements