Learn R Programming

phytools (version 0.1-9)

write.simmap: Simulate stochastic character map on a phylogenetic tree

Description

This function writes stochastic character mapped trees to file using the Newick style format of SIMMAP v1.0 (Bollback 2006). Note, can only write one tree at a time to file (hence the append option).

Usage

write.simmap(tree,file=NULL,append=FALSE,map.order=NULL)

Arguments

tree
a phylogenetic tree as a modified object of class "phylo". See make.simmap and read.simmap.
file
an optional filename.
append
a logical value indicating whether to append to file.
map.order
a optional value specifying whether to write the map in left-to-right or right-to-left order. Acceptable values are "left-to-right" or "right-to-left" or some abbreviation of either. If not provided, write.simmap will use attr(tree,"m

Value

  • a file or string (if file=NULL).

References

Huelsenbeck, J. P., R. Neilsen, and J. P. Bollback. 2003. Stochastic mapping of morphological characters. Systematic Biology, 52, 131-138. Bollback, J. P. 2006. Stochastic character mapping of discrete traits on phylogenies. BMC Bioinformatics, 7, 88.

See Also

make.simmap, read.simmap, plotSimmap

Examples

Run this code
# simulate a tree & data
	tree<-sim.history(pbtree(n=100,scale=1),Q=matrix(c(-1,1,1,-1),2,2))
	# generate stochastic character maps
	mtrees<-make.simmap(tree,tree$states,nsim=20)
	# write them to file
	# for(i in 1:length(mtrees)) 
	#   write.simmap(mtrees[[i]],file="treefile.tre",append=TRUE)

Run the code above in your browser using DataLab