#include "common.h"#include "linefile.h"#include "sqlList.h"#include "dystring.h"#include "dnaMotif.h"#include "portable.h"#include "dnaMotif.pss"Include dependency graph for dnaMotif.c:

Go to the source code of this file.
Data Structures | |
| struct | letterProb |
Functions | |
| dnaMotif * | dnaMotifCommaIn (char **pS, struct dnaMotif *ret) |
| void | dnaMotifFree (struct dnaMotif **pEl) |
| void | dnaMotifFreeList (struct dnaMotif **pList) |
| void | dnaMotifOutput (struct dnaMotif *el, FILE *f, char sep, char lastSep) |
| float | dnaMotifSequenceProb (struct dnaMotif *motif, DNA *dna) |
| char | dnaMotifBestStrand (struct dnaMotif *motif, DNA *dna) |
| double | dnaMotifBitScore (struct dnaMotif *motif, DNA *dna) |
| void | dnaMotifNormalize (struct dnaMotif *motif) |
| boolean | dnaMotifIsScoreBased (struct dnaMotif *motif) |
| void | dnaMotifScoreToProb (struct dnaMotif *motif) |
| void | dnaMotifMakeProbabalistic (struct dnaMotif *motif) |
| static void | printProbRow (FILE *f, char *label, float *p, int pCount) |
| void | dnaMotifPrintProb (struct dnaMotif *motif, FILE *f) |
| static double | u1 (double prob) |
| static double | uncertainty (struct dnaMotif *motif, int pos) |
| double | dnaMotifBitsOfInfo (struct dnaMotif *motif, int pos) |
| static struct letterProb * | letterProbNew (char letter, double prob) |
| static int | letterProbCmp (const void *va, const void *vb) |
| static void | addBaseProb (struct letterProb **pList, char letter, double prob) |
| static struct letterProb * | letterProbFromMotifColumn (struct dnaMotif *motif, int pos) |
| static void | psOneColumn (struct dnaMotif *motif, int pos, double xStart, double yStart, double width, double totalHeight, FILE *f) |
| static void | dnaMotifDims (struct dnaMotif *motif, double widthPerBase, double height, int *retWidth, int *retHeight) |
| void | dnaMotifToLogoPs (struct dnaMotif *motif, double widthPerBase, double height, char *fileName) |
| void | dnaMotifToLogoPng (struct dnaMotif *motif, double widthPerBase, double height, char *gsExe, char *tempDir, char *fileName) |
| void | dnaMotifToLogoPsW (struct dnaMotif *motif, double widthPerBase, double width, double height, char *fileName) |
| void | dnaMotifToLogoPGM (struct dnaMotif *motif, double widthPerBase, double width, double height, char *gsExe, char *tempDir, char *fileName) |
Variables | |
| static char const | rcsid [] = "$Id: dnaMotif.c,v 1.4 2006/09/14 21:08:24 braney Exp $" |
| static void addBaseProb | ( | struct letterProb ** | pList, | |
| char | letter, | |||
| double | prob | |||
| ) | [static] |
Definition at line 333 of file dnaMotif.c.
References letterProbNew(), and slAddHead.
Referenced by letterProbFromMotifColumn().
00335 { 00336 if (prob > 0) 00337 { 00338 struct letterProb *lp = letterProbNew(letter, prob); 00339 slAddHead(pList, lp); 00340 } 00341 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 173 of file dnaMotif.c.
References dnaMotif::columnCount, dnaMotifSequenceProb(), and reverseComplement().
00175 { 00176 float fScore, rScore; 00177 fScore = dnaMotifSequenceProb(motif, dna); 00178 reverseComplement(dna, motif->columnCount); 00179 rScore = dnaMotifSequenceProb(motif, dna); 00180 reverseComplement(dna, motif->columnCount); 00181 if (fScore >= rScore) 00182 return '+'; 00183 else 00184 return '-'; 00185 }
Here is the call graph for this function:

Definition at line 187 of file dnaMotif.c.
References dnaMotif::columnCount, dnaMotifSequenceProb(), and logBase2.
00189 { 00190 double p = dnaMotifSequenceProb(motif, dna); 00191 double q = pow(0.25, motif->columnCount); 00192 double odds = p/q; 00193 return logBase2(odds); 00194 }
Here is the call graph for this function:

| double dnaMotifBitsOfInfo | ( | struct dnaMotif * | motif, | |
| int | pos | |||
| ) |
Definition at line 293 of file dnaMotif.c.
References dnaMotif::columnCount, internalErr, and uncertainty().
Referenced by dnaMotifToLogoPs().
00295 { 00296 if (pos > motif->columnCount || pos < 0) 00297 internalErr(); 00298 return 2 - uncertainty(motif, pos); 00299 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 14 of file dnaMotif.c.
References AllocArray, AllocVar, sqlEatChar(), sqlSignedComma(), and sqlStringComma().
00018 { 00019 char *s = *pS; 00020 int i; 00021 00022 if (ret == NULL) 00023 AllocVar(ret); 00024 ret->name = sqlStringComma(&s); 00025 ret->columnCount = sqlSignedComma(&s); 00026 s = sqlEatChar(s, '{'); 00027 AllocArray(ret->aProb, ret->columnCount); 00028 for (i=0; i<ret->columnCount; ++i) 00029 { 00030 ret->aProb[i] = sqlSignedComma(&s); 00031 } 00032 s = sqlEatChar(s, '}'); 00033 s = sqlEatChar(s, ','); 00034 s = sqlEatChar(s, '{'); 00035 AllocArray(ret->cProb, ret->columnCount); 00036 for (i=0; i<ret->columnCount; ++i) 00037 { 00038 ret->cProb[i] = sqlSignedComma(&s); 00039 } 00040 s = sqlEatChar(s, '}'); 00041 s = sqlEatChar(s, ','); 00042 s = sqlEatChar(s, '{'); 00043 AllocArray(ret->gProb, ret->columnCount); 00044 for (i=0; i<ret->columnCount; ++i) 00045 { 00046 ret->gProb[i] = sqlSignedComma(&s); 00047 } 00048 s = sqlEatChar(s, '}'); 00049 s = sqlEatChar(s, ','); 00050 s = sqlEatChar(s, '{'); 00051 AllocArray(ret->tProb, ret->columnCount); 00052 for (i=0; i<ret->columnCount; ++i) 00053 { 00054 ret->tProb[i] = sqlSignedComma(&s); 00055 } 00056 s = sqlEatChar(s, '}'); 00057 s = sqlEatChar(s, ','); 00058 *pS = s; 00059 return ret; 00060 }
Here is the call graph for this function:

| static void dnaMotifDims | ( | struct dnaMotif * | motif, | |
| double | widthPerBase, | |||
| double | height, | |||
| int * | retWidth, | |||
| int * | retHeight | |||
| ) | [static] |
Definition at line 380 of file dnaMotif.c.
References dnaMotif::columnCount.
Referenced by dnaMotifToLogoPGM(), dnaMotifToLogoPng(), dnaMotifToLogoPs(), and dnaMotifToLogoPsW().
00383 { 00384 static int widthFudgeFactor = 2, heightFudgeFactor = 2; 00385 *retWidth = ceil(widthPerBase * motif->columnCount) + widthFudgeFactor; 00386 *retHeight = ceil(height) + heightFudgeFactor; 00387 }
Here is the caller graph for this function:

| void dnaMotifFree | ( | struct dnaMotif ** | pEl | ) |
Definition at line 62 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::cProb, freeMem(), freez(), dnaMotif::gProb, dnaMotif::name, and dnaMotif::tProb.
Referenced by dnaMotifFreeList().
00065 { 00066 struct dnaMotif *el; 00067 00068 if ((el = *pEl) == NULL) return; 00069 freeMem(el->name); 00070 freeMem(el->aProb); 00071 freeMem(el->cProb); 00072 freeMem(el->gProb); 00073 freeMem(el->tProb); 00074 freez(pEl); 00075 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void dnaMotifFreeList | ( | struct dnaMotif ** | pList | ) |
Definition at line 77 of file dnaMotif.c.
References dnaMotifFree(), and dnaMotif::next.
00079 { 00080 struct dnaMotif *el, *next; 00081 00082 for (el = *pList; el != NULL; el = next) 00083 { 00084 next = el->next; 00085 dnaMotifFree(&el); 00086 } 00087 *pList = NULL; 00088 }
Here is the call graph for this function:

| boolean dnaMotifIsScoreBased | ( | struct dnaMotif * | motif | ) |
Definition at line 216 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::columnCount, dnaMotif::cProb, FALSE, dnaMotif::gProb, dnaMotif::tProb, and TRUE.
Referenced by dnaMotifMakeProbabalistic().
00219 { 00220 int i; 00221 for (i=0; i<motif->columnCount; ++i) 00222 { 00223 if (motif->aProb[i] < 0) return TRUE; 00224 if (motif->cProb[i] < 0) return TRUE; 00225 if (motif->gProb[i] < 0) return TRUE; 00226 if (motif->tProb[i] < 0) return TRUE; 00227 } 00228 return FALSE; 00229 }
Here is the caller graph for this function:

| void dnaMotifMakeProbabalistic | ( | struct dnaMotif * | motif | ) |
Definition at line 247 of file dnaMotif.c.
References dnaMotifIsScoreBased(), dnaMotifNormalize(), and dnaMotifScoreToProb().
00250 { 00251 if (dnaMotifIsScoreBased(motif)) 00252 dnaMotifScoreToProb(motif); 00253 else 00254 dnaMotifNormalize(motif); 00255 }
Here is the call graph for this function:

| void dnaMotifNormalize | ( | struct dnaMotif * | motif | ) |
Definition at line 197 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::columnCount, dnaMotif::cProb, errAbort(), dnaMotif::gProb, dnaMotif::name, and dnaMotif::tProb.
Referenced by dnaMotifMakeProbabalistic(), and dnaMotifScoreToProb().
00199 { 00200 int i; 00201 for (i=0; i<motif->columnCount; ++i) 00202 { 00203 float sum = motif->aProb[i] + motif->cProb[i] + motif->gProb[i] + motif->tProb[i]; 00204 if (sum < 0) 00205 errAbort("%s has negative numbers, perhaps it's score not probability based", 00206 motif->name); 00207 if (sum == 0) 00208 motif->aProb[i] = motif->cProb[i] = motif->gProb[i] = motif->tProb[i] = 0.25; 00209 motif->aProb[i] /= sum; 00210 motif->cProb[i] /= sum; 00211 motif->gProb[i] /= sum; 00212 motif->tProb[i] /= sum; 00213 } 00214 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void dnaMotifOutput | ( | struct dnaMotif * | el, | |
| FILE * | f, | |||
| char | sep, | |||
| char | lastSep | |||
| ) |
Definition at line 90 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::columnCount, dnaMotif::cProb, dnaMotif::gProb, dnaMotif::name, and dnaMotif::tProb.
00092 { 00093 int i; 00094 if (sep == ',') fputc('"',f); 00095 fprintf(f, "%s", el->name); 00096 if (sep == ',') fputc('"',f); 00097 fputc(sep,f); 00098 fprintf(f, "%d", el->columnCount); 00099 fputc(sep,f); 00100 if (sep == ',') fputc('{',f); 00101 for (i=0; i<el->columnCount; ++i) 00102 { 00103 fprintf(f, "%f", el->aProb[i]); 00104 fputc(',', f); 00105 } 00106 if (sep == ',') fputc('}',f); 00107 fputc(sep,f); 00108 if (sep == ',') fputc('{',f); 00109 for (i=0; i<el->columnCount; ++i) 00110 { 00111 fprintf(f, "%f", el->cProb[i]); 00112 fputc(',', f); 00113 } 00114 if (sep == ',') fputc('}',f); 00115 fputc(sep,f); 00116 if (sep == ',') fputc('{',f); 00117 for (i=0; i<el->columnCount; ++i) 00118 { 00119 fprintf(f, "%f", el->gProb[i]); 00120 fputc(',', f); 00121 } 00122 if (sep == ',') fputc('}',f); 00123 fputc(sep,f); 00124 if (sep == ',') fputc('{',f); 00125 for (i=0; i<el->columnCount; ++i) 00126 { 00127 fprintf(f, "%f", el->tProb[i]); 00128 fputc(',', f); 00129 } 00130 if (sep == ',') fputc('}',f); 00131 fputc(lastSep,f); 00132 }
| void dnaMotifPrintProb | ( | struct dnaMotif * | motif, | |
| FILE * | f | |||
| ) |
Definition at line 267 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::columnCount, dnaMotif::cProb, dnaMotif::gProb, printProbRow(), and dnaMotif::tProb.
00269 { 00270 printProbRow(f, "A", motif->aProb, motif->columnCount); 00271 printProbRow(f, "C", motif->cProb, motif->columnCount); 00272 printProbRow(f, "G", motif->gProb, motif->columnCount); 00273 printProbRow(f, "T", motif->tProb, motif->columnCount); 00274 }
Here is the call graph for this function:

| void dnaMotifScoreToProb | ( | struct dnaMotif * | motif | ) |
Definition at line 231 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::columnCount, dnaMotif::cProb, dnaMotifNormalize(), dnaMotif::gProb, and dnaMotif::tProb.
Referenced by dnaMotifMakeProbabalistic().
00234 : 25% for each base */ 00235 { 00236 int i; 00237 for (i=0; i<motif->columnCount; ++i) 00238 { 00239 motif->aProb[i] = exp(motif->aProb[i]); 00240 motif->cProb[i] = exp(motif->cProb[i]); 00241 motif->gProb[i] = exp(motif->gProb[i]); 00242 motif->tProb[i] = exp(motif->tProb[i]); 00243 } 00244 dnaMotifNormalize(motif); 00245 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 134 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::columnCount, dnaMotif::cProb, dnaMotif::gProb, internalErr, dnaMotif::tProb, and warn().
Referenced by dnaMotifBestStrand(), and dnaMotifBitScore().
00138 { 00139 float p = 1.0; 00140 int i; 00141 for (i=0; i<motif->columnCount; ++i) 00142 { 00143 switch (dna[i]) 00144 { 00145 case 'a': 00146 case 'A': 00147 p *= motif->aProb[i]; 00148 break; 00149 case 'c': 00150 case 'C': 00151 p *= motif->cProb[i]; 00152 break; 00153 case 'g': 00154 case 'G': 00155 p *= motif->gProb[i]; 00156 break; 00157 case 't': 00158 case 'T': 00159 p *= motif->tProb[i]; 00160 break; 00161 case 0: 00162 warn("dna shorter than motif"); 00163 internalErr(); 00164 break; 00165 default: 00166 p *= 0.25; 00167 break; 00168 } 00169 } 00170 return p; 00171 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void dnaMotifToLogoPGM | ( | struct dnaMotif * | motif, | |
| double | widthPerBase, | |||
| double | width, | |||
| double | height, | |||
| char * | gsExe, | |||
| char * | tempDir, | |||
| char * | fileName | |||
| ) |
Definition at line 484 of file dnaMotif.c.
References dnaMotifDims(), dnaMotifToLogoPsW(), dyStringAppend(), dyStringFree, dyStringNew, dyStringPrintf(), errAbort(), newDyString(), rTempName(), and dyString::string.
00493 { 00494 char *psName = rTempName(tempDir, "dnaMotif", ".ps"); 00495 struct dyString *dy = dyStringNew(0); 00496 int w, h; 00497 int sysRet; 00498 00499 if (gsExe == NULL) gsExe = "gs"; 00500 if (tempDir == NULL) tempDir = "/tmp"; 00501 dnaMotifToLogoPsW(motif, widthPerBase, width, height, psName); 00502 dnaMotifDims(motif, widthPerBase, height, &w, &h); 00503 dyStringAppend(dy, gsExe); 00504 dyStringAppend(dy, " -sDEVICE=pgmraw -sOutputFile="); 00505 dyStringAppend(dy, fileName); 00506 dyStringAppend(dy, " -dBATCH -dNOPAUSE -q "); 00507 dyStringPrintf(dy, "-g%dx%d ", (int) ceil(width), h); 00508 dyStringAppend(dy, psName); 00509 sysRet = system(dy->string); 00510 if (sysRet != 0) 00511 errAbort("System call returned %d for:\n %s", sysRet, dy->string); 00512 00513 /* Clean up. */ 00514 dyStringFree(&dy); 00515 00516 /* change permisssions so the webserver can access the file */ 00517 dy = newDyString(0); 00518 dyStringPrintf(dy, "chmod 666 %s ", fileName); 00519 sysRet = system(dy->string); 00520 00521 remove(psName); 00522 }
Here is the call graph for this function:

| void dnaMotifToLogoPng | ( | struct dnaMotif * | motif, | |
| double | widthPerBase, | |||
| double | height, | |||
| char * | gsExe, | |||
| char * | tempDir, | |||
| char * | fileName | |||
| ) |
Definition at line 417 of file dnaMotif.c.
References dnaMotifDims(), dnaMotifToLogoPs(), dyStringAppend(), dyStringFree, dyStringNew, dyStringPrintf(), errAbort(), newDyString(), rTempName(), and dyString::string.
00425 { 00426 char *psName = rTempName(tempDir, "dnaMotif", ".ps"); 00427 struct dyString *dy = dyStringNew(0); 00428 int w, h; 00429 int sysRet; 00430 00431 if (gsExe == NULL) gsExe = "gs"; 00432 if (tempDir == NULL) tempDir = "/tmp"; 00433 dnaMotifToLogoPs(motif, widthPerBase, height, psName); 00434 dnaMotifDims(motif, widthPerBase, height, &w, &h); 00435 dyStringAppend(dy, gsExe); 00436 dyStringAppend(dy, " -sDEVICE=png16m -sOutputFile="); 00437 dyStringAppend(dy, fileName); 00438 dyStringAppend(dy, " -dBATCH -dNOPAUSE -q "); 00439 dyStringPrintf(dy, "-g%dx%d ", w, h); 00440 dyStringAppend(dy, psName); 00441 sysRet = system(dy->string); 00442 if (sysRet != 0) 00443 errAbort("System call returned %d for:\n %s", sysRet, dy->string); 00444 00445 /* Clean up. */ 00446 dyStringFree(&dy); 00447 00448 /* change permisssions so the webserver can access the file */ 00449 dy = newDyString(0); 00450 dyStringPrintf(dy, "chmod 666 %s ", fileName); 00451 sysRet = system(dy->string); 00452 00453 remove(psName); 00454 }
Here is the call graph for this function:

| void dnaMotifToLogoPs | ( | struct dnaMotif * | motif, | |
| double | widthPerBase, | |||
| double | height, | |||
| char * | fileName | |||
| ) |
Definition at line 389 of file dnaMotif.c.
References carefulClose(), dnaMotif::columnCount, dnaMotifBitsOfInfo(), dnaMotifDims(), mustOpen(), and psOneColumn().
Referenced by dnaMotifToLogoPng().
00391 { 00392 FILE *f = mustOpen(fileName, "w"); 00393 int i; 00394 int xStart = 0; 00395 int w, h; 00396 char *s = 00397 #include "dnaMotif.pss" 00398 ; 00399 00400 dnaMotifDims(motif, widthPerBase, height, &w, &h); 00401 fprintf(f, "%%!PS-Adobe-3.1 EPSF-3.0\n"); 00402 fprintf(f, "%%%%BoundingBox: 0 0 %d %d\n\n", w, h); 00403 fprintf(f, "%s", s); 00404 00405 fprintf(f, "%s", "% Start of code for this specific logo\n"); 00406 00407 for (i=0; i<motif->columnCount; ++i) 00408 { 00409 double infoScale = dnaMotifBitsOfInfo(motif, i)/2.0; 00410 psOneColumn(motif, i, xStart, 0, widthPerBase, infoScale * height, f); 00411 xStart += widthPerBase; 00412 } 00413 fprintf(f, "showpage\n"); 00414 carefulClose(&f); 00415 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void dnaMotifToLogoPsW | ( | struct dnaMotif * | motif, | |
| double | widthPerBase, | |||
| double | width, | |||
| double | height, | |||
| char * | fileName | |||
| ) |
Definition at line 456 of file dnaMotif.c.
References carefulClose(), dnaMotif::columnCount, dnaMotifDims(), mustOpen(), and psOneColumn().
Referenced by dnaMotifToLogoPGM().
00458 { 00459 FILE *f = mustOpen(fileName, "w"); 00460 int i; 00461 int xStart = 0; 00462 int w, h; 00463 char *s = 00464 #include "dnaMotif.pss" 00465 ; 00466 00467 dnaMotifDims(motif, widthPerBase, height, &w, &h); 00468 fprintf(f, "%%!PS-Adobe-3.1 EPSF-3.0\n"); 00469 fprintf(f, "%%%%BoundingBox: 0 0 %d %d\n\n", w, h); 00470 fprintf(f, "%s", s); 00471 00472 fprintf(f, "%s", "% Start of code for this specific logo\n"); 00473 00474 for (i=0; i<motif->columnCount; ++i) 00475 { 00476 double infoScale = 0.9 ; 00477 xStart = i * width / motif->columnCount; 00478 psOneColumn(motif, i, xStart, 0, widthPerBase, infoScale * height, f); 00479 } 00480 fprintf(f, "showpage\n"); 00481 carefulClose(&f); 00482 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static int letterProbCmp | ( | const void * | va, | |
| const void * | vb | |||
| ) | [static] |
Definition at line 319 of file dnaMotif.c.
References letterProb::prob.
Referenced by letterProbFromMotifColumn().
00321 { 00322 const struct letterProb *a = *((struct letterProb **)va); 00323 const struct letterProb *b = *((struct letterProb **)vb); 00324 double dif = a->prob - b->prob; 00325 if (dif < 0) 00326 return -1; 00327 else if (dif > 0) 00328 return 1; 00329 else 00330 return 0; 00331 }
Here is the caller graph for this function:

| static struct letterProb* letterProbFromMotifColumn | ( | struct dnaMotif * | motif, | |
| int | pos | |||
| ) | [static, read] |
Definition at line 343 of file dnaMotif.c.
References addBaseProb(), dnaMotif::aProb, dnaMotif::cProb, dnaMotif::gProb, letterProbCmp(), slSort(), and dnaMotif::tProb.
Referenced by psOneColumn().
00345 { 00346 struct letterProb *lpList = NULL; 00347 addBaseProb(&lpList, 'A', motif->aProb[pos]); 00348 addBaseProb(&lpList, 'C', motif->cProb[pos]); 00349 addBaseProb(&lpList, 'G', motif->gProb[pos]); 00350 addBaseProb(&lpList, 'T', motif->tProb[pos]); 00351 slSort(&lpList, letterProbCmp); 00352 return lpList; 00353 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static struct letterProb* letterProbNew | ( | char | letter, | |
| double | prob | |||
| ) | [static, read] |
Definition at line 309 of file dnaMotif.c.
References AllocVar, letterProb::letter, and letterProb::prob.
Referenced by addBaseProb().
00311 { 00312 struct letterProb *lp; 00313 AllocVar(lp); 00314 lp->letter = letter; 00315 lp->prob = prob; 00316 return lp; 00317 }
Here is the caller graph for this function:

| static void printProbRow | ( | FILE * | f, | |
| char * | label, | |||
| float * | p, | |||
| int | pCount | |||
| ) | [static] |
Definition at line 257 of file dnaMotif.c.
Referenced by dnaMotifPrintProb().
00259 { 00260 int i; 00261 fprintf(f, "%s ", label); 00262 for (i=0; i < pCount; ++i) 00263 fprintf(f, "%5.2f ", p[i]); 00264 printf("\n"); 00265 }
Here is the caller graph for this function:

| static void psOneColumn | ( | struct dnaMotif * | motif, | |
| int | pos, | |||
| double | xStart, | |||
| double | yStart, | |||
| double | width, | |||
| double | totalHeight, | |||
| FILE * | f | |||
| ) | [static] |
Definition at line 355 of file dnaMotif.c.
References letterProb::letter, letterProbFromMotifColumn(), letterProb::next, letterProb::prob, and slFreeList().
Referenced by dnaMotifToLogoPs(), and dnaMotifToLogoPsW().
00359 { 00360 struct letterProb *lp, *lpList = letterProbFromMotifColumn(motif, pos); 00361 double x = xStart, y = yStart, w = width, h; 00362 for (lp = lpList; lp != NULL; lp = lp->next) 00363 { 00364 h = totalHeight * lp->prob; 00365 if (h >= 1.0) 00366 { 00367 fprintf(f, "%cColor ", tolower(lp->letter)); 00368 fprintf(f, "%3.2f ", x); 00369 fprintf(f, "%3.2f ", y); 00370 fprintf(f, "%3.2f ", x + w); 00371 fprintf(f, "%3.2f ", y + h); 00372 fprintf(f, "(%c) textInBox\n", lp->letter); 00373 } 00374 y += h; 00375 } 00376 fprintf(f, "\n"); 00377 slFreeList(&lpList); 00378 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static double u1 | ( | double | prob | ) | [static] |
Definition at line 277 of file dnaMotif.c.
References logBase2.
Referenced by uncertainty().
Here is the caller graph for this function:

| static double uncertainty | ( | struct dnaMotif * | motif, | |
| int | pos | |||
| ) | [static] |
Definition at line 285 of file dnaMotif.c.
References dnaMotif::aProb, dnaMotif::cProb, dnaMotif::gProb, dnaMotif::tProb, and u1().
Referenced by dnaMotifBitsOfInfo().
00288 { 00289 return -( u1(motif->aProb[pos]) + u1(motif->cProb[pos]) 00290 + u1(motif->gProb[pos]) +u1(motif->tProb[pos]) ); 00291 }
Here is the call graph for this function:

Here is the caller graph for this function:

char const rcsid[] = "$Id: dnaMotif.c,v 1.4 2006/09/14 21:08:24 braney Exp $" [static] |
Definition at line 12 of file dnaMotif.c.
1.5.2