lib/nibTwo.c File Reference

#include "common.h"
#include "hash.h"
#include "dnaseq.h"
#include "nib.h"
#include "twoBit.h"
#include "nibTwo.h"

Include dependency graph for nibTwo.c:

Go to the source code of this file.

Functions

nibTwoCachenibTwoCacheNew (char *pathName)
void nibTwoCacheFree (struct nibTwoCache **pNtc)
dnaSeqnibTwoCacheSeq (struct nibTwoCache *ntc, char *seqName)
dnaSeqnibTwoCacheSeqPartExt (struct nibTwoCache *ntc, char *seqName, int start, int size, boolean doMask, int *retFullSeqSize)
dnaSeqnibTwoCacheSeqPart (struct nibTwoCache *ntc, char *seqName, int start, int size, int *retFullSeqSize)
dnaSeqnibTwoLoadOne (char *pathName, char *seqName)

Variables

static char const rcsid [] = "$Id: nibTwo.c,v 1.5 2006/03/10 17:43:37 angie Exp $"


Function Documentation

void nibTwoCacheFree ( struct nibTwoCache **  pNtc  ) 

Definition at line 28 of file nibTwo.c.

References freez(), hashElFreeList(), hashElListHash(), hashFree, nibTwoCache::isTwoBit, hashEl::next, nibTwoCache::nibHash, nibInfoFree(), nibTwoCache::pathName, nibTwoCache::tbf, twoBitClose(), and hashEl::val.

00030 {
00031 struct nibTwoCache *ntc = *pNtc;
00032 if (ntc != NULL)
00033     {
00034     freez(&ntc->pathName);
00035     if (ntc->isTwoBit)
00036         twoBitClose(&ntc->tbf);
00037     else
00038         {
00039         struct hashEl *el, *list = hashElListHash(ntc->nibHash);
00040         struct nibInfo *nib;
00041         for (el = list; el != NULL; el = el->next)
00042              {
00043              nib = el->val;
00044              nibInfoFree(&nib);
00045              }
00046         hashElFreeList(&list);
00047         hashFree(&ntc->nibHash);
00048         }
00049     freez(pNtc);
00050     }
00051 }

Here is the call graph for this function:

struct nibTwoCache* nibTwoCacheNew ( char *  pathName  )  [read]

Definition at line 13 of file nibTwo.c.

References AllocVar, cloneString(), nibTwoCache::isTwoBit, newHash(), nibTwoCache::nibHash, nibTwoCache::pathName, nibTwoCache::tbf, twoBitIsFile(), and twoBitOpen().

00016 {
00017 struct nibTwoCache *ntc;
00018 AllocVar(ntc);
00019 ntc->pathName = cloneString(pathName);
00020 ntc->isTwoBit = twoBitIsFile(pathName);
00021 if (ntc->isTwoBit)
00022     ntc->tbf = twoBitOpen(pathName);
00023 else
00024     ntc->nibHash = newHash(10);
00025 return ntc;
00026 }

Here is the call graph for this function:

struct dnaSeq* nibTwoCacheSeq ( struct nibTwoCache ntc,
char *  seqName 
) [read]

Definition at line 53 of file nibTwo.c.

References nibInfo::f, nibInfo::fileName, nibTwoCache::isTwoBit, nibTwoCache::nibHash, nibInfoFromCache(), nibLdPart(), nibTwoCache::pathName, nibInfo::size, nibTwoCache::tbf, and twoBitReadSeqFrag().

00055 {
00056 if (ntc->isTwoBit)
00057     return twoBitReadSeqFrag(ntc->tbf, seqName, 0, 0);
00058 else
00059     {
00060     struct nibInfo *nib = nibInfoFromCache(ntc->nibHash, ntc->pathName, seqName);
00061     return nibLdPart(nib->fileName, nib->f, nib->size, 0, nib->size);
00062     }
00063 }

Here is the call graph for this function:

struct dnaSeq* nibTwoCacheSeqPart ( struct nibTwoCache ntc,
char *  seqName,
int  start,
int  size,
int *  retFullSeqSize 
) [read]

Definition at line 87 of file nibTwo.c.

References nibTwoCacheSeqPartExt(), and TRUE.

00091 {
00092 return nibTwoCacheSeqPartExt(ntc, seqName, start, size, TRUE, retFullSeqSize);
00093 }

Here is the call graph for this function:

struct dnaSeq* nibTwoCacheSeqPartExt ( struct nibTwoCache ntc,
char *  seqName,
int  start,
int  size,
boolean  doMask,
int *  retFullSeqSize 
) [read]

Definition at line 65 of file nibTwo.c.

References nibInfo::f, nibInfo::fileName, nibTwoCache::isTwoBit, NIB_MASK_MIXED, nibTwoCache::nibHash, nibInfoFromCache(), nibLdPartMasked(), nibTwoCache::pathName, nibInfo::size, nibTwoCache::tbf, and twoBitReadSeqFragExt().

Referenced by nibTwoCacheSeqPart().

00071 {
00072 if (ntc->isTwoBit)
00073     {
00074     return twoBitReadSeqFragExt(ntc->tbf, seqName, start, start+size,
00075                                 doMask, retFullSeqSize);
00076     }
00077 else
00078     {
00079     struct nibInfo *nib = nibInfoFromCache(ntc->nibHash, ntc->pathName, seqName);
00080     int opts = (doMask ? NIB_MASK_MIXED : 0);
00081     if (retFullSeqSize != NULL)
00082         *retFullSeqSize = nib->size;
00083     return nibLdPartMasked(opts, nib->fileName, nib->f, nib->size, start, size);
00084     }
00085 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct dnaSeq* nibTwoLoadOne ( char *  pathName,
char *  seqName 
) [read]

Definition at line 95 of file nibTwo.c.

References NIB_MASK_MIXED, nibLoadAllMasked(), safef(), twoBitClose(), twoBitIsFile(), twoBitOpen(), and twoBitReadSeqFrag().

00098 {
00099 struct dnaSeq *seq;
00100 if (twoBitIsFile(pathName))
00101     {
00102     struct twoBitFile *tbf = twoBitOpen(pathName);
00103     seq = twoBitReadSeqFrag(tbf, seqName, 0, 0);
00104     twoBitClose(&tbf);
00105     }
00106 else
00107     {
00108     char path[512];
00109     safef(path, sizeof(path), "%s/%s.nib", pathName, seqName);
00110     seq = nibLoadAllMasked(NIB_MASK_MIXED, path);
00111     }
00112 return seq;
00113 }

Here is the call graph for this function:


Variable Documentation

char const rcsid[] = "$Id: nibTwo.c,v 1.5 2006/03/10 17:43:37 angie Exp $" [static]

Definition at line 11 of file nibTwo.c.


Generated on Tue Dec 25 20:05:40 2007 for blat by  doxygen 1.5.2