Hi, I have a dataset of roughly 7000 trees in newick format that I have loaded into R. Each tree has 5 tips, each representing a species. As the trees are not rooted, I am trying to root the trees using one of the species (AGAP) as the outgroup. However, when I run the root function like so:
x <- root(nh.tree.list[[1]], outgroup = "AGAP")
The tree does indeed shift so that the node below the tip AGAP is at the base of the tree, but the tree remains unrooted (which I can confirm using the is.rooted command). This tree in question in newick format is:
(AMEM:0.06608854676,AARA:0.05958550382((AGAP:0.08235019885,AQUA:0.05921768275):0.0120129681,AMEC:0.06541441488):0.007929218113);
I need to root the trees as the analysis I intend to do requires rooted trees. In case it helps, these trees were created from multiple sequence alignment fasta files, using neighbour joining methods (njs function). I cannot fathom why the trees aren't being rooted. Can anyone shed any light on this? Thanks.
That tree shows up as rooted for me:
I got the same as Fanli.gcb when i ran on Ape too. Plot the tree, you will see if its rooted or not. Maybe there is a problem with function to check rooting or something.
This is very strange. I am still getting:
When I plotted it is still not rooted. I tried to read in the tree independently from the same information I have given you and I still got the above message, using no arguments other than file for read.tree. The fact that two of you got the same means there's something wrong my end, though I am not sure what it might be.
Ok I think I know what my issue is. I was using read.tree(file = "filename") which seems to result in an unrooted tree. You guys did read.tree(), and then entered tree details on the next line, as fanli.gcb already showed. However, how can I do this if I need to read in 7000 files? To be clear, I am talking about the difference between this:
Which produces an unrooted tree, and this:
Which produces the rooted tree. What I need to know is how to achieve the latter tree when reading in multiple files?