Description Usage Arguments Value Author(s) See Also Examples
Generate an insert.
This method uses the function stgored in the proposeBy
virtual field to
sample the insert length and then calls the function stored in the generateBy
field to generate the insert.
The default generateBy
function set by the GeneralInsertor constructor truncates/repeats
the template sequence stored in the templateSeq
field to have the sequence with the right size
and then calls the sampleStates
method on the resulting object. That means that if we start with a
template sequence which has NA states, but has a substitution process attached, then the resulting sequence
will be different every time the generateInsert
method is called.
The generateBy
, proposeBy
and templateSeq
fields must be set in order to use this method.
1 2 |
this |
A GeneralInsertor object. |
length |
Generate an insert with the specified length if this argument is present. |
target.seq |
The Sequence object targeted by the insertion (optional). This argument is passed to the |
event.pos |
The position of the site proposing the insertion (optional). This argument is passed to the |
insert.pos |
The position of the insertion in the target sequence (optional). This argument is passed to the |
... |
Not used. |
A Sequence object.
Botond Sipos, Gregory Jordan
For more information see GeneralInsertor
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # build the template sequence
ts<-NucleotideSequence(length = 10,processes=list(list(JC69())));
# fix some site states
setStates(ts,"A",c(1,2));
setStates(ts,"T",c(5,6));
setStates(ts,"C",c(9,10));
# print template sequence
ts
# create a GeneralInsertor object
i<-GeneralInsertor(
rate=0.5,
template.seq=ts,
propose.by=function(process){sample(c(5:50),1)}, # inserts between 5 and 50
)
# generate some inserts
generateInsert(i)
generateInsert(i)
generateInsert(i)
generateInsert(i)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.