本文整理汇总了C++中carefulClose函数的典型用法代码示例。如果您正苦于以下问题:C++ carefulClose函数的具体用法?C++ carefulClose怎么用?C++ carefulClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了carefulClose函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: writeOutput
void writeOutput(double *gcBins, unsigned int windowSize, double totalWindows, char *outFilename)
{
unsigned int i = 0;
FILE *fout = mustOpen(outFilename, "w");
double percentGc = 0, percentTotal = 0;
for(i=0; i<=windowSize; i++)
{
percentGc = (double)i/(double)windowSize;
percentTotal = gcBins[i]/totalWindows;
fprintf(fout, "%u %f %f\n", i, percentGc, percentTotal);
}
carefulClose(&fout);
}
开发者ID:craiglowe,项目名称:copyNumberDiff,代码行数:14,代码来源:faToGcStats.c
示例2: cnvBedToPsl
void cnvBedToPsl(char *chromSizesFile, char *bedFile, char *pslFile)
/* convert bed format files to PSL format */
{
struct hash *chromSizes = loadChromSizes(chromSizesFile);
struct lineFile *bedLf = lineFileOpen(bedFile, TRUE);
FILE *pslFh = mustOpen(pslFile, "w");
char *line;
while (lineFileNextReal(bedLf, &line))
cnvBedRec(line, chromSizes, pslFh);
carefulClose(&pslFh);
lineFileClose(&bedLf);
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:14,代码来源:bedToPsl.c
示例3: ldGencodeIntron
void ldGencodeIntron(char *database, char *table,
int gtfCount, char *gtfNames[])
/* Load Gencode intron status table from GTF files with
* intron_id and intron_status keywords */
{
struct gffFile *gff, *gffList = NULL;
struct gffLine *gffLine;
struct gencodeIntron *intron, *intronList = NULL;
struct sqlConnection *conn;
FILE *f;
int i;
int introns = 0;
for (i=0; i<gtfCount; i++)
{
verbose(1, "Reading %s\n", gtfNames[i]);
gff = gffRead(gtfNames[i]);
for (gffLine = gff->lineList; gffLine != NULL; gffLine = gffLine->next)
{
if (sameWord(gffLine->feature, "intron"))
{
AllocVar(intron);
intron->chrom = gffLine->seq;
intron->chromStart = gffLine->start;
intron->chromEnd = gffLine->end;
intron->name = gffLine->intronId;
intron->strand[0] = gffLine->strand;
intron->strand[1] = 0;
intron->status = gffLine->intronStatus;
intron->transcript = gffLine->group;
intron->geneId = gffLine->geneId;
slAddHead(&intronList, intron);
verbose(2, "%s %s\n", intron->chrom, intron->name);
introns++;
}
}
}
slSort(&intronList, bedCmp);
f = hgCreateTabFile(".", table);
for (intron = intronList; intron != NULL; intron = intron->next)
gencodeIntronTabOut(intron, f);
carefulClose(&f);
verbose(1, "%d introns in %d files\n", introns, gtfCount);
hSetDb(database);
conn = sqlConnect(database);
gencodeIntronTableCreate(conn, table, hGetMinIndexLength());
hgLoadTabFile(conn, ".", table, &f);
sqlDisconnect(&conn);
}
开发者ID:bowhan,项目名称:kent,代码行数:50,代码来源:ldGencodeIntron.c
示例4: pickCassettePcrPrimers
void pickCassettePcrPrimers(char *db, char *bedFileName, char *primerFaName, char *primerBedName)
/* pickCassettePcrPrimers - Takes a bedFile with three exons and for each bed calls primer3 to pick primers that will detect the inclusion or exclusion of the exon.. */
{
struct bed *bed=NULL, *bedList = NULL;
FILE *primerFa = NULL;
FILE *primerBed = NULL;
struct cassetteSeq *cseq = NULL;
int targetExon = optionInt("targetExon", 1);
hSetDb(db);
bed = bedList = bedLoadAll(bedFileName);
primerFa = mustOpen(primerFaName, "w");
primerBed = mustOpen(primerBedName, "w");
for(bed=bedList; bed != NULL; bed = bed->next)
{
cseq = cassetteSeqFromBed(bed, targetExon);
callPrimer3(cseq, primerFa, primerBed);
cassetteSeqFree(&cseq);
}
bedFreeList(&bedList);
carefulClose(&primerFa);
carefulClose(&primerBed);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:23,代码来源:pickCassettePcrPrimers.c
示例5: getProtSeqs
static void getProtSeqs(struct sqlConnection *conn, struct hash *refSeqVerInfoTbl, char *outFile)
/* get request prot sequences from database */
{
struct hash *doneProts = hashNew(16);
FILE *fh = mustOpen(outFile, "w");
struct hashCookie cookie = hashFirst(refSeqVerInfoTbl);
struct hashEl *hel;
while ((hel = hashNext(&cookie)) != NULL)
{
processProtSeq(fh, conn, hel->val, doneProts);
}
carefulClose(&fh);
hashFree(&doneProts);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:14,代码来源:refSeqGet.c
示例6: invokeR
void invokeR(struct dyString *script)
/* Call R on our script. */
{
struct tempName rScript;
FILE *out = NULL;
char command[256];
assert(script);
makeTempName(&rScript, "sp", ".R");
out = mustOpen(rScript.forCgi, "w");
fprintf(out, "%s", script->string);
carefulClose(&out);
safef(command, sizeof(command), "R --vanilla < %s >& /dev/null ", rScript.forCgi);
system(command);
}
开发者ID:apmagalhaes,项目名称:kentUtils,代码行数:14,代码来源:spliceProbeVis.c
示例7: main
int main(int argc, char *argv[])
{
if (argc != 3)
usage();
db = argv[1];
hSetDb(db);
if (!hTableExists(argv[2]))
{
verbose(1, "can't find table %s\n", argv[2]);
return 1;
}
errorFileHandle = mustOpen("hapmapValidate.error", "w");
complexFileHandle = mustOpen("hapmapValidate.complex", "w");
dynamicObserved = newDyString(32);
hapmapValidate(argv[2]);
carefulClose(&errorFileHandle);
carefulClose(&complexFileHandle);
return 0;
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:23,代码来源:hapmapValidate.c
示例8: getGeneAnns
static void getGeneAnns(struct sqlConnection *conn, struct hash *refSeqVerInfoTbl, char *outFile)
/* get request genePred annotations from database */
{
struct genePredReader *gpr = genePredReaderQuery(conn, "refGene", NULL);
FILE *fh = mustOpen(outFile, "w");
struct genePred *gp;
while ((gp = genePredReaderNext(gpr)) != NULL)
{
processGenePred(fh, refSeqVerInfoTbl, gp);
genePredFree(&gp);
}
carefulClose(&fh);
genePredReaderFree(&gpr);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:14,代码来源:refSeqGet.c
示例9: faLowerToN
void faLowerToN(char *inName, char *outName)
/* faLowerToN - Convert lower case bases to N.. */
{
struct lineFile *lf = lineFileOpen(inName, TRUE);
FILE *f = mustOpen(outName, "w");
char *line;
while (lineFileNext(lf, &line, NULL))
{
if (line[0] != '>')
lowerToN(line);
fprintf(f, "%s\n", line);
}
carefulClose(&f);
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:14,代码来源:faLowerToN.c
示例10: aNotB
void aNotB(char *aFile, char *bFile, char *outFile)
/* aNotB - List symbols that are in a but not b. */
{
struct hash *bHash = hashFirstWord(bFile);
struct lineFile *lf = lineFileOpen(aFile, TRUE);
FILE *f = mustOpen(outFile, "w");
char *row[1];
while (lineFileRow(lf, row))
{
if (!hashLookup(bHash, row[0]))
fprintf(f, "%s\n", row[0]);
}
carefulClose(&f);
}
开发者ID:sktu,项目名称:kentUtils,代码行数:14,代码来源:aNotB.c
示例11: mustOpen
struct sanger22extra *makeFixedGffAndReadExtra(char *txGff, char *cdsGff,
char *fixedGff, struct hash *extraHash)
/* Combine txGff and cdsGff into something our regular GFF to
* genePred routine can handle. */
{
FILE *f = mustOpen(fixedGff, "w");
struct sanger22extra *extraList = NULL;
processOneGff(txGff, f, "exon", extraHash, &extraList, FALSE);
processOneGff(cdsGff, f, "CDS", extraHash, &extraList, TRUE);
carefulClose(&f);
slReverse(&extraList);
return extraList;
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:14,代码来源:hgSanger22.c
示例12: main
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 4)
usage();
refType = optionVal("refType", refType);
char *fileName = optionVal("constExon", NULL);
if (fileName != NULL)
fConst = mustOpen(fileName, "w");
txgAnalyze(argv[1], argv[2], argv[3]);
carefulClose(&fConst);
return 0;
}
开发者ID:ucsc-mus-strain-cactus,项目名称:kent,代码行数:14,代码来源:txgAnalyze.c
示例13: main
int main(int argc, char *argv[])
/* read chrN_snpTmp, handle locType, rewrite to individual chrom tables */
{
struct slName *chromList, *chromPtr;
int expandCount = 0;
if (argc != 3)
usage();
snpDb = argv[1];
contigGroup = argv[2];
hSetDb(snpDb);
chromList = getChromListFromContigInfo(contigGroup);
if (chromList == NULL)
{
verbose(1, "couldn't get chrom info\n");
return 1;
}
errorFileHandle = mustOpen("snpLocType125.errors", "w");
exceptionFileHandle = mustOpen("snpLocType125.exceptions", "w");
for (chromPtr = chromList; chromPtr != NULL; chromPtr = chromPtr->next)
{
verbose(1, "chrom = %s\n", chromPtr->name);
expandCount = expandCount + doLocType(chromPtr->name);
recreateDatabaseTable(chromPtr->name);
loadDatabase(chromPtr->name);
}
if (expandCount > 0)
verbose(1, "need to expand %d alleles\n", expandCount);
carefulClose(&errorFileHandle);
carefulClose(&exceptionFileHandle);
return 0;
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:37,代码来源:snpLocType125.c
示例14: doFetch
void doFetch(char *inputFileName, char *sequenceFileName, char *outputFileName)
/* lookup sequence for each line */
{
struct lineFile *lf = NULL;
char *line;
char *row[6];
int elementCount;
struct twoBitFile *tbf;
char *fileChrom = NULL;
int start = 0;
int end = 0;
char *name = NULL;
int score = 0;
char *strand = NULL;
struct dnaSeq *chunk = NULL;
FILE *outputFileHandle = mustOpen(outputFileName, "w");
tbf = twoBitOpen(sequenceFileName);
lf = lineFileOpen(inputFileName, TRUE);
while (lineFileNext(lf, &line, NULL))
{
elementCount = chopString(line, "\t", row, ArraySize(row));
if (elementCount != 6) continue;
fileChrom = cloneString(row[0]);
start = sqlUnsigned(row[1]);
end = sqlUnsigned(row[2]);
name = cloneString(row[3]);
score = sqlUnsigned(row[4]);
strand = cloneString(row[5]);
if (start == end) continue;
assert (end > start);
chunk = twoBitReadSeqFrag(tbf, fileChrom, start, end);
touppers(chunk->dna);
if (sameString(strand, "-"))
reverseComplement(chunk->dna, chunk->size);
fprintf(outputFileHandle, "%s\t%d\t%d\t%s\t%d\t%s\t%s\n", fileChrom, start, end, name, score, strand, chunk->dna);
dnaSeqFree(&chunk);
}
lineFileClose(&lf);
carefulClose(&outputFileHandle);
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:49,代码来源:fetchSeq.c
示例15: dnaseHg38AddTreatments
void dnaseHg38AddTreatments(char *inTab, char *outTab)
/* dnaseHg38AddTreatments - Add treatments to dnase hg38 metadata. */
{
struct sqlConnection *conn = sqlConnect("hgFixed");
struct lineFile *lf = lineFileOpen(inTab, TRUE);
FILE *f = mustOpen(outTab, "w");
char *line;
while (lineFileNext(lf, &line, NULL))
{
if (line[0] == '#')
fprintf(f, "%s\ttreatment\tlabel\n", line);
else
{
char *inRow[5];
int wordCount = chopByWhite(line, inRow, ArraySize(inRow));
lineFileExpectWords(lf, 4, wordCount);
char *acc = inRow[0];
char *biosample = inRow[1];
char query[512];
sqlSafef(query, sizeof(query), "select expVars from encodeExp where accession = '%s'", acc);
char varBuf[1024];
char *treatment = "n/a";
char *label = biosample;
char labelBuf[256];
char *vars = sqlQuickQuery(conn, query, varBuf, sizeof(varBuf));
if (!isEmpty(vars))
{
treatment = vars + strlen("treatment=");
if (sameString(treatment, "4OHTAM_20nM_72hr"))
safef(labelBuf, sizeof(labelBuf), "%s 40HTAM", biosample);
else if (sameString(treatment, "diffProtA_14d"))
safef(labelBuf, sizeof(labelBuf), "%s diff 14d", biosample);
else if (sameString(treatment, "diffProtA_5d"))
safef(labelBuf, sizeof(labelBuf), "%s diff 5d", biosample);
else if (sameString(treatment, "DIFF_4d"))
safef(labelBuf, sizeof(labelBuf), "%s diff 4d", biosample);
else if (sameString(treatment, "Estradiol_100nM_1hr"))
safef(labelBuf, sizeof(labelBuf), "%s estradi 1h", biosample);
else if (sameString(treatment, "Estradiol_ctrl_0hr"))
safef(labelBuf, sizeof(labelBuf), "%s estradi 0h", biosample);
else
errAbort("Unknown treatment %s", treatment);
label = labelBuf;
}
fprintf(f, "%s\t%s\t%s\t%s\t%s\t%s\n", inRow[0], inRow[1], inRow[2], inRow[3], treatment, label);
}
}
carefulClose(&f);
}
开发者ID:davidhoover,项目名称:kent,代码行数:49,代码来源:dnaseHg38AddTreatments.c
示例16: mafStats
void mafStats(char *twoBitFile, char *mafDir, char *outFile)
/* mafStats - Calculate basic stats on maf file including species-by-species
* coverage and percent ID. */
{
struct twoBitFile *tbf = twoBitOpen(twoBitFile);
FILE *f = mustOpen(outFile, "w");
struct twoBitIndex *ix;
long genomeSize = 0;
struct hash *speciesHash = hashNew(0);
struct speciesAcc *speciesList = NULL, *species;
for (ix = tbf->indexList; ix != NULL; ix = ix->next)
{
unsigned chromSize = twoBitSeqSizeNoNs(tbf, ix->name);
genomeSize += chromSize;
char mafFileName[PATH_LEN];
safef(mafFileName, sizeof(mafFileName), "%s/%s.maf", mafDir, ix->name);
struct mafFile *mf = mafMayOpen(mafFileName);
verbose(1, "processing %s\n", ix->name);
if (mf == NULL)
{
warn("%s doesn't exist", mafFileName);
continue;
}
struct mafAli *maf;
while ((maf = mafNext(mf)) != NULL)
{
struct mafComp *mc;
for (mc = maf->components; mc != NULL; mc = mc->next)
{
if (mc->text != NULL)
toUpperN(mc->text, maf->textSize);
}
addCounts(maf, speciesHash, &speciesList);
mafAliFree(&maf);
}
mafFileFree(&mf);
}
slReverse(&speciesList);
for (species = speciesList; species != NULL; species = species->next)
{
fprintf(f, "counts: %s\t%ld\t%ld\t%ld\n", species->name, species->covCount, species->aliCount, species->idCount);
fprintf(f, "precents: %s\t%4.2f%%\t%4.2f%%\t%4.2f%%\n",
species->name, 100.0 * species->covCount/genomeSize,
100.0 * species->aliCount/genomeSize,
100.0 * species->idCount/species->aliCount);
}
carefulClose(&f);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:49,代码来源:mafStats.c
示例17: output_matrix_long
void output_matrix_long(struct perBaseMatrix *pbm, int decimals, struct slName *labels, boolean keep_bed, int left,
int right, int tile, boolean header, char *outputfile)
/* long output. right this is just patching things up. this and some other stuff could be combined */
/* with aggregate some day. */
{
FILE *out = mustOpen(outputfile, "w");
int i,j,k, lr_pos;
int n_labels = slCount(labels);
int unfused_cols = pbm->ncol / n_labels;
assert(unfused_cols == (left+right)/tile);
struct slName *lab;
if (header)
{
if (keep_bed)
fprintf(out, "chrom\tchromStart\tchromEnd\tname\tscore\tstrand\tSignal\tPosition\tValue\n");
else
fprintf(out, "Signal\tRegion\tPosition\tValue\n");
}
/* Do label, region, Position, Value */
for (lr_pos = -1 *left, k = 0; (lr_pos <= right) && (k < unfused_cols); lr_pos += (lr_pos + tile == 0) ? 2*tile : tile, k++)
{
for (lab = labels, j = 0; (lab != NULL) && (j < n_labels); lab = lab->next, j++)
{
for (i = 0; i < pbm->nrow; i++)
{
int jj = j*unfused_cols + k;
struct perBaseWig *pbw = pbm->array[i];
if (keep_bed)
{
char strand = pbw->strand[0];
char *chrom = pbw->chrom;
int chromStart = k*tile + pbw->chromStart;
if (strand == '-')
chromStart = pbw->chromEnd - k*tile - 1;
fprintf(out, "%s\t%d\t%d\t", chrom, chromStart, chromStart + tile);
fprintf(out, "%s\t", pbw->name);
fprintf(out, "%d\t%c\t", pbw->score, strand);
}
fprintf(out, "%s\t", lab->name);
if (!keep_bed)
fprintf(out, "%s\t", (pbw->name) ? pbw->name : ".");
fprintf(out, "%d\t", lr_pos);
na_or_num(out, pbm->matrix[i][jj], decimals);
fprintf(out, "\n");
}
}
}
carefulClose(&out);
}
开发者ID:CRG-Barcelona,项目名称:bwtool,代码行数:49,代码来源:matrix.c
示例18: bwtool_find_extrema
void bwtool_find_extrema(struct hash *options, char *favorites, char *regions, unsigned decimals, double fill, char *bigfile, char *tmp_dir, char *outputfile)
/* find local extrema */
{
unsigned min_sep = sqlUnsigned((char *)hashOptionalVal(options, "min-sep", "0"));
char *other_bigfile = (char *)hashOptionalVal(options, "against", NULL);
enum ex_removal rem = get_removal(options);
struct metaBig *main_big = metaBigOpen_check(bigfile, tmp_dir, regions);
struct metaBig *other_big = NULL;
struct extrema *main_list;
struct extrema *other_list = NULL;
struct extrema *ex;
unsigned shift = 0;
FILE *out;
if (other_bigfile)
{
char *num;
if (rem == no_removal)
errAbort("must specify either -maxima or -minima with -against");
if (!strchr(other_bigfile, ','))
errAbort("must specify shift limit in -against option");
num = chopPrefixAt(other_bigfile, ',');
shift = sqlUnsigned(num);
other_big = metaBigOpen_check(other_bigfile, tmp_dir, regions);
}
if (!main_big || (!other_big && other_bigfile))
errAbort("could not open bigWig file");
main_list = extrema_find(main_big, min_sep, rem);
slReverse(&main_list);
if (other_bigfile)
{
other_list = extrema_find(other_big, min_sep, rem);
extrema_find_shifts(main_list, other_list, shift);
}
metaBigClose(&main_big);
if (other_big)
metaBigClose(&other_big);
out = mustOpen(outputfile, "w");
if (other_bigfile)
for (ex = main_list; ex != NULL; ex = ex->next)
fprintf(out, "%s\t%d\t%d\t%d\t1000\t%c\n", ex->chrom, ex->chromStart, ex->chromStart+1, (int)ex->val, ex->min_or_max);
else
{
slSort(&main_list, extrema_bed_cmp);
for (ex = main_list; ex != NULL; ex = ex->next)
fprintf(out, "%s\t%d\t%d\t%0.*f\t1000\t%c\n", ex->chrom, ex->chromStart, ex->chromStart+1, decimals, ex->val, ex->min_or_max);
}
carefulClose(&out);
extrema_free_list(&main_list);
}
开发者ID:CRG-Barcelona,项目名称:bwtool,代码行数:49,代码来源:find.c
示例19: safeGetOne
boolean safeGetOne(char *source, char *md5, char *dest)
/* Fetch file from source to tmp file. Check md5. If
* it doesn't work return FALSE. If it does work
* rename tmp file to dest and return TRUE. */
{
struct dyString *command = dyStringNew(0);
boolean ok = TRUE;
int err;
dyStringClear(command);
dyStringPrintf(command, "wget -nv --timestamping -O %s '%s'",
tmpName, source);
verbose(1, "%s\n", command->string);
if ((err = system(command->string)) != 0)
{
warn("Error %d on %s", err, command->string);
ok = FALSE;
}
verbose(1, "wget returned %d\n", err);
/* Make up a little md5 file. */
if (ok)
{
FILE *f = mustOpen(md5tmp, "w");
fprintf(f, "%s %s\n", md5, tmpName);
carefulClose(&f);
/* Run md5sum. */
dyStringClear(command);
dyStringPrintf(command, "md5sum -c %s", md5tmp);
verbose(1, "%s\n", command->string);
err = system(command->string);
verbose(1, "md5sum returned %d\n", err);
if (err != 0)
{
warn("md5sum failed on %s", source);
ok = FALSE;
}
}
/* Rename file to proper name */
if (ok)
{
if ((err = rename(tmpName, dest)) < 0)
errnoAbort("Couldn't rename %s to %s", tmpName, dest);
}
dyStringFree(&command);
return ok;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:49,代码来源:gensatFtpImages.c
示例20: regBedStats
void regBedStats(char *fileOfFiles, char *output)
/* regBedStats - Go through bed files and calculate a bunch of statistics on them. */
{
struct slName *in, *inList = readAllLines(fileOfFiles);
FILE *f = mustOpen(output, "w");
int colCount = max(chromColIx, startColIx);
colCount = max(colCount, endColIx);
colCount = max(colCount, scoreColIx);
colCount += 1;
for (in = inList; in != NULL; in = in->next)
{
bedFileStats(in->name, colCount, f);
}
carefulClose(&f);
}
开发者ID:davidhoover,项目名称:kent,代码行数:15,代码来源:regBedStats.c
注:本文中的carefulClose函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论