Skip to contents

Iteratively merges adjacent rows in a data frame of AI segments if they meet criteria defined by MergeAICheck. For merged segments, MAF values are re-estimated and segment information is updated.

Usage

MergeAIRow(df, mergeai, snpmin, tmp_maf)

Arguments

df

A data frame or tibble of AI segments, with columns such as Chromosome, bin, Start, End, snp_count, each_maf, etc.

mergeai

Numeric. Threshold for the difference in MAF (gmm_mean) between adjacent segments to allow merging.

snpmin

Numeric. Minimum SNP count required for a segment to be considered as a separate segment.

tmp_maf

A data frame or tibble containing maf values and genomic coordinates (must include Chromosome, Start, End, maf).

Value

A data frame or tibble with merged AI segments, updated maf estimates, and segment information.

Details

This function uses MergeAICheck to determine if two adjacent segments should be merged. For merged segments, maf values are re-estimated using EstimateMAFbyGMM.