Closed brj1 closed 3 years ago
I think we should rename write_beast_newick
to write.beast.newick
and read.beast.tree
to read.beast.newick
, so that the style of function names is consistent.
to consistent with other parser functions in treeio, please only use file
as input.
PS: user can use file = textConnection(text)
I've made all 3 of the requested changes.
Description
Added a method
read.beast.tree
to read untranslated newick BEAST trees with metadata. Also exported thewrite_beast_newick
method in R/write-beast.R.Recently, I tried to create starting trees for a BEAST2 run that uses the MultiTypeTree package. I found this quite challenging with available methods as
read.tree
removes tree metadata ([]
after tip/node labels). Also writing newick trees with meta data for BEAST2 is annoying because you have to manually put the[]
in the labels.I also refactored
read.beast
(and internal functions) a bit so that it reads the file less and reruns less code.Example