コード例 #1
0
ファイル: hgLoadPsl.c プロジェクト: Nicholas-NVS/kentUtils
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);
    }
}
コード例 #2
0
ファイル: hgLoadPsl.c プロジェクト: Nicholas-NVS/kentUtils
void copyPslToTab(char *pslFile, char *tabFile)
/* copy a single PSL to the tab file */
{
struct psl *psl;
struct lineFile *lf = pslFileOpen(pslFile);
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 ((psl = pslNext(lf)) != NULL)
    {
    if (pslCreateOpts & PSL_WITH_BIN)
        fprintf(tabFh, "%u\t", hFindBin(psl->tStart, psl->tEnd));
    pslTabOut(psl, tabFh);
    pslFree(&psl);
    }
lineFileClose(&lf);
if (noSort)
    carefulClose(&tabFh);
else
    {
    pipelineWait(pl);
    pipelineFree(&pl);
    }
}
コード例 #3
0
ファイル: linefile.c プロジェクト: bh0085/kent
void lineFileClose(struct lineFile **pLf)
/* Close up a line file. */
{
struct lineFile *lf;
if ((lf = *pLf) != NULL)
    {
    if (lf->pl != NULL)
        {
        pipelineWait(lf->pl);
        pipelineFree(&lf->pl);
        }
    else if (lf->fd > 0 && lf->fd != fileno(stdin))
	{
	close(lf->fd);
	freeMem(lf->buf);
	}
#ifdef USE_TABIX
    else if (lf->tabix != NULL)
	{
	if (lf->tabixIter != NULL)
	    ti_iter_destroy(lf->tabixIter);
	ti_close(lf->tabix);
	}
#endif // USE_TABIX
    freeMem(lf->fileName);
    metaDataFree(lf);
    freez(pLf);
    }
}
コード例 #4
0
ファイル: textOut.c プロジェクト: JinfengChen/pblat
void textOutClose(struct pipeline **pCompressPipeline)
/* Flush and close stdout, wait for the pipeline to finish, and then free 
 * the pipeline object. */
{
if (pCompressPipeline && *pCompressPipeline)
    {
    fflush(stdout);
    fclose(stdout);
    pipelineWait(*pCompressPipeline);
    pipelineFree(pCompressPipeline);
    }
}
コード例 #5
0
ファイル: pslPartition.c プロジェクト: Nicholas-NVS/kentUtils
static void pslInputFree(struct pslInput **piPtr)
/* free pslInput object */
{
    struct pslInput *pi = *piPtr;
    if (pi != NULL)
    {
        assert(pi->pending == NULL);
        pipelineWait(pi->pl);
        pipelineFree(&pi->pl);
        freez(piPtr);
    }
}
コード例 #6
0
ファイル: linefile.c プロジェクト: Puneet-Shivanand/zinba
void lineFileClose(struct lineFile **pLf)
/* Close up a line file. */
{
struct lineFile *lf;
if ((lf = *pLf) != NULL)
    {
    if (lf->pl != NULL)
        {
        pipelineWait(lf->pl);
        pipelineFree(&lf->pl);
        }
    else if (lf->fd > 0 && lf->fd != fileno(stdin))
	{
	close(lf->fd);
	freeMem(lf->buf);
	}
    freeMem(lf->fileName);
    metaDataFree(lf);
    freez(pLf);
    }
}