[R-sig-phylo] Generating a tree based on a distance matrix?
All, I have a tree topology (tree_name.tre), and a distance matrix, based on that tree topology. However I cant not seem to find the nexus file from which the matrix was generated. Is there a way to use that distance matrix to incorporate branch lengths into my topology? I have looked into all the threads of questions posted in the list, but still can not find an answer. my final objective is just to generate a tree with branch lengths proportional to the distances on the matrix (reviewers requirement for a publication). Any suggestions would be greatly appreciated! Thanks. Maria Mercedes -- Maria Mercedes Gavilanez Department of Biological Sciences 107 Life Sciences Building Louisiana State University Baton Rouge, LA 70803 (225)578-4284 ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Generating a tree based on a distance matrix?
Hi Nick, I tried nj, but the topology I obtain from that is totally different. I am not sure if it has anything to do with the fact that the tree was created based on maximum likelihood? Thanks though! Meche On Thu, May 12, 2011 at 4:23 PM, Nick Matzke mat...@berkeley.edu wrote: The APE command NJ (neighbor-joining) will form a tree from a distance matrix, so that's one option. You could do it and then see if you get the same topology from NJ as from your topology tree. The branch lengths will reflect whatever distances were calculated from the data (which might be one of several corrected or uncorrected distances, depending on the input sequence/character data). Cheers, Nick On 5/12/11 2:18 PM, mgavil2 wrote: All, I have a tree topology (tree_name.tre), and a distance matrix, based on that tree topology. However I cant not seem to find the nexus file from which the matrix was generated. Is there a way to use that distance matrix to incorporate branch lengths into my topology? I have looked into all the threads of questions posted in the list, but still can not find an answer. my final objective is just to generate a tree with branch lengths proportional to the distances on the matrix (reviewers requirement for a publication). Any suggestions would be greatly appreciated! Thanks. Maria Mercedes -- Nicholas J. Matzke Ph.D. Candidate, Graduate Student Researcher Huelsenbeck Lab Center for Theoretical Evolutionary Genomics 4151 VLSB (Valley Life Sciences Building) Department of Integrative Biology University of California, Berkeley Graduate Student Instructor, IB200B Principles of Phylogenetics: Ecology and Evolution http://ib.berkeley.edu/courses/ib200b/ http://phylo.wikidot.com/ Lab websites: http://ib.berkeley.edu/people/lab_detail.php?lab=54 http://fisher.berkeley.edu/cteg/hlab.html Dept. personal page: http://ib.berkeley.edu/people/students/person_detail.php?person=370 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html Lab phone: 510-643-6299 Dept. fax: 510-643-6264 Cell phone: 510-301-0179 Email: mat...@berkeley.edu Mailing address: Department of Integrative Biology 3060 VLSB #3140 Berkeley, CA 94720-3140 - [W]hen people thought the earth was flat, they were wrong. When people thought the earth was spherical, they were wrong. But if you think that thinking the earth is spherical is just as wrong as thinking the earth is flat, then your view is wronger than both of them put together. Isaac Asimov (1989). The Relativity of Wrong. The Skeptical Inquirer, 14(1), 35-44. Fall 1989. http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm -- Maria Mercedes Gavilanez Department of Biological Sciences 107 Life Sciences Building Louisiana State University Baton Rouge, LA 70803 (225)578-4284 ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Generating a tree based on a distance matrix?
You can get the least squares branch lengths. I believe that if the distance matrix is a patristic distance matrix from your tree, then the least squares branch lengths are guaranteed to be the same as your original branches (and you should have a sum of squares error, Q, of zero - to numerical precision). To test this, you can just use my optim.phylo.ls() function, and set the input tree to your target tree. You will need to have phangorn and ape to run this: source(http://anolis.oeb.harvard.edu/~liam/R-phylogenetics/optim.phylo.ls/v0.3/optim.phylo.ls.R;) # load the source LStree-optim.phylo.ls(D,stree=tree) Note that LStree will be unrooted even if tree is rooted. To test this, try the following: tree-rtree(5,rooted=F) # random unrooted tree tree$edge.length # show edge lengths [1] 0.005683385 0.516492136 0.761613776 0.714302898 0.071461088 0.217680734 0.393926894 D-cophenetic(tree) # compute distance matrix tree$edge.length-NULL # delete branch lengths test-optim.phylo.ls(D,tree) # compute LS tree with true tree as input best Q score of 4.19082355898663e-30 found after 0 nearest neighbor interchange(s). test$edge.length [,1] 6,7 0.005683385 7,1 0.516492136 7,8 0.761613776 8,2 0.714302898 8,3 0.071461088 6,4 0.217680734 6,5 0.393926894 You can easily see that they are the same branch lengths as in our original tree. I hope this is helpful. Sincerely, Liam -- Liam J. Revell University of Massachusetts Boston web: http://faculty.umb.edu/liam.revell/ email: liam.rev...@umb.edu blog: http://phytools.blogspot.com On 5/12/2011 5:18 PM, mgavil2 wrote: All, I have a tree topology (tree_name.tre), and a distance matrix, based on that tree topology. However I cant not seem to find the nexus file from which the matrix was generated. Is there a way to use that distance matrix to incorporate branch lengths into my topology? I have looked into all the threads of questions posted in the list, but still can not find an answer. my final objective is just to generate a tree with branch lengths proportional to the distances on the matrix (reviewers requirement for a publication). Any suggestions would be greatly appreciated! Thanks. Maria Mercedes ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo
Re: [R-sig-phylo] Generating a tree based on a distance matrix?
The APE command NJ (neighbor-joining) will form a tree from a distance matrix, so that's one option. You could do it and then see if you get the same topology from NJ as from your topology tree. The branch lengths will reflect whatever distances were calculated from the data (which might be one of several corrected or uncorrected distances, depending on the input sequence/character data). Cheers, Nick On 5/12/11 2:18 PM, mgavil2 wrote: All, I have a tree topology (tree_name.tre), and a distance matrix, based on that tree topology. However I cant not seem to find the nexus file from which the matrix was generated. Is there a way to use that distance matrix to incorporate branch lengths into my topology? I have looked into all the threads of questions posted in the list, but still can not find an answer. my final objective is just to generate a tree with branch lengths proportional to the distances on the matrix (reviewers requirement for a publication). Any suggestions would be greatly appreciated! Thanks. Maria Mercedes -- Nicholas J. Matzke Ph.D. Candidate, Graduate Student Researcher Huelsenbeck Lab Center for Theoretical Evolutionary Genomics 4151 VLSB (Valley Life Sciences Building) Department of Integrative Biology University of California, Berkeley Graduate Student Instructor, IB200B Principles of Phylogenetics: Ecology and Evolution http://ib.berkeley.edu/courses/ib200b/ http://phylo.wikidot.com/ Lab websites: http://ib.berkeley.edu/people/lab_detail.php?lab=54 http://fisher.berkeley.edu/cteg/hlab.html Dept. personal page: http://ib.berkeley.edu/people/students/person_detail.php?person=370 Lab personal page: http://fisher.berkeley.edu/cteg/members/matzke.html Lab phone: 510-643-6299 Dept. fax: 510-643-6264 Cell phone: 510-301-0179 Email: mat...@berkeley.edu Mailing address: Department of Integrative Biology 3060 VLSB #3140 Berkeley, CA 94720-3140 - [W]hen people thought the earth was flat, they were wrong. When people thought the earth was spherical, they were wrong. But if you think that thinking the earth is spherical is just as wrong as thinking the earth is flat, then your view is wronger than both of them put together. Isaac Asimov (1989). The Relativity of Wrong. The Skeptical Inquirer, 14(1), 35-44. Fall 1989. http://chem.tufts.edu/AnswersInScience/RelativityofWrong.htm ___ R-sig-phylo mailing list R-sig-phylo@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-phylo