Export treedata object to BEAST NEXUS file. This function was adopted and modified from ape::write.nexus

write.beast(treedata, file = "", translate = TRUE, tree.name = "UNTITLED")

Arguments

treedata

treedata object

file

output file. If file = "", print the output content on screen

translate

whether translate taxa labels

tree.name

name of the tree

Value

output file or file content on screen

Author

Guangchuang Yu

Examples

nhxfile <- system.file("extdata/NHX", "phyldog.nhx", package="treeio") nhx <- read.nhx(nhxfile) write.beast(nhx)
#> #NEXUS #> [R-package treeio, Mon Jan 11 09:11:41 2021] #> #> BEGIN TAXA; #> DIMENSIONS NTAX = 16; #> TAXLABELS #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> [email protected] #> ; #> END; #> BEGIN TREES; #> TRANSLATE #> 1 [email protected], #> 2 [email protected], #> 3 [email protected], #> 4 [email protected], #> 5 [email protected], #> 6 [email protected], #> 7 [email protected], #> 8 [email protected], #> 9 [email protected], #> 10 [email protected], #> 11 [email protected], #> 12 [email protected], #> 13 [email protected], #> 14 [email protected], #> 15 [email protected], #> 16 [email protected] #> ; #> TREE * UNTITLED = [&R] (((1[&Ev=S,S=58,ND=0]:0.0682841,(2[&Ev=S,S=69,ND=1]:0.0193941,3[&Ev=S,S=70,ND=2]:0.0121378)[&Ev=S,S=60,ND=3]:0.0217782)[&Ev=S,S=36,ND=4]:0.0607598,((4[&Ev=S,S=31,ND=9]:0.11832,(((5[&Ev=S,S=37,ND=10]:0.0144549,6[&Ev=S,S=38,ND=11]:0.0149723)[&Ev=S,S=33,ND=12]:0.0925388,7[&Ev=S,S=61,ND=13]:0.077429)[&Ev=S,S=24,ND=14]:0.0274637,(8[&Ev=S,S=52,ND=15]:0.0761163,((9[&Ev=S,S=53,ND=16]:0.0906068,10[&Ev=S,S=54,ND=17]:1e-06)[&Ev=S,S=45,ND=18]:1e-06,((11[&Ev=S,S=65,ND=19]:0.120851,12[&Ev=S,S=71,ND=20]:0.133939)[&Ev=S,S=56,ND=21]:1e-06,13[&Ev=S,S=64,ND=22]:0.0693814)[&Ev=S,S=46,ND=23]:1e-06)[&Ev=S,S=40,ND=24]:0.0333823)[&Ev=S,S=35,ND=25]:1e-06)[&Ev=D,S=24,ND=26]:0.0431861)[&Ev=S,S=19,ND=27]:1e-06,14[&Ev=S,S=26,ND=28]:0.22283)[&Ev=S,S=17,ND=29]:0.0292362)[&Ev=D,S=17,ND=8]:0.185603,(15[&Ev=S,S=16,ND=5]:0.0621782,16[&Ev=S,S=15,ND=6]:0.332505)[&Ev=S,S=12,ND=7]:0.185603)[&Ev=S,S=9,ND=30]; #> END;