bool run ( Data& d ) { LINFO ( "instancing " << d.grammar->patterns.size() << " patterns over this sentence:" << d.sentence ); d.stats->setTimeStart ("instantiate-patterns"); instantiatePatternsHash ( d ); d.stats->setTimeEnd ("instantiate-patterns"); writeHashToFile ( d ); LINFO ( "Finished!" ); return false; };
void findCounts(struct cutter *cutters, struct dnaSeq *seqs, char *outputFile) /* Go through each sequence, and each time add the counts of the enzymes */ /* encountered to the hash of counts. */ { struct dnaSeq *seq; struct hash *countHash = initCutterCountHash(cutters); for (seq = seqs; seq != NULL; seq = seq->next) { struct bed *bedList = matchEnzymes(cutters, seq, 0); if (bedList) { addCountsToHash(countHash, bedList); bedFreeList(&bedList); } } writeHashToFile(countHash, outputFile); }
void consolidateTheCounts(char *inputFile, char *outputFile) /* Read the cat'ed file in, and either make a new hash item for each enzyme */ /* encountered on each line, or add to an existing one. Then output the hash. */ { struct lineFile *lf = lineFileOpen(inputFile, TRUE); struct hash *countHash = newHash(12); char *words[2]; while (lineFileRow(lf, words)) { char *name = words[0]; int count = lineFileNeedFullNum(lf, words, 1); struct hashEl *el = hashLookup(countHash, name); if (!el) hashAddInt(countHash, name, count); else el->val = intToPt(ptToInt(el->val) + count); } writeHashToFile(countHash, outputFile); freeHash(&countHash); }