shmulateTree {shazam} | R Documentation |
Simulate mutations in a lineage tree
Description
shmulateTree
returns a set of simulated sequences generated from an input
sequence and a lineage tree. The input sequence is used to replace the most recent
common ancestor (MRCA) node of the igraph
object defining the lineage tree.
Sequences are then simulated with mutations corresponding to edge weights in the tree.
Sequences will not be generated for groups of nodes that are specified to be excluded.
Usage
shmulateTree(
sequence,
graph,
targetingModel = HH_S5F,
field = NULL,
exclude = NULL,
junctionWeight = NULL,
start = 1,
end = nchar(sequence)
)
Arguments
sequence |
string defining the MRCA sequence to seed mutations from. |
graph |
|
targetingModel |
5-mer TargetingModel object to be used for computing probabilities of mutations at each position. Defaults to HH_S5F. |
field |
annotation to use for both unweighted path length exclusion
and consideration as the MRCA node. If |
exclude |
vector of annotation values in |
junctionWeight |
fraction of the nucleotide sequence that is within the
junction region. When specified this adds a proportional
number of mutations to the immediate offspring nodes of the
MRCA. Requires a value between 0 and 1. If |
start |
Initial position in |
end |
Last position in |
Value
A data.frame
of simulated sequences with columns:
-
name
: name of the corresponding node in the inputgraph
. -
sequence
: mutated sequence. -
distance
: Hamming distance of the mutated sequence from the seedsequence
.
See Also
See shmulateSeq for imposing mutations on a single sequence. See HH_S5F and MK_RS5NF for predefined TargetingModel objects.
Examples
# Load example lineage and define example MRCA
data(ExampleTrees, package="alakazam")
graph <- ExampleTrees[[17]]
sequence <- "NGATCTGACGACACGGCCGTGTATTACTGTGCGAGAGATAGTTTA"
# Simulate using the default human 5-mer targeting model
shmulateTree(sequence, graph)
# Simulate using the mouse 5-mer targeting model
# Exclude nodes without a sample identifier
# Add 20% mutation rate to the immediate offsprings of the MRCA
shmulateTree(sequence, graph, targetingModel=MK_RS5NF,
field="sample_id", exclude=NA, junctionWeight=0.2)