+ fixed bug in the filtering function (if read offset overlapped into [AC]
authorfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Sat, 9 Feb 2008 14:42:05 +0000 (14:42 +0000)
committerfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Sat, 9 Feb 2008 14:42:05 +0000 (14:42 +0000)
position then we got single brackets)

git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@7753 e1793c9e-67f9-0310-80fc-b846ff1f7b36

tools/data_tools/filterReads.c

index 1a05ae9..d94cc94 100644 (file)
@@ -533,6 +533,29 @@ int join_reads(int exon_stop, int exon_start, Read* up_read, Read* down_read, FI
    strncpy(new_chastity+u_size, down_read->chastity+d_off, d_size);
    new_chastity[read_size] = '\0';
 
+   //if(read_nr == 39063) {
+   //   printf("read nr %d",read_nr);
+   //   printf("pos: %d %d %d %d\n",p_start,exon_stop,exon_start,p_stop);
+   //   printf("u/d range: %d %d\n",up_range,down_range);
+   //   printf("u/d size: %d %d\n",u_size,d_size);
+   //   printf("u/d off: %d %d\n",u_off,d_off);
+   //   printf("******************\n");
+
+   //   printf("%s\n",up_read->seq);
+   //   printf("%s\n",new_up_seq);
+
+   //   printf("******************\n");
+
+   //   printf("%s\n",down_read->seq);
+   //   printf("%s\n",new_down_seq);
+
+   //   printf("******************\n");
+   //   printf("%s\n",new_seq);
+   //   printf("%s\n",new_prb);
+   //   printf("%s\n",new_cal_prb);
+   //   printf("%s\n",new_chastity);
+   //}
+
    int status = fitting(up_read->prb,down_read->prb,u_off,d_off,u_size,d_size);
    int retval;
 
@@ -569,8 +592,8 @@ int fitting(char* up_prb, char* down_prb, int u_off, int d_off, int u_size, int
 
    int idx;
 
-   printf("prb %s\n",up_prb);
-   printf("prb %s\n",down_prb);
+   //printf("prb %s\n",up_prb);
+   //printf("prb %s\n",down_prb);
 
    for(idx=0;idx<w_size;idx++) {
       current_mean_up += up_prb[u_off+u_size+idx]-50;
@@ -591,7 +614,7 @@ int fitting(char* up_prb, char* down_prb, int u_off, int d_off, int u_size, int
    else
       ratio = current_mean_up / current_mean_down;
 
-   printf("ratio is %f\n",ratio);
+   //printf("ratio is %f\n",ratio);
 
    if (ratio < 0.5)
       return 0;
@@ -654,7 +677,18 @@ void join_seq(char* new_seq, char* up_seq,int u_off, int u_size, char* down_seq,
    new_idx = idx = 0;
    int elem_ctr = 0;
 
-   printf("join_seq %d %d %d %d\n",u_off,u_size,d_off,d_size);
+   //printf("join_seq %d %d %d %d\n",u_off,u_size,d_off,d_size);
+   //if(read_nr == 39063)
+   //   printf("%s\n",new_seq);
+
+   if( u_off > 0 && up_seq[u_off+idx-1] == '[' )
+      idx = -1;
+
+   if( u_off > 1 && up_seq[u_off+idx-2] == '[' )
+      idx = -2;
+
+   if( u_off > 2 && up_seq[u_off+idx-3] == '[' )
+      idx = -3;
 
    while(1) {
       if (elem_ctr == u_size)
@@ -680,6 +714,19 @@ void join_seq(char* new_seq, char* up_seq,int u_off, int u_size, char* down_seq,
 
    elem_ctr = 0;
    idx = 0;
+   //if(read_nr == 39063) {
+   //   printf("%s\n",new_seq);
+   //   printf("%c\n",down_seq[d_off+idx]);
+   //}
+
+   if( d_off > 0 && down_seq[d_off+idx-1] == '[' )
+      idx = -1;
+
+   if( d_off > 1 && down_seq[d_off+idx-2] == '[' )
+      idx = -2;
+
+   if( d_off > 2 && down_seq[d_off+idx-3] == '[' )
+      idx = -3;
 
    while(1) {
       if (elem_ctr == d_size)
@@ -703,8 +750,11 @@ void join_seq(char* new_seq, char* up_seq,int u_off, int u_size, char* down_seq,
       elem_ctr++;
    }
 
+
    new_seq[new_idx+1] = '\0';
-   printf("result: %s\n",new_seq);
+   //printf("result: %s\n",new_seq);
+   //if(read_nr == 39063)
+   //   printf("%s\n",new_seq);
 }
 
 void print_read(Read* cRead) {