Verifies that mutations in the simulated genome match their expected alternative nucleotides, accounting for lost segments that should contain 'N's.
check_genome_mutations(clone_genome, clone_mutation_table, clone_seg_list)A nested list containing genome sequences:
First level: haplotypes (maternal/paternal)
Second level: chromosomes with nucleotide sequences
A data frame containing mutation information:
haplotype - Maternal or paternal copy
chrom - Chromosome name
pos - Mutation position
alternative_nt - Expected nucleotide after mutation
A nested list containing segment information:
First level: haplotypes
Second level: data frame with segment details including loss information
A nested list where:
First level: haplotypes
Second level: chromosomes
Values are either:
Success message if all mutations are correct
Data frame of incorrect mutations with details for investigation
The function:
Processes mutations chromosome by chromosome
Checks if mutations fall in lost segments (should be 'N')
Compares actual nucleotides to expected ones
Provides detailed output only for incorrect mutations
Handles special cases:
Mutations in lost segments
No mutations in a chromosome
if (FALSE) { # \dontrun{
validation_results <- check_genome_mutations(
clone_genome = synthesized_genome,
clone_mutation_table = mutations,
clone_seg_list = segments
)
# Check results for specific chromosome
validation_results$maternal$chr1
} # }