void cgapSageBedAddFreqs(char *oldBedFile, char *freqFile, char *libsFile, char *newBedFile) /* cgapSageBedAddFreqs - Add frequency data to the bed. */ { struct hash *totTagsHash; struct bed *mappings; struct hash *freqHash; struct cgapSage *sageList; verbose(1, "Loading libraries...\n"); totTagsHash = getTotTagsHash(libsFile); verbose(1, "Loaded libraries.\n"); verbose(1, "Loading mappings...\n"); mappings = bedLoadNAll(oldBedFile, 8); verbose(1, "Loaded mappings.\n"); verbose(1, "Loading frequencies...\n"); freqHash = getFreqHash(freqFile); verbose(1, "Loaded frequencies.\n"); verbose(1, "Building new bed list...\n"); sageList = makeCgapSageList(freqHash, totTagsHash, mappings); verbose(1, "Built new bed list.\n"); verbose(1, "Writing output...\n"); writeCgapSageFile(sageList, newBedFile); verbose(1, "Wrote output. All done!\n"); freeFreqHash(&freqHash); hashFree(&totTagsHash); cgapSageFreeList(&sageList); slFreeList(&mappings); }
struct hash *getTotTagsHashFromTable(struct sqlConnection *conn) /* Load the cgapSageLib table for the db then call getTotTagsHash. */ { struct cgapSageLib *libs = cgapSageLibLoadByQuery(conn, "NOSQLINJ select * from cgapSageLib"); struct hash *libTotHash = getTotTagsHash(libs); cgapSageLibFreeList(&libs); return libTotHash; }