shift: Normalised heteroplasmy shift

View source: R/transformers.R

shiftR Documentation

Normalised heteroplasmy shift

Description

Normalised heteroplasmy shift

Usage

shift(H, H0, percent = TRUE, tol = 1e-04)

Arguments

H

numeric vector of heteroplasmy fractions, either in [0; 1] or represented as percentages in [0; 100]

H0

numeric vector of baseline heteroplasmy fractions, either in [0; 1] or represented as percentages in [0; 100]

percent

logical; are values in H represented as percentage points?

tol

tolerance with which to resolve homoplasmy

Value

A vector of normalised heteroplasmy shift calculated as

shift(H; H_0) = \frac{H(1-H_0)}{H_0(1-H)}.

Homoplasmic states are resolved as tol for homoplasmic wildtype, and (1 - tol) for homoplasmic mutant.

Examples

# Using percentage points
H <- sample(0:100, 10)
H0 <- 50
shift(H, H0)

# Using fractions
h <- stats::runif(10)
h0 <- 0.3
shift(h, h0, percent = FALSE)

lbozhilova/kimura documentation built on May 7, 2023, 12:07 p.m.