void copyPslXaToTab(char *pslFile, char *tabFile) /* copy a single PSL XA to the tab file */ { struct xAli *xa; char *row[23]; struct lineFile *lf = lineFileOpen(pslFile, TRUE); struct pipeline *pl = NULL; FILE *tabFh = NULL; if (noSort) tabFh = mustOpen(tabFile, "w"); else { if (pslCreateOpts & PSL_WITH_BIN) pl = pipelineOpen(outPipeBin, pipelineWrite, tabFile, NULL); else pl = pipelineOpen(outPipeNoBin, pipelineWrite, tabFile, NULL); tabFh = pipelineFile(pl); } while (lineFileRow(lf, row)) { xa = xAliLoad(row); if (pslCreateOpts & PSL_WITH_BIN) fprintf(tabFh, "%u\t", hFindBin(xa->tStart, xa->tEnd)); xAliTabOut(xa, tabFh); xAliFree(&xa); } lineFileClose(&lf); if (noSort) carefulClose(&tabFh); else { pipelineWait(pl); pipelineFree(&pl); } }
void freePslOrXa(struct psl *psl, boolean isXa) /* Free a psl that may be extended. */ { if (isXa) { struct xAli *xa = (struct xAli *)psl; xAliFree(&xa); } else pslFree(&psl); }
void xAliFreeList(struct xAli **pList) /* Free a list of dynamically allocated xAli's */ { struct xAli *el, *next; for (el = *pList; el != NULL; el = next) { next = el->next; xAliFree(&el); } *pList = NULL; }