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)

Arguments

clone_genome

A nested list containing genome sequences:

  • First level: haplotypes (maternal/paternal)

  • Second level: chromosomes with nucleotide sequences

clone_mutation_table

A data frame containing mutation information:

  • haplotype - Maternal or paternal copy

  • chrom - Chromosome name

  • pos - Mutation position

  • alternative_nt - Expected nucleotide after mutation

clone_seg_list

A nested list containing segment information:

  • First level: haplotypes

  • Second level: data frame with segment details including loss information

Value

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

Details

The function:

  1. Processes mutations chromosome by chromosome

  2. Checks if mutations fall in lost segments (should be 'N')

  3. Compares actual nucleotides to expected ones

  4. Provides detailed output only for incorrect mutations

  5. Handles special cases:

    • Mutations in lost segments

    • No mutations in a chromosome

Examples

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
} # }