Updates a tracker structure that organizes and monitors recurrent mutations across different lineages, categorizing them as identical, inclusive, or branching.

process_recurrent_mutation(mutation, mutation_key, tracker)

Arguments

mutation

Data frame containing information about a specific set of recurrent mutations at the same genomic location

mutation_key

Character string uniquely identifying the genomic location of the mutation (typically in format "haplotype_chromosome_position")

tracker

List structure that tracks recurrent mutations by organizing them into sets based on their occurrence patterns

Value

Updated tracker list with the mutation properly categorized and stored

Details

This function processes recurrent mutations by comparing them to existing mutation sets in a tracker. It handles three scenarios:

  1. If the mutation set already exists and is identical, it returns the tracker unchanged.

  2. If the mutation set is a superset of an existing set, it updates the existing set with new mutations.

  3. If the mutation set is distinct from existing sets, it creates a new branch in the tracker.

The function prints the relationship category for debugging and monitoring purposes.