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

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

Go to the source code of this file.
Data Structures | |
| struct | nt4Seq |
Functions | |
| nt4Seq * | newNt4 (DNA *dna, int size, char *name) |
| void | freeNt4 (struct nt4Seq **pSeq) |
| nt4Seq * | loadNt4 (char *fileName, char *seqName) |
| void | saveNt4 (char *fileName, DNA *dna, bits32 dnaSize) |
| int | nt4BaseCount (char *fileName) |
| DNA * | nt4Unpack (struct nt4Seq *n, int start, int size) |
| DNA * | nt4LoadPart (char *nt4FileName, int start, int size) |
| void freeNt4 | ( | struct nt4Seq ** | pSeq | ) |
Definition at line 55 of file nt4.c.
References nt4Seq::bases, freeMem(), freez(), and nt4Seq::name.
Referenced by flyFreeNt4Genome(), wormFreeNt4Genome(), and xenAlignBig().
00057 { 00058 struct nt4Seq *seq = *pSeq; 00059 if (seq == NULL) 00060 return; 00061 freeMem(seq->bases); 00062 freeMem(seq->name); 00063 freez(pSeq); 00064 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct nt4Seq* loadNt4 | ( | char * | fileName, | |
| char * | seqName | |||
| ) | [read] |
Definition at line 78 of file nt4.c.
References allocNt4(), nt4Seq::bases, bits32, bits32PaddedSize(), carefulClose(), mustRead(), mustReadOne, and nt4OpenVerify().
Referenced by flyLoadNt4Genome(), and wormLoadNt4Genome().
00080 { 00081 bits32 size; 00082 struct nt4Seq *seq; 00083 FILE *f = nt4OpenVerify(fileName); 00084 00085 mustReadOne(f, size); 00086 if (seqName == NULL) 00087 seqName = fileName; 00088 seq = allocNt4(size, seqName); 00089 mustRead(f, seq->bases, bits32PaddedSize(size)); 00090 carefulClose(&f); 00091 return seq; 00092 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 32 of file nt4.c.
References allocNt4(), nt4Seq::bases, bits32, and packDna16().
Referenced by xenAlignBig().
00034 { 00035 bits32 *packed; 00036 DNA *unpacked; 00037 char last[16]; 00038 struct nt4Seq *seq = allocNt4(size, name); 00039 packed = seq->bases; 00040 unpacked = dna; 00041 while (size > 16) 00042 { 00043 *packed++ = packDna16(dna); 00044 dna += 16; 00045 size -= 16; 00046 } 00047 if (size > 0) 00048 { 00049 memcpy(last, dna, size); 00050 *packed++ = packDna16(dna); 00051 } 00052 return seq; 00053 }
Here is the call graph for this function:

Here is the caller graph for this function:

| int nt4BaseCount | ( | char * | fileName | ) |
Definition at line 121 of file nt4.c.
References bits32, mustReadOne, and nt4OpenVerify().
Referenced by wormChromSize().
00123 { 00124 bits32 size; 00125 FILE *f = nt4OpenVerify(fileName); 00126 00127 mustReadOne(f, size); 00128 fclose(f); 00129 return (int)size; 00130 }
Here is the call graph for this function:

Here is the caller graph for this function:

| DNA* nt4LoadPart | ( | char * | nt4FileName, | |
| int | start, | |||
| int | size | |||
| ) |
Definition at line 226 of file nt4.c.
References bits32, freeMem(), mustRead(), mustReadOne, needLargeMem(), nt4OpenVerify(), SEEK_CUR, and unalignedUnpackDna().
Referenced by wormChromPart().
00228 { 00229 bits32 basesInFile; 00230 int tStart, tEnd, tSize; 00231 int end; 00232 FILE *f; 00233 DNA *unpacked; 00234 bits32 *tiles; 00235 00236 /* Open file, and make sure request is covered by file. */ 00237 f = nt4OpenVerify(fileName); 00238 mustReadOne(f, basesInFile); 00239 00240 assert(start >= 0); 00241 end = start + size; 00242 assert(end <= (int)basesInFile); 00243 00244 /* Figure out tiles to load */ 00245 tStart = (start>>4); 00246 tEnd = ((end+15)>>4); 00247 tSize = tEnd - tStart; 00248 00249 /* Allocate tile array and read it from disk. */ 00250 tiles = needLargeMem(tSize * sizeof(*tiles)); 00251 fseek(f, tStart * sizeof(*tiles), SEEK_CUR); 00252 mustRead(f, tiles, tSize * sizeof(*tiles) ); 00253 00254 /* Allocate and unpack array. */ 00255 unpacked = needLargeMem(size+1); 00256 unalignedUnpackDna(tiles, start - (tStart<<4), size, unpacked); 00257 00258 freeMem(tiles); 00259 fclose(f); 00260 return unpacked; 00261 }
Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 217 of file nt4.c.
References nt4Seq::bases, needLargeMem(), and unalignedUnpackDna().
Referenced by scoreNoninsertingExtensions().
00219 { 00220 DNA *unpacked = needLargeMem(size+1); 00221 unalignedUnpackDna(n->bases, start, size, unpacked); 00222 return unpacked; 00223 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void saveNt4 | ( | char * | fileName, | |
| DNA * | dna, | |||
| bits32 | dnaSize | |||
| ) |
Definition at line 94 of file nt4.c.
References nt4Seq::bases, bits32, mustOpen(), nt4Signature, packDna16(), writeOne, and zeroBytes().
00096 { 00097 FILE *f = mustOpen(fileName, "wb"); 00098 bits32 signature = nt4Signature; 00099 bits32 bases; 00100 char last[16]; 00101 00102 writeOne(f, signature); 00103 writeOne(f, dnaSize); 00104 while (dnaSize >= 16) 00105 { 00106 bases = packDna16(dna); 00107 writeOne(f, bases); 00108 dna += 16; 00109 dnaSize -= 16; 00110 } 00111 if (dnaSize > 0) 00112 { 00113 zeroBytes(last, sizeof(last)); 00114 memcpy(last, dna, dnaSize); 00115 bases = packDna16(last); 00116 writeOne(f, bases); 00117 } 00118 fclose(f); 00119 }
Here is the call graph for this function:

1.5.2