diff --git a/sequence.c b/sequence.c index d5c8436..515c8b1 100644 --- a/sequence.c +++ b/sequence.c @@ -663,14 +663,14 @@ int shine_dalgarno_exact(unsigned char *seq, int pos, int start, double *rwt) { double match[6], cur_ctr, dis_flag; limit = imin(6, start-4-pos); - for(i = limit; i < 6; i++) match[i] = -10.0; + for(i = 0; i < 6; i++) match[i] = -10.0; /* Compare the 6-base region to AGGAGG */ for(i = 0; i < limit; i++) { - if(pos+i < 0) continue; - if(i%3 == 0 && is_a(seq, pos+i) == 1) match[i] = 2.0; - else if(i%3 != 0 && is_g(seq, pos+i) == 1) match[i] = 3.0; - else match[i] = -10.0; + if(pos + i >= 0) { + if(i%3 == 0 && is_a(seq, pos+i) == 1) match[i] = 2.0; + else if(i%3 != 0 && is_g(seq, pos+i) == 1) match[i] = 3.0; + } } /* Find the maximally scoring motif */ @@ -739,18 +739,19 @@ int shine_dalgarno_mm(unsigned char *seq, int pos, int start, double *rwt) { double match[6], cur_ctr, dis_flag; limit = imin(6, start-4-pos); - for(i = limit; i < 6; i++) match[i] = -10.0; + for(i = 0; i < 6; i++) match[i] = -10.0; /* Compare the 6-base region to AGGAGG */ for(i = 0; i < limit; i++) { - if(pos+i < 0) continue; - if(i % 3 == 0) { - if(is_a(seq, pos+i) == 1) match[i] = 2.0; - else match[i] = -3.0; - } - else { - if(is_g(seq, pos+i) == 1) match[i] = 3.0; - else match[i] = -2.0; + if(pos+i >= 0) { + if(i % 3 == 0) { + if(is_a(seq, pos+i) == 1) match[i] = 2.0; + else match[i] = -3.0; + } + else { + if(is_g(seq, pos+i) == 1) match[i] = 3.0; + else match[i] = -2.0; + } } }