emmanuelparadis / ape

analysis of phylogenetics and evolution

Home Page:http://ape-package.ird.fr/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

write.tree not using tree.names

IanGBrennan opened this issue · comments

Hello, thanks for the development and maintenance of such an incredible resource.

the tree.names = TRUE argument of write.tree doesn't seem to write the tree names to file.
e.g.

trees <- NULL
trees[[1]] <- read.tree(text="(A,(B,C));")
trees[[2]] <- read.tree(text="(C,(B,A));")
class(trees) <- "multiPhylo"
names(trees) <- c("Opt1", "Opt2")
write.tree(trees, file="TEST.trees", tree.names = T)

I think it's that .write.tree2 doesn't use the tree.prefix argument when it pastes the newick string in the last line, e.g. the last line should read paste0(tree.prefix, " ", NEWICK[root], ";") instead.

Thanks for any help.

Hello Ian, thanks for the appreciation!

Your diagnostic is correct: this bug was introduced in ape 5.7. I've fixed it and pushed a new version here.

It seems there used to be no space between the tree name (stored in tree.prefix) and the Newick string, so I omitted the , " " from your suggestion.

Cheers,

Fantastic. Thanks for fixing so quickly.