R/heterogeneity.R

Defines functions math_score

Documented in math_score

#' Evaluate heterogeneity
#'
#' `math_score` calculates MATH (mutant-allele tumor heterogeneity) score
#' from variant allele frequencies.
#' @inheritParams stats::mad
#' @rdname heterogeneity
#' @export
math_score = function(x, constant = 1.4826, na.rm = FALSE) {
  med = stats::median(x, na.rm = na.rm)
  mad = stats::mad(x, center = med, constant = constant, na.rm = na.rm)
  mad / med
}
heavywatal/rtumopp documentation built on March 30, 2024, 11:08 a.m.