setGenerateBy.GeneralInsertor: Set the function object used for generating inserts

Description Usage Arguments Value Author(s) See Also Examples

Description

Set the function object used for generating inserts. The provided function must return a Sequence object whne called and must have the following arguments: process, length, target.seq, event.pos, insert.pos (see generateInsert.GeneralInsertor).

Usage

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

Arguments

this

A GeneralInsertor object.

value

A function object.

...

Not used.

Value

The 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
19
20
21
22
23
24
25
26
27
	# 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(string="AAAAAAA")
	)

	# save insert generator
	old.gen<-getGenerateBy(i)
	# set a new insert generator
	i$generateBy<-function(
                           process,
                           length,
                           target.seq,
                           event.pos,
                           insert.pos){
                   return(NucleotideSequence(string="AATTGGCC"))
                   }
	# get the generator function
	i$generateBy
	# generate insert
	generateInsert(i)
	# restore old generator
	i$generateBy<-old.gen
	# generate insert
	generateInsert(i)
 

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