The QMatrix class

Share:

Description

This is the class representing rate matrices. The QMatrix objects store two rate matrices: one contains the rates provided by the user (unscaled rate matrix), the other matrix (scaled rate matrix) is rescaled so the expected number of subsitutions per unit time is equal to one when the process is at equlibrium. The scaled rate matrices, along with the site-process-specific rate multiplier parameters define the rates of the Event objects generated by the associated GeneralSubstitution objects.

The QMatrix objects have a bidirectonal relationship with the GeneralSubstitution object as they store a reference to the associated process objects. QMatrix objects do not have a write-protection field, but they use the one from the associated GeneralSubstitution object.

Usually there is no need to interact with the QMatrix objects directly, so this class is mainly used internally.

Package:
Class QMatrix

Object
~~|
~~+--PSRoot
~~~~~~~|
~~~~~~~+--QMatrix

Directly known subclasses:

public static class QMatrix
extends PSRoot

Usage

1
QMatrix(name="Anonymous", alphabet=NA, rate.list=NA, process=NA, ...)

Arguments

name

The name of the QMatrix object (a character vector of length one).

alphabet

An Alphabet object.

rate.list

A list of unscaled event rates and the associated event names. It will be passed to the setRateList.QMatrix method.

process

A GeneralSubstitution object to be associated with the QMatrix object.

...

Not used.

Fields and Methods

Methods:

Scale -
as.character -
checkConsistency -
getAlphabet -
getEventRate -
getId -
getMatrix -
getName -
getProcess -
getRate -
getRateList -
getScaledMatrix -
getWriteProtected -
is -
print -
setAlphabet -
setId -
setMatrix -
setName -
setProcess -
setRate -
setRateList -
setScaledMatrix -
setWriteProtected -
summary -

Methods inherited from PSRoot:
checkConsistency, enableVirtual, getComments, getMethodsList, globalConsistencyCheck, intersect.list, is, is.na, ll, my.all.equal, plot, setComments, setMethodsList, summary, virtualAssignmentForbidden

Methods inherited from Object:
$, $<-, [[, [[<-, as.character, attach, attachLocally, clearCache, clearLookupCache, clone, detach, equals, extend, finalize, getEnvironment, getFieldModifier, getFieldModifiers, getFields, getInstantiationTime, getStaticInstance, hasField, hashCode, ll, load, names, objectSize, print, save

Author(s)

Botond Sipos, Gregory Jordan

See Also

GeneralSubstitution Alphabet Process

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
	# create a QMatrix object by providing an Alphabet object and rates
	m<-QMatrix(name="Susie Q", alphabet=BinaryAlphabet(), rate.list=list("1->0"=2,"0->1"=3))
	# get object summary
	summary(m)
       # create a GeneralSubstitution object by
       # providing an Alphabet object and the rates
       p<-GeneralSubstitution(alphabet=BinaryAlphabet(), rate.list=list("1->0"=1,"0->1"=3))
       # get the QMatrix object from p
       m<-p$QMatrix
	# get various object properties
	m
	is.QMatrix(m)
	m$name
	m$id
	m$alphabet
	# get the associated process
	m$process
	# get the unscaled rate of "0->1"
	getRate(m,"0->1")
	# get the scaled rate of "0->1"
	getEventRate(m,"0->1")
	# get the list of unscaled rates
	m$rateList
	# get unscaled rate matrix
	m$matrix
	# get scaled rate matrix
	m$scaledMatrix
 

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.