#include "common.h"#include "linefile.h"#include "hash.h"#include "dnaseq.h"#include "dnautil.h"#include "chain.h"Include dependency graph for chain.c:

Go to the source code of this file.
Defines | |
| #define | FACTOR 300000000 |
Functions | |
| void | chainFree (struct chain **pChain) |
| void | chainFreeList (struct chain **pList) |
| int | cBlockCmpTarget (const void *va, const void *vb) |
| int | cBlockCmpBoth (const void *va, const void *vb) |
| int | cBlockCmpDiagQuery (const void *va, const void *vb) |
| void | cBlocksAddOffset (struct cBlock *blockList, int qOff, int tOff) |
| int | chainCmpScore (const void *va, const void *vb) |
| int | chainCmpScoreDesc (const void *va, const void *vb) |
| int | chainCmpTarget (const void *va, const void *vb) |
| int | chainCmpQuery (const void *va, const void *vb) |
| void | chainIdSet (int id) |
| void | chainIdReset () |
| void | chainIdNext (struct chain *chain) |
| void | chainWriteHead (struct chain *chain, FILE *f) |
| void | chainWrite (struct chain *chain, FILE *f) |
| void | chainWriteAll (struct chain *chainList, FILE *f) |
| void | chainWriteLong (struct chain *chain, FILE *f) |
| chain * | chainReadChainLine (struct lineFile *lf) |
| void | chainReadBlocks (struct lineFile *lf, struct chain *chain) |
| chain * | chainRead (struct lineFile *lf) |
| void | chainSwap (struct chain *chain) |
| hash * | chainReadUsedSwapLf (char *fileName, boolean swapQ, Bits *bits, struct lineFile *lf) |
| hash * | chainReadUsedSwap (char *fileName, boolean swapQ, Bits *bits) |
| hash * | chainReadAllSwap (char *fileName, boolean swapQ) |
| hash * | chainReadAll (char *fileName) |
| hash * | chainReadAllWithMeta (char *fileName, FILE *f) |
| chain * | chainLookup (struct hash *hash, int id) |
| void | chainSubsetOnT (struct chain *chain, int subStart, int subEnd, struct chain **retSubChain, struct chain **retChainToFree) |
| void | chainFastSubsetOnT (struct chain *chain, struct cBlock *firstBlock, int subStart, int subEnd, struct chain **retSubChain, struct chain **retChainToFree) |
| void | chainSubsetOnQ (struct chain *chain, int subStart, int subEnd, struct chain **retSubChain, struct chain **retChainToFree) |
| void | chainRangeQPlusStrand (struct chain *chain, int *retQs, int *retQe) |
Variables | |
| static char const | rcsid [] = "$Id: chain.c,v 1.25 2007/02/19 18:29:32 kent Exp $" |
| static int | nextId = 1 |
| int cBlockCmpBoth | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 47 of file chain.c.
References cBlock::qStart, and cBlock::tStart.
00049 { 00050 const struct cBlock *a = *((struct cBlock **)va); 00051 const struct cBlock *b = *((struct cBlock **)vb); 00052 int dif; 00053 dif = a->qStart - b->qStart; 00054 if (dif == 0) 00055 dif = a->tStart - b->tStart; 00056 return dif; 00057 }
| int cBlockCmpDiagQuery | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 59 of file chain.c.
References cBlock::qStart, and cBlock::tStart.
00061 { 00062 const struct cBlock *a = *((struct cBlock **)va); 00063 const struct cBlock *b = *((struct cBlock **)vb); 00064 int dif; 00065 dif = (a->tStart - a->qStart) - (b->tStart - b->qStart); 00066 if (dif == 0) 00067 dif = a->qStart - b->qStart; 00068 return dif; 00069 }
| int cBlockCmpTarget | ( | const void * | va, | |
| const void * | vb | |||
| ) |
| void cBlocksAddOffset | ( | struct cBlock * | blockList, | |
| int | qOff, | |||
| int | tOff | |||
| ) |
Definition at line 71 of file chain.c.
References cBlock::next, cBlock::qEnd, cBlock::qStart, cBlock::tEnd, and cBlock::tStart.
00073 { 00074 struct cBlock *block; 00075 for (block = blockList; block != NULL; block = block->next) 00076 { 00077 block->tStart += tOff; 00078 block->tEnd += tOff; 00079 block->qStart += qOff; 00080 block->qEnd += qOff; 00081 } 00082 }
| int chainCmpQuery | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 119 of file chain.c.
References chain::qName, and chain::qStart.
00121 { 00122 const struct chain *a = *((struct chain **)va); 00123 const struct chain *b = *((struct chain **)vb); 00124 int dif; 00125 00126 dif = strcmp(a->qName, b->qName); 00127 if (dif == 0) 00128 dif = a->qStart - b->qStart; 00129 return dif; 00130 }
| int chainCmpScore | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 84 of file chain.c.
References chain::score.
Referenced by chainBlocks().
00086 { 00087 const struct chain *a = *((struct chain **)va); 00088 const struct chain *b = *((struct chain **)vb); 00089 double diff = b->score - a->score; 00090 if (diff < 0.0) return -1; 00091 else if (diff > 0.0) return 1; 00092 else return 0; 00093 }
Here is the caller graph for this function:

| int chainCmpScoreDesc | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 95 of file chain.c.
References chain::score.
00097 { 00098 const struct chain *a = *((struct chain **)va); 00099 const struct chain *b = *((struct chain **)vb); 00100 double diff = a->score - b->score; 00101 if (diff < 0.0) return -1; 00102 else if (diff > 0.0) return 1; 00103 else return 0; 00104 }
| int chainCmpTarget | ( | const void * | va, | |
| const void * | vb | |||
| ) |
Definition at line 106 of file chain.c.
References chain::tName, and chain::tStart.
00108 { 00109 const struct chain *a = *((struct chain **)va); 00110 const struct chain *b = *((struct chain **)vb); 00111 int dif = strcmp(a->tName, b->tName); 00112 if (dif == 0) 00113 dif = a->tStart - b->tStart; 00114 return dif; 00115 }
| void chainFastSubsetOnT | ( | struct chain * | chain, | |
| struct cBlock * | firstBlock, | |||
| int | subStart, | |||
| int | subEnd, | |||
| struct chain ** | retSubChain, | |||
| struct chain ** | retChainToFree | |||
| ) |
Definition at line 432 of file chain.c.
References BIGNUM, CloneVar, cBlock::next, cBlock::qEnd, cBlock::qStart, chain::tEnd, cBlock::tEnd, and cBlock::tStart.
Referenced by chainSubsetOnT().
00436 { 00437 struct chain *sub = NULL; 00438 struct cBlock *oldB, *b, *bList = NULL; 00439 int qStart = BIGNUM, qEnd = -BIGNUM; 00440 int tStart = BIGNUM, tEnd = -BIGNUM; 00441 00442 /* Check for easy case. */ 00443 if (subStart <= chain->tStart && subEnd >= chain->tEnd) 00444 { 00445 *retSubChain = chain; 00446 *retChainToFree = NULL; 00447 return; 00448 } 00449 /* Build new block list and calculate bounds. */ 00450 for (oldB = firstBlock; oldB != NULL; oldB = oldB->next) 00451 { 00452 if (oldB->tStart >= subEnd) 00453 break; 00454 b = CloneVar(oldB); 00455 if (b->tStart < subStart) 00456 { 00457 b->qStart += subStart - b->tStart; 00458 b->tStart = subStart; 00459 } 00460 if (b->tEnd > subEnd) 00461 { 00462 b->qEnd -= b->tEnd - subEnd; 00463 b->tEnd = subEnd; 00464 } 00465 slAddHead(&bList, b); 00466 if (qStart > b->qStart) 00467 qStart = b->qStart; 00468 if (qEnd < b->qEnd) 00469 qEnd = b->qEnd; 00470 if (tStart > b->tStart) 00471 tStart = b->tStart; 00472 if (tEnd < b->tEnd) 00473 tEnd = b->tEnd; 00474 } 00475 slReverse(&bList); 00476 00477 /* Make new chain based on old. */ 00478 if (bList != NULL) 00479 { 00480 double sizeRatio; 00481 AllocVar(sub); 00482 sub->blockList = bList; 00483 sub->qName = cloneString(chain->qName); 00484 sub->qSize = chain->qSize; 00485 sub->qStrand = chain->qStrand; 00486 sub->qStart = qStart; 00487 sub->qEnd = qEnd; 00488 sub->tName = cloneString(chain->tName); 00489 sub->tSize = chain->tSize; 00490 sub->tStart = tStart; 00491 sub->tEnd = tEnd; 00492 sub->id = chain->id; 00493 00494 /* Fake new score. */ 00495 sizeRatio = (sub->tEnd - sub->tStart); 00496 sizeRatio /= (chain->tEnd - chain->tStart); 00497 sub->score = sizeRatio * chain->score; 00498 } 00499 *retSubChain = *retChainToFree = sub; 00500 }
Here is the caller graph for this function:

| void chainFree | ( | struct chain ** | pChain | ) |
Definition at line 13 of file chain.c.
References chain::blockList, freeMem(), freez(), chain::qName, slFreeList(), and chain::tName.
Referenced by chainFreeList(), and chainReadUsedSwapLf().
00015 { 00016 struct chain *chain = *pChain; 00017 if (chain != NULL) 00018 { 00019 slFreeList(&chain->blockList); 00020 freeMem(chain->qName); 00021 freeMem(chain->tName); 00022 freez(pChain); 00023 } 00024 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void chainFreeList | ( | struct chain ** | pList | ) |
Definition at line 26 of file chain.c.
References chainFree(), and chain::next.
Referenced by ssFindBestBig().
00028 { 00029 struct chain *el, *next; 00030 00031 for (el = *pList; el != NULL; el = next) 00032 { 00033 next = el->next; 00034 chainFree(&el); 00035 } 00036 *pList = NULL; 00037 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void chainIdNext | ( | struct chain * | chain | ) |
Definition at line 146 of file chain.c.
References chain::id, and nextId.
Referenced by chainReadChainLine(), and chainWriteHead().
Here is the caller graph for this function:

| void chainIdReset | ( | ) |
Definition at line 140 of file chain.c.
References chainIdSet().
00142 { 00143 chainIdSet(1); 00144 }
Here is the call graph for this function:

| void chainIdSet | ( | int | id | ) |
Definition at line 405 of file chain.c.
References hashMustFindVal(), and safef().
00407 { 00408 char nameBuf[16]; 00409 safef(nameBuf, sizeof(nameBuf), "%x", id); 00410 return hashMustFindVal(hash, nameBuf); 00411 }
Here is the call graph for this function:

| void chainRangeQPlusStrand | ( | struct chain * | chain, | |
| int * | retQs, | |||
| int * | retQe | |||
| ) |
Definition at line 572 of file chain.c.
References errAbort(), chain::qEnd, chain::qSize, chain::qStart, and chain::qStrand.
00575 { 00576 if (chain == NULL) 00577 errAbort("chain::chainRangeQPlusStrand() - Can't find range in null query chain."); 00578 if (chain->qStrand == '-') 00579 { 00580 *retQs = chain->qSize - chain->qEnd; 00581 *retQe = chain->qSize - chain->qStart; 00582 } 00583 else 00584 { 00585 *retQs = chain->qStart; 00586 *retQe = chain->qEnd; 00587 } 00588 }
Here is the call graph for this function:

Definition at line 289 of file chain.c.
References chainReadBlocks(), and chainReadChainLine().
Referenced by chainReadUsedSwapLf().
00293 { 00294 struct chain *chain = chainReadChainLine(lf); 00295 if (chain != NULL) 00296 chainReadBlocks(lf, chain); 00297 return chain; 00298 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct hash* chainReadAll | ( | char * | fileName | ) | [read] |
Definition at line 389 of file chain.c.
References chainReadAllSwap(), and FALSE.
00391 { 00392 return chainReadAllSwap(fileName, FALSE); 00393 }
Here is the call graph for this function:

| struct hash* chainReadAllSwap | ( | char * | fileName, | |
| boolean | swapQ | |||
| ) | [read] |
Definition at line 383 of file chain.c.
References chainReadUsedSwap().
Referenced by chainReadAll().
00385 { 00386 return chainReadUsedSwap(fileName, swapQ, NULL); 00387 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct hash* chainReadAllWithMeta | ( | char * | fileName, | |
| FILE * | f | |||
| ) | [read] |
Definition at line 395 of file chain.c.
References chainReadUsedSwapLf(), FALSE, lineFileClose(), lineFileOpen(), lineFileSetMetaDataOutput(), and TRUE.
00397 { 00398 struct lineFile *lf = lineFileOpen(fileName, TRUE); 00399 struct hash *hash = NULL; 00400 lineFileSetMetaDataOutput(lf, f); 00401 hash = chainReadUsedSwapLf(fileName, FALSE, NULL, lf); 00402 lineFileClose(&lf); 00403 return hash; 00404 }
Here is the call graph for this function:

Definition at line 250 of file chain.c.
References AllocVar, chain::blockList, errAbort(), lineFile::fileName, lineFileChop, lineFileNeedNum(), lineFile::lineIx, chain::qEnd, cBlock::qEnd, cBlock::qStart, chain::qStart, slAddHead, slReverse(), chain::tEnd, cBlock::tEnd, cBlock::tStart, and chain::tStart.
Referenced by chainRead().
00252 { 00253 char *row[3]; 00254 int q,t; 00255 00256 /* Now read in block list. */ 00257 q = chain->qStart; 00258 t = chain->tStart; 00259 for (;;) 00260 { 00261 int wordCount = lineFileChop(lf, row); 00262 int size = lineFileNeedNum(lf, row, 0); 00263 struct cBlock *b; 00264 AllocVar(b); 00265 slAddHead(&chain->blockList, b); 00266 b->qStart = q; 00267 b->tStart = t; 00268 q += size; 00269 t += size; 00270 b->qEnd = q; 00271 b->tEnd = t; 00272 if (wordCount == 1) 00273 break; 00274 else if (wordCount < 3) 00275 errAbort("Expecting 1 or 3 words line %d of %s\n", 00276 lf->lineIx, lf->fileName); 00277 t += lineFileNeedNum(lf, row, 1); 00278 q += lineFileNeedNum(lf, row, 2); 00279 } 00280 if (q != chain->qEnd) 00281 errAbort("q end mismatch %d vs %d line %d of %s\n", 00282 q, chain->qEnd, lf->lineIx, lf->fileName); 00283 if (t != chain->tEnd) 00284 errAbort("t end mismatch %d vs %d line %d of %s\n", 00285 t, chain->tEnd, lf->lineIx, lf->fileName); 00286 slReverse(&chain->blockList); 00287 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 208 of file chain.c.
References AllocVar, chainIdNext(), cloneString(), errAbort(), lineFile::fileName, chain::id, lineFileChop, lineFileNeedNum(), lineFile::lineIx, chain::qEnd, chain::qName, chain::qSize, chain::qStart, chain::qStrand, sameString, chain::score, chain::tEnd, chain::tName, chain::tSize, and chain::tStart.
Referenced by chainRead().
00211 { 00212 char *row[13]; 00213 int wordCount; 00214 struct chain *chain; 00215 00216 wordCount = lineFileChop(lf, row); 00217 if (wordCount == 0) 00218 return NULL; 00219 if (wordCount < 12) 00220 errAbort("Expecting at least 12 words line %d of %s", 00221 lf->lineIx, lf->fileName); 00222 if (!sameString(row[0], "chain")) 00223 errAbort("Expecting 'chain' line %d of %s", lf->lineIx, lf->fileName); 00224 AllocVar(chain); 00225 chain->score = atof(row[1]); 00226 chain->tName = cloneString(row[2]); 00227 chain->tSize = lineFileNeedNum(lf, row, 3); 00228 if (wordCount >= 13) 00229 chain->id = lineFileNeedNum(lf, row, 12); 00230 else 00231 chainIdNext(chain); 00232 00233 /* skip tStrand for now, always implicitly + */ 00234 chain->tStart = lineFileNeedNum(lf, row, 5); 00235 chain->tEnd = lineFileNeedNum(lf, row, 6); 00236 chain->qName = cloneString(row[7]); 00237 chain->qSize = lineFileNeedNum(lf, row, 8); 00238 chain->qStrand = row[9][0]; 00239 chain->qStart = lineFileNeedNum(lf, row, 10); 00240 chain->qEnd = lineFileNeedNum(lf, row, 11); 00241 if (chain->qStart >= chain->qEnd || chain->tStart >= chain->tEnd) 00242 errAbort("End before start line %d of %s", lf->lineIx, lf->fileName); 00243 if (chain->qStart < 0 || chain->tStart < 0) 00244 errAbort("Start before zero line %d of %s", lf->lineIx, lf->fileName); 00245 if (chain->qEnd > chain->qSize || chain->tEnd > chain->tSize) 00246 errAbort("Past end of sequence line %d of %s", lf->lineIx, lf->fileName); 00247 return chain; 00248 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 373 of file chain.c.
References chainReadUsedSwapLf(), lineFileClose(), lineFileOpen(), and TRUE.
Referenced by chainReadAllSwap().
00376 { 00377 struct lineFile *lf = lineFileOpen(fileName, TRUE); 00378 struct hash *hash = chainReadUsedSwapLf(fileName, swapQ, NULL, lf); 00379 lineFileClose(&lf); 00380 return hash; 00381 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct hash* chainReadUsedSwapLf | ( | char * | fileName, | |
| boolean | swapQ, | |||
| Bits * | bits, | |||
| struct lineFile * | lf | |||
| ) | [read] |
Definition at line 344 of file chain.c.
References bitReadOne(), chainFree(), chainRead(), chainSwap(), errAbort(), lineFile::fileName, hashAdd(), hashLookup(), hashNew, chain::id, lineFile::lineIx, and safef().
Referenced by chainReadAllWithMeta(), and chainReadUsedSwap().
00347 { 00348 char nameBuf[16]; 00349 struct hash *hash = hashNew(18); 00350 struct chain *chain; 00351 int usedCount = 0, count = 0; 00352 00353 while ((chain = chainRead(lf)) != NULL) 00354 { 00355 ++count; 00356 if (bits != NULL && !bitReadOne(bits, chain->id)) 00357 { 00358 chainFree(&chain); 00359 continue; 00360 } 00361 safef(nameBuf, sizeof(nameBuf), "%x", chain->id); 00362 if (hashLookup(hash, nameBuf)) 00363 errAbort("Duplicate chain %d ending line %d of %s", 00364 chain->id, lf->lineIx, lf->fileName); 00365 if (swapQ) 00366 chainSwap(chain); 00367 hashAdd(hash, nameBuf, chain); 00368 ++usedCount; 00369 } 00370 return hash; 00371 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void chainSubsetOnQ | ( | struct chain * | chain, | |
| int | subStart, | |||
| int | subEnd, | |||
| struct chain ** | retSubChain, | |||
| struct chain ** | retChainToFree | |||
| ) |
Definition at line 502 of file chain.c.
References AllocVar, BIGNUM, chain::blockList, cloneString(), CloneVar, chain::id, cBlock::next, cBlock::qEnd, chain::qEnd, chain::qName, chain::qSize, cBlock::qStart, chain::qStrand, slAddHead, slReverse(), cBlock::tEnd, chain::tName, chain::tSize, and cBlock::tStart.
00510 { 00511 struct chain *sub = NULL; 00512 struct cBlock *oldB, *b, *bList = NULL; 00513 int qStart = BIGNUM, qEnd = -BIGNUM; 00514 int tStart = BIGNUM, tEnd = -BIGNUM; 00515 00516 /* Check for easy case. */ 00517 if (subStart <= chain->qStart && subEnd >= chain->qEnd) 00518 { 00519 *retSubChain = chain; 00520 *retChainToFree = NULL; 00521 return; 00522 } 00523 /* Build new block list and calculate bounds. */ 00524 for (oldB = chain->blockList; oldB != NULL; oldB = oldB->next) 00525 { 00526 if (oldB->qEnd <= subStart) 00527 continue; 00528 if (oldB->qStart >= subEnd) 00529 break; 00530 b = CloneVar(oldB); 00531 if (b->qStart < subStart) 00532 { 00533 b->tStart += subStart - b->qStart; 00534 b->qStart = subStart; 00535 } 00536 if (b->qEnd > subEnd) 00537 { 00538 b->tEnd -= b->qEnd - subEnd; 00539 b->qEnd = subEnd; 00540 } 00541 slAddHead(&bList, b); 00542 if (tStart > b->tStart) 00543 tStart = b->tStart; 00544 if (tEnd < b->tEnd) 00545 tEnd = b->tEnd; 00546 if (qStart > b->qStart) 00547 qStart = b->qStart; 00548 if (qEnd < b->qEnd) 00549 qEnd = b->qEnd; 00550 } 00551 slReverse(&bList); 00552 00553 /* Make new chain based on old. */ 00554 if (bList != NULL) 00555 { 00556 AllocVar(sub); 00557 sub->blockList = bList; 00558 sub->qName = cloneString(chain->qName); 00559 sub->qSize = chain->qSize; 00560 sub->qStrand = chain->qStrand; 00561 sub->qStart = qStart; 00562 sub->qEnd = qEnd; 00563 sub->tName = cloneString(chain->tName); 00564 sub->tSize = chain->tSize; 00565 sub->tStart = tStart; 00566 sub->tEnd = tEnd; 00567 sub->id = chain->id; 00568 } 00569 *retSubChain = *retChainToFree = sub; 00570 }
Here is the call graph for this function:

| void chainSubsetOnT | ( | struct chain * | chain, | |
| int | subStart, | |||
| int | subEnd, | |||
| struct chain ** | retSubChain, | |||
| struct chain ** | retChainToFree | |||
| ) |
Definition at line 413 of file chain.c.
References chain::blockList, chainFastSubsetOnT(), cBlock::next, and cBlock::tEnd.
00421 { 00422 /* Find first relevant block. */ 00423 struct cBlock *firstBlock; 00424 for (firstBlock = chain->blockList; firstBlock != NULL; firstBlock = firstBlock->next) 00425 { 00426 if (firstBlock->tEnd > subStart) 00427 break; 00428 } 00429 chainFastSubsetOnT(chain, firstBlock, subStart, subEnd, retSubChain, retChainToFree); 00430 }
Here is the call graph for this function:

| void chainSwap | ( | struct chain * | chain | ) |
Definition at line 300 of file chain.c.
References chain::blockList, cBlock::next, cBlock::qEnd, chain::qEnd, chain::qName, chain::qSize, cBlock::qStart, chain::qStart, chain::qStrand, reverseIntRange(), slReverse(), cBlock::tEnd, chain::tEnd, chain::tName, chain::tSize, cBlock::tStart, and chain::tStart.
Referenced by chainReadUsedSwapLf().
00302 { 00303 struct chain old = *chain; 00304 struct cBlock *b; 00305 00306 /* Copy basic stuff swapping t and q. */ 00307 chain->qName = old.tName; 00308 chain->tName = old.qName; 00309 chain->qStart = old.tStart; 00310 chain->qEnd = old.tEnd; 00311 chain->tStart = old.qStart; 00312 chain->tEnd = old.qEnd; 00313 chain->qSize = old.tSize; 00314 chain->tSize = old.qSize; 00315 00316 /* Swap t and q in blocks. */ 00317 for (b = chain->blockList; b != NULL; b = b->next) 00318 { 00319 struct cBlock old = *b; 00320 b->qStart = old.tStart; 00321 b->qEnd = old.tEnd; 00322 b->tStart = old.qStart; 00323 b->tEnd = old.qEnd; 00324 } 00325 00326 /* Cope with the minus strand. */ 00327 if (chain->qStrand == '-') 00328 { 00329 /* chain's are really set up so that the target is on the 00330 * + strand and the query is on the minus strand. 00331 * Therefore we need to reverse complement both 00332 * strands while swapping to preserve this. */ 00333 for (b = chain->blockList; b != NULL; b = b->next) 00334 { 00335 reverseIntRange(&b->tStart, &b->tEnd, chain->tSize); 00336 reverseIntRange(&b->qStart, &b->qEnd, chain->qSize); 00337 } 00338 reverseIntRange(&chain->tStart, &chain->tEnd, chain->tSize); 00339 reverseIntRange(&chain->qStart, &chain->qEnd, chain->qSize); 00340 slReverse(&chain->blockList); 00341 } 00342 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void chainWrite | ( | struct chain * | chain, | |
| FILE * | f | |||
| ) |
Definition at line 163 of file chain.c.
References chain::blockList, chainWriteHead(), cBlock::next, cBlock::qEnd, cBlock::qStart, cBlock::tEnd, and cBlock::tStart.
Referenced by chainWriteAll().
00165 { 00166 struct cBlock *b, *nextB; 00167 00168 chainWriteHead(chain, f); 00169 for (b = chain->blockList; b != NULL; b = nextB) 00170 { 00171 nextB = b->next; 00172 fprintf(f, "%d", b->qEnd - b->qStart); 00173 if (nextB != NULL) 00174 fprintf(f, "\t%d\t%d", 00175 nextB->tStart - b->tEnd, nextB->qStart - b->qEnd); 00176 fputc('\n', f); 00177 } 00178 fputc('\n', f); 00179 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void chainWriteAll | ( | struct chain * | chainList, | |
| FILE * | f | |||
| ) |
Definition at line 181 of file chain.c.
References chainWrite(), and chain::next.
00183 { 00184 struct chain *chain; 00185 for (chain = chainList; chain != NULL; chain = chain->next) 00186 chainWrite(chain, f); 00187 }
Here is the call graph for this function:

| void chainWriteHead | ( | struct chain * | chain, | |
| FILE * | f | |||
| ) |
Definition at line 152 of file chain.c.
References chainIdNext(), chain::id, chain::qEnd, chain::qName, chain::qSize, chain::qStart, chain::qStrand, chain::score, chain::tEnd, chain::tName, chain::tSize, and chain::tStart.
Referenced by chainWrite(), chainWriteLong(), and peelChains().
00154 { 00155 if (chain->id == 0) 00156 chainIdNext(chain); 00157 fprintf(f, "chain %1.0f %s %d + %d %d %s %d %c %d %d %d\n", chain->score, 00158 chain->tName, chain->tSize, chain->tStart, chain->tEnd, 00159 chain->qName, chain->qSize, chain->qStrand, chain->qStart, chain->qEnd, 00160 chain->id); 00161 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void chainWriteLong | ( | struct chain * | chain, | |
| FILE * | f | |||
| ) |
Definition at line 189 of file chain.c.
References chain::blockList, chainWriteHead(), cBlock::next, cBlock::qEnd, cBlock::qStart, cBlock::tEnd, and cBlock::tStart.
00191 { 00192 struct cBlock *b, *nextB; 00193 00194 chainWriteHead(chain, f); 00195 for (b = chain->blockList; b != NULL; b = nextB) 00196 { 00197 nextB = b->next; 00198 fprintf(f, "%d\t%d\t", b->tStart, b->qStart); 00199 fprintf(f, "%d", b->qEnd - b->qStart); 00200 if (nextB != NULL) 00201 fprintf(f, "\t%d\t%d", 00202 nextB->tStart - b->tEnd, nextB->qStart - b->qEnd); 00203 fputc('\n', f); 00204 } 00205 fputc('\n', f); 00206 }
Here is the call graph for this function:

int nextId = 1 [static] |
char const rcsid[] = "$Id: chain.c,v 1.25 2007/02/19 18:29:32 kent Exp $" [static] |
1.5.2