Learn R Programming

phylosim (version 3.0.5)

getEventsAtSite.GeneralInsertor: Generate insertion event object given the state of the target site

Description

Generate insertion event object given the state of the target site.

This method generates a list with one insertion event. The rate of the event is calculated as the product of the general rate of the process and the "rate.multiplier" site-process specific parameter. An empty list is returned if the rate is zero or NA.

Usage

# S3 method for GeneralInsertor
getEventsAtSite(this, target.site, ...)

Arguments

this

A GeneralInsertor object.

target.site

A Site object.

...

Not used.

Value

A list of Event objects.

See Also

GeneralInsertor GeneralInDel Process Event

Examples

Run this code
# NOT RUN {
	# create a sequence object
	s<-NucleotideSequence(string="AAAA")
	# create a GeneralInsertor process, provide template sequence.
	# propsed insert lengths:3, always accept.
	i<-GeneralInsertor(
		rate=0.5,
		template.seq=NucleotideSequence(string="GGG"),
		propose.by=function(process){3},
		accept.by=function(process,sequence,window){TRUE}
	)
	# attach process to site
	s$processes<-list(list(i));
	# set rate multiplier
	setRateMultipliers(s,i,2)
	# get the list of active events from site 2
	events<-getEventsAtSite(i,s$sites[[2]])
	events
	# set postition for event
	e<-events[[1]]
	e$.position<-2
	# print sequence
	s
	# perform event
	Perform(e)
	# check sequence again
	s
 
# }

Run the code above in your browser using DataLab