inc/emblParse.h File Reference

#include "hash.h"
#include "dystring.h"
#include "linefile.h"

Include dependency graph for emblParse.h:

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

Go to the source code of this file.

Functions

boolean emblLineGroup (struct lineFile *lf, char type[16], struct dyString *val)
hashemblRecord (struct lineFile *lf)
lineFileemblOpen (char *fileName, char type[256])


Function Documentation

boolean emblLineGroup ( struct lineFile lf,
char  type[16],
struct dyString val 
)

Definition at line 54 of file emblParse.c.

References dyStringAppend(), dyStringAppendC(), dyStringClear, errAbort(), lineFile::fileName, lineFileNext(), lineFileReuse(), lineFile::lineIx, nextWord(), skipLeadingSpaces(), and startsWith().

Referenced by emblRecord().

00057 {
00058 char *line, *word;
00059 int typeLen = 0;
00060 
00061 dyStringClear(val);
00062 while (lineFileNext(lf, &line, NULL))
00063     {
00064     line = skipLeadingSpaces(line);
00065 
00066     /* Parse out first word into type. */
00067     if (isspace(line[0]))
00068         errAbort("embl line that doesn't start with type line %d of %s", 
00069                 lf->lineIx, lf->fileName);
00070     if (typeLen == 0)
00071         {
00072         word = nextWord(&line);
00073         typeLen = strlen(word);
00074         if (typeLen >= 16)
00075             errAbort("Type word at start of line too long for embl file line %d of %s",
00076                 lf->lineIx, lf->fileName);
00077         strcpy(type, word);
00078         }
00079     else if (!startsWith(type, line) || !isspace(line[typeLen]))
00080         {
00081         lineFileReuse(lf);
00082         break;
00083         }
00084     else
00085         {
00086         dyStringAppendC(val, '\n');
00087         word = nextWord(&line);
00088         }
00089 
00090     if (line != NULL)
00091         {
00092         /* Usually have two spaces after type. */
00093         if (isspace(line[0]))
00094            ++line;
00095         if (isspace(line[0]))
00096            ++line;
00097 
00098         /* Append what's rest of line to return value. */
00099         dyStringAppend(val, line);
00100         }
00101     }
00102 return typeLen > 0;
00103 }

Here is the call graph for this function:

Here is the caller graph for this function:

struct lineFile* emblOpen ( char *  fileName,
char  type[256] 
) [read]

Definition at line 137 of file emblParse.c.

References emblRecord(), freeHashAndVals(), hashFindVal(), lineFileOpen(), notEmbl(), and TRUE.

00140 {
00141 struct lineFile *lf = lineFileOpen(fileName, TRUE);
00142 struct hash *hash = emblRecord(lf);
00143 char *vv;
00144 
00145 if (hash == NULL)
00146     notEmbl(fileName);
00147 if ((vv = hashFindVal(hash, "VV")) == NULL)
00148     notEmbl(fileName);
00149 if (type != NULL)
00150     {
00151     if (strlen(vv) >= 256)
00152         notEmbl(fileName);
00153     strcpy(type, vv);
00154     }
00155 freeHashAndVals(&hash);
00156 return lf;
00157 }

Here is the call graph for this function:

struct hash* emblRecord ( struct lineFile lf  )  [read]

Definition at line 105 of file emblParse.c.

References cloneString(), emblLineGroup(), FALSE, lineFile::fileName, hashAdd(), newDyString(), newHash(), sameString, dyString::string, TRUE, and warn().

Referenced by emblOpen().

00109 {
00110 struct hash *hash = NULL;
00111 char type[16];
00112 struct dyString *val = newDyString(256);
00113 boolean gotEnd = FALSE;
00114 
00115 while (emblLineGroup(lf, type, val))
00116     {
00117     if (hash == NULL)
00118         hash = newHash(7);
00119     if (sameString(type, "//"))
00120         {
00121         gotEnd = TRUE;
00122         break;
00123         }
00124     hashAdd(hash, type, cloneString(val->string));
00125     }
00126 if (hash != NULL && !gotEnd)
00127     warn("Incomplete last record of embl file %s\n", lf->fileName);
00128 return hash;
00129 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Tue Dec 25 18:53:46 2007 for blat by  doxygen 1.5.2