ggtree

How to colour the branches of an unrooted tree using a variable in R

我只是一个虾纸丫 提交于 2021-01-27 20:50:59
问题 I would like to generated unrooted neighbour joining trees from input haplotype data, and then colour the branches of the trees based on a variable. I am using the packages Ape and ggtree. The haplotypes and co-variables (metadata) are on two separate files with matching sample names. I have been able to produce trees and colour the tips of the trees by variables, but not the tree branches. Using mock data - # Packages library('ggplot2') library('ape') library('phangorn') library('dplyr')

Add legend into ggtree (ggplot) R

ぐ巨炮叔叔 提交于 2019-12-24 02:54:09
问题 I'm building a tree with ggtree on R. library(ggtree) here is the newick file content: ((Tribolium_castaneum:1.00000,Anoplophora_glabripennis:1.00000):1.23589,(((((Ichneumoninae_B:1.00000,Ichneumoninae_A:1.00000)1:1.27089,((Tryphoninae_A:1.00000,Tryphoninae_B:1.00000)1:1.34418,((Ophioninae_A:1.00000,Campopleginae:1.00000)1:0.14225,(Cremastinae_B:1.00000,Cremastinae_A:1.00000)1:0.66653)1:0.19416)1:0.08638)1:0.63371,(((Microplitis_demolitor:1.00000,Cotesia_vestalis:1.00000)1:1.02258,