Closed
Description
>>> tree = open("tree/tree.nwk").read()
>>> tree.count(")")
203738
>>> tree.count("(")
203738
Method 1:
tre <- read.tree("./tree/tree.nwk")
Method 2:
tre <- read.newick("./tree/tree.nwk")
I got same error when use method 1 or method2.
Error in FUN(X[[i]], ...) : numbers of left and right parentheses in Newick string not equal
Activity
alienzj commentedon Sep 1, 2021
tree.nwk.txt
brj1 commentedon Sep 1, 2021
The
read.tree
function is exported from the ape package. You should make an issue in ape's GitHub to fix this issue. https://github.com/emmanuelparadis/apeThe
read.newick
function in treeio uses ape'sread.tree
function to read the tree, which is why you get the same error.xiangpin commentedon Sep 2, 2021
This is because the node labels contain ";" symbol, it will be confused with the end of single tree. But I also think it might be a bug of
read.tree
ofape
. But you can also replace the "; " of node labes to "|" with some tools, such as sed shell or gsub in R.alienzj commentedon Sep 2, 2021
Thanks for your answers.
alienzj commentedon Sep 2, 2021
Nice! Thank you so much~