simSeqfromSp {phybase}R Documentation

simulate DNA sequences from a species tree

Description

The function simulates sequences from a species tree.

Usage

simSeqfromSp(sptree, spname, ntaxasp, ngene, theta=0, noclock=0, simsequence=1, murate="Dirichlet",alpha=5, seqlength=100, model=1, kappa=2, rate=c(1,1,1,1,1,1), frequency=c(1/4,1/4,1/4,1/4), outfile, format="phylip")

Arguments

sptree A species tree which must be a rooted tree.
spname species names
ntaxasp a vector of the number of individuals in each species
ngene number of genes
theta population size
noclock 0: clocklike species tree 1: nonclocklike species tree
simsequence 1: simulate sequences and gene trees, 0: simulate gene trees
murate distribution of mutation rates
alpha the shape parameter of dirichlet distribution
seqlength the number of nucleotides along the sequences
model substitution model
kappa transition/transversion ratio
rate rates
frequency nucleotide frequency
outfile the full path of the output file
format either "phylip" or "nexus"

Value

The function writes sequences into a file.

Author(s)

Liang Liu lliu@oeb.harvard.edu

References

Felsenstein, J. The Newick tree format. http://evolution.genetics.washington.edu/phylip/newicktree.html

See Also

write.subtree, read.tree.string

Examples

#read the species tree from a data file
data(sptree)
outfile<-"out.txt"
spname <- paste("S",1:20,sep="")
outgroup <- "S20"
ntaxasp <- rep(2,length(spname))
ntaxasp[length(spname)]<-1
ngene<-2
seqlength<-100
simSeqfromSp(sptree,spname,ntaxasp,noclock=1,ngene=ngene,seqlength=seqlength,model=1,outfile=outfile)
simSeqfromSp(sptree,spname,ntaxasp,noclock=0,ngene=ngene,simsequence=0,seqlength=seqlength,model=1,outfile=outfile)

[Package phybase version 1.1 Index]