+ recalculating exons boundaries fixed
authorfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Fri, 4 Jul 2008 08:50:57 +0000 (08:50 +0000)
committerfabio <fabio@e1793c9e-67f9-0310-80fc-b846ff1f7b36>
Fri, 4 Jul 2008 08:50:57 +0000 (08:50 +0000)
git-svn-id: http://svn.tuebingen.mpg.de/ag-raetsch/projects/QPalma@9861 e1793c9e-67f9-0310-80fc-b846ff1f7b36

tools/data_tools/filterReads.c

index 0e8f563..84e45ae 100644 (file)
@@ -229,6 +229,8 @@ void process_reads(FILE* reads_fs,struct gene*** allGenes,int numGenes, FILE* ou
             reverse_complement(&seq,strlen(seq));
          //printf("after rc %s\n",seq);
 
+         //printf("new read: %s at %d\n",seq,pos);
+   
          // define read start and stop positions
          read_start = pos;
          read_stop  = pos + read_size-1;
@@ -497,8 +499,8 @@ int join_reads(int exon_stop, int exon_start, Read* up_read, Read* down_read, FI
    if( u_size > up_range || d_size > down_range)
       return 0;
 
-   const int p_start  = exon_stop  - u_size + 1;
-   const int p_stop   = exon_start + d_size - 1;
+   int p_start  = exon_stop  - u_size + 1;
+   int p_stop   = exon_start + d_size - 1;
 
    int u_off = p_start - up_read_start;
    int d_off = exon_start - down_read_start;
@@ -548,8 +550,18 @@ 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+additional_pos);
    new_chastity[read_size+additional_pos] = '\0';
 
-   printf("old reads: %s %s\n",up_read->seq,down_read->seq);
-   printf("new read: %s %d\n",new_seq,cut_pos);
+   //printf("old reads: %s %s (%d %d %d/%d)\n",up_read->seq,down_read->seq,up_read->pos,down_read->pos,u_off,d_off);
+   //printf("new read: %s %d %d\n",new_seq,cut_pos,u_size);
+
+   int alpha   = read_size - u_off - 1;
+   int beta    = alpha - u_size ;
+   p_start     = up_read->pos + beta + 1;
+   exon_stop   = up_read->pos + alpha;
+
+   alpha   = read_size - d_off - 1;
+   beta    = alpha - (read_size - u_size);
+   exon_start  = down_read->pos + beta + 1; 
+   p_stop      = down_read->pos + alpha;
 
    int status = 1; //fitting(up_read->prb,down_read->prb,u_off,d_off,u_size,d_size);
 
@@ -560,12 +572,6 @@ int join_reads(int exon_stop, int exon_start, Read* up_read, Read* down_read, FI
 
    retval = status;
 
-   //fprintf(out_fs,"%d\t%d\t%c\t%s\t%d\t%d\t%s\t%s\t%s\t%s\t%d\t%d\t%d\t%d\t%s\t%s\n",
-   //   read_nr,up_read->chr,up_read->strand,new_seq,cut_pos,read_size,new_prb,new_cal_prb,new_chastity,gene_id,p_start,exon_stop,exon_start,p_stop,up_read->seq,down_read->seq);
-
-   //fprintf(out_fs,"%lu\t%d\t%c\t%s\t%d\t%d\t%s\t%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n",
-   //   read_nr,up_read->chr,up_read->strand,new_seq,cut_pos,read_size,new_prb,new_cal_prb,new_chastity,gene_id,p_start,exon_stop,exon_start,p_stop,u_size);
-
    fprintf(out_fs,"%lu\t%d\t%c\t%s\t%d\t%d\t%s\t%s\t%s\t%s\t%d\t%d\t%d\t%d\t%d\n",
       read_nr,up_read->chr,up_read->strand,new_seq,cut_pos,read_size,new_prb,new_cal_prb,new_chastity,gene_id,p_start,exon_stop,exon_start,p_stop,u_size);