lib/scoreWindow.c File Reference

#include "common.h"

Include dependency graph for scoreWindow.c:

Go to the source code of this file.

Functions

int scoreWindow (char c, char *s, int size, int *score, int *start, int *end, int match, int misMatch)

Variables

static char const rcsid [] = "$Id: scoreWindow.c,v 1.4 2004/07/16 22:42:55 baertsch Exp $"


Function Documentation

int scoreWindow ( char  c,
char *  s,
int  size,
int *  score,
int *  start,
int *  end,
int  match,
int  misMatch 
)

Definition at line 6 of file scoreWindow.c.

References max.

00011 {
00012 int i=0, j=0, max=0, count = 0; 
00013 
00014 *end = 0;
00015 
00016 for (i=0 ; i<size ; i++)
00017     {
00018     int prevScore = (i > 0) ? score[i-1] : 0;
00019 
00020     if (toupper(s[i]) == toupper(c) )
00021         score[i] = prevScore+match;
00022     else
00023         score[i] = prevScore-misMatch;
00024     if (score[i] >= max)
00025         {
00026         max = score[i];
00027         *end = i;
00028         /* traceback to find start */
00029         for (j=i ; j>=0 ; j--)
00030             if (score[j] == 0)
00031                 {
00032                 *start = j+1;
00033                 break;
00034                 }
00035         }
00036     if (score[i] < 0) 
00037         score[i] = 0;
00038     }
00039 assert (*end < size);
00040 
00041 for (i=*start ; i<=*end ; i++)
00042     {
00043     assert (i < size);
00044     if (toupper(s[i]) == toupper(c) )
00045         count++;
00046     }
00047 return count;
00048 }


Variable Documentation

char const rcsid[] = "$Id: scoreWindow.c,v 1.4 2004/07/16 22:42:55 baertsch Exp $" [static]

Definition at line 4 of file scoreWindow.c.


Generated on Tue Dec 25 20:15:54 2007 for blat by  doxygen 1.5.2