getInsertHook.GeneralInsertor: Get the insert hook function

Description Usage Arguments Value Author(s) See Also Examples

Description

Get the insert hook function.

The insert hook allows to make various modifications on the insert before performing the insertion.

The insert hook function is called by the insertion event handler function. The insert hook takes the sequence generated by the generateInsert method throught the "seq" argument. The function must return a Sequnece object, which will be inserted in the target sequence.

Usage

1
2
## S3 method for class 'GeneralInsertor'
getInsertHook(this, ...)

Arguments

this

A GeneralInsertor object.

...

Not used.

Value

A function object.

Author(s)

Botond Sipos, Gregory Jordan

See Also

For more information see GeneralInsertor.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
	# create a GeneralInsertor object
	i<-GeneralInsertor(
		rate=0.5,
		propose.by=function(process){sample(c(5:10),1)}, # inserts between 5 and 10
		template.seq=NucleotideSequence(length=5,processes=list(list(JC69())))
	)
	# set a dummy insert hook
	setInsertHook(i,function(seq){return(seq)})
	# set a new insert hook via virtual field
	i$insertHook<-function(seq){
		seq$processes<-list(list(GTR())) # replace the subsitution process
		return(seq)
	}
	# get the insert hook via virtual field
	i$insertHook
	# get the insert hook
	getInsertHook(i)
 

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