你有没有遇到过这个错误? - Newick 字符串中左右括号的数量不相等 - R 中的树 [英] have you ever had this error?-numbers of left and right parentheses in Newick string not equal- tree in R

查看:26
本文介绍了你有没有遇到过这个错误? - Newick 字符串中左右括号的数量不相等 - R 中的树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试读取树时发生上述错误.tree <- read.tree(paste0(table_dir,'tree.19.08.tre'))我试图重现错误,但使用其他树,例如使用 iris 示例数据集,它完美地工作.该树是使用 write.tree(tree, file='C:/Users/J/Desktop/proj/d/t/tree.19.08.tre',append = FALSE) 生成的.我可以在程序 FigTree(基于 javascript)中查看 tree.也许它看起来有点奇怪,但为什么我不能在 R 中打开它?
有什么建议吗?

The above error is occurring when trying to read a tree . tree <- read.tree(paste0(table_dir,'tree.19.08.tre')) I tried to reproduce the error but with other trees, for example with the iris example dataset it worked perfectly. The tree was generated with write.tree(tree, file='C:/Users/J/Desktop/proj/d/t/tree.19.08.tre',append = FALSE). I can look at tree in the programme FigTree (javascript based). Maybe it looks a bit strange but why can´t I open it in R?
Any suggestions?

这是 figtree 中 tree 的一个切口,以防万一;)

That is a cutout of tree in figtree, in case it helps ;)

这是完整的错误:

Fehler in FUN(X[[i]], ...) : numbers of left and right parentheses in Newick string not equal
3.
FUN(X[[i]], ...)
2.
lapply(STRING, .treeBuild)
1.
read.tree(paste0(table_dir, "tree.19.08.tre"))

推荐答案

我遇到了同样的问题,我也无法使用 DECIPHER 加载它,但我使用 phytools:

I had the same problem and I couldn't load it with DECIPHER either, but I made it with phytools:

library(phytools)
tree = read.newick(treeFileName)

探索加载的 phylo 对象我意识到这棵树是不正确的,原因是树的叶子包含在名称分号中,因为它在某些分类格式中是常用的,例如

Exploring the loaded phylo object I realized that the tree was not correct, the reason being that the leaves of the tree contained in the name semicolons, as it is costumary in some taxonomic formats, e.g.

d__细菌;p__Proteobacteria;c__Gammaproteobacteria

d__Bacteria;p__Proteobacteria;c__Gammaproteobacteria

问题是分号以newick格式表示树的结尾.只需将分号转换为其他符号,例如

and the problem is that the semicolon indicates the end of the tree in newick format. Simply transforming the semicolons into other symbol, e.g.

d__细菌|p__Proteobacteria|c__Gammaproteobacteria

d__Bacteria|p__Proteobacteria|c__Gammaproteobacteria

解决了问题.

这篇关于你有没有遇到过这个错误? - Newick 字符串中左右括号的数量不相等 - R 中的树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆