This function inserts single nucleotide variants (SNVs) into a genome at specified positions. It groups mutations by haplotype and chromosome for efficient processing and modifies the genome sequence accordingly.

insert_mutations(genome, mutations)

Arguments

genome

List containing genome sequences organized by haplotype and chromosome

mutations

Data frame containing mutation details with columns: haplotype, chrom, pos, alternative_nt

Value

The modified genome list with mutations incorporated

Details

The function is designed to be efficient when processing large numbers of mutations by minimizing the number of times each sequence needs to be modified.