Hi Meche.

> I am pretty sure it is the correct distance matrix, but I ll look
> again to make sure . Also looking at the topology (even though it is
> unrooted, it looks pretty off. I mean i find species from one clade
> within a (many) different clades?

This should not be the case as NJ & LS (if properly implemented) are both guaranteed to recover the "true tree" if the distances are exactly faithful to that tree.

> 1. what is a "good"  Q score?  mine said it is 0.0422062959681288
> found after 19 nearest neighbor interchange(s). is this right? I mean
> it find one so fast for the example you sent, but the value is also so
> different.

For your example, the Q score (which is just the summed squared differences between the distances in your matrix and the distances implied by the tree) should be zero (that is, to the limits of numerical precision). This is because if I understand it correctly, your matrix has been computed from the patristic distances from your ML tree, thus there exists some tree for which the summed squared differences between the measured and implied distances is zero (your ML tree). For other examples, it is not possible to say in general what a good Q is (just like it is not possible to say, in general, what a good log-likelihood is).

> 2. based on what you said, the distance matrix I obtain from the new
> LStree should exactly resemble the distance matrix I used to generate
> the tree right? however, this does not happen in my case, the original
> distance matrix is different from the distance matrix generated from
> the LStree.  Any ideas why this might be happening?

My best idea is that your distance matrix is not the patristic distance matrix from your tree. Another possibility is that the tree you are feeding the function is not the topology that corresponds to this matrix, and the program is failing to converge for some reason.

> I am trying to run the same procedure with a different tree (from
> which I am sure I have the distance matrix), to see if it is that my
> matrix doesn't belong to the topology i give it, but keep getting an
> error saying
> "Error in solve.default(t(X) %*% X) :
>    Lapack routine dgesv: system is exactly singular"
> Maybe because that tree is ultrametric?

I think this is happening because your tree has multifurcations. I have posted a new version of this for which this is not a problem: (http://anolis.oeb.harvard.edu/~liam/R-phylogenetics/optim.phylo.ls/v0.4/optim.phylo.ls.R). Sorry.

> 3. Also, the tree I get from NJ and the tree I get fromt he optimum LS
> is different too, as are the distance matrices?  should these two be
> the same?

Yes, these should be the same if your distance matrix exactly reflects the "true tree" (in the case, the ML tree with lost branch lengths). Furthermore, under these conditions NJ is guaranteed to give you the true tree and branch lengths - so there should be no need to use my function anyway. (See Felsenstein 2004; p. 166.)

- 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/13/2011 10:22 AM, mgavil2 wrote:
Liam,

I am pretty sure it is the correct distance matrix, but I ll look
again to make sure . Also looking at the topology (even though it is
unrooted, it looks pretty off. I mean i find species from one clade
within a (many) different clades?

Also, I ran your code for finding the optimum tree based on least
squares, and I have a  few questions about my outcome:
1. what is a "good"  Q score?  mine said it is 0.0422062959681288
found after 19 nearest neighbor interchange(s). is this right? I mean
it find one so fast for the example you sent, but the value is also so
different.

2. based on what you said, the distance matrix I obtain from the new
LStree should exactly resemble the distance matrix I used to generate
the tree right? however, this does not happen in my case, the original
distance matrix is different from the distance matrix generated from
the LStree.  Any ideas why this might be happening?

I am trying to run the same procedure with a different tree (from
which I am sure I have the distance matrix), to see if it is that my
matrix doesn't belong to the topology i give it, but keep getting an
error saying
"Error in solve.default(t(X) %*% X) :
   Lapack routine dgesv: system is exactly singular"
Maybe because that tree is ultrametric?

3. Also, the tree I get from NJ and the tree I get fromt he optimum LS
is different too, as are the distance matrices?  should these two be
the same?

Sorry for all the questions!

Meche

On Thu, May 12, 2011 at 5:33 PM, Liam J. Revell<liam.rev...@umb.edu>  wrote:
Hi Nick&  al.

Actually, Nick's method should work too.

If the distance matrix is a patristic distance matrix based on the ML tree,
then neighbor-joining ought to recover the exact topology and branch lengths
of your ML tree.  This is on p. 166 of Felsenstein (2004):
"Neighbor-joining, like the least squares methods, is guaranteed to recover
the true tree if the distance matrix happens to be an exact reflection of a
tree."

Maria, are you sure that your distance matrix came from the branch lengths
in your ML tree; and, furthermore, are you sure that NJ did not give you the
correct tree?  Keep in mind that NJ will return an unrooted tree and that
the branches might be rotated around any node (thus, your plotted tree may
seem quite different from the ML tree).

- 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:28 PM, mgavil2 wrote:

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
====================================================









_______________________________________________
R-sig-phylo mailing list
R-sig-phylo@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-phylo

Reply via email to