本文整理汇总了C++中carefulClose函数的典型用法代码示例。如果您正苦于以下问题:C++ carefulClose函数的具体用法?C++ carefulClose怎么用?C++ carefulClose使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了carefulClose函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}