R/genome_relevant_functions.R
synth_clone_genome.RdConstructs 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
)Character. Name of the clone whose genome is to be synthesized.
Nested list containing the nearest ancestor's genome sequences:
First level: haplotypes (maternal/paternal)
Second level: chromosomes with nucleotide sequences
Character. Name of the nearest ancestor clone.
igraph object. Phylogenetic tree structure.
Nested list containing segment information for all clones:
First level: clone names
Second level: haplotypes
Each haplotype contains segment information (data frame)
Data frame containing mutation information with columns:
edge_name - Tree edge identifier
other mutation-specific columns required by introduce_snv
A nested list containing the synthesized genome with the same structure as nearest_genome, but updated with all genomic changes.
The function:
Identifies edges between nearest ancestor and target clone
For each edge:
Processes segment changes (copy number variations)
Handles segment losses (marks with "N")
Adds new segments for gains
Applies SNVs if present
Maintains separate tracking for maternal and paternal haplotypes