This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to attach numbers next to nodes and tips in a tree illustration produced by ggtree? The numbers are imported from an external tsv file.

For those of you familiar with ggtree, how do I go about annotating numerical information per node and tip in ggtree?

This gives me a tree no issue:

library(tidyverse)
library(ggtree)

# the path to the tree files is

tree <- read.tree("tree.txt")
ggtree(tree,branch.length = 'none') + theme_tree2()+geom_tiplab(align=TRUE, linesize=.5)+ xlim(0,25)
ggsave("test_2.pdf", width = 60, height = 80, units = "cm", limitsize = FALSE)

But my gene tree could use some annotations with numbers, speciifically I want to be able to add number relevant to each node and tip.

I have looked around and this tutorial is about as close as I can come to describing what I want to do but I am not being able to set the code just right.

This is the closest I came but keep getting the error Error in UseMethod("left_join") : no applicable method for 'left_join' applied to an object of class "NULL"

dd <- read.table(file = 'raw_data/counts.csv',sep='\t',header=TRUE) # this is the data frame where one column is the name of tips and rows and the second column named 'Increase' is the count per tip and node

tree <- read.tree("raw_data/tree.txt") # this is the tree

tree <- tree %<+% dd + geom_tiplab() + geom_tippoint(aes(size=Increase), alpha=0.25) # this is what I was hoping would add the data frame data to the tree

Here are the files if you want to try.

ggtree

0 answers

No answers yet.

Log in to answer this question.