本文整理汇总了C++中errAbort函数的典型用法代码示例。如果您正苦于以下问题:C++ errAbort函数的具体用法?C++ errAbort怎么用?C++ errAbort使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了errAbort函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pslSort
void pslSort(char *command, char *outFile, char *tempDir, char *inDirs[], int inDirCount)
/* Do the two step sort. */
{
int i;
struct slName *fileList = NULL, *name;
char *inDir;
struct slName *dirDir, *dirFile;
char fileName[512];
int fileCount;
int totalFilesProcessed = 0;
int filesPerMidFile;
int midFileCount = 0;
FILE *f;
struct lineFile *lf;
boolean doReflect = FALSE;
boolean suppressSelf = FALSE;
boolean firstOnly = endsWith(command, "1");
boolean secondOnly = endsWith(command, "2");
if (startsWith("dirs", command))
;
else if (startsWith("g2g", command))
{
doReflect = TRUE;
suppressSelf = TRUE;
}
else
usage();
if (!secondOnly)
{
makeDir(tempDir);
/* Figure out how many files to process. */
for (i=0; i<inDirCount; ++i)
{
inDir = inDirs[i];
dirDir = listDir(inDir, "*.psl");
if (slCount(dirDir) == 0)
dirDir = listDir(inDir, "*.psl.gz");
if (slCount(dirDir) == 0)
errAbort("No psl files in %s\n", inDir);
verbose(1, "%s with %d files\n", inDir, slCount(dirDir));
for (dirFile = dirDir; dirFile != NULL; dirFile = dirFile->next)
{
sprintf(fileName, "%s/%s", inDir, dirFile->name);
name = newSlName(fileName);
slAddHead(&fileList, name);
}
slFreeList(&dirDir);
}
verbose(1, "%d files in %d dirs\n", slCount(fileList), inDirCount);
slReverse(&fileList);
fileCount = slCount(fileList);
filesPerMidFile = round(sqrt(fileCount));
// if (filesPerMidFile > 20)
// filesPerMidFile = 20; /* bandaide! Should keep track of mem usage. */
verbose(1, "Got %d files %d files per mid file\n", fileCount, filesPerMidFile);
/* Read in files a group at a time, sort, and write merged, sorted
* output of one group. */
name = fileList;
while (totalFilesProcessed < fileCount)
{
int filesInMidFile = 0;
struct psl *pslList = NULL, *psl;
int lfileCount = 0;
struct lm *lm = lmInit(256*1024);
for (filesInMidFile = 0; filesInMidFile < filesPerMidFile && name != NULL;
++filesInMidFile, ++totalFilesProcessed, name = name->next)
{
boolean reflectMe = FALSE;
if (doReflect)
{
reflectMe = !selfFile(name->name);
}
verbose(2, "Reading %s (%d of %d)\n", name->name, totalFilesProcessed+1, fileCount);
lf = pslFileOpen(name->name);
while ((psl = nextLmPsl(lf, lm)) != NULL)
{
if (psl->qStart == psl->tStart && psl->strand[0] == '+' &&
suppressSelf && sameString(psl->qName, psl->tName))
{
continue;
}
++lfileCount;
slAddHead(&pslList, psl);
if (reflectMe)
{
psl = mirrorLmPsl(psl, lm);
slAddHead(&pslList, psl);
}
}
lineFileClose(&lf);
}
slSort(&pslList, pslCmpQuery);
makeMidName(tempDir, midFileCount, fileName);
verbose(1, "Writing %s\n", fileName);
f = mustOpen(fileName, "w");
//.........这里部分代码省略.........
开发者ID:kenongit,项目名称:sequencing,代码行数:101,代码来源:pslSort.c
示例2: netConnectHttps
int netConnectHttps(char *hostName, int port)
/* Start https connection with server or die. */
{
errAbort("No openssl available in netConnectHttps for %s : %d", hostName, port);
return -1; /* will never get to here, make compiler happy */
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:6,代码来源:https.c
示例3: usage
void usage()
{
errAbort("vulgarToPsl - Convert the vulgar exonerate format to PSL.\n"
"usage:\n"
" vulgarToPsl input.vul proteinQ.fa dnaT.fa output.psl");
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:6,代码来源:vulgarToPsl.c
示例4: hgLoadChromGraph
void hgLoadChromGraph(boolean doLoad, char *db, char *track, char *fileName)
/* hgLoadChromGraph - Load up chromosome graph. */
{
double minVal,maxVal;
struct chromGraph *el, *list;
FILE *f;
char *tempDir = ".";
char path[PATH_LEN], gbdbPath[PATH_LEN];
char *idTable = optionVal("idTable", NULL);
char *pathPrefix = NULL;
if (idTable == NULL)
list = chromGraphLoadAll(fileName);
else
list = chromGraphListWithTable(fileName, db, idTable);
if (list == NULL)
errAbort("%s is empty", fileName);
/* Figure out min/max values */
minVal = maxVal = list->val;
for (el = list->next; el != NULL; el = el->next)
{
if (optionExists("minusLog10"))
{
if (el->val == 1)
el->val = 0;
else if (el->val > 0)
el->val = -1 * log(el->val)/log(10);
}
if (el->val < minVal)
minVal = el->val;
if (el->val > maxVal)
maxVal = el->val;
}
/* Sort and write out temp file. */
slSort(&list, chromGraphCmp);
f = hgCreateTabFile(tempDir, track);
for (el = list; el != NULL; el = el->next)
chromGraphTabOut(el, f);
if (doLoad)
{
struct dyString *dy = dyStringNew(0);
struct sqlConnection *conn;
/* Set up connection to database and create main table. */
conn = hAllocConn(db);
dyStringPrintf(dy, createString, track, hGetMinIndexLength(db));
sqlRemakeTable(conn, track, dy->string);
/* Load main table and clean up file handle. */
hgLoadTabFile(conn, tempDir, track, &f);
hgRemoveTabFile(tempDir, track);
/* If need be create meta table. If need be delete old row. */
if (!sqlTableExists(conn, "metaChromGraph"))
sqlUpdate(conn, metaCreateString);
else
{
dyStringClear(dy);
dyStringPrintf(dy, "delete from metaChromGraph where name = '%s'",
track);
sqlUpdate(conn, dy->string);
}
/* Make chrom graph file */
safef(path, sizeof(path), "%s.cgb", track);
chromGraphToBin(list, path);
safef(path, sizeof(path), "/gbdb/%s/chromGraph", db);
pathPrefix = optionVal("pathPrefix", path);
safef(gbdbPath, sizeof(gbdbPath), "%s/%s.cgb", pathPrefix, track);
/* Create new line in meta table */
dyStringClear(dy);
dyStringPrintf(dy, "insert into metaChromGraph values('%s',%f,%f,'%s');",
track, minVal, maxVal, gbdbPath);
sqlUpdate(conn, dy->string);
}
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:81,代码来源:hgLoadChromGraph.c
示例5: main
/* entry */
int main(int argc, char** argv)
{
char *selectFile, *inFile, *outFile, *dropFile;
optionInit(&argc, argv, optionSpecs);
if (argc != 4)
usage("wrong # args");
selectFile = argv[1];
inFile = argv[2];
outFile = argv[3];
/* select file options */
if (optionExists("selectFmt") && optionExists("selectCoordCols"))
errAbort("can't specify both -selectFmt and -selectCoordCols");
if (optionExists("selectFmt"))
selectFmt = parseFormatSpec(optionVal("selectFmt", NULL));
else if (optionExists("selectCoordCols"))
{
selectCoordCols = coordColsParseSpec("selectCoordCols",
optionVal("selectCoordCols", NULL));
selectFmt = COORD_COLS_FMT;
}
else
selectFmt = getFileFormat(selectFile);
if (optionExists("selectCds"))
selectCaOpts |= chromAnnCds;
if (optionExists("selectRange"))
selectCaOpts |= chromAnnRange;
if ((selectFmt == PSLQ_FMT) || (selectFmt == CHAINQ_FMT))
selectCaOpts |= chromAnnUseQSide;
/* in file options */
if (optionExists("inFmt") && optionExists("inCoordCols"))
errAbort("can't specify both -inFmt and -inCoordCols");
if (optionExists("inFmt"))
inFmt = parseFormatSpec(optionVal("inFmt", NULL));
else if (optionExists("inCoordCols"))
{
inCoordCols = coordColsParseSpec("inCoordCols",
optionVal("inCoordCols", NULL));
inFmt = COORD_COLS_FMT;
}
else
inFmt = getFileFormat(inFile);
inCaOpts = chromAnnSaveLines; // need lines for output
if (optionExists("inCds"))
inCaOpts |= chromAnnCds;
if (optionExists("inRange"))
inCaOpts |= chromAnnRange;
if ((inFmt == PSLQ_FMT) || (inFmt == CHAINQ_FMT))
inCaOpts |= chromAnnUseQSide;
/* select options */
useAggregate = optionExists("aggregate");
nonOverlapping = optionExists("nonOverlapping");
if (optionExists("strand") && optionExists("oppositeStrand"))
errAbort("can only specify one of -strand and -oppositeStrand");
if (optionExists("strand"))
selectOpts |= selStrand;
if (optionExists("oppositeStrand"))
selectOpts |= selOppositeStrand;
if (optionExists("excludeSelf") && (optionExists("idMatch")))
errAbort("can't specify both -excludeSelf and -idMatch");
if (optionExists("excludeSelf"))
selectOpts |= selExcludeSelf;
if (optionExists("idMatch"))
selectOpts |= selIdMatch;
criteria.threshold = optionFloat("overlapThreshold", 0.0);
criteria.thresholdCeil = optionFloat("overlapThresholdCeil", 1.1);
criteria.similarity = optionFloat("overlapSimilarity", 0.0);
criteria.similarityCeil = optionFloat("overlapSimilarityCeil", 1.1);
criteria.bases = optionInt("overlapBases", -1);
/* output options */
mergeOutput = optionExists("mergeOutput");
idOutput = optionExists("idOutput");
statsOutput = optionExists("statsOutput") || optionExists("statsOutputAll") || optionExists("statsOutputBoth");
if ((mergeOutput + idOutput + statsOutput) > 1)
errAbort("can only specify one of -mergeOutput, -idOutput, -statsOutput, -statsOutputAll, or -statsOutputBoth");
outputAll = optionExists("statsOutputAll");
outputBoth = optionExists("statsOutputBoth");
if (outputBoth)
outputAll = TRUE;
if (mergeOutput)
{
if (nonOverlapping)
errAbort("can't use -mergeOutput with -nonOverlapping");
if (useAggregate)
errAbort("can't use -mergeOutput with -aggregate");
if ((selectFmt == CHAIN_FMT) || (selectFmt == CHAINQ_FMT)
|| (inFmt == CHAIN_FMT) || (inFmt == CHAINQ_FMT))
if (useAggregate)
errAbort("can't use -mergeOutput with chains");
selectCaOpts |= chromAnnSaveLines;
}
dropFile = optionVal("dropped", NULL);
//.........这里部分代码省略.........
开发者ID:blumroy,项目名称:kentUtils,代码行数:101,代码来源:overlapSelect.c
示例6: processMrnaFa
static void processMrnaFa(struct sqlConnection *conn, int taxon, char *type, char *db)
/* process isPcr results */
{
struct dyString *dy = dyStringNew(0);
struct lineFile *lf = lineFileOpen("mrna.fa", TRUE);
int lineSize;
char *line;
char *name;
char *dna;
boolean more = lineFileNext(lf, &line, &lineSize);
while(more)
{
if (line[0] != '>')
errAbort("unexpected error out of phase\n");
name = cloneString(line+1);
verbose(2,"name=%s\n",name);
dyStringClear(dy);
while((more=lineFileNext(lf, &line, &lineSize)))
{
if (line[0] == '>')
{
break;
}
dyStringAppend(dy,line);
}
dna = cloneString(dy->string);
while(1)
{
int oldProbe = 0;
dyStringClear(dy);
dyStringPrintf(dy, "select id from vgPrb "
"where taxon=%d and type='%s' and tName='%s' and state='new'",taxon,type,name);
oldProbe = sqlQuickNum(conn,dy->string);
if (oldProbe==0)
break; /* no more records match */
/* record exists and hasn't already been updated */
int vgPrb = findVgPrbBySeq(conn,dna,taxon);
if (vgPrb == 0)
{
dyStringClear(dy);
dyStringAppend(dy, "update vgPrb set");
dyStringAppend(dy, " seq = '");
dyStringAppend(dy, dna);
dyStringAppend(dy, "',\n");
dyStringPrintf(dy, " db = '%s',\n", db);
dyStringAppend(dy, " state = 'seq'\n");
dyStringPrintf(dy, " where id=%d\n", oldProbe);
dyStringPrintf(dy, " and state='%s'\n", "new");
verbose(2, "%s\n", dy->string);
sqlUpdate(conn, dy->string);
}
else /* probe seq already exists */
{
/* just re-map the probe table recs to it */
dyStringClear(dy);
dyStringPrintf(dy, "update vgPrbMap set vgPrb=%d where vgPrb=%d",vgPrb,oldProbe);
sqlUpdate(conn, dy->string);
/* and delete it from vgPrb */
dyStringClear(dy);
dyStringPrintf(dy, "delete from vgPrb where id=%d",oldProbe);
sqlUpdate(conn, dy->string);
}
}
freez(&name);
freez(&dna);
}
lineFileClose(&lf);
dyStringFree(&dy);
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:77,代码来源:vgProbeTrack.c
示例7: hAllocConn
struct annoStreamer *annoStreamDbNew(char *db, char *table, struct annoAssembly *aa,
struct asObject *asObj, int maxOutRows)
/* Create an annoStreamer (subclass) object from a database table described by asObj. */
{
struct sqlConnection *conn = hAllocConn(db);
if (!sqlTableExists(conn, table))
errAbort("annoStreamDbNew: table '%s' doesn't exist in database '%s'", table, db);
struct annoStreamDb *self = NULL;
AllocVar(self);
struct annoStreamer *streamer = &(self->streamer);
int dbtLen = strlen(db) + strlen(table) + 2;
char dbTable[dbtLen];
safef(dbTable, dbtLen, "%s.%s", db, table);
annoStreamerInit(streamer, aa, asObj, dbTable);
streamer->rowType = arWords;
streamer->setRegion = asdSetRegion;
streamer->nextRow = asdNextRow;
streamer->close = asdClose;
self->conn = conn;
self->table = cloneString(table);
char *asFirstColumnName = streamer->asObj->columnList->name;
if (sqlFieldIndex(self->conn, self->table, "bin") == 0)
{
self->hasBin = 1;
self->minFinestBin = binFromRange(0, 1);
}
if (self->hasBin && !sameString(asFirstColumnName, "bin"))
self->omitBin = 1;
if (!asdInitBed3Fields(self))
errAbort("annoStreamDbNew: can't figure out which fields of %s.%s to use as "
"{chrom, chromStart, chromEnd}.", db, table);
self->makeBaselineQuery = asdMakeBaselineQuery;
// When a table has an index on endField, sometimes the query optimizer uses it
// and that ruins the sorting. Fortunately most tables don't anymore.
self->endFieldIndexName = sqlTableIndexOnField(self->conn, self->table, self->endField);
self->notSorted = FALSE;
// Special case: genbank-updated tables are not sorted because new mappings are
// tacked on at the end.
if (isIncrementallyUpdated(table))
self->notSorted = TRUE;
self->mergeBins = FALSE;
self->maxOutRows = maxOutRows;
self->useMaxOutRows = (maxOutRows > 0);
self->needQuery = TRUE;
self->chromList = annoAssemblySeqNames(aa);
if (slCount(self->chromList) > 1000)
{
// Assembly has many sequences (e.g. scaffold-based assembly) --
// don't break up into per-sequence queries. Take our chances
// with mysql being unhappy about the sqlResult being open too long.
self->doQuery = asdDoQuerySimple;
self->nextRowRaw = nextRowFromSqlResult;
}
else
{
// All-chromosome assembly -- if table is large, perform a series of
// chunked queries.
self->doQuery = asdDoQueryChunking;
self->nextRowRaw = nextRowFromBuffer;
}
return (struct annoStreamer *)self;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:62,代码来源:annoStreamDb.c
示例8: AllocVar
struct gapCalc *gapCalcRead(struct lineFile *lf)
/* Create gapCalc from open file. */
{
int i, tableSize, startLong = -1;
struct gapCalc *gapCalc;
int *gapInitPos;
double *gapInitQGap;
double *gapInitTGap;
double *gapInitBothGap;
AllocVar(gapCalc);
/* Parse file. */
readTaggedNumLine(lf, "tableSize", 1, &tableSize, NULL);
readTaggedNumLine(lf, "smallSize", 1, &gapCalc->smallSize, NULL);
AllocArray(gapInitPos,tableSize);
AllocArray(gapInitQGap,tableSize);
AllocArray(gapInitTGap,tableSize);
AllocArray(gapInitBothGap,tableSize);
readTaggedNumLine(lf, "position", tableSize, gapInitPos, NULL);
readTaggedNumLine(lf, "qGap", tableSize, NULL, gapInitQGap);
readTaggedNumLine(lf, "tGap", tableSize, NULL, gapInitTGap);
readTaggedNumLine(lf, "bothGap", tableSize, NULL, gapInitBothGap);
/* Set up precomputed interpolations for small gaps. */
AllocArray(gapCalc->qSmall, gapCalc->smallSize);
AllocArray(gapCalc->tSmall, gapCalc->smallSize);
AllocArray(gapCalc->bSmall, gapCalc->smallSize);
for (i=1; i<gapCalc->smallSize; ++i)
{
gapCalc->qSmall[i] =
interpolate(i, gapInitPos, gapInitQGap, tableSize);
gapCalc->tSmall[i] =
interpolate(i, gapInitPos, gapInitTGap, tableSize);
gapCalc->bSmall[i] = interpolate(i, gapInitPos,
gapInitBothGap, tableSize);
}
/* Set up to handle intermediate values. */
for (i=0; i<tableSize; ++i)
{
if (gapCalc->smallSize == gapInitPos[i])
{
startLong = i;
break;
}
}
if (startLong < 0)
errAbort("No position %d in gapCalcRead()\n", gapCalc->smallSize);
gapCalc->longCount = tableSize - startLong;
gapCalc->qPosCount = tableSize - startLong;
gapCalc->tPosCount = tableSize - startLong;
gapCalc->bPosCount = tableSize - startLong;
gapCalc->longPos = cloneMem(gapInitPos + startLong, gapCalc->longCount * sizeof(int));
gapCalc->qLong = cloneMem(gapInitQGap + startLong, gapCalc->qPosCount * sizeof(double));
gapCalc->tLong = cloneMem(gapInitTGap + startLong, gapCalc->tPosCount * sizeof(double));
gapCalc->bLong = cloneMem(gapInitBothGap + startLong, gapCalc->bPosCount * sizeof(double));
/* Set up to handle huge values. */
gapCalc->qLastPos = gapCalc->longPos[gapCalc->qPosCount-1];
gapCalc->tLastPos = gapCalc->longPos[gapCalc->tPosCount-1];
gapCalc->bLastPos = gapCalc->longPos[gapCalc->bPosCount-1];
gapCalc->qLastPosVal = gapCalc->qLong[gapCalc->qPosCount-1];
gapCalc->tLastPosVal = gapCalc->tLong[gapCalc->tPosCount-1];
gapCalc->bLastPosVal = gapCalc->bLong[gapCalc->bPosCount-1];
gapCalc->qLastSlope = calcSlope(gapCalc->qLastPosVal, gapCalc->qLong[gapCalc->qPosCount-2],
gapCalc->qLastPos, gapCalc->longPos[gapCalc->qPosCount-2]);
gapCalc->tLastSlope = calcSlope(gapCalc->tLastPosVal, gapCalc->tLong[gapCalc->tPosCount-2],
gapCalc->tLastPos, gapCalc->longPos[gapCalc->tPosCount-2]);
gapCalc->bLastSlope = calcSlope(gapCalc->bLastPosVal, gapCalc->bLong[gapCalc->bPosCount-2],
gapCalc->bLastPos, gapCalc->longPos[gapCalc->bPosCount-2]);
freez(&gapInitPos);
freez(&gapInitQGap);
freez(&gapInitTGap);
freez(&gapInitBothGap);
return gapCalc;
}
开发者ID:sivarajankumar,项目名称:zinba,代码行数:77,代码来源:gapCalc.c
示例9: loadOneBed
void loadOneBed(struct lineFile *lf, int bedSize, struct bedStub **pList)
/* Load one bed file. Make sure all lines have the correct number of fields.
* Put results in *pList. */
{
char *words[64], *line, *dupe;
int wordCount;
struct bedStub *bed;
struct asObject *asObj = getAsObj(bedSize);
int fieldCount = getFieldCount(bedSize, asObj);
struct bed *validateBed;
AllocVar(validateBed);
verbose(1, "Reading %s\n", lf->fileName);
while (lineFileNextReal(lf, &line))
{
if (hasBin)
nextWord(&line);
dupe = cloneString(line);
if (strictTab)
wordCount = chopTabs(line, words);
else
wordCount = chopLine(line, words);
/* ignore empty lines */
if (0 == wordCount)
continue;
lineFileExpectWords(lf, fieldCount, wordCount);
if (type)
// TODO also, may need to add a flag to the validateBed() interface to support -allowNegativeScores when not isCt
// although can probably get away without it since usually -allowNegativeScores is used by ct which has already verified it.
// thus -allowNegativeScores is unlikely to be used with -type.
{
loadAndValidateBed(words, typeBedN, fieldCount, lf, validateBed, asObj, FALSE);
checkChromNameAndSize(lf, validateBed->chrom, validateBed->chromEnd);
}
AllocVar(bed);
bed->chrom = cloneString(words[0]);
bed->chromStart = lineFileNeedNum(lf, words, 1);
bed->chromEnd = lineFileNeedNum(lf, words, 2);
if (! noStrict)
{
if ((bed->chromEnd < 1) && !allowStartEqualEnd)
errAbort("ERROR: line %d:'%s'\nchromEnd is less than 1\n",
lf->lineIx, dupe);
if (bed->chromStart == bed->chromEnd && !allowStartEqualEnd)
errAbort("ERROR: line %d:'%s'\nchromStart == chromEnd (%d) (zero-length item)\n"
"Use -allowStartEqualEnd if that is legit (e.g. for insertion point).\n",
lf->lineIx, dupe, bed->chromStart);
if (bed->chromStart > bed->chromEnd)
errAbort("ERROR: line %d:'%s'\nchromStart after chromEnd (%d > %d)\n",
lf->lineIx, dupe, bed->chromStart, bed->chromEnd);
}
bed->line = dupe;
slAddHead(pList, bed);
}
if (asObj)
asObjectFreeList(&asObj);
freez(&validateBed);
}
开发者ID:davidhoover,项目名称:kent,代码行数:61,代码来源:hgLoadBed.c
示例10: AllocVar
struct bbiFile *bbiFileOpen(char *fileName, bits32 sig, char *typeName)
/* Open up big wig or big bed file. */
{
/* This code needs to agree with code in two other places currently - bigBedFileCreate,
* and bigWigFileCreate. I'm thinking of refactoring to share at least between
* bigBedFileCreate and bigWigFileCreate. It'd be great so it could be structured
* so that it could send the input in one chromosome at a time, and send in the zoom
* stuff only after all the chromosomes are done. This'd potentially reduce the memory
* footprint by a factor of 2 or 4. Still, for now it works. -JK */
struct bbiFile *bbi;
AllocVar(bbi);
bbi->fileName = cloneString(fileName);
struct udcFile *udc = bbi->udc = udcFileOpen(fileName, udcDefaultDir());
/* Read magic number at head of file and use it to see if we are proper file type, and
* see if we are byte-swapped. */
bits32 magic;
boolean isSwapped = FALSE;
udcMustRead(udc, &magic, sizeof(magic));
if (magic != sig)
{
magic = byteSwap32(magic);
isSwapped = TRUE;
if (magic != sig)
errAbort("%s is not a %s file", fileName, typeName);
}
bbi->typeSig = sig;
bbi->isSwapped = isSwapped;
/* Read rest of defined bits of header, byte swapping as needed. */
bbi->version = udcReadBits16(udc, isSwapped);
bbi->zoomLevels = udcReadBits16(udc, isSwapped);
bbi->chromTreeOffset = udcReadBits64(udc, isSwapped);
bbi->unzoomedDataOffset = udcReadBits64(udc, isSwapped);
bbi->unzoomedIndexOffset = udcReadBits64(udc, isSwapped);
bbi->fieldCount = udcReadBits16(udc, isSwapped);
bbi->definedFieldCount = udcReadBits16(udc, isSwapped);
bbi->asOffset = udcReadBits64(udc, isSwapped);
bbi->totalSummaryOffset = udcReadBits64(udc, isSwapped);
bbi->uncompressBufSize = udcReadBits32(udc, isSwapped);
/* Skip over reserved area. */
udcSeek(udc, 64);
/* Read zoom headers. */
int i;
struct bbiZoomLevel *level, *levelList = NULL;
for (i=0; i<bbi->zoomLevels; ++i)
{
AllocVar(level);
level->reductionLevel = udcReadBits32(udc, isSwapped);
level->reserved = udcReadBits32(udc, isSwapped);
level->dataOffset = udcReadBits64(udc, isSwapped);
level->indexOffset = udcReadBits64(udc, isSwapped);
slAddHead(&levelList, level);
}
slReverse(&levelList);
bbi->levelList = levelList;
/* Attach B+ tree of chromosome names and ids. */
udcSeek(udc, bbi->chromTreeOffset);
bbi->chromBpt = bptFileAttach(fileName, udc);
return bbi;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:65,代码来源:bbiRead.c
示例11: asCompareObjs
boolean asCompareObjs(char *name1, struct asObject *as1, char *name2, struct asObject *as2, int numColumnsToCheck,
int *retNumColumnsSame, boolean abortOnDifference)
/* Compare as-objects as1 and as2 making sure several important fields show they are the same name and type.
* If difference found, print it to stderr. If abortOnDifference, errAbort.
* Othewise, return TRUE if the objects columns match through the first numColumnsToCheck fields.
* If retNumColumnsSame is not NULL, then it will be set to the number of contiguous matching columns. */
{
boolean differencesFound = FALSE;
struct asColumn *col1 = as1->columnList, *col2 = as2->columnList;
int checkCount = 0;
int verboseLevel = 2;
if (abortOnDifference)
verboseLevel = 1;
if (as1->isTable != as2->isTable)
{
verbose(verboseLevel,"isTable does not match: %s=[%d] %s=[%d]", name1, as1->isTable, name2, as2->isTable);
differencesFound = TRUE;
}
else if (as1->isSimple != as2->isSimple)
{
verbose(verboseLevel,"isSimple does not match: %s=[%d] %s=[%d]", name1, as1->isSimple, name2, as2->isSimple);
differencesFound = TRUE;
}
else
{
if (!as1->isTable)
{
errAbort("asCompareObjLists only supports Table .as objects at this time.");
}
for (col1 = as1->columnList, col2 = as2->columnList;
col1 != NULL && col2 != NULL && checkCount < numColumnsToCheck;
col1 = col1->next, col2 = col2->next, ++checkCount)
{
if (!sameOk(col1->name, col2->name))
{
verbose(verboseLevel,"column #%d names do not match: %s=[%s] %s=[%s]\n"
, checkCount+1, name1, col1->name, name2, col2->name);
differencesFound = TRUE;
break;
}
else if (col1->isSizeLink != col2->isSizeLink)
{
verbose(verboseLevel,"column #%d isSizeLink do not match: %s=[%d] %s=[%d]\n"
, checkCount+1, name1, col1->isSizeLink, name2, col2->isSizeLink);
differencesFound = TRUE;
break;
}
else if (col1->isList != col2->isList)
{
verbose(verboseLevel,"column #%d isList do not match: %s=[%d] %s=[%d]\n"
, checkCount+1, name1, col1->isList, name2, col2->isList);
differencesFound = TRUE;
break;
}
else if (col1->isArray != col2->isArray)
{
verbose(verboseLevel,"column #%d isArray do not match: %s=[%d] %s=[%d]\n"
, checkCount+1, name1, col1->isArray, name2, col2->isArray);
differencesFound = TRUE;
break;
}
else if (!sameOk(col1->lowType->name, col2->lowType->name))
{
verbose(verboseLevel,"column #%d type names do not match: %s=[%s] %s=[%s]\n"
, checkCount+1, name1, col1->lowType->name, name2, col2->lowType->name);
differencesFound = TRUE;
break;
}
else if (col1->fixedSize != col2->fixedSize)
{
verbose(verboseLevel,"column #%d fixedSize do not match: %s=[%d] %s=[%d]\n"
, checkCount+1, name1, col1->fixedSize, name2, col2->fixedSize);
differencesFound = TRUE;
break;
}
else if (!sameOk(col1->linkedSizeName, col2->linkedSizeName))
{
verbose(verboseLevel,"column #%d linkedSizeName do not match: %s=[%s] %s=[%s]\n"
, checkCount+1, name1, col1->linkedSizeName, name2, col2->linkedSizeName);
differencesFound = TRUE;
break;
}
}
if (!differencesFound && checkCount < numColumnsToCheck)
errAbort("Unexpected error in asCompareObjLists: asked to compare %d columns in %s and %s, but only found %d in one or both asObjects."
, numColumnsToCheck, name1, name2, checkCount);
}
if (differencesFound)
{
if (abortOnDifference)
errAbort("asObjects differ.");
else
verbose(verboseLevel,"asObjects differ. Matching field count=%d\n", checkCount);
}
if (retNumColumnsSame)
*retNumColumnsSame = checkCount;
return (!differencesFound);
}
开发者ID:hjanime,项目名称:bwtool,代码行数:98,代码来源:asParse.c
示例12: fakeFinContigs
void fakeFinContigs(char *agpName, char *faName, char *finDir, char *rootName, char *finFaDir, char *ooVer)
/* fakeFinContigs - Fake up contigs for a finished chromosome. */
{
struct contig *contigList = NULL, *contig = NULL;
struct agpFrag *agp;
struct lineFile *lf = lineFileOpen(agpName, TRUE);
char *line, *words[16];
int lineSize, wordCount;
int contigIx = 0;
char liftDir[512], contigDir[512], path[512];
char chrom[128];
FILE *f;
struct dnaSeq *seq;
int fragIx;
/* Build up contig list by scanning agp file. */
printf("Reading %s\n", lf->fileName);
while (lineFileNext(lf, &line, &lineSize))
{
if (line[0] == '#' || line[0] == 0)
continue;
wordCount = chopLine(line, words);
if (wordCount < 5)
errAbort("Expecting at least 5 words line %d of %s", lf->lineIx, lf->fileName);
if (words[4][0] == 'N' || words[4][0] == 'U')
{
contig = NULL;
continue;
}
lineFileExpectWords(lf, 9, wordCount);
agp = agpFragLoad(words);
// file is 1-based but agpFragLoad() now assumes 0-based:
agp->chromStart -= 1;
agp->fragStart -= 1;
if (contig == NULL)
{
AllocVar(contig);
sprintf(contig->name, "%s%d", rootName, ++contigIx);
contig->startOffset = agp->chromStart;
slAddHead(&contigList, contig);
}
else
{
if (contig->agpList != NULL && contig->agpList->chromEnd != agp->chromStart)
errAbort("Start doesn't match previous end line %d of %s",
lf->lineIx, lf->fileName);
}
if (agp->chromEnd - agp->chromStart != agp->fragEnd - agp->fragStart)
errAbort("Chrom and frag size mismatch line %d of %s", lf->lineIx, lf->fileName);
slAddHead(&contig->agpList, agp);
contig->endOffset = agp->chromEnd;
}
slReverse(&contigList);
for (contig = contigList; contig != NULL; contig = contig->next)
slReverse(&contig->agpList);
lineFileClose(&lf);
/* Load up chromosome sequence and make sure it is in one piece. */
printf("Reading %s\n", faName);
seq = faReadAllDna(faName);
if (slCount(seq) != 1)
errAbort("Got %d sequences in %s, can only handle one.", slCount(seq), faName);
/* Fix up agp coordinates. Make a directory for each contig. Fill it with
* .fa .agp barge.NN files for that contig. */
printf("Writing contig dirs\n");
for (contig = contigList; contig != NULL; contig = contig->next)
{
/* Make Contig dir. */
sprintf(contigDir, "%s/%s", finDir, contig->name);
makeDir(contigDir);
/* Make contig.agp file. */
sprintf(path, "%s/%s.agp", contigDir, contig->name);
f = mustOpen(path, "w");
fragIx = 0;
for (agp = contig->agpList; agp != NULL; agp = agp->next)
{
char buf[128];
sprintf(buf, "%s/%s", skipChr(agp->chrom), contig->name);
freez(&agp->chrom);
agp->chrom = cloneString(buf);
agp->chromStart -= contig->startOffset;
agp->chromEnd -= contig->startOffset;
agp->ix = ++fragIx;
agpFragTabOut(agp, f);
}
carefulClose(&f);
/* Make ooGreedy.NN.gl file */
sprintf(path, "%s/%s.%s.gl", contigDir, "ooGreedy", ooVer);
f = mustOpen(path, "w");
for (agp = contig->agpList; agp != NULL; agp = agp->next)
{
if (agp->type[0] != 'N' && agp->type[0] != 'U')
{
fprintf(f, "%s_1\t%d\t%d\t%s\n", agp->frag,
agp->chromStart,
agp->chromEnd,
agp->strand);
//.........这里部分代码省略.........
开发者ID:bowhan,项目名称:kent,代码行数:101,代码来源:fakeFinContigs.c
示例13: printMimeInfo
void printMimeInfo(struct mimePart *mp, FILE *out, int level)
/* print mimeParts recursively if needed */
{
char *cd = NULL, *cdMain = NULL, *cdName = NULL, *cdFileName = NULL,
*ct = NULL, *ce = NULL;
char *margin = needMem(level+1);
int i = 0;
for(i=0;i<level;++i)
margin[i] = ' ';
margin[level] = 0;
cd = hashFindVal(mp->hdr,"content-disposition");
ct = hashFindVal(mp->hdr,"content-type");
ce = hashFindVal(mp->hdr,"content-transfer-encoding");
if (cd)
{
fprintf(out,"%scontent-disposition: %s\n",margin,cd);
cdMain=getMimeHeaderMainVal(cd);
cdName=getMimeHeaderFieldVal(cd,"name");
fprintf(out,"%smain:[%s]\n",margin,cdMain);
fprintf(out,"%sname:[%s]\n",margin,cdName);
cdFileName=getMimeHeaderFieldVal(cd,"filename");
if (cdFileName)
fprintf(out,"%sfilename:[%s]\n",margin,cdFileName);
}
if (ct)
fprintf(out,"%scontent-type: %s\n",margin,ct);
if (ce)
fprintf(out,"%scontent-transer-encoding: %s\n",margin,ce);
if (cd)
{
fprintf(out,"%ssize:[%llu]\n",margin,(unsigned long long) mp->size);
if (mp->binary)
fprintf(out,"%sbinary (contains zeros)\n",margin);
if (mp->fileName)
fprintf(out,"%sfileName=[%s]\n",margin, mp->fileName);
fprintf(out,"%sdata:[%s]\n",margin,
mp->binary && mp->data ? "<binary data not safe to print>" : mp->data);
fprintf(out,"\n");
}
if (mp->data)
{
}
else if (mp->fileName)
{
}
else if (mp->multi)
{
fprintf(out,"%snested MIME structure\n\n",margin);
for(mp=mp->multi;mp;mp=mp->next)
printMimeInfo(mp, out, level+1);
}
else
{
errAbort("mp-> type not data,fileName, or multi - unexpected MIME structure");
}
freez(&cdMain);
freez(&cdName);
freez(&cdFileName);
freez(&margin);
}
开发者ID:bh0085,项目名称:kent,代码行数:68,代码来源:mimeTester.c
示例14: main
int main(int argc, char *argv[])
/* Process command line. */
{
struct sqlConnection *conn = NULL;
char *command = NULL;
optionInit(&argc, argv, options);
database = optionVal("database", database);
sqlPath = optionVal("sqlPath", sqlPath);
if (argc < 2)
usage();
command = argv[1];
if (argc >= 3)
setCurrentDir(argv[2]);
conn = sqlConnect(database);
if (sameWord(command,"INIT"))
{
if (argc != 2)
usage();
errAbort("INIT is probably too dangerous. DO NOT USE.");
/*
init(conn);
*/
}
else if (sameWord(command,"POP"))
{
if (argc != 2)
usage();
/* populate vgPrb where missing */
populateMissingVgPrb(conn);
}
else if (sameWord(command,"SEQ"))
{
if (argc != 4)
usage();
/* make fake probe sequences */
makeFakeProbeSeq(conn,argv[3]);
}
else if (sameWord(command,"ALI"))
{
if (argc != 4)
usage();
/* blat anything left that is not aligned,
nor even attempted */
doAlignments(conn,argv[3]);
}
else if (sameWord(command,"EXT"))
{
if (argc != 4)
usage();
/* update seq and extfile as necessary */
doSeqAndExtFile(conn,argv[3],"vgProbes");
}
else if (sameWord(command,"PSLMAP"))
{
if (argc != 5)
usage();
/* pslMap anything left that is not aligned,
nor even attempted */
doAlignmentsPslMap(conn,argv[3],argv[4]);
}
else if (sameWord(command,"REMAP"))
{
if (argc != 7)
usage();
/* re-map anything in track specified that is not aligned,
nor even attempted yet, using specified fasta file. */
doAlignmentsReMap(conn,argv[3],argv[4],argv[5],argv[6]);
}
else if (sameWord(command,"SELFMAP"))
{
if (argc != 4)
usage();
/* re-map anything in track specified that is not aligned,
nor even attempted yet, using specified fasta file. */
doAlignmentsSelfMap(conn,argv[3]);
}
else if (sameWord(command,"EXTALL"))
{
if (argc != 4)
usage();
/* update seq and extfile as necessary */
doSeqAndExtFile(conn,argv[3],"vgAllProbes");
}
else
usage();
sqlDisconnect(&conn);
return 0;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:88,代码来源:vgProbeTrack.c
示例15: writeBedTab
void writeBedTab(char *fileName, struct bedStub *bedList)
/* Write out bed list to tab-separated file. */
{
struct bedStub *bed;
FILE *f = mustOpen(fileName, "w");
char *words[64];
int i, wordCount;
for (bed = bedList; bed != NULL; bed = bed->next)
{
if (!noBin)
{
// allow for zero-length at start of seq [bin code can't handle 0-0]
unsigned end = (bed->chromEnd > 0) ? bed->chromEnd : 1;
if (fprintf(f, "%u\t", hFindBin(bed->chromStart, end)) <= 0)
writeFailed(fileName);
}
if (strictTab)
wordCount = chopTabs(bed->line, words);
else
wordCount = chopLine(bed->line, words);
for (i=0; i<wordCount; ++i)
{
/* new definition for old "reserved" field, now itemRgb */
/* and when itemRgb, it is a comma separated string r,g,b */
if (itemRgb && (i == 8))
{
char *comma;
/* Allow comma separated list of rgb values here */
comma = strchr(words[8], ',');
if (comma)
{
int itemRgb = 0;
if (-1 == (itemRgb = bedParseRgb(words[8])))
errAbort("ERROR: expecting r,g,b specification, "
"found: '%s'", words[8]);
else
if (fprintf(f, "%d", itemRgb) <= 0)
writeFailed(fileName);
verbose(2, "itemRgb: %s, rgb: %#x\n", words[8], itemRgb);
}
else
if (fputs(words[i], f) == EOF)
writeFailed(fileName);
}
else if ((dotIsNull > 0) && (dotIsNull == i) && sameString(words[i],"."))
/* If the . was used to represent NULL, replace with -1 in the tables */
{
if (fputs("-1", f) == EOF)
writeFailed(fileName);
}
else
if (fputs(words[i], f) == EOF)
writeFailed(fileName);
if (i == wordCount-1)
{
if (fputc('\n', f) == EOF)
writeFailed(fileName);
}
else
if (fputc('\t', f) == EOF)
writeFailed(fileName);
}
}
fclose(f);
}
开发者ID:davidhoover,项目名称:kent,代码行数:67,代码来源:hgLoadBed.c
示例16: processIsPcr
static void processIsPcr(struct sqlConnection *conn, int taxon, char *db)
/* process isPcr results */
{
/* >NM_010919:371+1088 2 718bp CGCGGATCCAAGGACATCTTGGACCTTCCG CCCAAGCTTGCATGTGCTGCAGCGACTGCG */
struct dyString *dy = dyStringNew(0);
struct lineFile *lf = lineFileOpen("isPcr.fa", TRUE);
int lineSize;
char *line;
char *name;
char *dna;
char *word, *end;
char *tName;
int tStart;
int tEnd;
char *tStrand;
int probeid=0; /* really a vgPrb id */
boolean more = lineFileNext(lf, &line, &lineSize);
while(more)
{
if (line[0] != '>')
errAbort("unexpected error out of phase\n");
name = cloneString(line);
verbose(1,"name=%s\n",name);
dyStringClear(dy);
while((more=lineFileNext(lf, &line, &lineSize)))
{
if (line[0] == '>')
{
break;
}
dyStringAppend(dy,line);
}
dna = cloneString(dy->string);
word = name+1;
end = strchr(word,':');
tName = cloneStringZ(word,end-word);
word = end+1;
end = strchr(word,'+');
tStrand = "+";
if (!end)
{
end = strchr(word,'-');
tStrand = "-";
}
tStart = atoi(word);
word = end+1;
end = strchr(word,' ');
tEnd = atoi(word);
word = end+1;
end = strchr(word,' ');
probeid = atoi(word);
dyStringClear(dy);
dyStringPrintf(dy, "select count(*) from vgPrb where id=%d and state='new'",probeid);
if (sqlQuickNum(conn,dy->string)>0)
{
/* record exists and hasn't already been updated */
int vgPrb = findVgPrbBySeq(conn,dna,taxon);
if (vgPrb == 0)
{
dyStringClear(dy);
dyStringAppend(dy, "update vgPrb set");
dyStringAppend(dy, " seq='");
dyStringAppend(dy, dna);
dyStringAppend(dy, "',\n");
dyStringPrintf(dy, " tName='%s',\n", tName);
dyStringPrintf(dy, " tStart=%d,\n", tStart);
dyStringPrintf(dy, " tEnd=%d,\n", tEnd);
dyStringPrintf(dy, " tStrand='%s',\n", tStrand);
dyStringPrintf(dy, " db='%s',\n", db);
dyStringPrintf(dy, " state='%s'\n", "seq");
dyStringPrintf(dy, " where id=%d\n", probeid);
dyStringPrintf(dy, " and state='%s'\n", "new");
verbose(2, "%s\n", dy->string);
sqlUpdate(conn, dy->string);
}
else /* probe seq already exists */
{
/* just re-map the probe table recs to it */
dyStringClear(dy);
dyStringPrintf(dy, "update vgPrbMap set vgPrb=%d where vgPrb=%d",vgPrb,probeid);
sqlUpdate(conn, dy->string);
/* and delete it from vgPrb */
dyStringClear(dy);
dyStringPrintf(dy, "delete from vgPrb where id=%d",probeid);
sqlUpdate(conn, dy->string);
}
}
freez(&tName);
freez(&name);
freez(&dna);
}
lineFileClose(&lf);
dyStringFree(&dy);
//.........这里部分代码省略.........
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:101,代码来源:vgProbeTrack.c
|
请发表评论