inc/hmmPfamParse.h File Reference

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

Go to the source code of this file.

Data Structures

struct  hpfDomain
struct  hpfModel
struct  hpfResult

Functions

void hpfModelFree (struct hpfModel **pMod)
void hpfModelFreeList (struct hpfModel **pList)
void hpfResultFree (struct hpfResult **pHr)
void hpfResultFreeList (struct hpfResult **pList)
hpfModelhpfFindResultInModel (struct hpfResult *hr, char *modName)
hpfResulthpfNext (struct lineFile *lf)


Function Documentation

struct hpfModel* hpfFindResultInModel ( struct hpfResult hr,
char *  modName 
) [read]

Definition at line 93 of file hmmPfamParse.c.

References hpfResult::modelList, hpfModel::name, hpfModel::next, and sameString.

Referenced by hpfNext().

00095 {
00096 struct hpfModel *mod;
00097 for (mod = hr->modelList; mod != NULL; mod = mod->next)
00098     if (sameString(mod->name, modName))
00099         break;
00100 return mod;
00101 }

Here is the caller graph for this function:

void hpfModelFree ( struct hpfModel **  pMod  ) 

Definition at line 11 of file hmmPfamParse.c.

References hpfModel::description, hpfModel::domainList, freeMem(), freez(), hpfModel::name, and slFreeList().

Referenced by hpfModelFreeList().

00013 {
00014 struct hpfModel *mod = *pMod;
00015 if (mod != NULL)
00016     {
00017     freeMem(mod->name);
00018     freeMem(mod->description);
00019     slFreeList(&mod->domainList);
00020     freez(pMod);
00021     }
00022 }

Here is the call graph for this function:

Here is the caller graph for this function:

void hpfModelFreeList ( struct hpfModel **  pList  ) 

Definition at line 24 of file hmmPfamParse.c.

References hpfModelFree(), and hpfModel::next.

Referenced by hpfResultFree().

00026 {
00027 struct hpfModel *el, *next;
00028 for (el = *pList; el != NULL; el = next)
00029     {
00030     next = el->next;
00031     hpfModelFree(&el);
00032     }
00033 *pList = NULL;
00034 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct hpfResult* hpfNext ( struct lineFile lf  )  [read]

Definition at line 103 of file hmmPfamParse.c.

References AllocVar, cloneString(), hpfModel::description, hpfModel::domainList, hpfModel::eVal, hpfDomain::eVal, hpfDomain::hmmEnd, hpfDomain::hmmStart, hpfFindResultInModel(), lineFileNeedDouble(), lineFileNeedNext(), lineFileNeedNum(), lineFileSkipToLineStartingWith(), hpfResult::modelList, hpfResult::name, hpfModel::name, needLineStartingWith(), spacedColumn::next, nextWord(), parseErr(), hpfDomain::qEnd, hpfDomain::qStart, hpfModel::score, hpfDomain::score, spacedColumn::size, skipLeadingSpaces(), slAddTail(), slCount(), slFreeList(), spacedColumnFatten(), spacedColumnFromSample(), spacedColumnParseLine(), spacedColumn::start, and startsWith().

00105 {
00106 /* Seek to first line that starts with "Query sequence:" and parse name out of it. */
00107 char *queryPat = "Query sequence: ";
00108 char *line = lineFileSkipToLineStartingWith(lf, queryPat, 100);
00109 if (line == NULL)
00110     return NULL;
00111 line += strlen(queryPat);
00112 char *query = cloneString(nextWord(&line));
00113 if (query == NULL)
00114     parseErr(lf, "Missing sequence name");
00115 
00116 /* Seek to start of model list, figuring out width of fields we need in the process. */
00117 needLineStartingWith(lf, "Scores for sequence family", 10);
00118 needLineStartingWith(lf, "Model ", 2);
00119 char *template = needLineStartingWith(lf, "----", 1);
00120 struct spacedColumn *colList = spacedColumnFromSample(template);
00121 spacedColumnFatten(colList);
00122 int colCount = slCount(colList);
00123 if (colCount < 5)
00124     parseErr(lf, "Expecting at least 5 columns");
00125 
00126 /* Parse out all the models. */
00127 struct hpfResult *hr;
00128 AllocVar(hr);
00129 hr->name = query;
00130 for (;;)
00131     {
00132     lineFileNeedNext(lf, &line, NULL);
00133     line = skipLeadingSpaces(line);
00134     if (line[0] == 0)
00135         break;
00136     if (startsWith("[no hits above thresholds]", line))
00137         break;
00138     char *row[colCount];
00139     if (!spacedColumnParseLine(colList, line, row))
00140         parseErr(lf, "short line");
00141     struct hpfModel *mod;
00142     AllocVar(mod);
00143     mod->name = cloneString(row[0]);
00144     mod->description = cloneString(row[1]);
00145     mod->score = lineFileNeedDouble(lf, row, 2);
00146     mod->eVal = lineFileNeedDouble(lf, row, 3);
00147     slAddTail(&hr->modelList, mod);
00148     }
00149 slFreeList(&colList);
00150 
00151 /* Skip over to the section on domains, figuriong out column widths while we're at it. */
00152 needLineStartingWith(lf, "Parsed for domains:", 10);
00153 needLineStartingWith(lf, "Model ", 2);
00154 template = needLineStartingWith(lf, "----", 1);
00155 colList = spacedColumnFromSample(template);
00156 colCount = slCount(colList);
00157 if (colCount < 8)
00158     parseErr(lf, "Expecting at least 8 columns.");
00159 struct spacedColumn *col2 = colList->next;
00160 colList->size = col2->start - 1;
00161 
00162 /* Parse out all the domains. */
00163 for (;;)
00164     {
00165     lineFileNeedNext(lf, &line, NULL);
00166     line = skipLeadingSpaces(line);
00167     if (line[0] == 0)
00168         break;
00169     if (startsWith("[no hits above thresholds]", line))
00170         break;
00171     char *row[colCount];
00172     if (!spacedColumnParseLine(colList, line, row))
00173         parseErr(lf, "short line");
00174     struct hpfModel *mod = hpfFindResultInModel(hr, row[0]);
00175     if (mod == NULL)
00176         parseErr(lf, "Model %s in domain section but not model section", row[0]);
00177     struct hpfDomain *dom;
00178     AllocVar(dom);
00179     dom->qStart = lineFileNeedNum(lf, row, 2) - 1;
00180     dom->qEnd = lineFileNeedNum(lf, row, 3);
00181     dom->hmmStart = lineFileNeedNum(lf, row, 4) - 1;
00182     dom->hmmEnd = lineFileNeedNum(lf, row, 5);
00183     dom->score = lineFileNeedDouble(lf, row, 6);
00184     dom->eVal = lineFileNeedDouble(lf, row, 7);
00185     slAddTail(&mod->domainList, dom);
00186     }
00187 slFreeList(&colList);
00188 if (!lineFileSkipToLineStartingWith(lf, "//", 10000000))
00189     parseErr(lf, "Expecting //");
00190 return hr;
00191 }

Here is the call graph for this function:

void hpfResultFree ( struct hpfResult **  pHr  ) 

Definition at line 37 of file hmmPfamParse.c.

References freeMem(), freez(), hpfModelFreeList(), hpfResult::modelList, and hpfResult::name.

Referenced by hpfResultFreeList().

00039 {
00040 struct hpfResult *hr = *pHr;
00041 if (hr != NULL)
00042     {
00043     freeMem(hr->name);
00044     hpfModelFreeList(&hr->modelList);
00045     freez(pHr);
00046     }
00047 }

Here is the call graph for this function:

Here is the caller graph for this function:

void hpfResultFreeList ( struct hpfResult **  pList  ) 

Definition at line 49 of file hmmPfamParse.c.

References hpfResultFree(), and hpfResult::next.

00051 {
00052 struct hpfResult *el, *next;
00053 for (el = *pList; el != NULL; el = next)
00054     {
00055     next = el->next;
00056     hpfResultFree(&el);
00057     }
00058 *pList = NULL;
00059 }

Here is the call graph for this function:


Generated on Tue Dec 25 19:00:30 2007 for blat by  doxygen 1.5.2