lib/mafScore.c File Reference

#include "common.h"
#include "maf.h"

Include dependency graph for mafScore.c:

Go to the source code of this file.

Data Structures

struct  gap_scores

Defines

#define CLEN(s)   (sizeof((s))-1)
#define NACHARS   128
#define SS(c, d)   ss[(uchar)c][(uchar)d]
#define GAP(w, x, y, z)   gop[(gtype[w]<<6)+(gtype[x]<<4)+(gtype[y]<<2)+gtype[z]]
#define DASH   '-'

Typedefs

typedef gap_scores gap_scores_t
typedef int ss_t [NACHARS][NACHARS]
typedef unsigned char uchar

Functions

static void DNA_scores (ss_t ss)
static void gap_costs (int *gop, int *gtype, int gap_open)
double mafScoreRangeMultiz (struct mafAli *maf, int start, int size)
double mafScoreMultiz (struct mafAli *maf)
double mafScoreMultizMaxCol (int species)
void mafColMinMaxScore (struct mafAli *maf, double *retMin, double *retMax)

Variables

static char const rcsid [] = "$Id: mafScore.c,v 1.9 2005/11/23 17:20:50 braney Exp $"
static ss_t ss
static gap_scores_t ds
static int gop [256]
static int gtype [128]
static const uchar nchars [] = "ACGT"
static const int HOXD70_sym [4][4]


Define Documentation

#define CLEN (  )     (sizeof((s))-1)

Definition at line 16 of file mafScore.c.

Referenced by DNA_scores().

#define DASH   '-'

Definition at line 20 of file mafScore.c.

Referenced by gap_costs(), and mafScoreRangeMultiz().

#define GAP ( w,
x,
y,
 )     gop[(gtype[w]<<6)+(gtype[x]<<4)+(gtype[y]<<2)+gtype[z]]

Definition at line 19 of file mafScore.c.

Referenced by gap_costs(), and mafScoreRangeMultiz().

#define NACHARS   128

Definition at line 17 of file mafScore.c.

Referenced by DNA_scores().

#define SS ( c,
 )     ss[(uchar)c][(uchar)d]

Definition at line 18 of file mafScore.c.

Referenced by mafScoreRangeMultiz().


Typedef Documentation

typedef struct gap_scores gap_scores_t

typedef int ss_t[NACHARS][NACHARS]

Definition at line 22 of file mafScore.c.

typedef unsigned char uchar

Definition at line 23 of file mafScore.c.


Function Documentation

static void DNA_scores ( ss_t  ss  )  [static]

Definition at line 38 of file mafScore.c.

References CLEN, HOXD70_sym, NACHARS, and nchars.

Referenced by mafScoreRangeMultiz().

00039 {
00040         int i, j, bad, a, b, A, B;
00041 
00042         for (i = 0; i < NACHARS; ++i)
00043                 for (j = 0; j < NACHARS; ++j)
00044                         ss[i][j] = -100;
00045         for (i = 0; i < (signed)CLEN(nchars); ++i) {
00046                 A = nchars[i];
00047                 a = tolower(A);
00048                 for (j = 0; j < (signed)CLEN(nchars); ++j) {
00049                         B = nchars[j];
00050                         b = tolower(B);
00051                         ss[A][B] = ss[a][B] = ss[A][b] = ss[a][b] =
00052                                 HOXD70_sym[i][j];
00053                 }
00054         }
00055         bad = -1000;
00056         for (i = 0; i < NACHARS; ++i)
00057                 ss['X'][i] = ss[i]['X'] = ss['x'][i] = ss[i]['x'] = bad;
00058 }

Here is the caller graph for this function:

static void gap_costs ( int *  gop,
int *  gtype,
int  gap_open 
) [static]

Definition at line 61 of file mafScore.c.

References DASH, and GAP.

Referenced by mafScoreRangeMultiz().

00062 {
00063         int i, X, D;
00064 
00065         for (i = 0; i < 128; ++i)
00066                 gtype[i] = 0;
00067         D = DASH;
00068         gtype[D] = 1;
00069 
00070         for (i = 0; i < 256; ++i)
00071                 gop[i] = 0;
00072         X = (uchar)'A';
00073         GAP(X,X,X,D) = gap_open;
00074         GAP(X,X,D,X) = gap_open;
00075         GAP(X,D,D,X) = gap_open;
00076         GAP(D,X,X,D) = gap_open;
00077         GAP(D,D,X,D) = gap_open;
00078         GAP(D,D,D,X) = gap_open;
00079 }

Here is the caller graph for this function:

void mafColMinMaxScore ( struct mafAli maf,
double *  retMin,
double *  retMax 
)

Definition at line 146 of file mafScore.c.

References mafAli::components, mafScoreMultizMaxCol(), and slCount().

00149 {
00150 *retMax = mafScoreMultizMaxCol(slCount(maf->components));
00151 *retMin = -*retMax;
00152 }

Here is the call graph for this function:

double mafScoreMultiz ( struct mafAli maf  ) 

Definition at line 130 of file mafScore.c.

References mafScoreRangeMultiz(), and mafAli::textSize.

00133 {
00134 return mafScoreRangeMultiz(maf, 0, maf->textSize);
00135 }

Here is the call graph for this function:

double mafScoreMultizMaxCol ( int  species  ) 

Definition at line 137 of file mafScore.c.

Referenced by mafColMinMaxScore().

00139 {
00140 int i, count = 0;
00141 for (i=1; i<species; ++i)
00142     count += i;
00143 return 100.0*count; 
00144 }

Here is the caller graph for this function:

double mafScoreRangeMultiz ( struct mafAli maf,
int  start,
int  size 
)

Definition at line 81 of file mafScore.c.

References mafAli::components, DASH, DNA_scores(), ds, gap_scores::E, errAbort(), GAP, gap_costs(), gop, gtype, HOXD70_sym, mafComp::next, gap_scores::O, mafComp::size, SS, ss, mafComp::text, and mafAli::textSize.

Referenced by mafScoreMultiz().

00082                                                             :
00083  *    maf - the alignment
00084  *    start - the (zero based) offset to start calculating score
00085  *    size - the size of the subset
00086  * The following relationship should hold:
00087  *   scoreRange(maf,start,size) =
00088  *      scoreRange(maf,0,start+size) - scoreRange(maf,0,start)
00089  */
00090 {
00091 uchar ai, ar, bi, br;
00092 int i;
00093 double score;
00094 struct mafComp *c1, *c2;
00095 
00096 if (start < 0 || size <= 0 || 
00097     start+size > maf->textSize) {
00098         errAbort( "mafScoreRange: start = %d, size = %d, textSize = %d\n",
00099                 start, size, maf->textSize);
00100 }
00101 if (ss['A']['A'] != HOXD70_sym[0][0]) {
00102         DNA_scores(ss);
00103         ds.E = 30;
00104         ds.O = 400;
00105         for (i = 0; i < 128; ++i)
00106                 ss[i][DASH] = ss[DASH][i] = -ds.E;
00107         ss[DASH][DASH] = 0;
00108         gap_costs(gop, gtype, ds.O);   /* quasi-natural gap costs */
00109 }
00110 score = 0.0;
00111 for (i = start; i < start+size; ++i) {
00112         for (c1 = maf->components; c1 != NULL; c1 = c1->next) {
00113                 if (c1->size == 0) continue;
00114                 br = c1->text[i];
00115                 for (c2 = c1->next; c2 != NULL; c2 = c2->next) {
00116                         if (c2->size == 0) continue;
00117                         bi = c2->text[i];
00118                         score += SS(br, bi);
00119                         if (i > 0) {
00120                                 ar = c1->text[i-1];
00121                                 ai = c2->text[i-1];
00122                                 score -= GAP(ar,ai,br,bi);
00123                         }
00124                 }
00125         }
00126 }
00127 return score;
00128 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

gap_scores_t ds [static]

Definition at line 26 of file mafScore.c.

Referenced by dyStringAppend(), dyStringAppendC(), dyStringAppendMultiC(), dyStringAppendN(), dyStringBumpBufSize(), dyStringCannibalize(), dyStringExpandBuf(), dyStringPrintf(), dyStringResize(), dyStringVaPrintf(), freeDyString(), freeDyStringList(), interpolate(), mafScoreRangeMultiz(), newDyString(), nodeNames(), oligoTm(), phyloFindPath(), and phyloNodeNames().

int gop[256] [static]

Definition at line 27 of file mafScore.c.

Referenced by mafScoreRangeMultiz().

int gtype[128] [static]

Definition at line 27 of file mafScore.c.

Referenced by mafScoreRangeMultiz().

const int HOXD70_sym[4][4] [static]

Initial value:

 {
  {  91, -114,  -31, -123 },
  {-114,  100, -125,  -31 },
  { -31, -125,  100, -114 },
  {-123,  -31, -114,   91 },
}

Definition at line 30 of file mafScore.c.

Referenced by DNA_scores(), and mafScoreRangeMultiz().

const uchar nchars[] = "ACGT" [static]

Definition at line 29 of file mafScore.c.

Referenced by DNA_scores().

char const rcsid[] = "$Id: mafScore.c,v 1.9 2005/11/23 17:20:50 braney Exp $" [static]

Definition at line 8 of file mafScore.c.

ss_t ss [static]

Definition at line 25 of file mafScore.c.

Referenced by affineAlign(), axtAffine(), axtAffine2Level(), axtPrintTraditional(), axtScore(), axtScoreDnaDefault(), axtScoreFilterRepeats(), axtScoreProteinDefault(), axtScoreSchemeDefault(), axtScoreSchemeDnaWrite(), axtScoreSchemeFromBlastzMatrix(), axtScoreSchemeFromProteinText(), axtScoreSchemeProteinDefault(), axtScoreSchemeProteinRead(), axtScoreSchemeRead(), axtScoreSchemeReadLf(), axtScoreSchemeRnaDefault(), axtScoreSchemeRnaFill(), axtScoreSchemeSimpleDna(), axtScoreSym(), axtScoreSymFilterRepeats(), axtScoreUngapped(), axtSubsetOnT(), bafWriteLine(), bandedExtend(), bandExt(), bandExtAfter(), bandExtBefore(), bandExtFf(), bCmpSeqSource(), blastiodAxtOutput(), calcSpliceScore(), chainCalcScore(), chainCalcScoreSubChain(), countPositives(), dnaQuery(), findFromSmallerSeeds(), findSource(), gfAlignTrans(), gfAlignTransTrans(), gfClumpDump(), gfIndexNibsAndTwoBits(), gfLargeIndexSeq(), gfQuerySeqTrans(), gfQuerySeqTransTrans(), gfSmallIndexSeq(), gfText(), hardRefineSplice(), interpolate(), kForwardAffine(), mafScoreRangeMultiz(), pcrQuery(), propagateCase(), searchOneIndex(), smoothOneGap(), spaceSaverAdd(), spaceSaverAddOverflow(), spaceSaverFinish(), spaceSaverFree(), spaceSaverMaxCellsNew(), targetClump(), transIndexBothStrands(), transQuery(), and transTransQuery().


Generated on Tue Dec 25 20:00:39 2007 for blat by  doxygen 1.5.2