lib/ffScore.c File Reference

#include "common.h"
#include "dnautil.h"
#include "obscure.h"
#include "fuzzyFind.h"

Include dependency graph for ffScore.c:

Go to the source code of this file.

Functions

void setFfIntronMax (int value)
int ffScoreMatch (DNA *a, DNA *b, int size)
int ffCalcCdnaGapPenalty (int hGap, int nGap)
static int calcTightGap (int hGap, int nGap)
static int calcLooseGap (int hGap, int nGap)
int ffCalcGapPenalty (int hGap, int nGap, enum ffStringency stringency)
int ffCdnaGapPenalty (struct ffAli *left, struct ffAli *right)
int ffGapPenalty (struct ffAli *left, struct ffAli *right, enum ffStringency stringency)
int ffScoreSomeAlis (struct ffAli *ali, int count, enum ffStringency stringency)
int ffScoreSomething (struct ffAli *ali, enum ffStringency stringency, boolean isProt)
int ffScore (struct ffAli *ali, enum ffStringency stringency)
int ffScoreCdna (struct ffAli *ali)
int ffScoreProtein (struct ffAli *ali, enum ffStringency stringency)

Variables

static char const rcsid [] = "$Id: ffScore.c,v 1.5 2003/10/21 22:06:32 kent Exp $"
int ffIntronMax = ffIntronMaxDefault


Function Documentation

static int calcLooseGap ( int  hGap,
int  nGap 
) [static]

Definition at line 93 of file ffScore.c.

References min.

Referenced by ffCalcGapPenalty().

00095 {
00096 if (hGap == 0 && nGap == 0)
00097     return 0;
00098 else
00099     {
00100     int overlap = min(hGap, nGap);
00101     int penalty = 8;
00102     if (overlap < 0)
00103         overlap = 0;
00104 
00105     if (hGap < 0)
00106         hGap = -8*hGap;
00107     if (nGap < 0)
00108         nGap = -2*nGap;
00109     penalty += log(hGap-overlap+1) + log(nGap-overlap+1);
00110     return penalty;
00111     }
00112 }

Here is the caller graph for this function:

static int calcTightGap ( int  hGap,
int  nGap 
) [static]

Definition at line 72 of file ffScore.c.

References min.

Referenced by ffCalcGapPenalty().

00074 {
00075 if (hGap == 0 && nGap == 0)
00076     return 0;
00077 else
00078     {
00079     int overlap = min(hGap, nGap);
00080     int penalty = 8;
00081     if (overlap < 0)
00082         overlap = 0;
00083 
00084     if (hGap < 0)
00085         hGap = -8*hGap;
00086     if (nGap < 0)
00087         nGap = -2*nGap;
00088     penalty += (hGap-overlap + nGap-overlap) + overlap;
00089     return penalty;
00090     }
00091 }

Here is the caller graph for this function:

int ffCalcCdnaGapPenalty ( int  hGap,
int  nGap 
)

Definition at line 38 of file ffScore.c.

References digitsBaseTwo(), and ffIntronMax.

Referenced by ffCalcGapPenalty(), ffCdnaGapPenalty(), and smoothOneGap().

00040 {
00041 int acc = 2;
00042 if (hGap > 400000)      /* Discourage really long introns. */
00043     {
00044     acc += (hGap - 400000)/3000;
00045     if (hGap > ffIntronMax)
00046         acc += (hGap - ffIntronMax)/2000;
00047     }
00048 if (hGap < 0)   /* Discourage jumping back in haystack. */
00049     {
00050     hGap = -8*hGap;
00051     if (hGap > 48)
00052         hGap = (hGap*hGap);
00053     }
00054 if (nGap < 0)   /* Jumping back in needle gets rid of previous alignment. */
00055     {
00056     acc += -nGap;
00057     nGap = 0;
00058     }
00059 acc += digitsBaseTwo(hGap)/2;
00060 if (nGap != 0)
00061     {
00062     acc += digitsBaseTwo(nGap);
00063     }
00064 else
00065     {
00066     if (hGap > 30)
00067         acc -= 1;
00068     }
00069 return acc;
00070 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ffCalcGapPenalty ( int  hGap,
int  nGap,
enum ffStringency  stringency 
)

Definition at line 115 of file ffScore.c.

References calcLooseGap(), calcTightGap(), errAbort(), ffCalcCdnaGapPenalty(), ffCdna, ffLoose, and ffTight.

Referenced by ffGapPenalty(), scoreAli(), ssGapCost(), ssGraphMake(), and trimGapPenalty().

00117 {
00118 switch (stringency)
00119     {
00120     case ffCdna:
00121         return ffCalcCdnaGapPenalty(hGap, nGap);
00122     case ffTight:
00123         return calcTightGap(hGap,nGap);
00124     case ffLoose:
00125         return calcLooseGap(hGap,nGap);
00126     default:
00127         errAbort("Unknown stringency type %d", stringency);
00128         return 0;
00129     }
00130 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ffCdnaGapPenalty ( struct ffAli left,
struct ffAli right 
)

Definition at line 133 of file ffScore.c.

References ffCalcCdnaGapPenalty(), ffAli::hEnd, ffAli::hStart, ffAli::left, ffAli::nEnd, ffAli::nStart, and ffAli::right.

Referenced by reconsiderAlignedGaps().

00135 {
00136 int hGap = right->hStart - left->hEnd;
00137 int nGap = right->nStart - left->nEnd;
00138 return ffCalcCdnaGapPenalty(hGap, nGap);
00139 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ffGapPenalty ( struct ffAli left,
struct ffAli right,
enum ffStringency  stringency 
)

Definition at line 141 of file ffScore.c.

References ffCalcGapPenalty(), ffAli::hEnd, ffAli::hStart, ffAli::left, ffAli::nEnd, ffAli::nStart, and ffAli::right.

Referenced by ffScoreSomeAlis(), and ffScoreSomething().

00143 {
00144 int hGap = right->hStart - left->hEnd;
00145 int nGap = right->nStart - left->nEnd;
00146 return ffCalcGapPenalty(hGap, nGap, stringency);
00147 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ffScore ( struct ffAli ali,
enum ffStringency  stringency 
)

Definition at line 195 of file ffScore.c.

References FALSE, and ffScoreSomething().

Referenced by cutAtBigIntrons(), ffFindAndScore(), and ffScoreCdna().

00197 {
00198 return ffScoreSomething(ali, stringency, FALSE);
00199 }

Here is the call graph for this function:

Here is the caller graph for this function:

int ffScoreCdna ( struct ffAli ali  ) 

Definition at line 201 of file ffScore.c.

References ffCdna, and ffScore().

00204 {
00205 return ffScore(ali, ffCdna);
00206 }

Here is the call graph for this function:

int ffScoreMatch ( DNA a,
DNA b,
int  size 
)

Definition at line 17 of file ffScore.c.

Referenced by trimFlakyEnds().

00021 {
00022 int i;
00023 int score = 0;
00024 for (i=0; i<size; ++i)
00025     {
00026     DNA aa = a[i];
00027     DNA bb = b[i];
00028     if (aa == 'n' || bb == 'n')
00029         continue;
00030     if (aa == bb)
00031         ++score;
00032     else
00033         score -= 1;
00034     }
00035 return score;
00036 }

Here is the caller graph for this function:

int ffScoreProtein ( struct ffAli ali,
enum ffStringency  stringency 
)

Definition at line 208 of file ffScore.c.

References ffScoreSomething(), and TRUE.

00210 {
00211 return ffScoreSomething(ali, stringency, TRUE);
00212 }

Here is the call graph for this function:

int ffScoreSomeAlis ( struct ffAli ali,
int  count,
enum ffStringency  stringency 
)

Definition at line 149 of file ffScore.c.

References dnaScoreMatch(), ffGapPenalty(), ffAli::hEnd, ffAli::hStart, ffAli::nStart, and ffAli::right.

00151 {
00152 int score = 0;
00153 int oneScore;
00154 
00155 while (--count >= 0)
00156     {
00157     int len = ali->hEnd - ali->hStart;
00158     struct ffAli *right = ali->right;
00159     oneScore = dnaScoreMatch(ali->hStart, ali->nStart, len);
00160     score += oneScore;
00161     if (count > 0)  /* Calculate gap penalty */
00162         score -= ffGapPenalty(ali, right,stringency);
00163     ali = right;
00164     }
00165 return score;
00166 }

Here is the call graph for this function:

int ffScoreSomething ( struct ffAli ali,
enum ffStringency  stringency,
boolean  isProt 
)

Definition at line 168 of file ffScore.c.

References aaScoreMatch(), dnaScoreMatch(), ffGapPenalty(), ffAli::hEnd, ffAli::hStart, ffAli::left, ffAli::nStart, and ffAli::right.

Referenced by ffScore(), and ffScoreProtein().

00171 {
00172 int score = 0;
00173 int oneScore;
00174 int (*scoreMatch)(char *a, char *b, int size);
00175 
00176 if (ali == NULL)
00177     return -0x7FFFFFFF;
00178 scoreMatch = (isProt ? aaScoreMatch : dnaScoreMatch );
00179 while (ali->left != NULL) ali = ali->left;
00180 while (ali != NULL)
00181     {
00182     int len = ali->hEnd - ali->hStart;
00183     struct ffAli *right = ali->right;
00184     oneScore = scoreMatch(ali->hStart, ali->nStart, len);
00185     score += oneScore;
00186     if (right)  /* Calculate gap penalty */
00187         {
00188         score -= ffGapPenalty(ali, right, stringency);
00189         }
00190     ali = right;
00191     }
00192 return score;
00193 }

Here is the call graph for this function:

Here is the caller graph for this function:

void setFfIntronMax ( int  value  ) 

Definition at line 12 of file ffScore.c.

References ffIntronMax.

Referenced by main().

00013 {
00014 ffIntronMax = value;
00015 }

Here is the caller graph for this function:


Variable Documentation

int ffIntronMax = ffIntronMaxDefault

Definition at line 10 of file ffScore.c.

Referenced by ffCalcCdnaGapPenalty(), ffSeedExtInMem(), gfAlignSomeClumps(), gfAlignStrand(), gfAlignTrans(), gfAlignTransTrans(), gfFindAlignAaTrans(), scanIndexForSmallExons(), seedResolvePower(), setFfIntronMax(), and ssStitch().

char const rcsid[] = "$Id: ffScore.c,v 1.5 2003/10/21 22:06:32 kent Exp $" [static]

Definition at line 8 of file ffScore.c.


Generated on Tue Dec 25 19:50:00 2007 for blat by  doxygen 1.5.2