This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| gapCalc * | gapCalcDefault () |
| gapCalc * | gapCalcRnaDna () |
| gapCalc * | gapCalcCheap () |
| gapCalc * | gapCalcOriginal () |
| gapCalc * | gapCalcFromFile (char *fileName) |
| gapCalc * | gapCalcFromString (char *s) |
| gapCalc * | gapCalcRead (struct lineFile *lf) |
| void | gapCalcFree (struct gapCalc **pGapCalc) |
| int | gapCalcCost (struct gapCalc *gapCalc, int dq, int dt) |
| char * | gapCalcSampleFileContents () |
| void | gapCalcTest (struct gapCalc *gapCalc) |
| struct gapCalc* gapCalcCheap | ( | ) | [read] |
Definition at line 267 of file gapCalc.c.
References cheapGapCosts, and gapCalcFromString().
00269 { 00270 return gapCalcFromString(cheapGapCosts); 00271 }
Here is the call graph for this function:

| int gapCalcCost | ( | struct gapCalc * | gapCalc, | |
| int | dq, | |||
| int | dt | |||
| ) |
Definition at line 296 of file gapCalc.c.
References gapCalc::bLastPos, gapCalc::bLastPosVal, gapCalc::bLastSlope, gapCalc::bLong, gapCalc::bPosCount, gapCalc::bSmall, interpolate(), gapCalc::longPos, gapCalc::qLastPos, gapCalc::qLastPosVal, gapCalc::qLastSlope, gapCalc::qLong, gapCalc::qPosCount, gapCalc::qSmall, gapCalc::smallSize, gapCalc::tLastPos, gapCalc::tLastPosVal, gapCalc::tLastSlope, gapCalc::tLong, gapCalc::tPosCount, and gapCalc::tSmall.
Referenced by chainCalcScore(), chainCalcScoreSubChain(), chainConnectCost(), chainConnectGapCost(), and gapCalcTest().
00298 { 00299 if (dt < 0) dt = 0; 00300 if (dq < 0) dq = 0; 00301 if (dt == 0) 00302 { 00303 if (dq < gapCalc->smallSize) 00304 return gapCalc->qSmall[dq]; 00305 else if (dq >= gapCalc->qLastPos) 00306 return gapCalc->qLastPosVal + gapCalc->qLastSlope * (dq-gapCalc->qLastPos); 00307 else 00308 return interpolate(dq, gapCalc->longPos, gapCalc->qLong, gapCalc->qPosCount); 00309 } 00310 else if (dq == 0) 00311 { 00312 if (dt < gapCalc->smallSize) 00313 return gapCalc->tSmall[dt]; 00314 else if (dt >= gapCalc->tLastPos) 00315 return gapCalc->tLastPosVal + gapCalc->tLastSlope * (dt-gapCalc->tLastPos); 00316 else 00317 return interpolate(dt, gapCalc->longPos, gapCalc->tLong, gapCalc->tPosCount); 00318 } 00319 else 00320 { 00321 int both = dq + dt; 00322 if (both < gapCalc->smallSize) 00323 return gapCalc->bSmall[both]; 00324 else if (both >= gapCalc->bLastPos) 00325 return gapCalc->bLastPosVal + gapCalc->bLastSlope * (both-gapCalc->bLastPos); 00326 else 00327 return interpolate(both, gapCalc->longPos, gapCalc->bLong, gapCalc->bPosCount); 00328 } 00329 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct gapCalc* gapCalcDefault | ( | ) | [read] |
Definition at line 255 of file gapCalc.c.
References defaultGapCosts, and gapCalcFromString().
00257 { 00258 return gapCalcFromString(defaultGapCosts); 00259 }
Here is the call graph for this function:

| void gapCalcFree | ( | struct gapCalc ** | pGapCalc | ) |
Definition at line 279 of file gapCalc.c.
References gapCalc::bLong, gapCalc::bSmall, freeMem(), freez(), gapCalc::longPos, gapCalc::qLong, gapCalc::qSmall, gapCalc::tLong, and gapCalc::tSmall.
00281 { 00282 struct gapCalc *gapCalc = *pGapCalc; 00283 if (gapCalc != NULL) 00284 { 00285 freeMem(gapCalc->qSmall); 00286 freeMem(gapCalc->tSmall); 00287 freeMem(gapCalc->bSmall); 00288 freeMem(gapCalc->longPos); 00289 freeMem(gapCalc->qLong); 00290 freeMem(gapCalc->tLong); 00291 freeMem(gapCalc->bLong); 00292 freez(pGapCalc); 00293 } 00294 }
Here is the call graph for this function:

| struct gapCalc* gapCalcFromFile | ( | char * | fileName | ) | [read] |
Definition at line 231 of file gapCalc.c.
References defaultGapCosts, gapCalcFromString(), gapCalcRead(), lineFileClose(), lineFileOpen(), originalGapCosts, sameString, TRUE, and verbose().
00233 { 00234 struct gapCalc *gapCalc = NULL; 00235 00236 if (sameString(fileName, "loose")) 00237 { 00238 verbose(2, "using loose linear gap costs (chicken/human)\n"); 00239 gapCalc = gapCalcFromString(defaultGapCosts); 00240 } 00241 else if (sameString(fileName, "medium")) 00242 { 00243 verbose(2, "using medium (original) linear gap costs (mouse/human)\n"); 00244 gapCalc = gapCalcFromString(originalGapCosts); 00245 } 00246 else 00247 { 00248 struct lineFile *lf = lineFileOpen(fileName, TRUE); 00249 gapCalc = gapCalcRead(lf); 00250 lineFileClose(&lf); 00251 } 00252 return gapCalc; 00253 }
Here is the call graph for this function:

| struct gapCalc* gapCalcFromString | ( | char * | s | ) | [read] |
Definition at line 222 of file gapCalc.c.
References cloneString(), gapCalcRead(), lineFileClose(), lineFileOnString(), and TRUE.
Referenced by gapCalcCheap(), gapCalcDefault(), gapCalcFromFile(), gapCalcOriginal(), and gapCalcRnaDna().
00224 { 00225 struct lineFile *lf = lineFileOnString("string", TRUE, cloneString(s)); 00226 struct gapCalc *gapCalc = gapCalcRead(lf); 00227 lineFileClose(&lf); 00228 return gapCalc; 00229 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct gapCalc* gapCalcOriginal | ( | ) | [read] |
Definition at line 273 of file gapCalc.c.
References gapCalcFromString(), and originalGapCosts.
00275 { 00276 return gapCalcFromString(originalGapCosts); 00277 }
Here is the call graph for this function:

Definition at line 144 of file gapCalc.c.
References AllocArray, AllocVar, gapCalc::bSmall, interpolate(), gapCalc::qSmall, readTaggedNumLine(), gapCalc::smallSize, and gapCalc::tSmall.
Referenced by gapCalcFromFile(), and gapCalcFromString().
00146 { 00147 int i, tableSize, startLong = -1; 00148 struct gapCalc *gapCalc; 00149 int *gapInitPos; 00150 double *gapInitQGap; 00151 double *gapInitTGap; 00152 double *gapInitBothGap; 00153 00154 AllocVar(gapCalc); 00155 00156 /* Parse file. */ 00157 readTaggedNumLine(lf, "tableSize", 1, &tableSize, NULL); 00158 readTaggedNumLine(lf, "smallSize", 1, &gapCalc->smallSize, NULL); 00159 AllocArray(gapInitPos,tableSize); 00160 AllocArray(gapInitQGap,tableSize); 00161 AllocArray(gapInitTGap,tableSize); 00162 AllocArray(gapInitBothGap,tableSize); 00163 readTaggedNumLine(lf, "position", tableSize, gapInitPos, NULL); 00164 readTaggedNumLine(lf, "qGap", tableSize, NULL, gapInitQGap); 00165 readTaggedNumLine(lf, "tGap", tableSize, NULL, gapInitTGap); 00166 readTaggedNumLine(lf, "bothGap", tableSize, NULL, gapInitBothGap); 00167 00168 /* Set up precomputed interpolations for small gaps. */ 00169 AllocArray(gapCalc->qSmall, gapCalc->smallSize); 00170 AllocArray(gapCalc->tSmall, gapCalc->smallSize); 00171 AllocArray(gapCalc->bSmall, gapCalc->smallSize); 00172 for (i=1; i<gapCalc->smallSize; ++i) 00173 { 00174 gapCalc->qSmall[i] = 00175 interpolate(i, gapInitPos, gapInitQGap, tableSize); 00176 gapCalc->tSmall[i] = 00177 interpolate(i, gapInitPos, gapInitTGap, tableSize); 00178 gapCalc->bSmall[i] = interpolate(i, gapInitPos, 00179 gapInitBothGap, tableSize); 00180 } 00181 00182 /* Set up to handle intermediate values. */ 00183 for (i=0; i<tableSize; ++i) 00184 { 00185 if (gapCalc->smallSize == gapInitPos[i]) 00186 { 00187 startLong = i; 00188 break; 00189 } 00190 } 00191 if (startLong < 0) 00192 errAbort("No position %d in gapCalcRead()\n", gapCalc->smallSize); 00193 gapCalc->longCount = tableSize - startLong; 00194 gapCalc->qPosCount = tableSize - startLong; 00195 gapCalc->tPosCount = tableSize - startLong; 00196 gapCalc->bPosCount = tableSize - startLong; 00197 gapCalc->longPos = cloneMem(gapInitPos + startLong, gapCalc->longCount * sizeof(int)); 00198 gapCalc->qLong = cloneMem(gapInitQGap + startLong, gapCalc->qPosCount * sizeof(double)); 00199 gapCalc->tLong = cloneMem(gapInitTGap + startLong, gapCalc->tPosCount * sizeof(double)); 00200 gapCalc->bLong = cloneMem(gapInitBothGap + startLong, gapCalc->bPosCount * sizeof(double)); 00201 00202 /* Set up to handle huge values. */ 00203 gapCalc->qLastPos = gapCalc->longPos[gapCalc->qPosCount-1]; 00204 gapCalc->tLastPos = gapCalc->longPos[gapCalc->tPosCount-1]; 00205 gapCalc->bLastPos = gapCalc->longPos[gapCalc->bPosCount-1]; 00206 gapCalc->qLastPosVal = gapCalc->qLong[gapCalc->qPosCount-1]; 00207 gapCalc->tLastPosVal = gapCalc->tLong[gapCalc->tPosCount-1]; 00208 gapCalc->bLastPosVal = gapCalc->bLong[gapCalc->bPosCount-1]; 00209 gapCalc->qLastSlope = calcSlope(gapCalc->qLastPosVal, gapCalc->qLong[gapCalc->qPosCount-2], 00210 gapCalc->qLastPos, gapCalc->longPos[gapCalc->qPosCount-2]); 00211 gapCalc->tLastSlope = calcSlope(gapCalc->tLastPosVal, gapCalc->tLong[gapCalc->tPosCount-2], 00212 gapCalc->tLastPos, gapCalc->longPos[gapCalc->tPosCount-2]); 00213 gapCalc->bLastSlope = calcSlope(gapCalc->bLastPosVal, gapCalc->bLong[gapCalc->bPosCount-2], 00214 gapCalc->bLastPos, gapCalc->longPos[gapCalc->bPosCount-2]); 00215 freez(&gapInitPos); 00216 freez(&gapInitQGap); 00217 freez(&gapInitTGap); 00218 freez(&gapInitBothGap); 00219 return gapCalc; 00220 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct gapCalc* gapCalcRnaDna | ( | ) | [read] |
Definition at line 261 of file gapCalc.c.
References gapCalcFromString(), and rnaDnaGapCosts.
00263 { 00264 return gapCalcFromString(rnaDnaGapCosts); 00265 }
Here is the call graph for this function:

| char* gapCalcSampleFileContents | ( | ) |
Definition at line 74 of file gapCalc.c.
References defaultGapCosts.
00076 { 00077 return defaultGapCosts; 00078 }
| void gapCalcTest | ( | struct gapCalc * | gapCalc | ) |
Definition at line 331 of file gapCalc.c.
References gapCalcCost(), and verbose().
00333 { 00334 int i; 00335 for (i=1; i<=10; i++) 00336 { 00337 verbose(1, "%d: %d %d %d\n", i, gapCalcCost(gapCalc, i, 0), 00338 gapCalcCost(gapCalc, 0, i), gapCalcCost(gapCalc, i/2, i-i/2)); 00339 } 00340 for (i=1; ; i *= 10) 00341 { 00342 verbose(1, "%d: %d %d %d\n", i, gapCalcCost(gapCalc, i, 0), gapCalcCost(gapCalc, 0, i), 00343 gapCalcCost(gapCalc, i/2, i-i/2)); 00344 if (i == 1000000000) 00345 break; 00346 } 00347 verbose(1, "%d %d cost %d\n", 6489540, 84240, gapCalcCost(gapCalc, 84240, 6489540)); 00348 verbose(1, "%d %d cost %d\n", 2746361, 1075188, gapCalcCost(gapCalc, 1075188, 2746361)); 00349 verbose(1, "%d %d cost %d\n", 6489540 + 2746361 + 72, 84240 + 1075188 + 72, gapCalcCost(gapCalc, 84240 + 1075188 + 72, 6489540 + 2746361 + 72)); 00350 }
Here is the call graph for this function:

1.5.2