For a more detailed explanation, see vignette("sub-models").

sub_JC69(lambda, mu = 1, gamma_shape = NULL, gamma_k = 5, invariant = 0)

sub_K80(alpha, beta, mu = 1, gamma_shape = NULL, gamma_k = 5, invariant = 0)

sub_F81(pi_tcag, mu = 1, gamma_shape = NULL, gamma_k = 5, invariant = 0)

sub_HKY85(
  pi_tcag,
  alpha,
  beta,
  mu = 1,
  gamma_shape = NULL,
  gamma_k = 5,
  invariant = 0
)

sub_F84(
  pi_tcag,
  beta,
  kappa,
  mu = 1,
  gamma_shape = NULL,
  gamma_k = 5,
  invariant = 0
)

sub_TN93(
  pi_tcag,
  alpha_1,
  alpha_2,
  beta,
  mu = 1,
  gamma_shape = NULL,
  gamma_k = 5,
  invariant = 0
)

sub_GTR(
  pi_tcag,
  abcdef,
  mu = 1,
  gamma_shape = NULL,
  gamma_k = 5,
  invariant = 0
)

sub_UNREST(Q, mu = 1, gamma_shape = NULL, gamma_k = 5, invariant = 0)

Arguments

lambda

Substitution rate for all possible substitutions.

mu

Total rate of substitutions. Defaults to 1, which makes branch lengths in units of substitutions per site. Passing NULL results in no scaling.

gamma_shape

Numeric shape parameter for discrete Gamma distribution used for among-site variability. Values must be greater than zero. If this parameter is NULL, among-site variability is not included. Defaults to NULL.

gamma_k

The number of categories to split the discrete Gamma distribution into. Values must be an integer in the range [2,255]. This argument is ignored if gamma_shape is NA. Defaults to 5.

invariant

Proportion of sites that are invariant. Values must be in the range [0,1). Defaults to 0.

alpha

Substitution rate for transitions.

beta

Substitution rate for transversions.

pi_tcag

Vector of length 4 indicating the equilibrium distributions of T, C, A, and G respectively. Values must be >= 0, and they are forced to sum to 1.

kappa

The transition/transversion rate ratio.

alpha_1

Substitution rate for T <-> C transition.

alpha_2

Substitution rate for A <-> G transition.

abcdef

A vector of length 6 that contains the off-diagonal elements for the substitution rate matrix. See vignette("sub-models") for how the values are ordered in the matrix.

Q

Matrix of substitution rates for "T", "C", "A", and "G", respectively. Item Q[i,j] is the rate of substitution from nucleotide i to nucleotide j. Do not include indel rates here! Values on the diagonal are calculated inside the function so are ignored.

Value

A sub_info object, which is an R6 class that wraps the info needed for the create_haplotypes function. It does not allow the user to directly manipulate the info inside, as that should be done using the sub_models functions. You can use the following methods from the class to view information:

Q()

View a list of substitution rate matrices, one for each Gamma category.

pi_tcag()

View the equilibrium nucleotide frequencies.

gammas()

View the discrete Gamma-class values.

invariant()

View the proportion of invariant sites.

model()

View the substitution model.

U()

View list of the U matrices (one matrix per Gamma category) used for calculating transition-probability matrices. This is empty for UNREST models.

Ui()

View list of the U^-1 matrices (one matrix per Gamma category) used for calculating transition-probability matrices. This is empty for UNREST models.

L()

View list of the lambda vectors (one vector per Gamma category) used for calculating transition-probability matrices. This is empty for UNREST models.

Functions

  • sub_JC69(): JC69 model.

  • sub_K80(): K80 model.

  • sub_F81(): F81 model.

  • sub_HKY85(): HKY85 model.

  • sub_F84(): F84 model.

  • sub_TN93(): TN93 model.

  • sub_GTR(): GTR model.

  • sub_UNREST(): UNREST model.

Examples

# Same substitution rate for all types:
obj_JC69 <- sub_JC69(lambda = 0.1)

# Transitions 2x more likely than transversions:
obj_K80 <- sub_K80(alpha = 0.2, beta = 0.1)

# Incorporating equilibrium frequencies:
obj_HKY85 <- sub_HKY85(pi_tcag = c(0.1, 0.2, 0.3, 0.4),
                       alpha = 0.2, beta = 0.1)

# 10-category Gamma distribution for among-site variability:
obj_K80 <- sub_K80(alpha = 0.2, beta = 0.1,
                   gamma_shape = 1, gamma_k = 10)

# Invariant sites:
obj_K80 <- sub_K80(alpha = 0.2, beta = 0.1,
                   invariant = 0.25)