+ changed interface for decoded plif features -> directly access double array
[qpalma.git] / QPalmaDP / result_align.cpp
index 4891d15..20dd4eb 100644 (file)
@@ -5,18 +5,8 @@ using namespace std;
 
 void increaseFeatureCount(penalty_struct* qparam, int dnanum, int estnum, double estprb) {
 
-   if(dnanum == 0) {
-      //printf("Zero entry\n");
-      return;
-   }
-
-   if(estnum == 0) { // we have a gap
-      //printf("Zero entry\n");
-      return;
-   }
-
-   penalty_struct currentStruct = qparam[(estnum-1)*5+(dnanum-1)];
-   printf("Current index %d\n",(estnum-1)*5+(dnanum-1));
+   penalty_struct currentStruct = qparam[(estnum-1)*6+(dnanum)];
+   printf("Current index %d dna/est: %d %d\n",(estnum-1)*6+(dnanum),dnanum,estnum);
 
       printf("before\n");
       int p_idx;
@@ -66,7 +56,7 @@ void increaseFeatureCount(penalty_struct* qparam, int dnanum, int estnum, double
    printf("\n");
 }
 
-bool result_align(Pre_score* matrices[], int z, int est_len, int dna_len, int* result_length_ptr, char* est, char* dna, double* prb, double* chastity, int* s_align, int* e_align, int* mparam, double* alignmentscores, int* max_score_positions, penalty_struct* qparam)
+bool result_align(Pre_score* matrices[], int z, int est_len, int dna_len, int* result_length_ptr, char* est, char* dna, double* prb, double* chastity, int* s_align, int* e_align, int* mparam, double* alignmentscores, int* max_score_positions, penalty_struct* qparam, mode currentMode)
 //Gibt 1 zurueck, wenn kein weiterer Pfad existiert, sonst 0
 
 {  
@@ -143,9 +133,12 @@ bool result_align(Pre_score* matrices[], int z, int est_len, int dna_len, int* r
 
       prbnum = prb[i-1];
       chastitynum = chastity[i-1];
-      increaseFeatureCount(qparam,dnanum,estnum,prbnum);
 
-      mparam[mlen*dnanum +estnum] ++ ;
+      if(currentMode == USE_QUALITY_SCORES)
+         increaseFeatureCount(qparam,dnanum,estnum,prbnum);
+      else
+         mparam[mlen*dnanum+estnum] ++ ;
+
     }
     else if ((prev_i == (i)) && (prev_j == (j-1))) {// gap on EST
       (*result_length_ptr)= (*result_length_ptr) + 1;
@@ -168,9 +161,11 @@ bool result_align(Pre_score* matrices[], int z, int est_len, int dna_len, int* r
 
       prbnum = prb[i-1];
       chastitynum = chastity[i-1];
-      increaseFeatureCount(qparam,dnanum,estnum,prbnum);
 
-      mparam[mlen*dnanum +estnum] ++ ;
+      if(currentMode == USE_QUALITY_SCORES)
+         increaseFeatureCount(qparam,dnanum,estnum,prbnum);
+      else
+         mparam[mlen*dnanum +estnum] ++ ;
     }
     else {// splice site
       (*result_length_ptr) =  (*result_length_ptr) + (j - prev_j);
@@ -228,5 +223,3 @@ bool result_align(Pre_score* matrices[], int z, int est_len, int dna_len, int* r
 
   return 0;
 }
-
-