GeneralDeletor: The GeneralDeletor class

Description Usage Arguments Fields and Methods Author(s) See Also Examples

Description

This is the class implementing a process generating deletion events. The rates of the deletion events are calculated as the product of the general rate of the process and the "rate.multiplier" site-process-specific parameter.

The simulation code calls the Perform method on the selected deletion event objects, which call their handler function to perform the deletion.

The deletion lengths are proposed by the function stored in the proposeBy virtual field. The function must have the following arguments: process (the process object), sequence (the target sequence), position (the position of the site which generated the event).

The deletion randomly affects the sites from the left or from the right of the target position (but never both). Positions which are out of range are discarded.

The proposed deletions are accepted or rejected by the function stored in the acceptBy virtual field. The function must have the following arguments: process (the deletion prcoess), sequence (the target sequence), range (a vector of positions affected by the deletion).

The probability of accepting a deletion is calculated as the product of the "deletion.tolerance" site-process-specific parameters from the sites affected by the deletion event.

Package:
Class GeneralDeletor

Object
~~|
~~+--PSRoot
~~~~~~~|
~~~~~~~+--Process
~~~~~~~~~~~~|
~~~~~~~~~~~~+--GeneralInDel
~~~~~~~~~~~~~~~~~|
~~~~~~~~~~~~~~~~~+--GeneralDeletor

Directly known subclasses:
ContinuousDeletor, DiscreteDeletor, FastFieldDeletor

public static class GeneralDeletor
extends GeneralInDel

Usage

1
GeneralDeletor(name="Anonymous", rate=NA, propose.by=NA, accept.by=NA, ...)

Arguments

name

The name of the object.

rate

The general rate of the object.

propose.by

A function used to propose events.

accept.by

A function used to accept/reject events.

...

Additional arguments.

Fields and Methods

Methods:

checkConsistency -
getEventsAtSite -
is -
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

Author(s)

Botond Sipos, Gregory Jordan

See Also

GeneralInDel DiscreteDeletor ContinuousDeletor FastFieldDeletor

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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 	# create a GeneralDeletor object
       # proposed deletion length: 4, always accept
       d<-GeneralDeletor(
                       name = "DEL",
                       rate = 1,
                       propose.by=function(process, sequence, position){ 4 },
                       accept.by=function(process, sequence, range){ TRUE }
       )
	d
	# check if object inherits from GeneralDeletor
	is.GeneralDeletor(d)
	# get object summary
	summary(d)
	# set/get name
	d$name<-"Del Bosque"
	d$name
	# set/get rate
	d$rate<-0.5
	d$rate
	# set/get proposeBy
	# propose deletion lengths between 3 and 6
	d$proposeBy<-function(process, sequence, position){ sample(3:6,1) }
	d$proposeBy
	# set/get acceptBy
   # reject half of the events
	d$acceptBy<-function(process, sequence, range){ sample(c(TRUE, FALSE), 1)}
	d$acceptBy
	# create a sequence object, attach process
	s<-NucleotideSequence(string="AATTGGCCCCGGTTAA", processes=list(list(d)))
	# set the rate multiplier
       setRateMultipliers(s,d,2)
       # get the list of active events at site 6
       events<-getEventsAtSite(d,s$sites[[6]])
       events;
       # print sequence
       s
       # set the position for the event object
       e<-events[[1]];
       e$.position<-6;
       # perform the deletion event
       Perform(e)
       # check the results
       s
 

phylosim documentation built on Nov. 22, 2019, 1:07 a.m.