#include "common.h"#include "obscure.h"#include "dnautil.h"#include "fuzzyFind.h"#include "seqOut.h"#include "htmshell.h"#include "axt.h"Include dependency graph for seqOut.c:

Go to the source code of this file.
Functions | |
| cfm * | cfmNew (int wordLen, int lineLen, boolean lineNumbers, boolean countDown, FILE *out, int numOff) |
| static void | cfmPopFormat (struct cfm *cfm) |
| static void | cfmPushFormat (struct cfm *cfm) |
| void | cfmOutExt (struct cfm *cfm, char c, int color, boolean underline, boolean bold, boolean italic) |
| void | cfmOut (struct cfm *cfm, char c, int color) |
| void | cfmFree (struct cfm **pCfm) |
| void | bafInit (struct baf *baf, DNA *needle, int nNumOff, boolean nCountDown, DNA *haystack, int hNumOff, boolean hCountDown, FILE *out, int lineSize, boolean isTrans) |
| void | bafSetAli (struct baf *baf, struct ffAli *ali) |
| void | bafSetPos (struct baf *baf, int nStart, int hStart) |
| void | bafStartLine (struct baf *baf) |
| static int | maxDigits (int x, int y) |
| void | bafWriteLine (struct baf *baf) |
| void | bafOut (struct baf *baf, char n, char h) |
| void | bafFlushLine (struct baf *baf) |
Variables | |
| static char const | rcsid [] = "$Id: seqOut.c,v 1.27 2007/03/26 18:11:48 angie Exp $" |
| int | seqOutColorLookup [] |
| void bafFlushLine | ( | struct baf * | baf | ) |
Definition at line 316 of file seqOut.c.
References bafWriteLine(), baf::cix, and baf::out.
00318 { 00319 if (baf->cix > 0) 00320 bafWriteLine(baf); 00321 fflush(baf->out); 00322 fprintf(baf->out, "<HR ALIGN=\"CENTER\">"); 00323 baf->cix = 0; 00324 }
Here is the call graph for this function:

| void bafInit | ( | struct baf * | baf, | |
| DNA * | needle, | |||
| int | nNumOff, | |||
| boolean | nCountDown, | |||
| DNA * | haystack, | |||
| int | hNumOff, | |||
| boolean | hCountDown, | |||
| FILE * | out, | |||
| int | lineSize, | |||
| boolean | isTrans | |||
| ) |
Definition at line 138 of file seqOut.c.
References baf::cix, baf::haystack, baf::hCountDown, baf::hCurPos, baf::hLineStart, baf::hNumOff, baf::isTrans, baf::lineSize, baf::nCountDown, baf::nCurPos, baf::needle, baf::nLineStart, baf::nNumOff, and baf::out.
00142 { 00143 baf->cix = 0; 00144 baf->needle = needle; 00145 baf->nCountDown = nCountDown; 00146 baf->haystack = haystack; 00147 baf->nNumOff = nNumOff; 00148 baf->hNumOff = hNumOff; 00149 baf->hCountDown = hCountDown; 00150 baf->out = out; 00151 baf->lineSize = lineSize; 00152 baf->isTrans = isTrans; 00153 baf->nCurPos = baf->hCurPos = 0; 00154 baf->nLineStart = baf->hLineStart = 0; 00155 }
| void bafOut | ( | struct baf * | baf, | |
| char | n, | |||
| char | h | |||
| ) |
Definition at line 298 of file seqOut.c.
References bafWriteLine(), baf::cix, baf::hChars, baf::hCurPos, baf::hLineStart, baf::lineSize, baf::nChars, baf::nCurPos, and baf::nLineStart.
00300 { 00301 baf->nChars[baf->cix] = n; 00302 baf->hChars[baf->cix] = h; 00303 if (n != '.' && n != '-') 00304 baf->nCurPos += 1; 00305 if (h != '.' && h != '-') 00306 baf->hCurPos += 1; 00307 if (++(baf->cix) >= baf->lineSize) 00308 { 00309 bafWriteLine(baf); 00310 baf->cix = 0; 00311 baf->nLineStart = baf->nCurPos; 00312 baf->hLineStart = baf->hCurPos; 00313 } 00314 }
Here is the call graph for this function:

Definition at line 157 of file seqOut.c.
References baf::haystack, baf::hCurPos, ffAli::hStart, baf::nCurPos, baf::needle, and ffAli::nStart.
00159 { 00160 baf->nCurPos = ali->nStart - baf->needle; 00161 baf->hCurPos = ali->hStart - baf->haystack; 00162 }
| void bafSetPos | ( | struct baf * | baf, | |
| int | nStart, | |||
| int | hStart | |||
| ) |
Definition at line 164 of file seqOut.c.
References baf::hCurPos, baf::isTrans, and baf::nCurPos.
00166 { 00167 if (baf->isTrans) 00168 nStart *= 3; 00169 baf->nCurPos = nStart; 00170 baf->hCurPos = hStart; 00171 }
| void bafStartLine | ( | struct baf * | baf | ) |
Definition at line 173 of file seqOut.c.
References baf::hCurPos, baf::hLineStart, baf::nCurPos, and baf::nLineStart.
00175 { 00176 baf->nLineStart = baf->nCurPos; 00177 baf->hLineStart = baf->hCurPos; 00178 }
| void bafWriteLine | ( | struct baf * | baf | ) |
Definition at line 187 of file seqOut.c.
References axtScoreSchemeFromProteinText(), blosumText, cfmOut(), cfmPopFormat(), cfmPushFormat(), baf::cix, baf::hChars, baf::hCountDown, baf::hCurPos, baf::hLineStart, baf::hNumOff, baf::isTrans, lookupCodon(), maxDigits(), baf::nChars, baf::nCountDown, baf::nCurPos, baf::nLineStart, baf::nNumOff, baf::out, cfm::out, seqOutColorLookup, ss, tolowers(), and ZeroVar.
Referenced by bafFlushLine(), and bafOut().
00190 { 00191 int i; 00192 int count = baf->cix; 00193 int nStart = baf->nLineStart + 1 + baf->nNumOff; 00194 int hStart = baf->hLineStart + 1 + baf->hNumOff; 00195 int nEnd = baf->nCurPos + baf->nNumOff; 00196 int hEnd = baf->hCurPos + baf->hNumOff; 00197 int startDigits = maxDigits(nStart, hStart); 00198 int endDigits = maxDigits(nEnd, hEnd); 00199 int hStartNum, hEndNum; 00200 int nStartNum, nEndNum; 00201 static struct axtScoreScheme *ss = 0; /* Scoring scheme. */ 00202 struct cfm cfm; 00203 extern char blosumText[]; 00204 extern struct axtScoreScheme *axtScoreSchemeFromProteinText(char *text, char *fileName); 00205 boolean revArrows = (baf->nCountDown ^ baf->hCountDown); 00206 char arrowChar = (revArrows ? '<' : '>'); 00207 00208 ZeroVar(&cfm); 00209 cfm.out = baf->out; 00210 if (ss == 0) 00211 ss = axtScoreSchemeFromProteinText(blosumText, "fake"); 00212 00213 if (baf->nCountDown) 00214 { 00215 nStartNum = baf->nNumOff - baf->nLineStart; 00216 nEndNum = 1+baf->nNumOff - baf->nCurPos; 00217 } 00218 else 00219 { 00220 nStartNum = 1+baf->nNumOff + baf->nLineStart; 00221 nEndNum = baf->nNumOff + baf->nCurPos; 00222 } 00223 fprintf(baf->out, "%0*d ", startDigits, nStartNum); 00224 for (i=0; i<count; ++i) 00225 fputc(baf->nChars[i], baf->out); 00226 fprintf(baf->out, " %0*d\n", endDigits, nEndNum); 00227 00228 for (i=0; i<startDigits; ++i) 00229 fputc(arrowChar, baf->out); 00230 fputc(' ', baf->out); 00231 for (i=0; i<count; ++i) 00232 { 00233 char n,h,c = ' '; 00234 00235 n = baf->nChars[i]; 00236 h = baf->hChars[i]; 00237 if (baf->isTrans) 00238 { 00239 if (n != ' ') 00240 { 00241 DNA codon[4]; 00242 codon[0] = baf->hChars[i-1]; 00243 codon[1] = h; 00244 codon[2] = baf->hChars[i+1]; 00245 codon[3] = 0; 00246 tolowers(codon); 00247 c = lookupCodon(codon); 00248 cfmPushFormat(&cfm); 00249 if (toupper(n) == c) 00250 cfmOut(&cfm, '|', seqOutColorLookup[0]); 00251 else 00252 { 00253 int color; 00254 00255 if (c == 0) 00256 c = 'X'; 00257 if (ss->matrix[(int)toupper(n)][(int)c] > 0) 00258 color = 5; 00259 else 00260 color = 6; 00261 cfmOut(&cfm, c, seqOutColorLookup[color]); 00262 } 00263 cfmPopFormat(&cfm); 00264 } 00265 else 00266 { 00267 fputc(c, baf->out); 00268 } 00269 } 00270 else 00271 { 00272 if (toupper(n) == toupper(h)) 00273 c = '|'; 00274 fputc(c, baf->out); 00275 } 00276 } 00277 fputc(' ', baf->out); 00278 for (i=0; i<endDigits; ++i) 00279 fputc(arrowChar, baf->out); 00280 fprintf(baf->out, "\n"); 00281 00282 if (baf->hCountDown) 00283 { 00284 hStartNum = baf->hNumOff - baf->hLineStart; 00285 hEndNum = 1+baf->hNumOff - baf->hCurPos; 00286 } 00287 else 00288 { 00289 hStartNum = 1+baf->hNumOff + baf->hLineStart; 00290 hEndNum = baf->hNumOff + baf->hCurPos; 00291 } 00292 fprintf(baf->out, "%0*d ", startDigits, hStartNum); 00293 for (i=0; i<count; ++i) 00294 fputc(baf->hChars[i], baf->out); 00295 fprintf(baf->out, " %0*d\n\n", endDigits, hEndNum); 00296 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void cfmFree | ( | struct cfm ** | pCfm | ) |
Definition at line 115 of file seqOut.c.
References cfmPopFormat(), and freez().
Referenced by pslShowAlignmentStranded().
00117 { 00118 struct cfm *cfm = *pCfm; 00119 if (cfm != NULL) 00120 { 00121 cfmPopFormat(cfm); 00122 freez(pCfm); 00123 } 00124 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct cfm* cfmNew | ( | int | wordLen, | |
| int | lineLen, | |||
| boolean | lineNumbers, | |||
| boolean | countDown, | |||
| FILE * | out, | |||
| int | numOff | |||
| ) | [read] |
Definition at line 17 of file seqOut.c.
References AllocVar, cfm::bold, cfm::charCount, cfm::color, cfm::countDown, FALSE, cfm::inLine, cfm::inWord, cfm::italic, cfm::lineLen, cfm::lineNumbers, cfm::numOff, cfm::out, cfm::underline, and cfm::wordLen.
Referenced by ffShNeedle(), and pslShowAlignmentStranded().
00020 { 00021 struct cfm *cfm; 00022 AllocVar(cfm); 00023 cfm->inWord = cfm->inLine = cfm->charCount = 0; 00024 cfm->color = 0; 00025 cfm->wordLen = wordLen; 00026 cfm->lineLen = lineLen; 00027 cfm->lineNumbers = lineNumbers; 00028 cfm->countDown = countDown; 00029 cfm->out = out; 00030 cfm->numOff = numOff; 00031 cfm->bold = cfm->underline = cfm->italic = FALSE; 00032 return cfm; 00033 }
Here is the caller graph for this function:

| void cfmOut | ( | struct cfm * | cfm, | |
| char | c, | |||
| int | color | |||
| ) |
Definition at line 109 of file seqOut.c.
References cfmOutExt(), and FALSE.
Referenced by bafWriteLine(), and pslShowAlignmentStranded().
Here is the call graph for this function:

Here is the caller graph for this function:

| void cfmOutExt | ( | struct cfm * | cfm, | |
| char | c, | |||
| int | color, | |||
| boolean | underline, | |||
| boolean | bold, | |||
| boolean | italic | |||
| ) |
Definition at line 61 of file seqOut.c.
References cfm::bold, cfmPopFormat(), cfmPushFormat(), cfm::charCount, cfm::color, cfm::countDown, cfm::inLine, cfm::inWord, cfm::italic, cfm::lineLen, cfm::lineNumbers, cfm::numOff, cfm::out, cfm::underline, and cfm::wordLen.
Referenced by cfmOut().
00063 { 00064 if (color != cfm->color || underline != cfm->underline 00065 || bold != cfm->bold || italic != cfm->italic) 00066 { 00067 cfmPopFormat(cfm); 00068 cfm->color = color; 00069 cfm->underline = underline; 00070 cfm->bold = bold; 00071 cfm->italic = italic; 00072 cfmPushFormat(cfm); 00073 } 00074 00075 ++cfm->charCount; 00076 fputc(c, cfm->out); 00077 if (cfm->wordLen) 00078 { 00079 if (++cfm->inWord >= cfm->wordLen) 00080 { 00081 cfmPopFormat(cfm); 00082 fputc(' ', cfm->out); 00083 cfmPushFormat(cfm); 00084 cfm->inWord = 0; 00085 } 00086 } 00087 if (cfm->lineLen) 00088 { 00089 if (++cfm->inLine >= cfm->lineLen) 00090 { 00091 if (cfm->lineNumbers) 00092 { 00093 int pos = cfm->charCount; 00094 if (cfm->countDown) 00095 { 00096 pos = 1-pos; 00097 } 00098 pos += cfm->numOff; 00099 cfmPopFormat(cfm); 00100 fprintf(cfm->out, " %d", pos); 00101 cfmPushFormat(cfm); 00102 } 00103 fprintf(cfm->out, "\n"); 00104 cfm->inLine = 0; 00105 } 00106 } 00107 }
Here is the call graph for this function:

Here is the caller graph for this function:

| static void cfmPopFormat | ( | struct cfm * | cfm | ) | [static] |
Definition at line 35 of file seqOut.c.
References cfm::bold, cfm::color, cfm::italic, cfm::out, and cfm::underline.
Referenced by bafWriteLine(), cfmFree(), and cfmOutExt().
00037 { 00038 if (cfm->color != 0) 00039 fprintf(cfm->out, "</FONT>"); 00040 if (cfm->underline) 00041 fprintf(cfm->out, "</U>"); 00042 if (cfm->bold) 00043 fprintf(cfm->out, "</B>"); 00044 if (cfm->italic) 00045 fprintf(cfm->out, "</I>"); 00046 }
Here is the caller graph for this function:

| static void cfmPushFormat | ( | struct cfm * | cfm | ) | [static] |
Definition at line 48 of file seqOut.c.
References cfm::bold, cfm::color, cfm::italic, cfm::out, and cfm::underline.
Referenced by bafWriteLine(), and cfmOutExt().
00050 { 00051 if (cfm->italic) 00052 fprintf(cfm->out, "<I>"); 00053 if (cfm->bold) 00054 fprintf(cfm->out, "<B>"); 00055 if (cfm->underline) 00056 fprintf(cfm->out, "<U>"); 00057 if (cfm->color != 0) 00058 fprintf(cfm->out, "<FONT COLOR=\"#%06X\">", cfm->color); 00059 }
Here is the caller graph for this function:

| static int maxDigits | ( | int | x, | |
| int | y | |||
| ) | [static] |
Definition at line 180 of file seqOut.c.
References digitsBaseTen().
Referenced by bafWriteLine().
00181 { 00182 int xDigits = digitsBaseTen(x); 00183 int yDigits = digitsBaseTen(y); 00184 return (xDigits > yDigits ? xDigits : yDigits); 00185 }
Here is the call graph for this function:

Here is the caller graph for this function:

char const rcsid[] = "$Id: seqOut.c,v 1.27 2007/03/26 18:11:48 angie Exp $" [static] |
| int seqOutColorLookup[] |
Initial value:
{
0x000000,
0x3300FF,
0x22CCEE,
0xFF0033,
0xFFcc22,
0x00aa00,
0xFF0000,
}
Definition at line 126 of file seqOut.c.
Referenced by bafWriteLine(), and pslShowAlignmentStranded().
1.5.2