void rmskOut2OpenVerify(char *fileName, struct lineFile **retFile, boolean *retEmpty) /* Open repeat masker .out file and verify that it is good. * Set retEmpty if it has header characteristic of an empty file. */ { struct lineFile *lf = lineFileOpen(fileName, TRUE); char *line; int lineSize; lineFileNeedNext(lf, &line, &lineSize); if (startsWith("There were no", line)) *retEmpty = TRUE; line = skipLeadingSpaces(line); if (! ( startsWith("SW", line) || startsWith("bit", line) ) ) errAbort("%s doesn't seem to be a RepeatMasker .out file", fileName); lineFileSkip(lf, 2); *retEmpty = FALSE; *retFile = lf; }
struct hash *getFreqHash(char *freqFile) /* Read the frequency file in, and store it in a hash and return that. */ { struct hash *freqHash = newHash(23); struct lineFile *lf = lineFileOpen(freqFile, TRUE); char *words[3]; /* Assume there's a header and skip it. */ lineFileSkip(lf, 1); while (lineFileRowTab(lf, words)) { int val; lineFileNeedFullNum(lf, words, 1); lineFileNeedFullNum(lf, words, 2); val = (int)sqlUnsigned(words[2]); addFreqToHash(freqHash, words[0], words[1], val); } lineFileClose(&lf); hashTraverseEls(freqHash, sortSlPairList); return freqHash; }