Learn R Programming

phylosim (version 3.0.5)

ToleranceSubstitution: The ToleranceSubstitution class

Description

This a class representing a continuous-time Markov process acting on the state space defined by the symbols stored in the Alphabet object passed to the object constructor.

In contrast to GeneralSubstitution, the ToleranceSubstitution class has a site-specific substitution tolerance parameter ("substitution.tolerance") which determines the probability of accepting the proposed events. As a consequence, the branch lengths inferred from the simulated data will no longer correspond to the neutral expectations unless all tolerance values are equal to 1.

Package: Class ToleranceSubstitution

Object ~~| ~~+--PSRoot ~~~~~~~| ~~~~~~~+--Process ~~~~~~~~~~~~| ~~~~~~~~~~~~+--ToleranceSubstitution

Directly known subclasses:

public static class ToleranceSubstitution extends Process

Usage

ToleranceSubstitution(name="Anonymous", alphabet=NA, rate.list=NA, equ.dist=NA, ...)

Arguments

name

The name of the object.

alphabet

The alphabet on which the process acts (Alphabet object).

rate.list

A list with the substitution rates. It will be passed to setRateList method.

equ.dist

The equilibrium distribution (see setEquDist.ToleranceSubstitution).

...

Not used.

Fields and Methods

Methods:

as.character -
checkConsistency -
clone -
getAlphabet -
getEquDist -
getEventRate -
getEventRateAtSite -
getEventsAtSite -
getQMatrix -
getRate -
getRateList -
hasUndefinedRate -
is -
plot -
rescaleQMatrix -
sampleState -
setAlphabet -
setEquDist -
setQMatrix -
setRate -
setRateList -
summary -

Methods inherited from Process: !=, ==, as.character, checkConsistency, clone, getAlphabet, getEventsAtSite, getId, getName, getParameterAtSite, getSiteSpecificParamIds, getSiteSpecificParamList, getWriteProtected, hasSiteSpecificParameter, hasUndefinedRate, is, setAlphabet, setId, setName, setParameterAtSite, setSiteSpecificParamIds, setSiteSpecificParamList, 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

See Also

Process QMatrix Event Site GeneralIndel GTR WAG

Examples

Run this code
# NOT RUN {
 # construct a GTR process object, we will use this to fill in the rates
 # for the ToleranceSubstitution process.
 gtr         <- GTR(
       name="MyGTR",
           rate.params=list(
               "a"=1, "b"=2, "c"=3,
                   "d"=1, "e"=2, "f"=3
           ),
           base.freqs=c(2,2,1,1)/6
   )
 rate.list.gtr   <- gtr$rateList

 # Construct the ToleranceSubstitution process.
 p   <- ToleranceSubstitution(
     name        = "MyTolSubst",
     alphabet    = NucleotideAlphabet(),
     rate.list   = rate.list.gtr,
 )

 plot(p)

 # construct root sequence object
 s<-NucleotideSequence(length=20)

 # attach process
 attachProcess(s,p)

 # sample states from the equilibrium
 # distribution of the attached processes
 sampleStates(s)

 ## Set the substitution tolerance parameters for some sites:
 setParameterAtSites(s, p, "substitution.tolerance",c(0,0.05,0.1),1:3)

 ## Plot the substitution tolerance parameters across sites:
 plotParametersAtSites(s,p,"substitution.tolerance")

 # Construct simulation object:
 sim <-PhyloSim(root.seq=s, phylo=rtree(3))

 # Run simulation:
 Simulate(sim)

 # Plot alignment:
 plot(sim)

 
# }

Run the code above in your browser using DataLab