Calculates the beta-binomial concentration parameter (K) for each segment based on local sequencing depth and a fitted dispersion model.
Arguments
- result
Data frame. Segment-level results, must include columns
Chromosome,Start, andEnd.- theta_fit
List or data frame. Fitted dispersion model, must include
breaks(numeric vector of depth bin edges) andtheta_table(data frame with columnsdepth_binandtheta).- maf
Data frame. Allelic count data for all SNPs, must include columns
chr,Pos,ref_count, andalt_count.
Value
The input result data frame with additional columns:
- depth
Median SNP depth for the segment.
- depth_bin
Depth bin index for the segment.
- theta
Estimated dispersion parameter for the segment.
- K
Estimated beta-binomial concentration parameter for the segment.
Details
For each segment, the function extracts all SNPs within the segment boundaries from the maf data, calculates the median depth, assigns a depth bin according to theta_fit$breaks, joins the corresponding theta value from theta_fit$theta_table, and computes K using the formula \(K = \frac{\text{depth}}{1 + \text{depth} \cdot \theta} - 1\).
