Labeling branches Newick Format

318 views
Skip to first unread message

hayot sepnos

unread,
Jul 16, 2021, 3:39:42 AM7/16/21
to PAML discussion group
I would like to run a  branch site model using codeml. I am  labeling  each branch i will be  testing by hand (#1, #2,.....) but i suspect some of my label may be wrong as newick format can be overwhelming. A good way to check my branch label would be to plot the tree with the branch labels(#1,#2,..) on it.

- Does anyone know a good program to visualize a phylogeny tree with branch labels? or anyway around this?
I tried Mega and Figtree but they do not display the branch labels.


bbj23

unread,
Jul 20, 2021, 2:56:31 PM7/20/21
to PAML discussion group
Figtree should recognize that your tree has labeled branches - when you open a tree from a file it will ask you to assign a name to the labels. Say you name it "my_labels", you can view them by expanding the "Branch labels" (or "Node labels") bar in the options panel at the left, then click "Display" and select "my_labels" and they will show up. 

Another easy viewing option is in R. For manual labeling and checking, I find this faster than Figtree. Install the 'ape' package, then:

my_tree<-read.tree("path/to/newick/file") # read in the file, or alternately below:
my_tree<-read.tree(text="((your, raw)#1, (labeled, newick));") # read in the raw newick text
my_tree<-ladderize(my_tree) # for easier viewing, optional
plot(my_tree, show.node.label = T, cex = 0.5) # cex is optional, but you may want to try smaller numbers to help with viewing if your tree is large
Just check that your labels appear in the right place and if not, manually edit the newick text and repeat above to check again.

Node labels can also be coded out in ape if that is more useful for you. Info here.

Hope that helps!
-Ben

hayot sepnos

unread,
Jul 28, 2021, 12:48:27 AM7/28/21
to PAML discussion group
 Thank you so much !! I tried it in R and it was so convenient. !
Reply all
Reply to author
Forward
0 new messages