Learn R Programming

phylosim (version 3.0.5)

DiscreteInsertor: The DiscreteInsertor class

Description

This class implements a process which performs insertions with lengths sampled from a user-specified discrete distribution. See GeneralInsertor for how the insertion process works.

Package: Class DiscreteInsertor

Object ~~| ~~+--PSRoot ~~~~~~~| ~~~~~~~+--Process ~~~~~~~~~~~~| ~~~~~~~~~~~~+--GeneralInDel ~~~~~~~~~~~~~~~~~| ~~~~~~~~~~~~~~~~~+--GeneralInsertor ~~~~~~~~~~~~~~~~~~~~~~| ~~~~~~~~~~~~~~~~~~~~~~+--DiscreteInsertor

Directly known subclasses: BrownianInsertor

public static class DiscreteInsertor extends GeneralInsertor

Usage

DiscreteInsertor(name="Anonymous", rate=NA, sizes=NA, probs=NA, ...)

Arguments

name

The name of the object.

rate

The general rate.

sizes

The insertion sizes to propose.

probs

A vector with the probabilites of the insertion sizes.

...

Additional arguments.

Fields and Methods

Methods:

checkConsistency -
getProbs -
getSizes -
plot -
setProbs -
setSizes -
summary -

Methods inherited from GeneralInsertor: checkConsistency, generateInsert, getAcceptWin, getEventsAtSite, getGenerateBy, getInsertHook, getTemplateSeq, is, setAcceptWin, setGenerateBy, setInsertHook, setTemplateSeq, summary

Methods inherited from GeneralInDel: checkConsistency, getAcceptBy, getProposeBy, getRate, hasUndefinedRate, is, proposeLength, setAcceptBy, setProposeBy, setRate, 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

GeneralInsertor ContinuousInsertor GeneralInDel

Examples

Run this code
# NOT RUN {
       # create a DiscreteInsertor process
       i<-DiscreteInsertor(
               name="Mii",
               rate=0.25,
               sizes=c(1,2),
               probs=c(1/2,1/2)
       )
	# set template sequence
	i$templateSeq<-NucleotideSequence(string="C")
       # get object summary
       summary(i)
       # set/get insertion sizes
       i$sizes<-1:3
	i$sizes
       # set/get length probabilities
       i$probs<-c(3,2,1)/6
       i$probs
       # plot length distribution
       plot(i)
     
       # The following code illustrates how to use
       # a DiscreteInsertor process in a simulation
     
       # create a sequence object and attach process i to it
       s<-NucleotideSequence(string="AAAAAAAAAAGGGGAAAAAAAAAA",processes=list(list(i)))
       # set the insertion tolerance to zero in range 11:15
       # creating a region rejecting all insertions
       setInsertionTolerance(s,i,0,11:15)     
       # get insertion tolerances
       getInsertionTolerance(s,i)
       # create a simulation object
       sim<-PhyloSim(root.seq=s,phylo=rcoal(2))
       # simulate
       Simulate(sim)
       # print resulting alignment
       sim$alignment
 
# }

Run the code above in your browser using DataLab