How to read phylogenetic tree downloaded from ncbi taxonomy

159 views
Skip to first unread message

Chirag Parsania

unread,
May 17, 2018, 6:41:15 AM5/17/18
to ggtree
Hi,

I have downloaded phylogenetic tree from ncbi taxonomy database using ncbi taxonomy ids.  See the attachment. File extension of tree is .phy. When I try to read this in R using read.tree it changes tree labels to some weird symbols.  

Kindly let me know how can I load the tree in R and further play using ggtree ?

Also, once the tree loaded in the R, How can I convert tree to distance matrix ?

Thanks,
Chirag.

phyliptree-5.phy

Yu, Guangchuang

unread,
May 17, 2018, 11:09:58 PM5/17/18
to Chirag Parsania, ggtree
treetext = readLines("phyliptree-5.phy")
treetext = paste0(treetext, collapse="")

read.tree(text=treetext)

the above commands work for your tree file which split newick tree text to more than 10k lines and should be pasted to a single line.


--
G Yu, DK Smith, H Zhu, Y Guan, TTY Lam*. ggtree: an R package for visualization and annotation of phylogenetic trees with their covariates and other associated data, Methods in Ecology and Evolution, 2017, 8(1):28-36. doi:10.1111/2041-210X.12628
 
Homepage: https://guangchuangyu.github.io/software/ggtree
---
You received this message because you are subscribed to the Google Groups "ggtree" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bioc-ggtree+unsubscribe@googlegroups.com.
To post to this group, send email to bioc-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bioc-ggtree/1a64a70b-d532-4867-a122-7e06f1ab4e0e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
--~--~---------~--~----~------------~-------~--~----~
Guangchuang Yu PhD
Postdoc researcher
State Key Laboratory of Emerging Infectious Diseases
School of Public Health
The University of Hong Kong
Hong Kong SAR, China
-~----------~----~----~----~------~----~------~--~---
Reply all
Reply to author
Forward
0 new messages