inc/dnautil.h File Reference

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

Go to the source code of this file.

Defines

#define T_BASE_VAL   0
#define U_BASE_VAL   0
#define C_BASE_VAL   1
#define A_BASE_VAL   2
#define G_BASE_VAL   3
#define N_BASE_VAL   4
#define MASKED_BASE_BIT   8

Typedefs

typedef char DNA
typedef char AA
typedef char BIOPOL
typedef char Codon

Enumerations

enum  dnaCase { dnaUpper, dnaLower, dnaMixed }

Functions

void dnaUtilOpen ()
void complement (DNA *dna, long length)
void reverseComplement (DNA *dna, long length)
long reverseOffset (long offset, long arraySize)
void reverseIntRange (int *pStart, int *pEnd, int size)
void reverseUnsignedRange (unsigned *pStart, unsigned *pEnd, int size)
void toRna (DNA *dna)
AA lookupCodon (DNA *dna)
boolean isStopCodon (DNA *dna)
boolean isKozak (char *dna, int dnaSize, int pos)
boolean isReallyStopCodon (char *dna, boolean selenocysteine)
AA lookupMitoCodon (DNA *dna)
Codon codonVal (DNA *start)
DNAvalToCodon (int val)
void dnaTranslateSome (DNA *dna, char *out, int outSize)
char * skipIgnoringDash (char *a, int size, bool skipTrailingDash)
int countNonDash (char *a, int size)
int nextPowerOfFour (long x)
long dnaFilteredSize (char *rawDna)
long aaFilteredSize (char *rawDna)
void dnaFilter (char *in, DNA *out)
void aaFilter (char *in, DNA *out)
void dnaFilterToN (char *in, DNA *out)
void upperToN (char *s, int size)
void lowerToN (char *s, int size)
void dnaBaseHistogram (DNA *dna, int dnaSize, int histogram[4])
void dnaMixedCaseFilter (char *in, DNA *out)
bits32 packDna16 (DNA *in)
bits16 packDna8 (DNA *in)
UBYTE packDna4 (DNA *in)
void unpackDna (bits32 *tiles, int tileCount, DNA *out)
void unpackDna4 (UBYTE *tiles, int byteCount, DNA *out)
void unalignedUnpackDna (bits32 *tiles, int start, int size, DNA *unpacked)
int intronOrientationMinSize (DNA *iStart, DNA *iEnd, int minIntronSize)
int intronOrientation (DNA *iStart, DNA *iEnd)
int dnaScore2 (DNA a, DNA b)
int dnaScoreMatch (DNA *a, DNA *b, int size)
int aaScore2 (AA a, AA b)
int aaScoreMatch (AA *a, AA *b, int size)
int dnaOrAaScoreMatch (char *a, char *b, int size, int matchScore, int mismatchScore, char ignore)
void writeSeqWithBreaks (FILE *f, char *letters, int letterCount, int maxPerLine)
int tailPolyASizeLoose (DNA *dna, int size)
int headPolyTSizeLoose (DNA *dna, int size)
int maskTailPolyA (DNA *dna, int size)
int maskHeadPolyT (DNA *dna, int size)
boolean isDna (char *poly, int size)
boolean isAllDna (char *poly, int size)

Variables

DNA ntChars [256]
AA aaChars [256]
int ntVal [256]
int aaVal [256]
int ntValLower [256]
int ntValUpper [256]
int ntValNoN [256]
int ntVal5 [256]
DNA valToNt []
DNA ntMixedCaseChars [256]
DNA ntCompTable [256]
int ntValMasked [256]
DNA valToNtMasked [256]


Define Documentation

#define A_BASE_VAL   2

Definition at line 26 of file dnautil.h.

Referenced by initNtLookup(), initNtVal(), isKozak(), makeMatchTable(), and makeWobbleMatchTable().

#define C_BASE_VAL   1

Definition at line 25 of file dnautil.h.

Referenced by calcGcRatio(), initNtLookup(), initNtVal(), makeMatchTable(), and makeWobbleMatchTable().

#define G_BASE_VAL   3

Definition at line 27 of file dnautil.h.

Referenced by calcGcRatio(), initNtLookup(), initNtVal(), isKozak(), makeMatchTable(), and makeWobbleMatchTable().

#define MASKED_BASE_BIT   8

Definition at line 69 of file dnautil.h.

Referenced by initNtVal(), nibInput(), and nibOutput().

#define N_BASE_VAL   4

Definition at line 28 of file dnautil.h.

Referenced by initNtVal().

#define T_BASE_VAL   0

Definition at line 23 of file dnautil.h.

Referenced by initNtLookup(), initNtVal(), makeMatchTable(), and makeWobbleMatchTable().

#define U_BASE_VAL   0

Definition at line 24 of file dnautil.h.

Referenced by initNtVal().


Typedef Documentation

typedef char AA

Definition at line 31 of file dnautil.h.

typedef char BIOPOL

Definition at line 32 of file dnautil.h.

typedef char Codon

Definition at line 98 of file dnautil.h.

typedef char DNA

Definition at line 30 of file dnautil.h.


Enumeration Type Documentation

enum dnaCase

Enumerator:
dnaUpper 
dnaLower 
dnaMixed 

Definition at line 92 of file dnautil.h.


Function Documentation

void aaFilter ( char *  in,
DNA out 
)

Definition at line 599 of file dnautil.c.

References aaChars, and dnaOrAaFilter().

Referenced by startServer().

00601 {
00602 dnaOrAaFilter(in, out, aaChars);
00603 }

Here is the call graph for this function:

Here is the caller graph for this function:

long aaFilteredSize ( char *  rawDna  ) 

Definition at line 593 of file dnautil.c.

References aaChars, and dnaOrAaFilteredSize().

Referenced by startServer().

00595 {
00596 return dnaOrAaFilteredSize(raw, aaChars);
00597 }

Here is the call graph for this function:

Here is the caller graph for this function:

int aaScore2 ( AA  a,
AA  b 
)

Definition at line 801 of file dnautil.c.

Referenced by clumpToHspRange(), and findCrossover().

00803 {
00804 if (a == 'X' || b == 'X') return 0;
00805 if (a == b) return 2;
00806 else return -1;
00807 }

Here is the caller graph for this function:

int aaScoreMatch ( AA a,
AA b,
int  size 
)

Definition at line 809 of file dnautil.c.

References dnaOrAaScoreMatch().

Referenced by ffScoreSomething(), findCrossover(), and scoreAli().

00811 {
00812 return dnaOrAaScoreMatch(a, b, size, 2, -1, 'X');
00813 }

Here is the call graph for this function:

Here is the caller graph for this function:

Codon codonVal ( DNA start  ) 

Definition at line 289 of file dnautil.c.

References ntVal.

00292 {
00293 int v1,v2,v3;
00294 
00295 if ((v1 = ntVal[(int)start[0]]) < 0)
00296     return -1;
00297 if ((v2 = ntVal[(int)start[1]]) < 0)
00298     return -1;
00299 if ((v3 = ntVal[(int)start[2]]) < 0)
00300     return -1;
00301 return ((v1<<4) + (v2<<2) + v3);
00302 }

void complement ( DNA dna,
long  length 
)

Definition at line 431 of file dnautil.c.

References initNtCompTable(), inittedCompTable, and ntCompTable.

Referenced by reverseComplement().

00432 {
00433 int i;
00434 
00435 if (!inittedCompTable) initNtCompTable();
00436 for (i=0; i<length; ++i)
00437     {
00438     *dna = ntCompTable[(int)*dna];
00439     ++dna;
00440     }
00441 }

Here is the call graph for this function:

Here is the caller graph for this function:

int countNonDash ( char *  a,
int  size 
)

Definition at line 511 of file dnautil.c.

Referenced by axtCheck(), axtSubsetOnT(), axtTransPosToQ(), and mafSubsetE().

00513 {
00514 int count = 0;
00515 int i;
00516 for (i=0; i<size; ++i)
00517     if (a[i] != '-') 
00518         ++count;
00519 return count;
00520 }

Here is the caller graph for this function:

void dnaBaseHistogram ( DNA dna,
int  dnaSize,
int  histogram[4] 
)

Definition at line 632 of file dnautil.c.

References ntVal, and zeroBytes().

Referenced by dnaMark0(), and makeFreqTable().

00635 {
00636 int val;
00637 zeroBytes(histogram, 4*sizeof(int));
00638 while (--dnaSize >= 0)
00639     {
00640     if ((val = ntVal[(int)*dna++]) >= 0)
00641         ++histogram[val];
00642     }
00643 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dnaFilter ( char *  in,
DNA out 
)

Definition at line 568 of file dnautil.c.

References dnaOrAaFilter(), and ntChars.

Referenced by gfPcrMakePrimer(), and startServer().

00570 {
00571 dnaOrAaFilter(in, out, ntChars);
00572 }

Here is the call graph for this function:

Here is the caller graph for this function:

long dnaFilteredSize ( char *  rawDna  ) 

Definition at line 562 of file dnautil.c.

References dnaOrAaFilteredSize(), and ntChars.

Referenced by gfPcrMakePrimer(), and startServer().

00564 {
00565 return dnaOrAaFilteredSize(rawDna, ntChars);
00566 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dnaFilterToN ( char *  in,
DNA out 
)

Definition at line 574 of file dnautil.c.

References initNtChars(), and ntChars.

Referenced by doBlat().

00576 {
00577 DNA c;
00578 initNtChars();
00579 while ((c = *in++) != 0)
00580     {
00581     if ((c = ntChars[(int)c]) != 0) *out++ = c;
00582     else *out++ = 'n';
00583     }
00584 *out++ = 0;
00585 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dnaMixedCaseFilter ( char *  in,
DNA out 
)

Definition at line 587 of file dnautil.c.

References dnaOrAaFilter(), and ntMixedCaseChars.

00589 {
00590 dnaOrAaFilter(in, out, ntMixedCaseChars);
00591 }

Here is the call graph for this function:

int dnaOrAaScoreMatch ( char *  a,
char *  b,
int  size,
int  matchScore,
int  mismatchScore,
char  ignore 
)

Definition at line 773 of file dnautil.c.

Referenced by aaScoreMatch(), bioScoreMatch(), and dnaScoreMatch().

00776 {
00777 int i;
00778 int score = 0;
00779 for (i=0; i<size; ++i)
00780     {
00781     char aa = a[i];
00782     char bb = b[i];
00783     if (aa == ignore || bb == ignore)
00784         continue;
00785     if (aa == bb)
00786         score += matchScore;
00787     else
00788         score += mismatchScore;
00789     }
00790 return score;
00791 }

Here is the caller graph for this function:

int dnaScore2 ( DNA  a,
DNA  b 
)

Definition at line 765 of file dnautil.c.

Referenced by clumpToHspRange(), and findCrossover().

00767 {
00768 if (a == 'n' || b == 'n') return 0;
00769 if (a == b) return 1;
00770 else return -1;
00771 }

Here is the caller graph for this function:

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

Definition at line 793 of file dnautil.c.

References dnaOrAaScoreMatch().

Referenced by cdaAliFromFfAli(), expandLeft(), expandRight(), ffScoreSomeAlis(), ffScoreSomething(), findCrossover(), rangeScore(), reconsiderAlignedGaps(), and scoreAli().

00797 {
00798 return dnaOrAaScoreMatch(a, b, size, 1, -1, 'n');
00799 }

Here is the call graph for this function:

Here is the caller graph for this function:

void dnaTranslateSome ( DNA dna,
char *  out,
int  outSize 
)

Definition at line 311 of file dnautil.c.

References lookupCodon().

00314 {
00315 int i;
00316 int dnaSize;
00317 int protSize = 0;
00318 
00319 outSize -= 1;  /* Room for terminal zero */
00320 dnaSize = strlen(dna);
00321 for (i=0; i<dnaSize-2; i+=3)
00322     {
00323     if (protSize >= outSize)
00324         break;
00325     if ((out[protSize++] = lookupCodon(dna+i)) == 0)
00326         break;
00327     }
00328 out[protSize] = 0;
00329 }

Here is the call graph for this function:

void dnaUtilOpen (  ) 

Definition at line 1068 of file dnautil.c.

References checkSizeTypes(), FALSE, initAaVal(), initNtChars(), initNtCompTable(), initNtMixedCaseChars(), initNtVal(), and TRUE.

Referenced by axtScoreSym(), axtScoreSymFilterRepeats(), dnaOrAaFilter(), dnaOrAaFilteredSize(), faFastReadNext(), faMixedSpeedReadNext(), faReadMixedNext(), faToDna(), faToProtein(), ffFind(), gffOpen(), htmShell(), htmShellWithHead(), isAllDna(), isDna(), main(), nextSeqFromMem(), nibOpenVerify(), nibStreamOpen(), twoBitReadSeqFragExt(), and unalignedUnpackDna().

01070 {
01071 static boolean opened = FALSE;
01072 if (!opened)
01073     {
01074     checkSizeTypes();
01075     initNtVal();
01076     initAaVal();
01077     initNtChars();
01078     initNtMixedCaseChars();
01079     initNtCompTable();
01080     opened = TRUE;
01081     }
01082 }

Here is the call graph for this function:

Here is the caller graph for this function:

int headPolyTSizeLoose ( DNA dna,
int  size 
)

Definition at line 960 of file dnautil.c.

References FALSE, findHeadPolyTMaybeMask(), and TRUE.

00965 {
00966 return findHeadPolyTMaybeMask(dna, size, FALSE, TRUE);
00967 }

Here is the call graph for this function:

int intronOrientation ( DNA iStart,
DNA iEnd 
)

Definition at line 757 of file dnautil.c.

References intronOrientationMinSize().

Referenced by ffIntronOrientation(), ffOneIntronOrientation(), pslHasIntron(), pslWeightedIntronOrientation(), and tradeMismatchToCloseSpliceGap().

00761 {
00762 return intronOrientationMinSize(iStart, iEnd, 32);
00763 }

Here is the call graph for this function:

Here is the caller graph for this function:

int intronOrientationMinSize ( DNA iStart,
DNA iEnd,
int  minIntronSize 
)

Definition at line 738 of file dnautil.c.

Referenced by intronOrientation().

00742 {
00743 if (iEnd - iStart < minIntronSize)
00744     return 0;
00745 if (iStart[0] == 'g' && iStart[1] == 't' && iEnd[-2] == 'a' && iEnd[-1] == 'g')
00746     {
00747     return 1;
00748     }
00749 else if (iStart[0] == 'c' && iStart[1] == 't' && iEnd[-2] == 'a' && iEnd[-1] == 'c')
00750     {
00751     return -1;
00752     }
00753 else
00754     return 0;
00755 }

Here is the caller graph for this function:

boolean isAllDna ( char *  poly,
int  size 
)

Definition at line 991 of file dnautil.c.

References dnaUtilOpen(), FALSE, ntChars, and TRUE.

00993 {
00994 int i;
00995 
00996 if (size <= 1)
00997     return FALSE;
00998 dnaUtilOpen();
00999 for (i=0; i<size-1; ++i)
01000     {
01001     if (ntChars[(int)poly[i]] == 0) 
01002         return FALSE;
01003     }
01004 return TRUE;
01005 }

Here is the call graph for this function:

boolean isDna ( char *  poly,
int  size 
)

Definition at line 976 of file dnautil.c.

References dnaUtilOpen(), ntChars, and round.

Referenced by faReadAllIntoHash(), and seqIsDna().

00978 {
00979 int i;
00980 int dnaCount = 0;
00981 
00982 dnaUtilOpen();
00983 for (i=0; i<size; ++i)
00984     {
00985     if (ntChars[(int)poly[i]]) 
00986         dnaCount += 1;
00987     }
00988 return (dnaCount >= round(0.9 * size));
00989 }

Here is the call graph for this function:

Here is the caller graph for this function:

boolean isKozak ( char *  dna,
int  dnaSize,
int  pos 
)

Definition at line 226 of file dnautil.c.

References A_BASE_VAL, FALSE, G_BASE_VAL, lookupCodon(), ntVal, and TRUE.

00228 {
00229 if (lookupCodon(dna+pos) != 'M')
00230    {
00231    return FALSE;
00232    }
00233 if (pos + 3 < dnaSize)
00234     {
00235     if (ntVal[(int)dna[pos+3]] == G_BASE_VAL)
00236         return TRUE;
00237     }
00238 if (pos >= 3)
00239     {
00240     int c = ntVal[(int)dna[pos-3]];
00241     if (c == A_BASE_VAL || c == G_BASE_VAL)
00242         return TRUE;
00243     }
00244 return FALSE;
00245 }

Here is the call graph for this function:

boolean isReallyStopCodon ( char *  dna,
boolean  selenocysteine 
)

Definition at line 248 of file dnautil.c.

References lookupCodon(), and lookupMitoCodon().

00251 {
00252 if (selenocysteine)
00253     {
00254     /* Luckily the mitochondria *also* replaces TGA with 
00255      * something else, even though it isn't selenocysteine */
00256     return lookupMitoCodon(dna) == 0;
00257     }
00258 else
00259     {
00260     return lookupCodon(dna) == 0;
00261     }
00262 }

Here is the call graph for this function:

boolean isStopCodon ( DNA dna  ) 

Definition at line 220 of file dnautil.c.

References lookupCodon().

00222 {
00223 return lookupCodon(dna) == 0;
00224 }

Here is the call graph for this function:

AA lookupCodon ( DNA dna  ) 

Definition at line 200 of file dnautil.c.

References codonTable, initNtVal(), inittedNtVal, ntVal, and codonTable::protCode.

Referenced by bafWriteLine(), dnaTranslateSome(), isKozak(), isReallyStopCodon(), isStopCodon(), pslShowAlignmentStranded(), and translateSeqN().

00201 {
00202 int ix;
00203 int i;
00204 char c;
00205 
00206 if (!inittedNtVal)
00207     initNtVal();
00208 ix = 0;
00209 for (i=0; i<3; ++i)
00210     {
00211     int bv = ntVal[(int)dna[i]];
00212     if (bv<0)
00213         return 'X';
00214     ix = (ix<<2) + bv;
00215     }
00216 c = codonTable[ix].protCode;
00217 return c;
00218 }

Here is the call graph for this function:

Here is the caller graph for this function:

AA lookupMitoCodon ( DNA dna  ) 

Definition at line 268 of file dnautil.c.

References codonTable, initNtVal(), inittedNtVal, codonTable::mitoCode, and ntVal.

Referenced by isReallyStopCodon().

00269 {
00270 int ix;
00271 int i;
00272 char c;
00273 
00274 if (!inittedNtVal)
00275     initNtVal();
00276 ix = 0;
00277 for (i=0; i<3; ++i)
00278     {
00279     int bv = ntVal[(int)dna[i]];
00280     if (bv<0)
00281         return 'X';
00282     ix = (ix<<2) + bv;
00283     }
00284 c = codonTable[ix].mitoCode;
00285 c = toupper(c);
00286 return c;
00287 }

Here is the call graph for this function:

Here is the caller graph for this function:

void lowerToN ( char *  s,
int  size 
)

Definition at line 618 of file dnautil.c.

00620 {
00621 char c;
00622 int i;
00623 for (i=0; i<size; ++i)
00624     {
00625     c = s[i];
00626     if (islower(c))
00627         s[i] = 'N';
00628     }
00629 }

int maskHeadPolyT ( DNA dna,
int  size 
)

Definition at line 969 of file dnautil.c.

References FALSE, findHeadPolyTMaybeMask(), and TRUE.

Referenced by trimSeq().

00972 {
00973 return findHeadPolyTMaybeMask(dna, size, TRUE, FALSE);
00974 }

Here is the call graph for this function:

Here is the caller graph for this function:

int maskTailPolyA ( DNA dna,
int  size 
)

Definition at line 896 of file dnautil.c.

References FALSE, findTailPolyAMaybeMask(), and TRUE.

Referenced by trimSeq().

00899 {
00900 return findTailPolyAMaybeMask(dna, size, TRUE, FALSE);
00901 }

Here is the call graph for this function:

Here is the caller graph for this function:

int nextPowerOfFour ( long  x  ) 

Definition at line 522 of file dnautil.c.

Referenced by findBestAli(), and rwFindTilesBetween().

00527 {
00528 int count = 1;
00529 while (x > 4)
00530     {
00531     count += 1;
00532     x >>= 2;
00533     }
00534 return count;
00535 }

Here is the caller graph for this function:

bits32 packDna16 ( DNA in  ) 

Definition at line 645 of file dnautil.c.

References bits32, and ntValNoN.

Referenced by makeGoodTile(), newNt4(), and saveNt4().

00647 {
00648 bits32 out = 0;
00649 int count = 16;
00650 int bVal;
00651 while (--count >= 0)
00652     {
00653     bVal = ntValNoN[(int)*in++];
00654     out <<= 2;
00655     out += bVal;
00656     }
00657 return out;
00658 }

Here is the caller graph for this function:

UBYTE packDna4 ( DNA in  ) 

Definition at line 675 of file dnautil.c.

References ntValNoN, and UBYTE.

Referenced by twoBitFromDnaSeq().

00677 {
00678 UBYTE out = 0;
00679 int count = 4;
00680 int bVal;
00681 while (--count >= 0)
00682     {
00683     bVal = ntValNoN[(int)*in++];
00684     out <<= 2;
00685     out += bVal;
00686     }
00687 return out;
00688 }

Here is the caller graph for this function:

bits16 packDna8 ( DNA in  ) 

Definition at line 660 of file dnautil.c.

References bits16, and ntValNoN.

Referenced by makeGoodTile().

00662 {
00663 bits16 out = 0;
00664 int count = 8;
00665 int bVal;
00666 while (--count >= 0)
00667     {
00668     bVal = ntValNoN[(int)*in++];
00669     out <<= 2;
00670     out += bVal;
00671     }
00672 return out;
00673 }

Here is the caller graph for this function:

void reverseComplement ( DNA dna,
long  length 
)

Definition at line 445 of file dnautil.c.

References complement(), and reverseBytes().

Referenced by axtSwap(), bigBlat(), cdaAliFromFfAli(), crudeAliFind(), dnaMotifBestStrand(), doBlat(), ffFindAndScore(), fixDirectionAndOffsets(), getWormGeneDna(), getWormGeneExonDna(), gfClient(), gfiExpandAndLoadCached(), gfMakeOoc(), gfPcrClumps(), mafFlipStrand(), outputBed(), outputFa(), outputPsl(), pcrLocalStrand(), pslShowAlignmentStranded(), pslShowAlignmentStranded2(), rcSeqs(), scoreNoninsertingExtensions(), searchOne(), transCountBothStrands(), transIndexBothStrands(), transTripleSearch(), xenAlignBig(), and xenAlignWorm().

00446 {
00447 reverseBytes(dna, length);
00448 complement(dna, length);
00449 }

Here is the call graph for this function:

Here is the caller graph for this function:

void reverseIntRange ( int *  pStart,
int *  pEnd,
int  size 
)

Definition at line 460 of file dnautil.c.

Referenced by axtSwap(), chainSwap(), gfiExpandAndLoadCached(), mafFlipStrand(), mafNeedSubset(), mafSubsetE(), nextBlock(), printAxtTargetBlastTab(), pslFromAlign(), pslFromFakeFfAli(), pslHasIntron(), pslRangeTreeOverlap(), pslRcBoth(), pslRecalcBounds(), pslTrimToQueryRange(), pslTrimToTargetRange(), setPslBounds(), and tabBlastOut().

00461 {
00462 int temp;
00463 temp = *pStart;
00464 *pStart = size - *pEnd;
00465 *pEnd = size - temp;
00466 }

Here is the caller graph for this function:

long reverseOffset ( long  offset,
long  arraySize 
)

Definition at line 453 of file dnautil.c.

Referenced by cdaRcOne(), fixDirectionAndOffsets(), gdfRcGene(), and rcQueryOffsetsAroundSeg().

00454 {
00455 return arraySize-1 - offset;
00456 }

Here is the caller graph for this function:

void reverseUnsignedRange ( unsigned *  pStart,
unsigned *  pEnd,
int  size 
)

Definition at line 470 of file dnautil.c.

00471 {
00472 unsigned temp;
00473 temp = *pStart;
00474 *pStart = size - *pEnd;
00475 *pEnd = size - temp;
00476 }

char* skipIgnoringDash ( char *  a,
int  size,
bool  skipTrailingDash 
)

Definition at line 496 of file dnautil.c.

Referenced by axtSubsetOnT(), axtTransPosToQ(), and mafSubsetE().

00499 {
00500 while (size > 0)
00501     {
00502     if (*a++ != '-')
00503         --size;
00504     }
00505 if (skipTrailingDash)
00506     while (*a == '-')
00507        ++a;
00508 return a;
00509 }

Here is the caller graph for this function:

int tailPolyASizeLoose ( DNA dna,
int  size 
)

Definition at line 888 of file dnautil.c.

References FALSE, findTailPolyAMaybeMask(), and TRUE.

00892 {
00893 return findTailPolyAMaybeMask(dna, size, FALSE, TRUE);
00894 }

Here is the call graph for this function:

void toRna ( DNA dna  ) 

Definition at line 480 of file dnautil.c.

00481 {
00482 DNA c;
00483 for (;;)
00484     {
00485     c = *dna;
00486     if (c == 't')
00487         *dna = 'u';
00488     else if (c == 'T')
00489         *dna = 'U';
00490     else if (c == 0)
00491         break;
00492     ++dna;
00493     }
00494 }

void unalignedUnpackDna ( bits32 *  tiles,
int  start,
int  size,
DNA unpacked 
)

Definition at line 169 of file nt4.c.

References bits32, dnaUtilOpen(), unpackDna(), unpackLeftSide(), unpackMidWord(), and unpackRightSide().

Referenced by nt4LoadPart(), and nt4Unpack().

00172 {
00173 DNA *pt = unpacked;
00174 int sizeLeft = size;
00175 int firstBases, middleBases;
00176 bits32 *startTile, *endTile;
00177 
00178 dnaUtilOpen();
00179 
00180 /* See if all data is in a single word. */
00181 startTile = tiles + (start>>4);
00182 endTile = tiles + ((start + size - 1)>>4);
00183 if (startTile == endTile)
00184     {
00185     unpackMidWord(*startTile, start&0xf, size, unpacked);
00186     return;
00187     }
00188 
00189 /* Skip over initial stuff. */
00190 tiles = startTile;
00191 
00192 /* See if just have one tile to 
00193  * Unpack the right hand side of the first tile. */
00194 firstBases = (16 - (start&0xf));
00195 unpackRightSide(*tiles, firstBases, pt);
00196 pt += firstBases;
00197 sizeLeft -= firstBases;
00198 tiles += 1;
00199 
00200 /* Unpack all of the middle tiles. */
00201 middleBases = (sizeLeft&0x7ffffff0);
00202 unpackDna(tiles, middleBases>>4, pt);
00203 pt += middleBases;
00204 sizeLeft -= middleBases;
00205 tiles += (middleBases>>4);
00206 
00207 /* Unpack the left side of last tile. */
00208 if (sizeLeft > 0)
00209     unpackLeftSide(*tiles, sizeLeft, pt);
00210 pt += sizeLeft;
00211 
00212 /* Add trailing zero to make it a DNA string. */
00213 assert(pt == unpacked+size);
00214 *pt = 0;
00215 }

Here is the call graph for this function:

Here is the caller graph for this function:

void unpackDna ( bits32 *  tiles,
int  tileCount,
DNA out 
)

Definition at line 690 of file dnautil.c.

References bits32, and valToNt.

Referenced by unalignedUnpackDna().

00692 {
00693 int i, j;
00694 bits32 tile;
00695 
00696 for (i=0; i<tileCount; ++i)
00697     {
00698     tile = tiles[i];
00699     for (j=15; j>=0; --j)
00700         {
00701         out[j] = valToNt[tile & 0x3];
00702         tile >>= 2;
00703         }
00704     out += 16;
00705     }
00706 }

Here is the caller graph for this function:

void unpackDna4 ( UBYTE *  tiles,
int  byteCount,
DNA out 
)

Definition at line 708 of file dnautil.c.

References UBYTE, and valToNt.

00710 {
00711 int i, j;
00712 UBYTE tile;
00713 
00714 for (i=0; i<byteCount; ++i)
00715     {
00716     tile = tiles[i];
00717     for (j=3; j>=0; --j)
00718         {
00719         out[j] = valToNt[tile & 0x3];
00720         tile >>= 2;
00721         }
00722     out += 4;
00723     }
00724 }

void upperToN ( char *  s,
int  size 
)

Definition at line 605 of file dnautil.c.

Referenced by bigBlat(), maskNucSeqList(), readMaskedNib(), and readMaskedTwoBit().

00607 {
00608 char c;
00609 int i;
00610 for (i=0; i<size; ++i)
00611     {
00612     c = s[i];
00613     if (isupper(c))
00614         s[i] = 'n';
00615     }
00616 }

Here is the caller graph for this function:

DNA* valToCodon ( int  val  ) 

Definition at line 304 of file dnautil.c.

References codonTable::codon, and codonTable.

00306 {
00307 assert(val >= 0 && val < 64);
00308 return codonTable[val].codon;
00309 }

void writeSeqWithBreaks ( FILE *  f,
char *  letters,
int  letterCount,
int  maxPerLine 
)

Definition at line 815 of file dnautil.c.

References mustWrite().

Referenced by faWriteNext().

00817 {
00818 int lettersLeft = letterCount;
00819 int lineSize;
00820 while (lettersLeft > 0)
00821     {
00822     lineSize = lettersLeft;
00823     if (lineSize > maxPerLine)
00824         lineSize = maxPerLine;
00825     mustWrite(f, letters, lineSize);
00826     fputc('\n', f);
00827     letters += lineSize;
00828     lettersLeft -= lineSize;
00829     }
00830 }

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

AA aaChars[256]

Definition at line 1014 of file dnautil.c.

Referenced by aaFilter(), aaFilteredSize(), faToProtein(), initAaVal(), and nextSeqFromMem().

int aaVal[256]

Definition at line 1011 of file dnautil.c.

Referenced by gfPepTile(), gfSegmentedFindNearHits(), gfStraightFindNearHits(), and initAaVal().

DNA ntChars[256]

Definition at line 333 of file dnautil.c.

Referenced by dnaFilter(), dnaFilteredSize(), dnaFilterToN(), faFastReadNext(), faReadMixedNext(), faToDna(), gffReadDna(), initNtChars(), isAllDna(), isDna(), and nextSeqFromMem().

DNA ntCompTable[256]

Definition at line 380 of file dnautil.c.

Referenced by complement(), and initNtCompTable().

DNA ntMixedCaseChars[256]

Definition at line 353 of file dnautil.c.

Referenced by dnaMixedCaseFilter(), and initNtMixedCaseChars().

int ntVal[256]

Definition at line 121 of file dnautil.c.

Referenced by badPcrPrimerSeq(), calcGcRatio(), codonFindFrame(), codonVal(), dnaBaseHistogram(), dnaMark1(), dnaMarkTriple(), dnaMatchEntropy(), ffHashFuncN(), fillInMatchEtc(), findImprobableOligo(), gfSegmentedFindNearHits(), gfStraightFindNearHits(), initNtVal(), isKozak(), lookupCodon(), lookupMitoCodon(), makeGoodTile(), oligoProb(), and unN().

int ntVal5[256]

Definition at line 124 of file dnautil.c.

Referenced by initNtVal(), nibOutput(), and nibStreamOne().

int ntValLower[256]

Definition at line 122 of file dnautil.c.

Referenced by initNtVal().

int ntValMasked[256]

Definition at line 129 of file dnautil.c.

Referenced by initNtVal(), and nibOutput().

int ntValNoN[256]

Definition at line 125 of file dnautil.c.

Referenced by addToPatSpace(), countPatSpace(), gfFastFindDnaHits(), initNtVal(), packDna16(), packDna4(), packDna8(), and patSpaceFindOne().

int ntValUpper[256]

Definition at line 123 of file dnautil.c.

Referenced by initNtVal().

DNA valToNt[]

Definition at line 126 of file dnautil.c.

Referenced by initNtVal(), makeMatchTable(), nibInput(), twoBitReadSeqFragExt(), unpackDna(), unpackDna4(), unpackLeftSide(), unpackMidWord(), and unpackRightSide().

DNA valToNtMasked[256]

Definition at line 130 of file dnautil.c.

Referenced by initNtVal(), and nibInput().


Generated on Tue Dec 25 18:53:10 2007 for blat by  doxygen 1.5.2