jkOwnLib/gfInternal.h File Reference

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

Go to the source code of this file.

Data Structures

struct  gfRange

Functions

void gfRangeFree (struct gfRange **pEl)
void gfRangeFreeList (struct gfRange **pList)
int gfRangeCmpTarget (const void *va, const void *vb)
gfRangegfRangesBundle (struct gfRange *exonList, int maxIntron)
ssFfItemgfRangesToFfItem (struct gfRange *rangeList, aaSeq *qSeq)
ssBundleffSeedExtInMem (struct genoFind *gf, struct dnaSeq *qSeq, Bits *qMaskBits, int qOffset, struct lm *lm, int minScore, boolean isRc)
void dumpBuns (struct ssBundle *bunList)
void dumpFf (struct ffAli *left, DNA *needle, DNA *hay)
void gfiExpandRange (struct gfRange *range, int qSize, int tSize, boolean respectFrame, boolean isRc, int expansion)
dnaSeqgfiExpandAndLoadCached (struct gfRange *range, struct hash *tFileCache, char *tSeqDir, int querySize, int *retTotalSeqSize, boolean respectFrame, boolean isRc, int expansion)
void gfiGetSeqName (char *spec, char *name, char *file)


Function Documentation

void dumpBuns ( struct ssBundle bunList  ) 

Definition at line 93 of file supStitch.c.

References dnaSeq::dna, dumpFf(), ssFfItem::ff, ssBundle::ffList, ssBundle::genoSeq, ssBundle::next, ssFfItem::next, ssBundle::qSeq, and slCount().

00095 {
00096 struct ssBundle *bun;
00097 struct ssFfItem *ffl;
00098 for (bun = bunList; bun != NULL; bun = bun->next)
00099     {
00100     struct dnaSeq *qSeq = bun->qSeq;        /* Query sequence (not owned by bundle.) */
00101     struct dnaSeq *genoSeq = bun->genoSeq;     /* Genomic sequence (not owned by bundle.) */
00102     printf("Bundle of %d between %s and %s\n", slCount(bun->ffList), qSeq->name, genoSeq->name);
00103     for (ffl = bun->ffList; ffl != NULL; ffl = ffl->next)
00104         {
00105         dumpFf(ffl->ff, bun->qSeq->dna, bun->genoSeq->dna);
00106         }
00107     }
00108 }

Here is the call graph for this function:

void dumpFf ( struct ffAli left,
DNA needle,
DNA hay 
)

Definition at line 81 of file supStitch.c.

References ffAli::hEnd, ffAli::hStart, ffAli::left, ffAli::nEnd, ffAli::nStart, and ffAli::right.

00083 {
00084 struct ffAli *ff;
00085 for (ff = left; ff != NULL; ff = ff->right)
00086     {
00087     printf("(%ld - %ld)[%ld-%ld] ", (long)(ff->hStart-hay), (long)(ff->hEnd-hay),
00088         (long)(ff->nStart - needle), (long)(ff->nEnd - needle));
00089     }
00090 printf("\n");
00091 }

struct ssBundle* ffSeedExtInMem ( struct genoFind gf,
struct dnaSeq qSeq,
Bits qMaskBits,
int  qOffset,
struct lm lm,
int  minScore,
boolean  isRc 
) [read]

Definition at line 1251 of file ffSeedExtend.c.

References AllocVar, clumpToExactRange(), FALSE, ffCdna, ffIntronMax, gfClumpFreeList(), gfFindClumpsWithQmask(), gfRangeCmpTarget(), gfRangeFreeList(), gfRangesBundle(), gfRangesToFfItem(), lm, gfClump::next, rangeList, refineBundle(), slAddHead, slSort(), ssStitch(), genoFind::tileSize, and TRUE.

01254 {
01255 struct ssBundle *bunList = NULL, *bun;
01256 int hitCount;
01257 struct gfClump *clumpList, *clump;
01258 struct gfRange *rangeList = NULL, *range;
01259 struct dnaSeq *tSeq;
01260 
01261 clumpList = gfFindClumpsWithQmask(gf, qSeq, qMaskBits, qOffset, lm, &hitCount);
01262 for (clump = clumpList; clump != NULL; clump = clump->next)
01263     clumpToExactRange(clump, qSeq, gf->tileSize, 0, NULL, &rangeList);
01264 slSort(&rangeList, gfRangeCmpTarget);
01265 rangeList = gfRangesBundle(rangeList, ffIntronMax);
01266 for (range = rangeList; range != NULL; range = range->next)
01267     {
01268     range->qStart += qOffset;
01269     range->qEnd += qOffset;
01270     tSeq = range->tSeq;
01271     AllocVar(bun);
01272     bun->qSeq = qSeq;
01273     bun->genoSeq = tSeq;
01274     bun->ffList = gfRangesToFfItem(range->components, qSeq);
01275     bun->isProt = FALSE;
01276     bun->avoidFuzzyFindKludge = TRUE;
01277     ssStitch(bun, ffCdna, 16, 10);
01278     refineBundle(gf, qSeq, qMaskBits, qOffset, tSeq, lm, bun, isRc);
01279     slAddHead(&bunList, bun);
01280     }
01281 gfRangeFreeList(&rangeList);
01282 gfClumpFreeList(&clumpList);
01283 return bunList;
01284 }

Here is the call graph for this function:

struct dnaSeq* gfiExpandAndLoadCached ( struct gfRange range,
struct hash tFileCache,
char *  tSeqDir,
int  querySize,
int *  retTotalSeqSize,
boolean  respectFrame,
boolean  isRc,
int  expansion 
) [read]

Definition at line 57 of file gfInternal.c.

References dnaSeq::dna, errAbort(), nibInfo::f, gfiExpandRange(), hashAdd(), hashFindVal(), nibInfoNew(), nibIsFile(), nibLdPart(), PATH_LEN, reverseComplement(), reverseIntRange(), safef(), dnaSeq::size, nibInfo::size, gfRange::tEnd, gfRange::tName, gfRange::tStart, twoBitOpen(), twoBitReadSeqFragLower(), and twoBitSeqSize().

Referenced by gfAlignStrand(), gfPcrOneViaNet(), and loadHashT3Ranges().

00063 {
00064 struct dnaSeq *target = NULL;
00065 char fileName[PATH_LEN+256];
00066 
00067 safef(fileName, sizeof(fileName), "%s/%s", tSeqDir, range->tName);
00068 if (nibIsFile(fileName))
00069     {
00070     struct nibInfo *nib = hashFindVal(tFileCache, fileName);
00071     if (nib == NULL)
00072         {
00073         nib = nibInfoNew(fileName);
00074         hashAdd(tFileCache, fileName, nib);
00075         }
00076     if (isRc)
00077         reverseIntRange(&range->tStart, &range->tEnd, nib->size);
00078     gfiExpandRange(range, querySize, nib->size, respectFrame, isRc, expansion);
00079     target = nibLdPart(fileName, nib->f, nib->size, 
00080         range->tStart, range->tEnd - range->tStart);
00081     if (isRc)
00082         {
00083         reverseComplement(target->dna, target->size);
00084         reverseIntRange(&range->tStart, &range->tEnd, nib->size);
00085         }
00086     *retTotalSeqSize = nib->size;
00087     }
00088 else
00089     {
00090     struct twoBitFile *tbf = NULL;
00091     char *tSeqName = strchr(fileName, ':');
00092     int tSeqSize = 0;
00093     if (tSeqName == NULL)
00094         errAbort("No colon in .2bit response from gfServer");
00095     *tSeqName++ = 0;
00096     tbf = hashFindVal(tFileCache, fileName);
00097     if (tbf == NULL)
00098         {
00099         tbf = twoBitOpen(fileName);
00100         hashAdd(tFileCache, fileName, tbf);
00101         }
00102     tSeqSize = twoBitSeqSize(tbf, tSeqName);
00103     if (isRc)
00104         reverseIntRange(&range->tStart, &range->tEnd, tSeqSize);
00105     gfiExpandRange(range, querySize, tSeqSize, respectFrame, isRc, expansion);
00106     target = twoBitReadSeqFragLower(tbf, tSeqName, range->tStart, range->tEnd);
00107     if (isRc)
00108         {
00109         reverseComplement(target->dna, target->size);
00110         reverseIntRange(&range->tStart, &range->tEnd, tSeqSize);
00111         }
00112     *retTotalSeqSize = tSeqSize;
00113     }
00114 return target;
00115 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gfiExpandRange ( struct gfRange range,
int  qSize,
int  tSize,
boolean  respectFrame,
boolean  isRc,
int  expansion 
)

Definition at line 24 of file gfInternal.c.

References extendRespect(), gfRange::qEnd, gfRange::qStart, gfRange::tEnd, and gfRange::tStart.

Referenced by gfClumpsToBundles(), and gfiExpandAndLoadCached().

00027 {
00028 int x;
00029 
00030 x = range->qStart - expansion;
00031 if (x < 0) x = 0;
00032 range->qStart = x;
00033 
00034 x = range->qEnd + expansion;
00035 if (x > qSize) x = qSize;
00036 range->qEnd = x;
00037 
00038 x = range->tStart - expansion;
00039 if (x < 0) x = 0;
00040 if (respectFrame && !isRc) 
00041     {
00042     x = extendRespect(range->tStart, x);
00043     }
00044 range->tStart = x;
00045 
00046 x = range->tEnd + expansion;
00047 if (x > tSize) x = tSize;
00048 if (respectFrame && isRc)
00049     {
00050     x = extendRespect(range->tEnd, x);
00051     if (x > tSize)
00052         x -= 3;
00053     }
00054 range->tEnd = x;
00055 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gfiGetSeqName ( char *  spec,
char *  name,
char *  file 
)

Definition at line 117 of file gfInternal.c.

References errAbort(), nibIsFile(), and splitPath().

Referenced by getTargetName(), and gfPcrOneViaNet().

00121 {
00122 if (nibIsFile(spec))
00123     {
00124     splitPath(spec, NULL, name, NULL);
00125     if (file != NULL)
00126         strcpy(file, spec);
00127     }
00128 else
00129     {
00130     char *s = strchr(spec, ':');
00131     if (s == NULL)
00132         errAbort("Expecting colon in %s", spec);
00133     strcpy(name, s+1);
00134     if (file != NULL)
00135         {
00136         int fileNameSize = s - spec;
00137         memcpy(file, spec, fileNameSize);
00138         file[fileNameSize] = 0;
00139         }
00140     }
00141 }

Here is the call graph for this function:

Here is the caller graph for this function:

int gfRangeCmpTarget ( const void *  va,
const void *  vb 
)

Definition at line 83 of file gfBlatLib.c.

References gfRange::t3, gfRange::tName, and gfRange::tStart.

Referenced by fastMapClumpsToBundles(), ffSeedExtInMem(), gfAlignSomeClumps(), gfAlignStrand(), gfAlignTrans(), gfAlignTransTrans(), gfClumpsToBundles(), gfFindAlignAaTrans(), and gfTransTransFindBundles().

00085 {
00086 const struct gfRange *a = *((struct gfRange **)va);
00087 const struct gfRange *b = *((struct gfRange **)vb);
00088 int diff;
00089 
00090 diff = strcmp(a->tName, b->tName);
00091 if (diff == 0)
00092     {
00093     long lDiff = a->t3 - b->t3;
00094     if (lDiff < 0)
00095        diff = -1;
00096     else if (lDiff > 0)
00097        diff = 1;
00098     else
00099        diff = 0;
00100 #ifdef SOLARIS_WORKAROUND_COMPILER_BUG_BUT_FAILS_IN_64_BIT
00101     diff = (unsigned long)(a->t3) - (unsigned long)(b->t3);     /* Casts needed for Solaris.  Thanks Darren Platt! */
00102 #endif /* SOLARIS_WORKAROUND_COMPILER_BUG_BUT_FAILS_IN_64_BIT */
00103     }
00104 if (diff == 0)
00105     diff = a->tStart - b->tStart;
00106 return diff;
00107 }

Here is the caller graph for this function:

void gfRangeFree ( struct gfRange **  pEl  ) 

Definition at line 41 of file gfBlatLib.c.

References gfRange::components, freeMem(), freez(), gfRangeFreeList(), and gfRange::tName.

Referenced by gfRangeFreeList().

00044 {
00045 struct gfRange *el;
00046 
00047 if ((el = *pEl) == NULL) return;
00048 freeMem(el->tName);
00049 if (el->components != NULL)
00050     gfRangeFreeList(&el->components);
00051 freez(pEl);
00052 }

Here is the call graph for this function:

Here is the caller graph for this function:

void gfRangeFreeList ( struct gfRange **  pList  ) 

Definition at line 54 of file gfBlatLib.c.

References gfRangeFree(), and gfRange::next.

Referenced by fastMapClumpsToBundles(), ffSeedExtInMem(), gfAlignSomeClumps(), gfAlignStrand(), gfAlignTrans(), gfAlignTransTrans(), gfFindAlignAaTrans(), gfPcrOneViaNet(), gfRangeFree(), and gfTransTransFindBundles().

00056 {
00057 struct gfRange *el, *next;
00058 
00059 for (el = *pList; el != NULL; el = next)
00060     {
00061     next = el->next;
00062     gfRangeFree(&el);
00063     }
00064 *pList = NULL;
00065 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct gfRange* gfRangesBundle ( struct gfRange exonList,
int  maxIntron 
) [read]

Definition at line 355 of file gfBlatLib.c.

References AllocVar, cloneString(), gfRange::next, sameString, slAddHead, and slAddTail().

Referenced by fastMapClumpsToBundles(), ffSeedExtInMem(), gfAlignSomeClumps(), gfAlignStrand(), gfAlignTrans(), gfAlignTransTrans(), gfClumpsToBundles(), gfFindAlignAaTrans(), and gfTransTransFindBundles().

00360 {
00361 struct gfRange *geneList = NULL, *gene = NULL, *lastExon = NULL, *exon, *nextExon;
00362 
00363 for (exon = exonList; exon != NULL; exon = nextExon)
00364     {
00365     nextExon = exon->next;
00366     if (lastExon == NULL || !sameString(lastExon->tName, exon->tName) 
00367         || exon->t3  != lastExon->t3
00368         || exon->tStart - lastExon->tEnd > maxIntron)
00369         {
00370         AllocVar(gene);
00371         gene->tStart = exon->tStart;
00372         gene->tEnd = exon->tEnd;
00373         gene->tName = cloneString(exon->tName);
00374         gene->tSeq = exon->tSeq;
00375         gene->qStart = exon->qStart;
00376         gene->qEnd = exon->qEnd;
00377         gene->hitCount = exon->hitCount;
00378         gene->t3 = exon->t3;
00379         slAddHead(&gene->components, exon);
00380         slAddHead(&geneList, gene);
00381         }
00382     else
00383         {
00384         if (exon->qStart < gene->qStart) gene->qStart = exon->qStart;
00385         if (exon->qEnd > gene->qEnd) gene->qEnd = exon->qEnd;
00386         if (exon->tStart < gene->tStart) gene->tStart = exon->tStart;
00387         if (exon->tEnd > gene->tEnd) gene->tEnd = exon->tEnd;
00388         gene->hitCount += exon->hitCount;
00389         slAddTail(&gene->components, exon);
00390         }
00391     lastExon = exon;
00392     }
00393 slReverse(&geneList);
00394 return geneList;
00395 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct ssFfItem* gfRangesToFfItem ( struct gfRange rangeList,
aaSeq qSeq 
) [read]

Definition at line 824 of file gfBlatLib.c.

References AllocVar, dnaSeq::dna, ssFfItem::ff, ffMakeRightLinks(), gfRange::next, gfRange::qEnd, gfRange::qStart, rangeList, gfRange::tEnd, gfRange::tSeq, and gfRange::tStart.

Referenced by fastMapClumpsToBundles(), ffSeedExtInMem(), gfAlignSomeClumps(), gfAlignTrans(), gfAlignTransTrans(), gfFindAlignAaTrans(), and gfTransTransFindBundles().

00826 {
00827 AA *q = qSeq->dna;
00828 struct ffAli *ffList = NULL, *ff;
00829 struct gfRange *range;
00830 struct ssFfItem *ffi;
00831 
00832 for (range = rangeList; range != NULL; range = range->next)
00833     {
00834     aaSeq *tSeq = range->tSeq;
00835     AA *t = tSeq->dna;
00836     AllocVar(ff);
00837     ff->nStart = q + range->qStart;
00838     ff->nEnd = q + range->qEnd;
00839     ff->hStart = t + range->tStart;
00840     ff->hEnd = t + range->tEnd;
00841     ff->left = ffList;
00842     ffList = ff;
00843     }
00844 AllocVar(ffi);
00845 ffi->ff = ffMakeRightLinks(ffList);
00846 return ffi;
00847 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 19:28:01 2007 for blat by  doxygen 1.5.2