#include "common.h"#include "linefile.h"#include "dystring.h"#include "sqlNum.h"#include "sqlList.h"#include "xAli.h"Include dependency graph for xAli.c:

Go to the source code of this file.
Functions | |
| xAli * | xAliLoad (char **row) |
| xAli * | xAliLoadAll (char *fileName) |
| xAli * | xAliCommaIn (char **pS, struct xAli *ret) |
| void | xAliFree (struct xAli **pEl) |
| void | xAliFreeList (struct xAli **pList) |
| void | xAliOutput (struct xAli *el, FILE *f, char sep, char lastSep) |
| xAli * | xAliNext (struct lineFile *lf) |
Variables | |
| static char const | rcsid [] = "$Id: xAli.c,v 1.6 2005/04/10 14:41:26 markd Exp $" |
Definition at line 71 of file xAli.c.
References AllocArray, AllocVar, sqlEatChar(), sqlFixedStringComma(), sqlSignedComma(), sqlStringComma(), and sqlUnsignedComma().
00075 { 00076 char *s = *pS; 00077 int i; 00078 00079 if (ret == NULL) 00080 AllocVar(ret); 00081 ret->match = sqlUnsignedComma(&s); 00082 ret->misMatch = sqlUnsignedComma(&s); 00083 ret->repMatch = sqlUnsignedComma(&s); 00084 ret->nCount = sqlUnsignedComma(&s); 00085 ret->qNumInsert = sqlUnsignedComma(&s); 00086 ret->qBaseInsert = sqlSignedComma(&s); 00087 ret->tNumInsert = sqlUnsignedComma(&s); 00088 ret->tBaseInsert = sqlSignedComma(&s); 00089 sqlFixedStringComma(&s, ret->strand, sizeof(ret->strand)); 00090 ret->qName = sqlStringComma(&s); 00091 ret->qSize = sqlUnsignedComma(&s); 00092 ret->qStart = sqlUnsignedComma(&s); 00093 ret->qEnd = sqlUnsignedComma(&s); 00094 ret->tName = sqlStringComma(&s); 00095 ret->tSize = sqlUnsignedComma(&s); 00096 ret->tStart = sqlUnsignedComma(&s); 00097 ret->tEnd = sqlUnsignedComma(&s); 00098 ret->blockCount = sqlUnsignedComma(&s); 00099 s = sqlEatChar(s, '{'); 00100 AllocArray(ret->blockSizes, ret->blockCount); 00101 for (i=0; i<ret->blockCount; ++i) 00102 { 00103 ret->blockSizes[i] = sqlUnsignedComma(&s); 00104 } 00105 s = sqlEatChar(s, '}'); 00106 s = sqlEatChar(s, ','); 00107 s = sqlEatChar(s, '{'); 00108 AllocArray(ret->qStarts, ret->blockCount); 00109 for (i=0; i<ret->blockCount; ++i) 00110 { 00111 ret->qStarts[i] = sqlUnsignedComma(&s); 00112 } 00113 s = sqlEatChar(s, '}'); 00114 s = sqlEatChar(s, ','); 00115 s = sqlEatChar(s, '{'); 00116 AllocArray(ret->tStarts, ret->blockCount); 00117 for (i=0; i<ret->blockCount; ++i) 00118 { 00119 ret->tStarts[i] = sqlUnsignedComma(&s); 00120 } 00121 s = sqlEatChar(s, '}'); 00122 s = sqlEatChar(s, ','); 00123 s = sqlEatChar(s, '{'); 00124 AllocArray(ret->qSeq, ret->blockCount); 00125 for (i=0; i<ret->blockCount; ++i) 00126 { 00127 ret->qSeq[i] = sqlStringComma(&s); 00128 } 00129 s = sqlEatChar(s, '}'); 00130 s = sqlEatChar(s, ','); 00131 s = sqlEatChar(s, '{'); 00132 AllocArray(ret->tSeq, ret->blockCount); 00133 for (i=0; i<ret->blockCount; ++i) 00134 { 00135 ret->tSeq[i] = sqlStringComma(&s); 00136 } 00137 s = sqlEatChar(s, '}'); 00138 s = sqlEatChar(s, ','); 00139 *pS = s; 00140 return ret; 00141 }
Here is the call graph for this function:

| void xAliFree | ( | struct xAli ** | pEl | ) |
Definition at line 143 of file xAli.c.
References xAli::blockSizes, freeMem(), freez(), xAli::qName, xAli::qSeq, xAli::qStarts, xAli::tName, xAli::tSeq, and xAli::tStarts.
Referenced by xAliFreeList().
00146 { 00147 struct xAli *el; 00148 00149 if ((el = *pEl) == NULL) return; 00150 freeMem(el->qName); 00151 freeMem(el->tName); 00152 freeMem(el->blockSizes); 00153 freeMem(el->qStarts); 00154 freeMem(el->tStarts); 00155 /* All strings in qSeq are allocated at once, so only need to free first. */ 00156 if (el->qSeq != NULL) 00157 freeMem(el->qSeq[0]); 00158 freeMem(el->qSeq); 00159 /* All strings in tSeq are allocated at once, so only need to free first. */ 00160 if (el->tSeq != NULL) 00161 freeMem(el->tSeq[0]); 00162 freeMem(el->tSeq); 00163 freez(pEl); 00164 }
Here is the call graph for this function:

Here is the caller graph for this function:

| void xAliFreeList | ( | struct xAli ** | pList | ) |
Definition at line 166 of file xAli.c.
References xAli::next, and xAliFree().
00168 { 00169 struct xAli *el, *next; 00170 00171 for (el = *pList; el != NULL; el = next) 00172 { 00173 next = el->next; 00174 xAliFree(&el); 00175 } 00176 *pList = NULL; 00177 }
Here is the call graph for this function:

| struct xAli* xAliLoad | ( | char ** | row | ) | [read] |
Definition at line 14 of file xAli.c.
References AllocVar, xAli::blockCount, xAli::blockSizes, cloneString(), xAli::match, xAli::misMatch, xAli::nCount, xAli::qBaseInsert, xAli::qEnd, xAli::qName, xAli::qNumInsert, xAli::qSeq, xAli::qSize, xAli::qStart, xAli::qStarts, xAli::repMatch, sqlSigned(), sqlStringDynamicArray(), sqlUnsigned(), sqlUnsignedDynamicArray(), xAli::strand, xAli::tBaseInsert, xAli::tEnd, xAli::tName, xAli::tNumInsert, xAli::tSeq, xAli::tSize, xAli::tStart, and xAli::tStarts.
Referenced by xAliLoadAll(), and xAliNext().
00017 { 00018 struct xAli *ret; 00019 int sizeOne; 00020 00021 AllocVar(ret); 00022 ret->blockCount = sqlUnsigned(row[17]); 00023 ret->match = sqlUnsigned(row[0]); 00024 ret->misMatch = sqlUnsigned(row[1]); 00025 ret->repMatch = sqlUnsigned(row[2]); 00026 ret->nCount = sqlUnsigned(row[3]); 00027 ret->qNumInsert = sqlUnsigned(row[4]); 00028 ret->qBaseInsert = sqlSigned(row[5]); 00029 ret->tNumInsert = sqlUnsigned(row[6]); 00030 ret->tBaseInsert = sqlSigned(row[7]); 00031 strcpy(ret->strand, row[8]); 00032 ret->qName = cloneString(row[9]); 00033 ret->qSize = sqlUnsigned(row[10]); 00034 ret->qStart = sqlUnsigned(row[11]); 00035 ret->qEnd = sqlUnsigned(row[12]); 00036 ret->tName = cloneString(row[13]); 00037 ret->tSize = sqlUnsigned(row[14]); 00038 ret->tStart = sqlUnsigned(row[15]); 00039 ret->tEnd = sqlUnsigned(row[16]); 00040 sqlUnsignedDynamicArray(row[18], &ret->blockSizes, &sizeOne); 00041 assert(sizeOne == ret->blockCount); 00042 sqlUnsignedDynamicArray(row[19], &ret->qStarts, &sizeOne); 00043 assert(sizeOne == ret->blockCount); 00044 sqlUnsignedDynamicArray(row[20], &ret->tStarts, &sizeOne); 00045 assert(sizeOne == ret->blockCount); 00046 sqlStringDynamicArray(row[21], &ret->qSeq, &sizeOne); 00047 assert(sizeOne == ret->blockCount); 00048 sqlStringDynamicArray(row[22], &ret->tSeq, &sizeOne); 00049 assert(sizeOne == ret->blockCount); 00050 return ret; 00051 }
Here is the call graph for this function:

Here is the caller graph for this function:

| struct xAli* xAliLoadAll | ( | char * | fileName | ) | [read] |
Definition at line 53 of file xAli.c.
References lineFileClose(), lineFileOpen(), lineFileRow, slAddHead, slReverse(), TRUE, and xAliLoad().
00056 { 00057 struct xAli *list = NULL, *el; 00058 struct lineFile *lf = lineFileOpen(fileName, TRUE); 00059 char *row[23]; 00060 00061 while (lineFileRow(lf, row)) 00062 { 00063 el = xAliLoad(row); 00064 slAddHead(&list, el); 00065 } 00066 lineFileClose(&lf); 00067 slReverse(&list); 00068 return list; 00069 }
Here is the call graph for this function:

Definition at line 273 of file xAli.c.
References lineFileRow, and xAliLoad().
00276 { 00277 char *row[23]; 00278 if (!lineFileRow(lf, row)) 00279 return NULL; 00280 return xAliLoad(row); 00281 }
Here is the call graph for this function:

| void xAliOutput | ( | struct xAli * | el, | |
| FILE * | f, | |||
| char | sep, | |||
| char | lastSep | |||
| ) |
Definition at line 179 of file xAli.c.
References xAli::blockCount, xAli::blockSizes, xAli::match, xAli::misMatch, xAli::nCount, xAli::qBaseInsert, xAli::qEnd, xAli::qName, xAli::qNumInsert, xAli::qSeq, xAli::qSize, xAli::qStart, xAli::qStarts, xAli::repMatch, xAli::strand, xAli::tBaseInsert, xAli::tEnd, xAli::tName, xAli::tNumInsert, xAli::tSeq, xAli::tSize, xAli::tStart, and xAli::tStarts.
00181 { 00182 int i; 00183 fprintf(f, "%u", el->match); 00184 fputc(sep,f); 00185 fprintf(f, "%u", el->misMatch); 00186 fputc(sep,f); 00187 fprintf(f, "%u", el->repMatch); 00188 fputc(sep,f); 00189 fprintf(f, "%u", el->nCount); 00190 fputc(sep,f); 00191 fprintf(f, "%u", el->qNumInsert); 00192 fputc(sep,f); 00193 fprintf(f, "%d", el->qBaseInsert); 00194 fputc(sep,f); 00195 fprintf(f, "%u", el->tNumInsert); 00196 fputc(sep,f); 00197 fprintf(f, "%d", el->tBaseInsert); 00198 fputc(sep,f); 00199 if (sep == ',') fputc('"',f); 00200 fprintf(f, "%s", el->strand); 00201 if (sep == ',') fputc('"',f); 00202 fputc(sep,f); 00203 if (sep == ',') fputc('"',f); 00204 fprintf(f, "%s", el->qName); 00205 if (sep == ',') fputc('"',f); 00206 fputc(sep,f); 00207 fprintf(f, "%u", el->qSize); 00208 fputc(sep,f); 00209 fprintf(f, "%u", el->qStart); 00210 fputc(sep,f); 00211 fprintf(f, "%u", el->qEnd); 00212 fputc(sep,f); 00213 if (sep == ',') fputc('"',f); 00214 fprintf(f, "%s", el->tName); 00215 if (sep == ',') fputc('"',f); 00216 fputc(sep,f); 00217 fprintf(f, "%u", el->tSize); 00218 fputc(sep,f); 00219 fprintf(f, "%u", el->tStart); 00220 fputc(sep,f); 00221 fprintf(f, "%u", el->tEnd); 00222 fputc(sep,f); 00223 fprintf(f, "%u", el->blockCount); 00224 fputc(sep,f); 00225 if (sep == ',') fputc('{',f); 00226 for (i=0; i<el->blockCount; ++i) 00227 { 00228 fprintf(f, "%u", el->blockSizes[i]); 00229 fputc(',', f); 00230 } 00231 if (sep == ',') fputc('}',f); 00232 fputc(sep,f); 00233 if (sep == ',') fputc('{',f); 00234 for (i=0; i<el->blockCount; ++i) 00235 { 00236 fprintf(f, "%u", el->qStarts[i]); 00237 fputc(',', f); 00238 } 00239 if (sep == ',') fputc('}',f); 00240 fputc(sep,f); 00241 if (sep == ',') fputc('{',f); 00242 for (i=0; i<el->blockCount; ++i) 00243 { 00244 fprintf(f, "%u", el->tStarts[i]); 00245 fputc(',', f); 00246 } 00247 if (sep == ',') fputc('}',f); 00248 fputc(sep,f); 00249 if (sep == ',') fputc('{',f); 00250 for (i=0; i<el->blockCount; ++i) 00251 { 00252 if (sep == ',') fputc('"',f); 00253 fprintf(f, "%s", el->qSeq[i]); 00254 if (sep == ',') fputc('"',f); 00255 fputc(',', f); 00256 } 00257 if (sep == ',') fputc('}',f); 00258 fputc(sep,f); 00259 if (sep == ',') fputc('{',f); 00260 for (i=0; i<el->blockCount; ++i) 00261 { 00262 if (sep == ',') fputc('"',f); 00263 fprintf(f, "%s", el->tSeq[i]); 00264 if (sep == ',') fputc('"',f); 00265 fputc(',', f); 00266 } 00267 if (sep == ',') fputc('}',f); 00268 fputc(lastSep,f); 00269 }
char const rcsid[] = "$Id: xAli.c,v 1.6 2005/04/10 14:41:26 markd Exp $" [static] |
1.5.2