write.beast: write.beast

Description Usage Arguments Value Author(s) Examples

View source: R/write-beast.R

Description

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

Usage

1
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(s)

Guangchuang Yu

Examples

1
2
3
nhxfile <- system.file("extdata/NHX", "phyldog.nhx", package="treeio")
nhx <- read.nhx(nhxfile)
write.beast(nhx)

Example output

Registered S3 method overwritten by 'treeio':
  method     from
  root.phylo ape 
treeio v1.14.3  For help: https://yulab-smu.top/treedata-book/

If you use treeio in published research, please cite:

LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR Jones, T Bradley, H Zhu, Y Guan, Y Jiang, G Yu. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. Molecular Biology and Evolution 2020, 37(2):599-603. doi: 10.1093/molbev/msz240

#NEXUS
[R-package treeio, Mon Dec 21 06:10:01 2020]

BEGIN TAXA;
	DIMENSIONS NTAX = 16;
	TAXLABELS
		Prayidae_D27SS7@2825365
		Kephyes_ovata@2606431
		Chuniphyes_multidentata@1277217
		Apolemia_sp_@1353964
		Bargmannia_amoena@263997
		Bargmannia_elongata@946788
		Physonect_sp_@2066767
		Stephalia_dilata@2960089
		Frillagalma_vityazi@1155031
		Resomia_ornicephala@3111757
		Lychnagalma_utricularia@2253871
		Nanomia_bijuga@717864
		Cordagalma_sp_@1525873
		Rhizophysa_filiformis@3073669
		Hydra_magnipapillata@52244
		Ectopleura_larynx@3556167
	;
END;
BEGIN TREES;
	TRANSLATE
		1	Prayidae_D27SS7@2825365,
		2	Kephyes_ovata@2606431,
		3	Chuniphyes_multidentata@1277217,
		4	Apolemia_sp_@1353964,
		5	Bargmannia_amoena@263997,
		6	Bargmannia_elongata@946788,
		7	Physonect_sp_@2066767,
		8	Stephalia_dilata@2960089,
		9	Frillagalma_vityazi@1155031,
		10	Resomia_ornicephala@3111757,
		11	Lychnagalma_utricularia@2253871,
		12	Nanomia_bijuga@717864,
		13	Cordagalma_sp_@1525873,
		14	Rhizophysa_filiformis@3073669,
		15	Hydra_magnipapillata@52244,
		16	Ectopleura_larynx@3556167
	;
	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;

treeio documentation built on Nov. 21, 2020, 2:01 a.m.