| simSeq {phangorn} | R Documentation |
Simulate sequences for a given evolutionary tree.
simSeq(tree, l=1000, Q=NULL, bf=NULL, rootseq=NULL, type="DNA",
model="", levels=NULL, rate=1, ancestral=FALSE)
tree |
a phylogenetic tree tree, an object of class phylo. |
l |
length of the sequence to simulate. |
Q |
the rate matrix. |
bf |
base frequences. |
rootseq |
a vector of length l containing the root sequence, other root sequence is randomly generated. |
type |
Type of sequences ("DNA", "AA" or "USER"). |
model |
Amino acid models: one of "WAG", "JTT", "Dayhoff" or "LG" |
levels |
levels takes a character vector of the different bases,
default is for nucleotide sequences, only used when type = "USER". |
rate |
rate. |
ancestral |
Return ancestral sequences? |
simSeq simulates sequence alingments. So far rate variation
is not yet implemented, but one can combine different alignments
having their own rate.
In fact it is possible to generate DNA, RNA, amino acid, or 0/1.
simSeq returns an object of class phyDat.
Klaus Schliep klaus.schliep@gmail.com
tree = rtree(5)
plot(tree)
nodelabels()
# Example for simple DNA alignment
data = simSeq(tree, l = 10, type="DNA", bf=c(.1,.2,.3,.4), Q=1:6)
as.character(data)
# Example to simulate discrete Gamma rate variation
rates = phangorn:::discrete.gamma(1,4)
data1 = simSeq(tree, l = 100, type="AA", model="WAG", rates[1])
data2 = simSeq(tree, l = 100, type="AA", model="WAG", rates[2])
data3 = simSeq(tree, l = 100, type="AA", model="WAG", rates[3])
data4 = simSeq(tree, l = 100, type="AA", model="WAG", rates[4])
data <- c(data1,data2, data3, data4)
write.phyDat(data, file="temp.dat", format="sequential",nbcol = -1, colsep = "")
unlink("temp.dat")