R/counts_to_tpm.R

Defines functions counts_to_tpm

Documented in counts_to_tpm

#' Convert read counts to TPM
#'
#' @param counts numeric.
#' @param eff_len numeric.
#'
#' @return A numeric vector of TPM values.
#' @export

counts_to_tpm <- function(counts, eff_len) {
  rate <- log(counts) - log(eff_len)
  denom <- log(sum(exp(rate)))
  exp(rate - denom + log(1e6))
}
genevol-usp/hlaseqlib documentation built on Aug. 24, 2022, 7:24 a.m.