Package 'RateViz'

Title: Visualizations for instantaneous rate matrices
Description: This package uses an instantaneous rate matrix (such as is used for models of DNA evolution, morphological character change over evolutionary history, and other areas) and summarizes it in various ways. These could include bubble plots, a network showing transitions, or calculations to figure out likely paths between two states.
Authors: Brian C. O'Meara and Jeremy M. Beaulieu
Maintainer: Brian C. O'Meara <[email protected]>
License: GPL (>= 2)
Version: 1.0
Built: 2024-10-24 03:27:43 UTC
Source: https://github.com/bomeara/RateViz

Help Index


Visualizations for instantaneous rate matrices

Description

This package uses an instantaneous rate matrix (such as is used for models of DNA evolution, morphological character change over evolutionary history, and other areas) and summarizes it in various ways. These could include bubble plots, a network showing transitions, or calculations to figure out likely paths between two states.

Details

Package: RateViz
Type: Package
Version: 1.0
Date: 2015-02-17
License: GPL (>=2)

Author(s)

Brian C. O'Meara and Jeremy M. Beaulieu

Maintainer: Brian C. O'Meara <[email protected]>

Examples

#A random sample transition matrix
Q <- matrix(runif(9), 3, 3)
diag(Q) <- 0
diag(Q) <- -rowSums(Q)
colnames(Q) <- c("A", "B", "C")
rownames(Q) <- c("A", "B", "C")
print(Q)
ComputePathwayProbability(Q, from=1, to=3)
PlotTransitionNetwork(Q)

ComputePathwayProbability

Description

This implements the rate summary used in Zanne et al. 2014. Using the rate matrix, one can calculate

Usage

ComputePathwayProbability(Q, from, to, correct.diag = TRUE, total.time = 1e+06)

Arguments

Q

Instantaneous rate matrix

from

Index (position) of start state in the matrix (i.e., the second character)

to

Index (position) of end state in the matrix

correct.diag

Normally the diagonal is the negative sum of the non-diagonal elements in a row. If TRUE, this verifies that this is so

total.time

A large enough time such that there is essentially no chance of remaining unchanged

Value

A vector with the probability of each path into the final state.

Author(s)

Brian C. O'Meara

References

Zanne et al. 2014

Examples

#A random sample transition matrix
Q <- matrix(runif(9), 3, 3)
diag(Q) <- 0
diag(Q) <- -rowSums(Q)
colnames(Q) <- c("A", "B", "C")
rownames(Q) <- c("A", "B", "C")
print(Q)
ComputePathwayProbability(Q, from=1, to=3)

PlotBubbleMatrix

Description

Plots a rate matrix such that circle area correlates with the rate

Usage

PlotBubbleMatrix(Q, main = "", special = Inf, cex = 1)

Arguments

Q

Instantaneous rate matrix

main

Optional plot title

special

If you want to highlight a particular element, input its number here

cex

Adjustment for text size

Value

None

Author(s)

Brian C. O'Meara

Examples

#A random sample transition matrix
Q <- matrix(runif(9), 3, 3)
diag(Q) <- 0
diag(Q) <- -rowSums(Q)
colnames(Q) <- c("A", "B", "C")
rownames(Q) <- c("A", "B", "C")
print(Q)
PlotBubbleMatrix(Q)

PlotTransitionNetwork

Description

This plots a network showing transition rates between given states. It uses igraph for plotting.

Usage

PlotTransitionNetwork(Q, main = "", layout.fn = layout.circle, ...)

Arguments

Q

Instantaneous rate matrix

main

Title for plot (optional)

layout.fn

Layout function from igraph. By default this uses a circle layout, but you may use other igraph functions. layout.fruchterman.reingold may generate a good looking graph.

...

Other arguments to pass to plot.igraph()

Value

No return

Author(s)

Brian C. O'Meara

Examples

#A random sample transition matrix
Q <- matrix(runif(9), 3, 3)
diag(Q) <- 0
diag(Q) <- -rowSums(Q)
colnames(Q) <- c("A", "B", "C")
rownames(Q) <- c("A", "B", "C")
print(Q)
PlotTransitionNetwork(Q)