struct orgGenes *orgGenesNew(char *srcDb, char *genePredFile) /* construct a new orgGenes object from the specified file */ { struct orgGenes *genes; AllocVar(genes); genes->srcDb = cloneString(srcDb); genes->bins = chromBinsNew(NULL); genes->memPool = lmInit(1024*1024); loadGenes(genes, genePredFile); return genes; }
static struct chromBins* loadMapChains(char *chainFile) /* read a chain file, convert to mapAln object and chromBins by query locations. */ { struct chromBins* mapAlns = chromBinsNew((chromBinsFreeFunc*)pslFree); struct chain *ch; struct lineFile *chLf = lineFileOpen(chainFile, TRUE); while ((ch = chainRead(chLf)) != NULL) { struct mapAln *mapAln = chainToPsl(ch); chromBinsAdd(mapAlns, mapAln->psl->qName, mapAln->psl->qStart, mapAln->psl->qEnd, mapAln); chainFree(&ch); } lineFileClose(&chLf); return mapAlns; }
static struct chromBins* loadMapPsls(char *pslFile) /* read a psl file and chromBins by query, linking multiple PSLs for the * same query.*/ { struct dyString* idBuf = NULL; struct chromBins* mapAlns = chromBinsNew((chromBinsFreeFunc*)pslFree); int id = 0; struct psl* psl; struct lineFile *pslLf = pslFileOpen(pslFile); while ((psl = pslNext(pslLf)) != NULL) { if (swapMap) pslSwap(psl, FALSE); chromBinsAdd(mapAlns, getMappingId(psl->qName, &idBuf), psl->qStart, psl->qEnd, mapAlnNew(psl, id)); id++; } lineFileClose(&pslLf); dyStringFree(&idBuf); return mapAlns; }