I am trying to analyze data from nexus file and tree file respectively in R. I imported the data after facing few difficulties, and now I intent to set outgroup and root the tree with the outgroup.
When I try to use the command "root()" from ape package, I get the following error;
object "phy" is not of class "phylo"
I tried google for help but it I believe it had let me down. I would appreciate any suggestion/help.
The files are given in dropbox,
https://www.dropbox.com/sh/kqo8bwi9s7ispcx/AADDEsRuDfLCpKbZeGgU81nha?dl=0
The name of file is "hominoid.nex", the folder also contains a file called questions. Which outlines my task of converting PAUP commands to their equivalent R ones.
1 answer
The error message is telling you what you need to know -- the object you are trying to root is not a tree, so you can't root it.
(hominoid.nex is a DNA alignment, you'd need to estimate a tree from it before you could root it. hominoid_apriori.tr is a (nexus formatted) tree, if you just want a rooted tree read that with read.nexus)
Log in to answer this question.
Thank you, I used to following command to obtain a distances from DNA alignment file. The command was from ape package.
Is the above command correct way, if not can you tell me or suggest me some sources from where I can understand how to estimate a tree from the given DNA alignment file.
After computing the distances, I am able to plot trees using
command. But still I am not able to set "Lemur_catta" as an outgroup.
Mani -- Q and A sites like Biostars work best when the answers section is reserved for answers to the original questions. Follows ups should appear as comments on particular answers.
As to your question,
dist.dnawill give you a distance matrix using the method you provide (check out?dist.dnato see what's on offer). You can then use?njto estimate a neighbor joining tree. I'm don't think any other tree-estimation methods are available in ape.Yes David, I already looked at that. setting root is possible in ape package "http://svitsrv25.epfl.ch/R-doc/library/ape/html/root.html"
I am guessing I am doing something wrong when using the command. Can you assist me with this?
Mani -- you have to make a tree. At the momeny you have a distance matrix, not a tree. See the help the function nj (?nj)
Hi David, I had constructed a tree already and tried rooting it too. Commands:
I am able to run the command, when I view the tree plot;
I see that
Lemur_cattaandTarsius_syrichta, both have been set as outgroup. But I want only Lemur catta as an outgroup? Is there any problem with my code?Mani, it's fine (presuming your instructor agrees) to use biostars to help in homework assignments. But people that help you are going to want to see that you are learning general lessons about how to use software and perform analysis. Rather than give blow-by-blow instructions on how to finish your assignment.
In this case the behaviour of root is precisely what the function's documentation describes. It forms a triple-branch at the node directly above the outgroup. Read the rest of the documentation for other option. If you prefer another visualization of the root you'll probably need to save the tree and view it another tree-viewing program.