amkozlov / raxml-ng

RAxML Next Generation: faster, easier-to-use and more flexible
GNU Affero General Public License v3.0
374 stars 62 forks source link

Add bootstrap values to phylogenetic tree #155

Closed asierFernandezP closed 1 year ago

asierFernandezP commented 1 year ago

Hi,

I have ran raxml-ng using the following command, so I get the bootstrap confidence values in my phylogenetic tree:

raxml-ng --all --msa $file --model GTR+G --tree pars{10} --bs-trees 100

However, when I try to plot them I realised that the length of treeML$node.label (bootstrap values) is different to the length of treeML$tip.label, giving an error.

The code that I use is the following:

treeML <- read.tree(list.files("./", "support$")) # read tree
d <- data.frame(label=treeML$tip.label, bootstrap = treeML$node.label, pair_ID=pair_ID, Sample_type=Sample_type) #error raises here as lengths are different

Any solutions for this?

Thank you, Asier

amkozlov commented 1 year ago

Hi Asier,

bootstrap support values are computed for inner nodes (or more precisely, for branches "above" the respective inner nodes). So why do yo expect. In a fully resolved unrooted tree with n tips, there are n-2 inner nodes. So it is expected that tip.label and node.label have different sizes.

If you just want to plot a tree with support values in R, you do not need to remap anything, see an example here:

https://github.com/amkozlov/cellphy/blob/master/script/support-map.R

Best, Alexey

asierFernandezP commented 1 year ago

Thank you very much for the explanation!

Best, Asier