+ started to extend fill_matrix in order to be able to use quality scores
[qpalma.git] / QPalmaDP / qpalma_dp.h
1 #ifndef _QPALMA_DP_H_
2 #define _QPALMA_DP_H_
3
4 #include "penalty_info.h"
5
6 struct ArrayElem { //24B
7 double score;
8 int prev_j;
9 int prev_i;
10 int prev_matrix_no;
11 bool isSplice;
12 } ;
13
14 struct pre_score { //24B
15 double value; //8
16 int prev_i; //4
17 int prev_j; //4
18 int prev_matrix_no;//4
19 bool issplice;//4
20 };
21
22 typedef struct pre_score Pre_score;
23
24 typedef struct Align_pair { //24B
25 double value ;
26 bool issplice;
27 int previ,prevj ;
28 char est_char;
29 char dna_char;
30 };
31
32
33 void fill_matrix (int nr_paths, Pre_score* matrices[], int len_est, int len_dna, char* est, char* dna, penalty_struct* functions, double* matchmatrix, double* donor, double* acceptor, bool remove_duplicate_scores, int nr_donor_sites, int* donor_sites, int* max_score_positions);
34
35 int check_char(char base);
36
37 bool result_align (Pre_score* matrices[], int matrixnr, int i, int j, int* result_length_ptr, char* est, char* dna, int* s_align, int* e_align, int* m_param, double* alignmentscores, int* max_score_positions );
38
39 extern void print_align(Pre_score* matrix, int length_est, int length_dna, Align_pair* vektor, int result_length, int print_matrix);
40
41
42 /*
43 * The function myalign calculates a new alignment given the scoring scheme
44 * Its input arguments are:
45 *
46 * num_path(id) -> an integer specifying which alignment has to be done
47 * dna ->
48 * est ->
49 * h ->
50 * mmatrix ->
51 * donor ->
52 * acceptor ->
53 * remove_duplicate_scores -> a boolean
54 * print_matrix -> a boolean
55 *
56 * [SpliceAlign, EstAlign, weightMatch, Gesamtscores, dnaest] = myalign_local(...
57 */
58
59 class Alignment {
60
61 private:
62 int* splice_align;
63 int* est_align;
64 int* mmatrix_param;
65 double* alignmentscores;
66 double* qualityMatrix;
67
68 int dna_len;
69 int est_len;
70 int mlen;
71 int nr_paths;
72
73 struct penalty_struct* matching_plifs;
74
75 INT len;
76 REAL *limits;
77 REAL *penalties;
78 INT max_len;
79 INT min_len;
80 REAL *cache;
81 enum ETransformType transform ;
82 INT id;
83 char * name;
84 INT use_svm;
85
86 public:
87 Alignment();
88 ~Alignment() {
89 if(splice_align != 0)
90 delete[] splice_align;
91
92 if(est_align != 0)
93 delete[] est_align;
94
95 if(mmatrix_param != 0)
96 delete[] mmatrix_param;
97
98 if(alignmentscores != 0)
99 delete[] alignmentscores;
100
101 if(qualityMatrix != 0)
102 delete[] qualityMatrix;
103 }
104
105 void myalign(int nr_paths_p, char* dna, int dna_len_p, char* est,
106 int est_len_p, struct penalty_struct h, double* matchmatrix, int mm_len,
107 double* donor, int d_len, double* acceptor, int a_len,
108 bool remove_duplicate_scores, bool print_matrix);
109
110 void setMatchPlifs(struct penalty_struct* match_plifs);
111
112 void penSetLength(int l) { len = l; }
113 void penSetLimits(REAL* lts) {
114 limits = new REAL[len];
115 for(int i=0; i<len; i++)
116 limits[i] = lts[i];
117 }
118
119 void setQualityMatrix(double* qMat, int length);
120 void getDNAEST();
121 void getAlignmentResults(int* s_align, int* e_align,
122 int* mmatrix_p, double* alignscores);
123 };
124
125 #endif // _QPALMA_DP_H_
126