source: trunk/GDE/MUSCLE/src/refinetreee.cpp

Last change on this file was 10390, checked in by aboeckma, 11 years ago

added muscle sourcles amd makefile

File size: 1.2 KB
Line 
1#include "muscle.h"
2#include "msa.h"
3#include "tree.h"
4#include "profile.h"
5#include <stdio.h>
6
7#define TRACE   0
8
9void RefineTreeE(MSA &msa, const SeqVect &v, Tree &tree, ProgNode *ProgNodes)
10        {
11        const unsigned uSeqCount = msa.GetSeqCount();
12        if (tree.GetLeafCount() != uSeqCount)
13                Quit("Refine tree, tree has different number of nodes");
14
15        if (uSeqCount < 3)
16                return;
17
18#if     DEBUG
19        ValidateMuscleIds(msa);
20        ValidateMuscleIds(tree);
21#endif
22
23        const unsigned uNodeCount = tree.GetNodeCount();
24        unsigned *uNewNodeIndexToOldNodeIndex= new unsigned[uNodeCount];
25
26        Tree Tree2;
27        TreeFromMSA(msa, Tree2, g_Cluster2, g_Distance2, g_Root2, g_pstrDistMxFileName2);
28
29#if     DEBUG
30        ValidateMuscleIds(Tree2);
31#endif
32
33        DiffTreesE(Tree2, tree, uNewNodeIndexToOldNodeIndex);
34
35        unsigned uRoot = Tree2.GetRootNodeIndex();
36        if (NODE_CHANGED == uNewNodeIndexToOldNodeIndex[uRoot])
37                {
38                MSA msa2;
39                RealignDiffsE(msa, v, Tree2, tree, uNewNodeIndexToOldNodeIndex, msa2, ProgNodes);
40                tree.Copy(Tree2);
41                msa.Copy(msa2);
42#if     DEBUG
43                ValidateMuscleIds(msa2);
44#endif
45                }
46
47        delete[] uNewNodeIndexToOldNodeIndex;
48
49        SetCurrentAlignment(msa);
50        ProgressStepsDone();
51        }
Note: See TracBrowser for help on using the repository browser.