Learn R Programming

Qploidy (version 1.0.1)

get_baf: Calculate B-Allele Frequency (BAF) from Theta Values

Description

This function calculates the B-allele frequency (BAF) from normalized theta values, using cluster centers that represent genotype classes. BAF is computed by linearly interpolating the theta values between adjacent genotype cluster centroids.

Usage

get_baf(theta_subject, centers_theta, ploidy)

Value

A numeric vector of BAF values ranging from 0 to 1

Arguments

theta_subject

A numeric vector of theta values to be standardized. These typically represent allelic ratios or normalized intensity values for a set of samples.

centers_theta

A numeric vector of length `ploidy + 1`, representing the estimated cluster centers (centroids) for each genotype class. These values should be sorted in increasing order from homozygous reference to homozygous alternative.

ploidy

An integer indicating the ploidy level of the organism (e.g., `2` for diploid).

Details

The approach is based on the methodology described by Wang et al. (2007), and is commonly used in SNP genotyping to infer allele-specific signal intensities.

References

Wang, K., Li, M., Hadley, D., Liu, R., Glessner, J., Grant, S. F. A., Hakonarson, H., & Bucan, M. (2007). PennCNV: An integrated hidden Markov model designed for high-resolution copy number variation detection in whole-genome SNP genotyping data. Genome Research, 17(11), 1665–1674. tools:::Rd_expr_doi("10.1101/gr.6861907")

Examples

Run this code
theta <- c(0.1, 0.35, 0.6, 0.95)
centers <- c(0.1, 0.5, 0.9)
get_baf(theta, centers, ploidy = 2)

Run the code above in your browser using DataLab