1

I am new to MATLAB, so please bear with me if this question is trival.

I encountered the function seqneighborjoin lately. I am struggling to find out the pseudocode explanation of it and to find out exactly what is the data structure of the returned value of the function call.

For example, z = seqneighborjoin(D, treemethod). What is z? I understand that all of these can be answered by examining the function seqneighborjoin itself. But the function itself is a bit complex.

I am posting here, just wondering is there any other way that you can get a clear pseudocode explanation of the function? I appreciate your time and attention.

EDIT: OK. This is what I did today. Here is the code.

names=arrayfun ( @num2str, 1:4, 'unif', 0);
d=[0,2,5,4,5,5];
z=seqneighjoin(d,'equivar',names);
get(z,'pointers')
squareform(pdist(z))

This is what I get:

ans =

     2     3
     1     5
     4     6


ans =

         0    3.0000    3.5000    5.0000
    3.0000         0    0.5000    5.0000
    3.5000    0.5000         0    5.5000
    5.0000    5.0000    5.5000         0

I understand what the first matrix doing there. To my surprise, for the second matrix, even if the distance between the nodes 1 and 2 are 0, here the (1,2) pair of this matrix is not zero at all. Does anyone understand why? And we have two specieses(sequences) which are exactly the same, they will have chances to be in the different clusters or not if the cluster function is applied later?

2 Answers 2

0

The documentation page for seqneighjoin provides three references that explain in detail the algorithm that it uses:

[1] Saitou, N., and Nei, M. (1987). The neighbor-joining method: A new method for reconstructing phylogenetic trees. Molecular Biology and Evolution 4(4), 406–425.

[2] Gascuel, O. (1997). BIONJ: An improved version of the NJ algorithm based on a simple model of sequence data. Molecular Biology and Evolution 14 685–695.

[3] Studier, J.A., Keppler, K.J. (1988). A note on the neighbor-joining algorithm of Saitou and Nei. Molecular Biology and Evolution 5(6) 729–731.

The output of seqneighjoin is a phytree object, which contains all the information about the tree structure, the names of the leaves and branches, the distances, and so on.

If you type doc phytree, you'll find a page that describes how to construct a phytree object directly (rather than with seqneighjoin); down at the bottom of the page you'll find a link phytree object, that provides documentation for the phytree object itself, such as how to extract the information above from it, how to view it, and so on.

0
0

NJ assumes additivity (distance from i to j should equal the sum of branch lengths along the path from i to j in the tree). In your case, d(a,b)=0, but d(a,c)=2 does not equal d(b,c)=4. So the matrix is not additive, and the resulting tree is not accurate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.