Learn R Programming

phylosim (version 3.0.5)

Event: The Event class

Description

This is the class representing an event. Event objects usually are generated by the getEventsAtSite.* methods based on the state of attached Site object and the properties of the generating Process object.

The Perform method will refuse to modify target objects if the position field is not set. The Perform method can be called only once for any Event object.

Package: Class Event

Object ~~| ~~+--PSRoot ~~~~~~~| ~~~~~~~+--Event

Directly known subclasses:

public static class Event extends PSRoot

Usage

Event(name=NA, rate=NA, site=NA, position=NA, process=NA, handler=NA, ...)

Arguments

name

The name of the Event object. Often stores useful information.

rate

The rate of the event.

site

The associated Site object.

position

The position of associated Site object in the enclosing Sequence object (if any).

process

The generator Process object.

handler

The handler function for the Event object. It will be called by Perform.Event with the Event object as an argument to make the changes corresponding to the event.

...

Not used.

Fields and Methods

Methods:

Perform -
as.character -
checkConsistency -
getHandler -
getName -
getPosition -
getProcess -
getRate -
getSite -
getWriteProtected -
is -
setHandler -
setName -
setPosition -
setProcess -
setRate -
setSite -
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

Site Process Sequence getEventsAtSite.GeneralSubstitution

Examples

Run this code
# NOT RUN {
	# Note: the following examples are not very useful
	# unless you want to implement your own process.

	# create a Sequence object and a Process object
	seq<-NucleotideSequence(string="A");
	p<-Process(alphabet=NucleotideAlphabet())
	# get the Site object from the Sequence object
	s<-seq$sites[[1]]
	# attach p to s
	attachProcess(s,p)
	# create an Event object
	e<-Event(name="A->G",rate=0.1,site=s,process=p,position=1)
	# get object summary
	summary(e)
	# get event name
	e$name
	# set/get event rate
	e$rate<-0.2
	e$rate
	# get site
	e$site
	# set/get event handler
	e$.handler<-function(this){this$.site$state<-"G"}
	e$handler
	# perform the event
	Perform(e)
	# check the state of the target site
	s$state
 
# }

Run the code above in your browser using DataLab