-
Notifications
You must be signed in to change notification settings - Fork 0
/
malign_tree.h
69 lines (62 loc) · 1.88 KB
/
malign_tree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef _MALIGN_TREE_H_
#define _MALIGN_TREE_H_
#include <string>
#include <vector>
#include <cstdlib>
#include <map>
#include "align.h"
using std::string;
using std::map;
using std::vector;
using std::cout;
using std::endl;
using std::cerr;
class MalignmentT{
private:
vector< vector<string> > seq_data;
map<int,string> ind2name;
double* dis_mtx;
int Num_Seq;
struct TreeNode
{
TreeNode* lchild;
TreeNode* rchild;
double ldist;
double rdist;
double depth;//height of this subtree,used for calculating ldist and rdist
vector<double> dists; //node distance to other nodes, only needed for tree root nodes
int seq_ind; //only leaf node have valid seq_ind, which is the index in seq_data
int size; //size of the tree OR number of leaf nodes OR number of sequences contained
//these two are to store the alignment and the sequence index of the contained sequences
vector< vector<string> > align_profile;
vector<int> align_seq_inds;
float align_score;
TreeNode():lchild(NULL),rchild(NULL),ldist(-1.0),rdist(-1.0),depth(0.0),seq_ind(-1),size(1){}
};
vector<TreeNode*> guide_tree;
float gap;
float mismatch;
float similar;
float verysimilar;
float identical;
void print_treenode(TreeNode*);
void find_min_pair(double&,int&,int&);
void update_dist(int,int);
float Score(string,string);
void cal_dismtx(void);
//do alignment when building tree if boolean tag is set to true
void cal_upgma(double*,int,bool);
//aligning the alignment profiles in b and c and store
//the new profile into a
float align_prof(vector< vector<string> >& a, vector< vector<string> >& b,vector< vector<string> >& c);
public:
MalignmentT(){};
MalignmentT( vector< vector<string> > );
~MalignmentT();
int align(void);
void print_data(void); //purly for debugging
void print_mtx(void);
void print_tree(void);
void print_alignment(void);
};
#endif