tm: Tree Models

Description Usage Arguments Details Value Author(s) Examples

View source: R/treeModel.R

Description

Make a new tree model

Usage

1
2
3
tm(tree, subst.mod, rate.matrix = NULL, backgd = NULL, alphabet = "ACGT",
  nratecats = 1, alpha = 0, rate.consts = NULL, rate.weights = NULL,
  selection = NULL, root.leaf = NULL, likelihood = NULL)

Arguments

tree

A character string representing a phylogenetic tree in newick foromat

subst.mod

A character string giving a valid substitution mod. See subst.mods.

rate.matrix

A square matrix representing the rate of substitution from one state to the next.

backgd

A numeric vector giving the equilibrium frequencies for each state.

alphabet

A character vector containing all valid states, given in the order they are represented in rate.matrix and backgd. Defaults to "ACGT"

nratecats

The number of rate categories in the model. Defaults to 1.

alpha

If nratecats > 1, weight for each category is computed using a gamma distribution with shape parameter alpha.

rate.consts

The rate for each rate category. NULL if only one category.

rate.weights

Vector of numeric of length nratecats, determining the weight of each rate category. Must sum to 1 (will be normalized otherwise). May be defined implicitly by alpha.

selection

If not NULL, then this is a numeric value giving the selection parameter for this model. If NULL then there is no selection in the model. If selection==0.0, means that selection has no effect in the current model, but is part of the model, and by default the selection parameter will be optimized by phyloFit. The rate matrix is assumed to already be scaled by the selection parameter, if provided.

root.leaf

Usually NULL, but if set to the name of a leaf node in the tree, the tree will be re-rooted at this leaf node.

likelihood

an optional value giving the log likelihood of this model for some alignment.

Details

Tree models represent a substitution process along a phylogenetic tree. They are stored as a list, with components defined by the arguments to this function.

Value

An object of class tm representing a phylogenetic model.

Author(s)

Melissa J. Hubisz and Adam Siepel

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
tree <- "((human:0.01, chimp:0.01):0.03, mouse:0.3)"
subst.mod <- "JC69"
rate.mat <- matrix(runif(16), nrow=4, ncol=4)
for (i in 1:4)
  rate.mat[i,i] <- -sum(rate.mat[i,-i])
backgd <- runif(4)
backgd <- backgd/sum(backgd)
alphabet <- "ACGT"
t <- tm(tree, subst.mod, rate.mat, backgd, alphabet)
t

nratecats <- 3
alpha <- 1.5
rate.consts <- runif(nratecats, max=3.0)
root.leaf <- "human"
t <- tm(tree, subst.mod, rate.matrix=rate.mat,
        backgd=backgd, alphabet=alphabet,
        nratecats=nratecats, alpha=alpha,
        rate.consts=rate.consts, root.leaf=root.leaf)
t

rphast documentation built on May 1, 2019, 9:26 p.m.