Identifies and returns the genomic segment that contains a specific mutation, handling both regular segments and segments that have been lost through deletions.

get_segment_info(seg_list, mutation, in_loss_segment)

Arguments

seg_list

List structure containing segment information for different clones and haplotypes

mutation

Data frame row containing information about a single mutation, with columns: clone, haplotype, chrom, pos

in_loss_segment

Logical indicating whether the mutation is in a segment that has been lost through deletion

Value

A data frame row containing the segment information for the mutation, or NULL if no matching segment is found

Details

This function locates the appropriate genomic segment for a mutation by:

  1. Extracting relevant information (haplotype, chromosome, clone, position) from the mutation

  2. Using different search criteria based on whether the segment is lost:

    • For lost segments: Matches chromosome and original coordinates (ori_start/ori_end) where CN_change is -1 and current coordinates (start/end) are NA

    • For normal segments: Matches chromosome and current coordinates (start/end)

  3. Returns NULL if no matching segment is found

This function is primarily used by simulate_single_nt_change() to map mutations to their genomic context before simulating nucleotide changes.