raxml-ng trees read into R as rooted (ape)

464 views
Skip to first unread message

KW

unread,
May 9, 2019, 6:26:26 PM5/9/19
to raxml
Hi,

My understanding is that RAxML best-fit trees are not rooted. Is this correct? When reading best-fit trees with bootstrap support values (.support) into R via ape, rooted tree objects are generated. Is there a recommended way to read RAxML trees into R? 

Thank you in advance!

Alexandros Stamatakis

unread,
May 10, 2019, 1:53:01 AM5/10/19
to ra...@googlegroups.com


On 10.05.19 00:26, KW wrote:
> Hi,
>
> My understanding is that RAxML best-fit trees are not rooted.
> Is this
> correct?

Yes, except if you have specified an outgroup of course.

> When reading best-fit trees with bootstrap support values
> (.support) into R via ape, rooted tree objects are generated.

Can you maybe send a screenshot? Also, maybe this paper here might be of
interest in this context:

https://academic.oup.com/mbe/article/34/6/1535/3077051

> Is there a
> recommended way to read RAxML trees into R?

Maybe some of the other users on here can tell. Personally, I don't use R.

Alexis

>
> Thank you in advance!
>
> --
> You received this message because you are subscribed to the Google
> Groups "raxml" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to raxml+un...@googlegroups.com
> <mailto:raxml+un...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/raxml/f8aff906-fec5-4420-84ad-fb63e8a0bc92%40googlegroups.com
> <https://groups.google.com/d/msgid/raxml/f8aff906-fec5-4420-84ad-fb63e8a0bc92%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
Alexandros (Alexis) Stamatakis

Research Group Leader, Heidelberg Institute for Theoretical Studies
Full Professor, Dept. of Informatics, Karlsruhe Institute of Technology

www.exelixis-lab.org

Heather

unread,
May 10, 2019, 9:08:21 AM5/10/19
to raxml
Hi KW, 

I'm just going to copy paste my code for reading trees into R and hopefully it makes sense :). 

library(ape)

library(Biostrings)

library(ggplot2)

library(ggtree)

library(tibble)

library(tidyr)

library(treeio)


####Set your wd

setwd("Working_Directory")



#####Load in tree data and make sure that it loads correctly

nex <- ("RAxML_bipartitionsBranchLabels.all_4_85")

tree <- read.raxml(nex)

tree


# Show tree information

tree@phylo$tip.label

tree@data$bootstrap


####Make major groupings for clade labeling 

smallgroups <- list(

  "Northern Deep Alaska"=c("Alaska_28", "Alaska_13"),

  "Large Pacific 1"=c("PacificNW_15")

)


###Root the tree (if needed)

roottree <- root.phylo(tree, "Dlighti_7", resolve.root=TRUE)


###Assign groups to the tree

grouptree <- groupOTU(tree, smallgroups)


###Make a data frame with these groups to rename the tips

name_4_85 <- c("Alaska_Nome", "Alaska_Bering Sea", "Alaska_Nome", "Diadumene lighti")

d <- data.frame(label=grouptree@phylo$tip.label, tipnames=name_4_85)



###Plot the tree

p <- ggtree(grouptree, ladderize =T, right=F, aes(color=group)) %<+% d +

  geom_tiplab(aes(label=tipnames), offset = 0, size=2.5, color = "black", hjust = 0) +

  geom_text2(aes(label=bootstrap, subset=bootstrap>70), size=3, color = "black", hjust = 1, vjust = -0.3) +

  scale_color_manual(values=c('black', '#91cf60'), 

                     breaks=c("Northern Deep Alaska", "Large Pacific 1")) +

  labs(color = "Geographic Groups") +

  theme(plot.margin = unit(c(1,1,1.5,1.2), "cm")) +

  theme(legend.position = "right") +

  ggplot2::xlim(0,0.05)


p


###Show internal node labels to assign clade labels to

p + geom_text(aes(label=node), hjust=-.3)

KW

unread,
May 16, 2019, 3:54:39 PM5/16/19
to raxml
Thank you both for the help!

Yes, this is indeed an issue with R packages reading trees. I have found that ggtree's read.raxml does not work with trees inferred with raxml-ng. I used ggtree's read.tree which automatically roots trees. However, this can be solved by unrooting them in R. 

Thanks again!
Reply all
Reply to author
Forward
0 new messages