#include "dnautil.h"#include "dnaseq.h"#include "nt4.h"#include "gdf.h"Include dependency graph for wormdna.h:

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

Go to the source code of this file.
Data Structures | |
| struct | wormCdnaInfo |
| struct | wormCdnaIterator |
| struct | wormFeature |
| struct | wormGdfCache |
Functions | |
| boolean | wormCdnaInfo (char *name, struct wormCdnaInfo *retInfo) |
| void | wormFaCommentIntoInfo (char *faComment, struct wormCdnaInfo *retInfo) |
| void | wormFreeCdnaInfo (struct wormCdnaInfo *ci) |
| boolean | wormInfoForGene (char *orfName, struct wormCdnaInfo *retInfo) |
| boolean | wormCdnaSeq (char *name, struct dnaSeq **retDna, struct wormCdnaInfo *retInfo) |
| void | wormCdnaUncache () |
| boolean | wormSearchAllCdna (struct wormCdnaIterator **retSi) |
| void | freeWormCdnaIterator (struct wormCdnaIterator **pIt) |
| dnaSeq * | nextWormCdna (struct wormCdnaIterator *it) |
| boolean | nextWormCdnaAndInfo (struct wormCdnaIterator *it, struct dnaSeq **retSeq, struct wormCdnaInfo *retInfo) |
| char * | wormFeaturesDir () |
| char * | wormChromDir () |
| char * | wormCdnaDir () |
| char * | wormSangerDir () |
| char * | wormGenieDir () |
| char * | wormXenoDir () |
| boolean | wormIsGeneName (char *name) |
| boolean | wormIsOrfName (char *in) |
| slName * | wormGeneToOrfNames (char *name) |
| char * | wormGeneFirstOrfName (char *geneName) |
| boolean | wormGeneForOrf (char *orfName, char *geneNameBuf, int bufSize) |
| boolean | getWormGeneExonDna (char *name, DNA **retDna) |
| boolean | getWormGeneDna (char *name, DNA **retDna, boolean upcExons) |
| void | wormLoadNt4Genome (struct nt4Seq ***retNt4Seq, int *retNt4Count) |
| void | wormFreeNt4Genome (struct nt4Seq ***pNt4Seq) |
| int | wormChromSize (char *chrom) |
| DNA * | wormChromPart (char *chromId, int start, int size) |
| DNA * | wormChromPartExonsUpper (char *chromId, int start, int size) |
| void | wormChromNames (char ***retNames, int *retNameCount) |
| int | wormChromIx (char *name) |
| char * | wormChromForIx (int ix) |
| char * | wormOfficialChromName (char *name) |
| boolean | wormGeneRange (char *name, char **retChromId, char *retStrand, int *retStart, int *retEnd) |
| boolean | wormParseChromRange (char *in, char **retChromId, int *retStart, int *retEnd) |
| boolean | wormIsChromRange (char *in) |
| void | wormClipRangeToChrom (char *chrom, int *pStart, int *pEnd) |
| boolean | wormIsNamelessCluster (char *name) |
| DNA * | wormGetNamelessClusterDna (char *name) |
| wormFeature * | newWormFeature (char *name, char *chrom, int start, int end, char typeByte) |
| wormFeature * | wormCdnasInRange (char *chromId, int start, int end) |
| wormFeature * | wormGenesInRange (char *chromId, int start, int end) |
| wormFeature * | wormSomeGenesInRange (char *chromId, int start, int end, char *gdfDir) |
| wormFeature * | wormCosmidsInRange (char *chromId, int start, int end) |
| cdaAli * | wormCdaAlisInRange (char *chromId, int start, int end) |
| FILE * | wormOpenGoodAli () |
| gdfGene * | wormGetGdfGene (char *name) |
| gdfGene * | wormGetSomeGdfGene (char *name, struct wormGdfCache *cache) |
| gdfGene * | wormGetGdfGeneList (char *baseName, int baseNameSize) |
| gdfGene * | wormGetSomeGdfGeneList (char *baseName, int baseNameSize, struct wormGdfCache *cache) |
| gdfGene * | wormGdfGenesInRange (char *chrom, int start, int end, struct wormGdfCache *geneFinder) |
| void | wormUncacheGdf () |
| void | wormUncacheSomeGdf (struct wormGdfCache *cache) |
Variables | |
| wormGdfCache | wormSangerGdfCache |
| wormGdfCache | wormGenieGdfCache |
| void freeWormCdnaIterator | ( | struct wormCdnaIterator ** | pIt | ) |
Definition at line 478 of file wormdna.c.
References carefulClose(), wormCdnaIterator::faFile, and freez().
00480 { 00481 struct wormCdnaIterator *it = *pIt; 00482 if (it != NULL) 00483 { 00484 carefulClose(&it->faFile); 00485 freez(pIt); 00486 } 00487 }
Here is the call graph for this function:

| boolean getWormGeneDna | ( | char * | name, | |
| DNA ** | retDna, | |||
| boolean | upcExons | |||
| ) |
Definition at line 656 of file wormdna.c.
References chromIds, gdfGene::chromIx, gdfGene::dataCount, gdfGene::dataPoints, FALSE, gdfFreeGene(), gdfGeneExtents(), gdfOffsetGene(), gdfRcGene(), slName::name, reverseComplement(), gdfGene::strand, toUpperN(), TRUE, wormChromPart(), wormGeneToOrfNames(), wormGenieGdfCache, wormGetSomeGdfGene(), wormIsGeneName(), and wormSangerGdfCache.
00658 { 00659 struct gdfGene *g; 00660 struct slName *syn = NULL; 00661 long lstart, lend; 00662 int start, end; 00663 int dnaSize; 00664 DNA *dna; 00665 struct wormGdfCache *gdfCache; 00666 00667 /* Translate biologist type name to cosmid.N name */ 00668 if (wormIsGeneName(name)) 00669 { 00670 syn = wormGeneToOrfNames(name); 00671 if (syn != NULL) 00672 name = syn->name; 00673 } 00674 if (strncmp(name, "g-", 2) == 0) 00675 gdfCache = &wormGenieGdfCache; 00676 else 00677 gdfCache = &wormSangerGdfCache; 00678 if ((g = wormGetSomeGdfGene(name, gdfCache)) == NULL) 00679 return FALSE; 00680 gdfGeneExtents(g, &lstart, &lend); 00681 start = lstart; 00682 end = lend; 00683 /* wormClipRangeToChrom(chromIds[g->chromIx], &start, &end); */ 00684 dnaSize = end-start; 00685 *retDna = dna = wormChromPart(chromIds[g->chromIx], start, dnaSize); 00686 00687 gdfOffsetGene(g, -start); 00688 if (g->strand == '-') 00689 { 00690 reverseComplement(dna, dnaSize); 00691 gdfRcGene(g, dnaSize); 00692 } 00693 if (upcExons) 00694 { 00695 int i; 00696 struct gdfDataPoint *pt = g->dataPoints; 00697 for (i=0; i<g->dataCount; i += 2) 00698 { 00699 toUpperN(dna + pt[i].start, pt[i+1].start - pt[i].start); 00700 } 00701 } 00702 gdfFreeGene(g); 00703 return TRUE; 00704 }
Here is the call graph for this function:

| boolean getWormGeneExonDna | ( | char * | name, | |
| DNA ** | retDna | |||
| ) |
Definition at line 706 of file wormdna.c.
References chromIds, gdfGene::chromIx, cloneString(), gdfGene::dataCount, gdfGene::dataPoints, dyStringAppendN(), dyStringFree, FALSE, gdfFreeGene(), gdfGeneExtents(), gdfOffsetGene(), gdfRcGene(), slName::name, newDyString(), reverseComplement(), gdfGene::strand, dyString::string, TRUE, wormChromPart(), wormGeneToOrfNames(), wormGenieGdfCache, wormGetSomeGdfGene(), wormIsGeneName(), and wormSangerGdfCache.
00708 { 00709 struct gdfGene *g; 00710 struct slName *syn = NULL; 00711 long lstart, lend; 00712 int start, end; 00713 int dnaSize; 00714 DNA *dna; 00715 int i; 00716 struct gdfDataPoint *pt = NULL; 00717 struct wormGdfCache *gdfCache; 00718 struct dyString *dy = newDyString(1000); 00719 /* Translate biologist type name to cosmid.N name */ 00720 if (wormIsGeneName(name)) 00721 { 00722 syn = wormGeneToOrfNames(name); 00723 if (syn != NULL) 00724 name = syn->name; 00725 } 00726 if (strncmp(name, "g-", 2) == 0) 00727 gdfCache = &wormGenieGdfCache; 00728 else 00729 gdfCache = &wormSangerGdfCache; 00730 if ((g = wormGetSomeGdfGene(name, gdfCache)) == NULL) 00731 return FALSE; 00732 gdfGeneExtents(g, &lstart, &lend); 00733 start = lstart; 00734 end = lend; 00735 /*wormClipRangeToChrom(chromIds[g->chromIx], &start, &end);*/ 00736 dnaSize = end-start; 00737 dna = wormChromPart(chromIds[g->chromIx], start, dnaSize); 00738 00739 gdfOffsetGene(g, -start); 00740 if (g->strand == '-') 00741 { 00742 reverseComplement(dna, dnaSize); 00743 gdfRcGene(g, dnaSize); 00744 } 00745 pt = g->dataPoints; 00746 for (i=0; i<g->dataCount; i += 2) 00747 { 00748 dyStringAppendN(dy, (dna+pt[i].start), (pt[i+1].start - pt[i].start)); 00749 } 00750 *retDna = cloneString(dy->string); 00751 dyStringFree(&dy); 00752 gdfFreeGene(g); 00753 return TRUE; 00754 }
Here is the call graph for this function:

| struct wormFeature* newWormFeature | ( | char * | name, | |
| char * | chrom, | |||
| int | start, | |||
| int | end, | |||
| char | typeByte | |||
| ) | [read] |
Definition at line 298 of file wormdna.c.
References wormFeature::chrom, wormFeature::end, name, wormFeature::name, needMem(), wormFeature::start, and wormFeature::typeByte.
Referenced by scanChromOffsetFile().
00300 { 00301 int size = sizeof(struct wormFeature) + strlen(name); 00302 struct wormFeature *feat = needMem(size); 00303 feat->chrom = chrom; 00304 feat->start = start; 00305 feat->end = end; 00306 feat->typeByte = typeByte; 00307 strcpy(feat->name, name); 00308 return feat; 00309 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct dnaSeq* nextWormCdna | ( | struct wormCdnaIterator * | it | ) | [read] |
Definition at line 458 of file wormdna.c.
References wormCdnaIterator::faFile, faReadOneDnaSeq(), and TRUE.
00460 { 00461 return faReadOneDnaSeq(it->faFile, "unknown", TRUE); 00462 }
Here is the call graph for this function:

| boolean nextWormCdnaAndInfo | ( | struct wormCdnaIterator * | it, | |
| struct dnaSeq ** | retSeq, | |||
| struct wormCdnaInfo * | retInfo | |||
| ) |
Definition at line 446 of file wormdna.c.
References wormCdnaIterator::faFile, FALSE, faReadNext(), TRUE, and wormFaCommentIntoInfo().
00449 { 00450 char *faComment; 00451 00452 if (!faReadNext(it->faFile, "unknown", TRUE, &faComment, retSeq)) 00453 return FALSE; 00454 wormFaCommentIntoInfo(faComment, retInfo); 00455 return TRUE; 00456 }
Here is the call graph for this function:

| struct cdaAli* wormCdaAlisInRange | ( | char * | chromId, | |
| int | start, | |||
| int | end | |||
| ) | [read] |
Definition at line 405 of file wormdna.c.
References AllocVar, alxSig, bits32, cdaLoadOne(), cdnaDir, errAbort(), mustOpen(), mustReadOne, readOne, SEEK_SET, slAddHead, slReverse(), and wormOpenGoodAli().
00407 { 00408 struct cdaAli *list = NULL, *el; 00409 char fileName[512]; 00410 FILE *ixFile, *aliFile; 00411 bits32 sig; 00412 int s, e; 00413 long fpos; 00414 00415 aliFile = wormOpenGoodAli(); 00416 00417 sprintf(fileName, "%s%s.alx", cdnaDir, chromId); 00418 ixFile = mustOpen(fileName, "rb"); 00419 mustReadOne(ixFile, sig); 00420 if (sig != alxSig) 00421 errAbort("Bad signature on %s", fileName); 00422 00423 for (;;) 00424 { 00425 if (!readOne(ixFile, s)) 00426 break; 00427 mustReadOne(ixFile, e); 00428 mustReadOne(ixFile, fpos); 00429 if (e <= start) 00430 continue; 00431 if (s >= end) 00432 break; 00433 AllocVar(el); 00434 fseek(aliFile, fpos, SEEK_SET); 00435 el = cdaLoadOne(aliFile); 00436 if (el == NULL) 00437 errAbort("Truncated cdnaAli file"); 00438 slAddHead(&list, el); 00439 } 00440 slReverse(&list); 00441 fclose(aliFile); 00442 fclose(ixFile); 00443 return list; 00444 }
Here is the call graph for this function:

| char* wormCdnaDir | ( | ) |
| boolean wormCdnaInfo | ( | char * | name, | |
| struct wormCdnaInfo * | retInfo | |||
| ) |
Definition at line 261 of file wormdna.c.
References cdnaFa, cdnaSnof, cloneString(), errAbort(), FALSE, SEEK_SET, snofFindOffset(), TRUE, wormCdnaCache(), and wormFaCommentIntoInfo().
00263 { 00264 char commentBuf[512]; 00265 char *comment; 00266 long offset; 00267 00268 wormCdnaCache(); 00269 if (!snofFindOffset(cdnaSnof, name, &offset)) 00270 return FALSE; 00271 fseek(cdnaFa, offset, SEEK_SET); 00272 fgets(commentBuf, sizeof(commentBuf), cdnaFa); 00273 if (commentBuf[0] != '>') 00274 errAbort("Expecting line starting with > in cDNA fa file.\nGot %s", commentBuf); 00275 comment = cloneString(commentBuf); 00276 wormFaCommentIntoInfo(comment, retInfo); 00277 return TRUE; 00278 }
Here is the call graph for this function:

| boolean wormCdnaSeq | ( | char * | name, | |
| struct dnaSeq ** | retDna, | |||
| struct wormCdnaInfo * | retInfo | |||
| ) |
Definition at line 280 of file wormdna.c.
References cdnaFa, cdnaSnof, FALSE, faReadNext(), SEEK_SET, snofFindOffset(), TRUE, wormCdnaCache(), and wormFaCommentIntoInfo().
00283 { 00284 long offset; 00285 char *faComment; 00286 char **pFaComment = (retInfo == NULL ? NULL : &faComment); 00287 00288 wormCdnaCache(); 00289 if (!snofFindOffset(cdnaSnof, name, &offset)) 00290 return FALSE; 00291 fseek(cdnaFa, offset, SEEK_SET); 00292 if (!faReadNext(cdnaFa, name, TRUE, pFaComment, retDna)) 00293 return FALSE; 00294 wormFaCommentIntoInfo(faComment, retInfo); 00295 return TRUE; 00296 }
Here is the call graph for this function:

| struct wormFeature* wormCdnasInRange | ( | char * | chromId, | |
| int | start, | |||
| int | end | |||
| ) | [read] |
Definition at line 358 of file wormdna.c.
References cdnaDir, cdoSig, getDirs(), and scanChromOffsetFile().
00361 { 00362 /* This routine looks through the .CDO files made by cdnaOff 00363 */ 00364 getDirs(); 00365 return scanChromOffsetFile(cdnaDir, ".cdo", cdoSig, 2*sizeof(int)+1, 00366 chromId, start, end, 0); 00367 }
Here is the call graph for this function:

| void wormCdnaUncache | ( | ) |
Definition at line 160 of file wormdna.c.
References carefulClose(), cdnaDir, cdnaFa, cdnaSnof, freez(), and snofClose().
Here is the call graph for this function:

| char* wormChromDir | ( | ) |
| char* wormChromForIx | ( | int | ix | ) |
| int wormChromIx | ( | char * | name | ) |
Definition at line 118 of file wormdna.c.
References chromIds, and stringIx.
Referenced by wormChromSize(), and wormOfficialChromName().
Here is the caller graph for this function:

| void wormChromNames | ( | char *** | retNames, | |
| int * | retNameCount | |||
| ) |
| DNA* wormChromPart | ( | char * | chromId, | |
| int | start, | |||
| int | size | |||
| ) |
Definition at line 813 of file wormdna.c.
References makeChromFileName(), and nt4LoadPart().
Referenced by getWormGeneDna(), getWormGeneExonDna(), wormChromPartExonsUpper(), wormGetNamelessClusterDna(), and xenAlignWorm().
00815 { 00816 char fileName[512]; 00817 makeChromFileName(chromId, fileName); 00818 return nt4LoadPart(fileName, start, size); 00819 }
Here is the call graph for this function:

Here is the caller graph for this function:

| DNA* wormChromPartExonsUpper | ( | char * | chromId, | |
| int | start, | |||
| int | size | |||
| ) |
Definition at line 821 of file wormdna.c.
References gdfFreeGene(), gdfUpcExons(), name, wormFeature::name, wormFeature::next, slFreeList(), wormFeature::start, wormChromPart(), wormGenesInRange(), wormGetGdfGene(), and wormIsNamelessCluster().
00823 { 00824 DNA *dna = wormChromPart(chromId, start, size); 00825 struct wormFeature *geneFeat = wormGenesInRange(chromId, start, start+size); 00826 struct wormFeature *feat; 00827 00828 for (feat = geneFeat; feat != NULL; feat = feat->next) 00829 { 00830 char *name = feat->name; 00831 if (!wormIsNamelessCluster(name)) 00832 { 00833 struct gdfGene *gene = wormGetGdfGene(name); 00834 gdfUpcExons(gene, feat->start, dna, size, start); 00835 gdfFreeGene(gene); 00836 } 00837 } 00838 slFreeList(&geneFeat); 00839 return dna; 00840 }
Here is the call graph for this function:

| int wormChromSize | ( | char * | chrom | ) |
Definition at line 791 of file wormdna.c.
References ArraySize, chromIds, errAbort(), makeChromFileName(), nt4BaseCount(), and wormChromIx().
Referenced by wormClipRangeToChrom().
00793 { 00794 static int sizes[ArraySize(chromIds)]; 00795 int ix; 00796 int size; 00797 00798 if ((ix = wormChromIx(chrom)) < 0) 00799 errAbort("%s isn't a chromosome", chrom); 00800 size = sizes[ix]; 00801 00802 /* If we don't know it already have to get it from file. */ 00803 if (size == 0) 00804 { 00805 char fileName[512]; 00806 makeChromFileName(chromIds[ix], fileName); 00807 size = sizes[ix] = nt4BaseCount(fileName); 00808 } 00809 return size; 00810 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void wormClipRangeToChrom | ( | char * | chrom, | |
| int * | pStart, | |||
| int * | pEnd | |||
| ) |
Definition at line 842 of file wormdna.c.
References wormChromSize().
Referenced by wormParseChromRange(), and xenAlignWorm().
00844 { 00845 int chromEnd = wormChromSize(chrom); 00846 int temp; 00847 00848 /* Swap ends if reversed. */ 00849 if (*pStart > *pEnd) 00850 { 00851 temp = *pEnd; 00852 *pEnd = *pStart; 00853 *pStart = temp; 00854 } 00855 /* Generally speaking try to slide the range covered by 00856 * start-end inside the chromosome rather than just 00857 * truncating an end. */ 00858 if (*pStart < 0) 00859 { 00860 *pEnd -= *pStart; 00861 *pStart = 0; 00862 } 00863 if (*pEnd > chromEnd) 00864 { 00865 *pStart -= *pEnd - chromEnd; 00866 *pEnd = chromEnd; 00867 } 00868 /* This handles case where the range is larger than the chromosome. */ 00869 if (*pStart < 0) 00870 *pStart = 0; 00871 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct wormFeature* wormCosmidsInRange | ( | char * | chromId, | |
| int | start, | |||
| int | end | |||
| ) | [read] |
Definition at line 385 of file wormdna.c.
References featDir, getDirs(), pgoSig, and scanChromOffsetFile().
00387 { 00388 /* This routine looks through the .COO files made by makePgo 00389 */ 00390 getDirs(); 00391 return scanChromOffsetFile(featDir, ".coo", pgoSig, 2*sizeof(int)+1, 00392 chromId, start, end, 1); 00393 }
Here is the call graph for this function:

| void wormFaCommentIntoInfo | ( | char * | faComment, | |
| struct wormCdnaInfo * | retInfo | |||
| ) |
Definition at line 241 of file wormdna.c.
References errAbort(), parseRestOfCdnaInfo(), and zeroBytes().
Referenced by nextWormCdnaAndInfo(), wormCdnaInfo(), wormCdnaSeq(), and wormInfoForGene().
00244 { 00245 if (retInfo) 00246 { 00247 char *s; 00248 zeroBytes(retInfo, sizeof(*retInfo)); 00249 /* Separate out first word and use it as name. */ 00250 s = strchr(faComment, ' '); 00251 if (s == NULL) 00252 errAbort("Expecting lots of info, just got %s", faComment); 00253 *s++ = 0; 00254 retInfo->name = faComment+1; 00255 retInfo->motherString = faComment; 00256 00257 parseRestOfCdnaInfo(s, retInfo); 00258 } 00259 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* wormFeaturesDir | ( | ) |
Definition at line 67 of file wormdna.c.
References featDir, and getDirs().
Referenced by wormGeneForOrf(), wormGeneToOrfNames(), and wormInfoForGene().
Here is the call graph for this function:

Here is the caller graph for this function:

| void wormFreeCdnaInfo | ( | struct wormCdnaInfo * | ci | ) |
Definition at line 168 of file wormdna.c.
References freeMem(), wormCdnaInfo::motherString, and zeroBytes().
00171 { 00172 freeMem(ci->motherString); 00173 zeroBytes(ci, sizeof(*ci)); 00174 }
Here is the call graph for this function:

| void wormFreeNt4Genome | ( | struct nt4Seq *** | pNt4Seq | ) |
Definition at line 779 of file wormdna.c.
References ArraySize, chromIds, freeNt4(), and freez().
Referenced by xenAlignWorm().
00781 { 00782 struct nt4Seq **seqs; 00783 int i; 00784 if ((seqs = *pNt4Seq) == NULL) 00785 return; 00786 for (i=0; i<ArraySize(chromIds); ++i) 00787 freeNt4(&seqs[i]); 00788 freez(pNt4Seq); 00789 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct gdfGene* wormGdfGenesInRange | ( | char * | chrom, | |
| int | start, | |||
| int | end, | |||
| struct wormGdfCache * | geneFinder | |||
| ) | [read] |
Definition at line 1183 of file wormdna.c.
References errAbort(), name, slAddHead, slFreeList(), slReverse(), wormGenieDir(), wormGenieGdfCache, wormGetSomeGdfGene(), wormIsNamelessCluster(), wormSangerDir(), wormSangerGdfCache, and wormSomeGenesInRange().
01186 { 01187 char *dir = NULL; 01188 struct gdfGene *gdfList = NULL, *gdf; 01189 struct wormFeature *nameList, *name; 01190 01191 if (geneFinder == &wormSangerGdfCache) 01192 dir = wormSangerDir(); 01193 else if (geneFinder == &wormGenieGdfCache) 01194 dir = wormGenieDir(); 01195 else 01196 errAbort("Unknown geneFinder line %d of %s", __LINE__, __FILE__); 01197 01198 nameList = wormSomeGenesInRange(chrom, start, end, dir); 01199 for (name = nameList; name != NULL; name = name->next) 01200 { 01201 char *n = name->name; 01202 if (!wormIsNamelessCluster(n)) 01203 { 01204 gdf = wormGetSomeGdfGene(n, geneFinder); 01205 slAddHead(&gdfList, gdf); 01206 } 01207 } 01208 slFreeList(&nameList); 01209 slReverse(&gdfList); 01210 return gdfList; 01211 }
Here is the call graph for this function:

| char* wormGeneFirstOrfName | ( | char * | geneName | ) |
Definition at line 578 of file wormdna.c.
References cloneString(), name, slName::name, slFreeList(), and wormGeneToOrfNames().
Referenced by wormInfoForGene().
00580 { 00581 struct slName *synList = wormGeneToOrfNames(geneName); 00582 char *name; 00583 if (synList == NULL) 00584 return NULL; 00585 name = cloneString(synList->name); 00586 slFreeList(&synList); 00587 return name; 00588 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean wormGeneForOrf | ( | char * | orfName, | |
| char * | geneNameBuf, | |||
| int | bufSize | |||
| ) |
Definition at line 590 of file wormdna.c.
References chopLine, FALSE, mustOpen(), TRUE, and wormFeaturesDir().
00592 { 00593 FILE *f; 00594 char fileName[512]; 00595 char lineBuf[512]; 00596 int nameLen = strlen(orfName); 00597 boolean ok = FALSE; 00598 00599 sprintf(fileName, "%sorf2gene", wormFeaturesDir()); 00600 f = mustOpen(fileName, "r"); 00601 while (fgets(lineBuf, sizeof(lineBuf), f)) 00602 { 00603 if (strncmp(lineBuf, orfName, nameLen) == 0 && lineBuf[nameLen] == ' ') 00604 { 00605 char *words[2]; 00606 int wordCount; 00607 wordCount = chopLine(lineBuf, words); 00608 assert((int)strlen(words[1]) < bufSize); 00609 strncpy(geneNameBuf, words[1], bufSize); 00610 ok = TRUE; 00611 break; 00612 } 00613 } 00614 fclose(f); 00615 return ok; 00616 }
Here is the call graph for this function:

| boolean wormGeneRange | ( | char * | name, | |
| char ** | retChromId, | |||
| char * | retStrand, | |||
| int * | retStart, | |||
| int * | retEnd | |||
| ) |
Definition at line 991 of file wormdna.c.
References chopLine, FALSE, featDir, findAltSpliceRange(), getDirs(), mustOpen(), slName::name, SEEK_SET, slFreeList(), snofFindOffset(), snofMustOpen(), touppers(), wormFixupOrfName(), wormGeneToOrfNames(), wormIsChromRange(), wormIsGeneName(), and wormParseChromRange().
Referenced by wormGetNamelessClusterDna().
00993 { 00994 static struct snof *c2gSnof = NULL, *c2cSnof = NULL; 00995 static FILE *c2gFile = NULL, *c2cFile = NULL; 00996 long offset; 00997 char fileName[512]; 00998 struct slName *syn = NULL; 00999 boolean ok; 01000 01001 if (wormIsChromRange(name)) 01002 { 01003 *retStrand = '.'; 01004 return wormParseChromRange(name, retChrom, retStart, retEnd); 01005 } 01006 01007 getDirs(); 01008 01009 /* Translate biologist type name to cosmid.N name */ 01010 if (wormIsGeneName(name)) 01011 { 01012 syn = wormGeneToOrfNames(name); 01013 if (syn != NULL) 01014 { 01015 name = syn->name; 01016 } 01017 } 01018 if (wormFixupOrfName(name)) /* See if ORF, and if so make nice. */ 01019 { 01020 if (c2gSnof == NULL) 01021 { 01022 sprintf(fileName, "%sc2g", featDir); 01023 c2gSnof = snofMustOpen(fileName); 01024 sprintf(fileName, "%sc2g", featDir); 01025 c2gFile = mustOpen(fileName, "rb"); 01026 } 01027 ok = findAltSpliceRange(name, c2gSnof, c2gFile, retChrom, retStart, retEnd, retStrand); 01028 } 01029 else /* Lets say it's a cosmid. */ 01030 { 01031 char lineBuf[128]; 01032 char *words[3]; 01033 int wordCount; 01034 touppers(name); 01035 if (c2cSnof == NULL) 01036 { 01037 sprintf(fileName, "%sc2c", featDir); 01038 c2cSnof = snofMustOpen(fileName); 01039 sprintf(fileName, "%sc2c", featDir); 01040 c2cFile = mustOpen(fileName, "rb"); 01041 } 01042 if (!snofFindOffset(c2cSnof, name, &offset) ) 01043 return FALSE; 01044 fseek(c2cFile, offset, SEEK_SET); 01045 fgets(lineBuf, sizeof(lineBuf), c2cFile); 01046 wordCount = chopLine(lineBuf, words); 01047 assert(wordCount == 3); 01048 assert(strcmp(words[2], name) == 0); 01049 assert(wormIsChromRange(words[0])); 01050 *retStrand = words[1][0]; 01051 ok = wormParseChromRange(words[0], retChrom, retStart, retEnd); 01052 } 01053 slFreeList(&syn); 01054 return ok; 01055 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct wormFeature* wormGenesInRange | ( | char * | chromId, | |
| int | start, | |||
| int | end | |||
| ) | [read] |
Definition at line 376 of file wormdna.c.
References getDirs(), sangerDir, and wormSomeGenesInRange().
Referenced by wormChromPartExonsUpper().
00378 { 00379 /* This routine looks through the .PGO files made by makePgo 00380 */ 00381 getDirs(); 00382 return wormSomeGenesInRange(chromId, start, end, sangerDir); 00383 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct slName* wormGeneToOrfNames | ( | char * | name | ) | [read] |
Definition at line 539 of file wormdna.c.
References ArraySize, chopString(), errAbort(), errno, newSlName(), slAddTail(), tolowers(), whiteSpaceChopper, and wormFeaturesDir().
Referenced by getWormGeneDna(), getWormGeneExonDna(), wormGeneFirstOrfName(), and wormGeneRange().
00541 { 00542 struct slName *synList = NULL; 00543 char synFileName[512]; 00544 FILE *synFile; 00545 char lineBuf[128]; 00546 int nameLen = strlen(name); 00547 00548 /* genes are supposed to be lower case. */ 00549 tolowers(name); 00550 00551 /* Open synonym file and loop through each line of it */ 00552 sprintf(synFileName, "%ssyn", wormFeaturesDir()); 00553 if ((synFile = fopen(synFileName, "r")) == NULL) 00554 errAbort("Can't find synonym file '%s'. (errno: %d)\n", synFileName, errno); 00555 while (fgets(lineBuf, ArraySize(lineBuf), synFile)) 00556 { 00557 /* If first part of line matches chop up line. */ 00558 if (strncmp(name, lineBuf, nameLen) == 0) 00559 { 00560 char *syns[32]; 00561 int count; 00562 count = chopString(lineBuf, whiteSpaceChopper, syns, ArraySize(syns)); 00563 00564 /* Looks like we got a synonym. Add all the aliases. */ 00565 if (strcmp(name, syns[0]) == 0) 00566 { 00567 int i; 00568 for (i=1; i<count; ++i) 00569 slAddTail(&synList, newSlName(syns[i])); 00570 break; 00571 } 00572 } 00573 } 00574 fclose(synFile); 00575 return synList; 00576 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* wormGenieDir | ( | ) |
| struct gdfGene* wormGetGdfGene | ( | char * | name | ) | [read] |
Definition at line 1139 of file wormdna.c.
References defaultGdfCache, and wormGetSomeGdfGene().
Referenced by wormChromPartExonsUpper().
01141 { 01142 return wormGetSomeGdfGene(name, defaultGdfCache); 01143 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct gdfGene* wormGetGdfGeneList | ( | char * | baseName, | |
| int | baseNameSize | |||
| ) | [read] |
Definition at line 1177 of file wormdna.c.
References defaultGdfCache, and wormGetSomeGdfGeneList().
01179 { 01180 return wormGetSomeGdfGeneList(baseName, baseNameSize, defaultGdfCache); 01181 }
Here is the call graph for this function:

| DNA* wormGetNamelessClusterDna | ( | char * | name | ) |
Definition at line 1070 of file wormdna.c.
References errAbort(), wormChromPart(), and wormGeneRange().
01072 { 01073 char *chrom; 01074 int start, end; 01075 char strand; 01076 if (!wormGeneRange(name, &chrom, &strand, &start, &end)) 01077 errAbort("Can't find %s in database", name); 01078 return wormChromPart(chrom, start, end-start); 01079 }
Here is the call graph for this function:

| struct gdfGene* wormGetSomeGdfGene | ( | char * | name, | |
| struct wormGdfCache * | cache | |||
| ) | [read] |
Definition at line 1127 of file wormdna.c.
References wormGdfCache::file, gdfReadOneGene(), SEEK_SET, wormGdfCache::snof, snofFindOffset(), and wormCacheSomeGdf().
Referenced by getWormGeneDna(), getWormGeneExonDna(), wormGdfGenesInRange(), and wormGetGdfGene().
01129 { 01130 long offset; 01131 01132 wormCacheSomeGdf(cache); 01133 if (!snofFindOffset(cache->snof, name, &offset) ) 01134 return NULL; 01135 fseek(cache->file, offset, SEEK_SET); 01136 return gdfReadOneGene(cache->file); 01137 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct gdfGene* wormGetSomeGdfGeneList | ( | char * | baseName, | |
| int | baseNameSize, | |||
| struct wormGdfCache * | cache | |||
| ) | [read] |
Definition at line 1145 of file wormdna.c.
References wormGdfCache::file, gdfReadOneGene(), SEEK_SET, slAddTail(), slReverse(), wormGdfCache::snof, snofElementCount(), snofFindFirstStartingWith(), snofNameOffsetAtIx(), and wormCacheSomeGdf().
Referenced by wormGetGdfGeneList().
01147 { 01148 int snIx; 01149 int maxIx; 01150 struct snof *snof; 01151 FILE *f; 01152 struct gdfGene *list = NULL, *el; 01153 01154 wormCacheSomeGdf(cache); 01155 snof = cache->snof; 01156 f = cache->file; 01157 if (!snofFindFirstStartingWith(snof, baseName, baseNameSize, &snIx)) 01158 return NULL; 01159 01160 maxIx = snofElementCount(snof); 01161 for (;snIx < maxIx; ++snIx) 01162 { 01163 long offset; 01164 char *geneName; 01165 01166 snofNameOffsetAtIx(snof, snIx, &geneName, &offset); 01167 if (strncmp(geneName, baseName, baseNameSize) != 0) 01168 break; 01169 fseek(f, offset, SEEK_SET); 01170 el = gdfReadOneGene(f); 01171 slAddTail(&list, el); 01172 } 01173 slReverse(&list); 01174 return list; 01175 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean wormInfoForGene | ( | char * | orfName, | |
| struct wormCdnaInfo * | retInfo | |||
| ) |
Definition at line 618 of file wormdna.c.
References cloneString(), FALSE, freeMem(), mustOpen(), TRUE, wormFaCommentIntoInfo(), wormFeaturesDir(), wormGeneFirstOrfName(), and wormIsGeneName().
00620 { 00621 FILE *f; 00622 char fileName[512]; 00623 char lineBuf[512]; 00624 int nameLen; 00625 char *info = NULL; 00626 char *synName = NULL; 00627 int lineCount = 0; 00628 00629 /* Make this one work for orfs as well as gene names */ 00630 if (wormIsGeneName(orfName)) 00631 { 00632 synName = wormGeneFirstOrfName(orfName); 00633 if (synName != NULL) 00634 orfName = synName; 00635 } 00636 sprintf(fileName, "%sorfInfo", wormFeaturesDir()); 00637 nameLen = strlen(orfName); 00638 f = mustOpen(fileName, "r"); 00639 while (fgets(lineBuf, sizeof(lineBuf), f)) 00640 { 00641 ++lineCount; 00642 if (strncmp(lineBuf, orfName, nameLen) == 0 && lineBuf[nameLen] == ' ') 00643 { 00644 info = cloneString(lineBuf); 00645 break; 00646 } 00647 } 00648 freeMem(synName); 00649 fclose(f); 00650 if (info == NULL) 00651 return FALSE; 00652 wormFaCommentIntoInfo(info, retInfo); 00653 return TRUE;; 00654 }
Here is the call graph for this function:

| boolean wormIsChromRange | ( | char * | in | ) |
Definition at line 898 of file wormdna.c.
References wormFeature::end, wormFeature::start, and wormParseChromRange().
Referenced by wormGeneRange().
00901 { 00902 char *chromId; 00903 int start, end; 00904 boolean ok; 00905 ok = wormParseChromRange(in, &chromId, &start, &end); 00906 return ok; 00907 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean wormIsGeneName | ( | char * | name | ) |
Definition at line 518 of file wormdna.c.
References chopString(), FALSE, isAllAlpha(), and isAllDigit().
Referenced by getWormGeneDna(), getWormGeneExonDna(), wormGeneRange(), and wormInfoForGene().
00522 { 00523 char buf[128]; 00524 int partCount; 00525 strncpy(buf, name, sizeof(buf)); 00526 partCount = chopString(buf, "-", NULL, 0); 00527 if (partCount == 2) 00528 { 00529 char *parts[2]; 00530 chopString(buf, "-", parts, 2); 00531 return isAllAlpha(parts[0]) && isAllDigit(parts[1]); 00532 } 00533 else 00534 { 00535 return FALSE; 00536 } 00537 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean wormIsNamelessCluster | ( | char * | name | ) |
Definition at line 1057 of file wormdna.c.
Referenced by wormChromPartExonsUpper(), and wormGdfGenesInRange().
01059 { 01060 char *e = strrchr(name, '.'); 01061 if (e == NULL) 01062 return FALSE; 01063 if (e[1] != 'N') 01064 return FALSE; 01065 if (!isdigit(e[2])) 01066 return FALSE; 01067 return TRUE; 01068 }
Here is the caller graph for this function:

| boolean wormIsOrfName | ( | char * | in | ) |
| void wormLoadNt4Genome | ( | struct nt4Seq *** | retNt4Seq, | |
| int * | retNt4Count | |||
| ) |
Definition at line 762 of file wormdna.c.
References ArraySize, chromIds, loadNt4(), makeChromFileName(), and needMem().
Referenced by xenAlignWorm().
00764 { 00765 int count = ArraySize(chromIds); 00766 struct nt4Seq **nt4s = needMem(count*sizeof(*nt4s)); 00767 int i; 00768 char fileName[512]; 00769 00770 for (i=0; i<count; ++i) 00771 { 00772 makeChromFileName(chromIds[i], fileName); 00773 nt4s[i] = loadNt4(fileName, chromIds[i]); 00774 } 00775 *retNt4Seq = nt4s; 00776 *retNt4Count = count; 00777 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* wormOfficialChromName | ( | char * | name | ) |
Definition at line 131 of file wormdna.c.
References chromIds, and wormChromIx().
Referenced by wormParseChromRange().
00135 { 00136 int ix = wormChromIx(name); 00137 if (ix < 0) return NULL; 00138 return chromIds[ix]; 00139 }
Here is the call graph for this function:

Here is the caller graph for this function:

| FILE* wormOpenGoodAli | ( | ) |
Definition at line 395 of file wormdna.c.
References cdaOpenVerify(), cdnaDir, and getDirs().
Referenced by wormCdaAlisInRange().
00398 { 00399 char fileName[512]; 00400 getDirs(); 00401 sprintf(fileName, "%sgood.ali", cdnaDir); 00402 return cdaOpenVerify(fileName); 00403 }
Here is the call graph for this function:

Here is the caller graph for this function:

| boolean wormParseChromRange | ( | char * | in, | |
| char ** | retChromId, | |||
| int * | retStart, | |||
| int * | retEnd | |||
| ) |
Definition at line 873 of file wormdna.c.
References ArraySize, chopString(), FALSE, TRUE, wormClipRangeToChrom(), and wormOfficialChromName().
Referenced by findAltSpliceRange(), wormGeneRange(), and wormIsChromRange().
00876 { 00877 char *words[5]; 00878 int wordCount; 00879 char *chromId; 00880 char buf[128]; 00881 00882 strncpy(buf, in, sizeof(buf)); 00883 wordCount = chopString(buf, "- \t\r\n:", words, ArraySize(words)); 00884 if (wordCount != 3) 00885 return FALSE; 00886 chromId = wormOfficialChromName(words[0]); 00887 if (chromId == NULL) 00888 return FALSE; 00889 if (!isdigit(words[1][0]) || !isdigit(words[2][0])) 00890 return FALSE; 00891 *retChromId = chromId; 00892 *retStart = atoi(words[1]); 00893 *retEnd = atoi(words[2]); 00894 wormClipRangeToChrom(chromId, retStart, retEnd); 00895 return TRUE; 00896 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* wormSangerDir | ( | ) |
| boolean wormSearchAllCdna | ( | struct wormCdnaIterator ** | retSi | ) |
Definition at line 464 of file wormdna.c.
References cdnaDir, getDirs(), mustOpen(), needMem(), and TRUE.
00466 { 00467 char buf[512]; 00468 struct wormCdnaIterator *it; 00469 00470 it = needMem(sizeof(*it)); 00471 getDirs(); 00472 sprintf(buf, "%s%s", cdnaDir, "allcdna.fa"); 00473 it->faFile = mustOpen(buf, "rb"); 00474 *retSi = it; 00475 return TRUE; 00476 }
Here is the call graph for this function:

| struct wormFeature* wormSomeGenesInRange | ( | char * | chromId, | |
| int | start, | |||
| int | end, | |||
| char * | gdfDir | |||
| ) | [read] |
Definition at line 369 of file wormdna.c.
References pgoSig, and scanChromOffsetFile().
Referenced by wormGdfGenesInRange(), and wormGenesInRange().
00371 { 00372 return scanChromOffsetFile(gdfDir, ".pgo", pgoSig, 2*sizeof(int)+1, 00373 chromId, start, end, 0); 00374 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void wormUncacheGdf | ( | ) |
Definition at line 1121 of file wormdna.c.
References defaultGdfCache, and wormUncacheSomeGdf().
01123 { 01124 wormUncacheSomeGdf(defaultGdfCache); 01125 }
Here is the call graph for this function:

| void wormUncacheSomeGdf | ( | struct wormGdfCache * | cache | ) |
Definition at line 1114 of file wormdna.c.
References carefulClose(), wormGdfCache::file, wormGdfCache::snof, and snofClose().
Referenced by wormUncacheGdf().
01116 { 01117 snofClose(&cache->snof); 01118 carefulClose(&cache->file); 01119 }
Here is the call graph for this function:

Here is the caller graph for this function:

| char* wormXenoDir | ( | ) |
| struct wormGdfCache wormGenieGdfCache |
Definition at line 1082 of file wormdna.c.
Referenced by getWormGeneDna(), getWormGeneExonDna(), and wormGdfGenesInRange().
| struct wormGdfCache wormSangerGdfCache |
Definition at line 1081 of file wormdna.c.
Referenced by getWormGeneDna(), getWormGeneExonDna(), and wormGdfGenesInRange().
1.5.2