本文整理汇总了C++中chopLine函数的典型用法代码示例。如果您正苦于以下问题:C++ chopLine函数的具体用法?C++ chopLine怎么用?C++ chopLine使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了chopLine函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lineFileOpen
struct mapPos *readInfoFile(char *mapName)
/* Read maps from file. */
{
struct lineFile *lf = lineFileOpen(mapName, TRUE);
int lineSize, wordCount;
char *line, *words[16];
struct mapPos *list = NULL, *el;
lineFileNeedNext(lf, &line, &lineSize);
while (lineFileNext(lf, &line, &lineSize))
{
if (line[0] == '#')
continue;
wordCount = chopLine(line, words);
lineFileExpectWords(lf, 3, wordCount);
AllocVar(el);
el->cloneName = cloneString(words[0]);
el->pos = atoi(words[1]);
el->phase = atoi(words[2]);
slAddHead(&list, el);
}
lineFileClose(&lf);
slReverse(&list);
return list;
}
开发者ID:davidhoover,项目名称:kent,代码行数:25,代码来源:agpVsMap.c
示例2: parseColumnHeaderRow
static void parseColumnHeaderRow(struct vcfFile *vcff, char *line)
/* Make sure column names are as we expect, and store genotype sample IDs if any are given. */
{
if (line[0] != '#')
{
vcfFileErr(vcff, "Expected to find # followed by column names (\"#CHROM POS ...\"), "
"not \"%s\"", line);
lineFileReuse(vcff->lf);
return;
}
char *words[VCF_MAX_COLUMNS];
int wordCount = chopLine(line+1, words);
if (wordCount >= VCF_MAX_COLUMNS)
vcfFileErr(vcff, "header contains at least %d columns; "
"VCF_MAX_COLUMNS may need to be increased in vcf.c!", VCF_MAX_COLUMNS);
expectColumnName(vcff, "CHROM", words, 0);
expectColumnName(vcff, "POS", words, 1);
expectColumnName(vcff, "ID", words, 2);
expectColumnName(vcff, "REF", words, 3);
expectColumnName(vcff, "ALT", words, 4);
expectColumnName2(vcff, "QUAL", "PROB", words, 5);
expectColumnName(vcff, "FILTER", words, 6);
expectColumnName(vcff, "INFO", words, 7);
if (wordCount > 8)
{
expectColumnName(vcff, "FORMAT", words, 8);
if (wordCount < 10)
vcfFileErr(vcff, "FORMAT column is given, but no sample IDs for genotype columns...?");
vcff->genotypeCount = (wordCount - 9);
vcff->genotypeIds = vcfFileAlloc(vcff, vcff->genotypeCount * sizeof(char *));
int i;
for (i = 9; i < wordCount; i++)
vcff->genotypeIds[i-9] = vcfFileCloneStr(vcff, words[i]);
}
}
开发者ID:vatlab,项目名称:VariantTools,代码行数:35,代码来源:vcf.c
示例3: AllocVar
struct blastFile *blastFileOpenVerify(char *fileName)
/* Open file, read and verify header. */
{
struct blastFile *bf;
char *line;
char *words[16];
int wordCount;
struct lineFile *lf;
AllocVar(bf);
bf->lf = lf = lineFileOpen(fileName, TRUE);
bf->fileName = cloneString(fileName);
/* Parse first line - something like: */
line = bfNeedNextLine(bf);
wordCount = chopLine(line, words);
if (wordCount < 3)
bfBadHeader(bf);
bf->program = cloneString(words[0]);
bf->version = cloneString(words[1]);
bf->buildDate = cloneString(words[2]);
if (!wildMatch("*BLAST*", bf->program))
bfBadHeader(bf);
if (!isdigit(bf->version[0]))
bfBadHeader(bf);
if (bf->buildDate[0] != '[')
bfBadHeader(bf);
return bf;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:29,代码来源:blastParse.c
示例4: startSeqQuery
static struct gfRange *gfQuerySeq(int conn, struct dnaSeq *seq)
/* Ask server for places sequence hits. */
{
struct gfRange *rangeList = NULL, *range;
char buf[256], *row[6];
int rowSize;
startSeqQuery(conn, seq, "query");
/* Read results line by line and save in list, and return. */
for (;;)
{
netRecieveString(conn, buf);
if (sameString(buf, "end"))
{
break;
}
else if (startsWith("Error:", buf))
{
gfServerWarn(seq, buf);
break;
}
else
{
rowSize = chopLine(buf, row);
if (rowSize < 6)
errAbort("Expecting 6 words from server got %d", rowSize);
range = gfRangeLoad(row);
slAddHead(&rangeList, range);
}
}
slReverse(&rangeList);
return rangeList;
}
开发者ID:davidhoover,项目名称:kent,代码行数:34,代码来源:gfBlatLib.c
示例5: wormGeneForOrf
boolean wormGeneForOrf(char *orfName, char *geneNameBuf, int bufSize)
/* Look for gene type (unc-12 or something) synonym for cosmid.N name. */
{
FILE *f;
char fileName[512];
char lineBuf[512];
int nameLen = strlen(orfName);
boolean ok = FALSE;
sprintf(fileName, "%sorf2gene", wormFeaturesDir());
f = mustOpen(fileName, "r");
while (fgets(lineBuf, sizeof(lineBuf), f))
{
if (strncmp(lineBuf, orfName, nameLen) == 0 && lineBuf[nameLen] == ' ')
{
char *words[2];
int wordCount;
wordCount = chopLine(lineBuf, words);
assert((int)strlen(words[1]) < bufSize);
strncpy(geneNameBuf, words[1], bufSize);
ok = TRUE;
break;
}
}
fclose(f);
return ok;
}
开发者ID:CRG-Barcelona,项目名称:libbeato,代码行数:27,代码来源:wormdna.c
示例6: findBedSize
int findBedSize(char *fileName, struct lineFile **retLf)
/* Read first line of file and figure out how many words in it. */
/* Input file could be stdin, in which case we really don't want to open,
* read, and close it here. So if retLf is non-NULL, return the open
* linefile (having told it to reuse the line we just read). */
{
struct lineFile *lf = lineFileOpen(fileName, TRUE);
char *words[64], *line;
int wordCount;
if (!lineFileNextReal(lf, &line))
if (ignoreEmpty)
return(0);
line = cloneString(line);
if (strictTab)
wordCount = chopTabs(line, words);
else
wordCount = chopLine(line, words);
if (wordCount == 0)
errAbort("%s appears to be empty", fileName);
if (retLf != NULL)
{
lineFileReuse(lf);
*retLf = lf;
}
else
lineFileClose(&lf);
freeMem(line);
return wordCount;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:30,代码来源:hgLoadBed.c
示例7: mustOpen
struct lump *readLumps(char *fileName)
/* Read in lumps from file. */
{
struct lump *lumpList = NULL, *lump = NULL;
char line[1024];
int lineCount;
char *words[3];
int wordCount;
boolean isIndented;
FILE *f = mustOpen(fileName, "r");
while (fgets(line, sizeof(line), f))
{
++lineCount;
isIndented = isspace(line[0]);
wordCount = chopLine(line, words);
if (wordCount == 0)
continue; /* Allow blank lines. */
if (isIndented)
{
if (wordCount != 2 || !isdigit(words[0][0]))
errAbort("Bad line %d of %s\n", lineCount, fileName);
lump->count += atoi(words[0]);
}
else
{
AllocVar(lump);
lump->seq = cloneString(words[0]);
slAddHead(&lumpList, lump);
}
}
fclose(f);
slReverse(&lumpList);
return lumpList;
}
开发者ID:davidhoover,项目名称:kent,代码行数:35,代码来源:strainLumps.c
示例8: mustOpen
struct pgo *readC2g(char *fileName)
/* Read a C2g file into memory. */
{
FILE *f = mustOpen(fileName, "r");
struct pgo *list = NULL, *el;
char lineBuf[128];
char *words[4];
int wordCount;
int lineCount = 0;
while (fgets(lineBuf, sizeof(lineBuf), f) != NULL)
{
++lineCount;
wordCount = chopLine(lineBuf, words);
if (wordCount == 0)
continue; /* Ignore blank lines. */
if (wordCount != 3)
{
errAbort("Strange line starting with %s line %d of %s",
words[0], lineCount, fileName);
}
AllocVar(el);
if (!wormParseChromRange(words[0], &el->chrom, &el->start, &el->end))
errAbort("Bad chromosome range line %d of %s", lineCount, fileName);
el->strand = words[1][0];
el->gene = cloneString(words[2]);
slAddHead(&list, el);
}
slReverse(&list);
return list;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:31,代码来源:makepgo.c
示例9: strlen
char *findEnsTrans(struct lineFile *lf, char *line)
/* Find transcript name out of ensemble line. Squawk and die
* if a problem. */
{
char *words[32];
int wordCount, i;
char *pat = "Translation:";
int patSize = strlen(pat);
wordCount = chopLine(line+1, words);
for (i=0; i<wordCount; ++i)
{
if (startsWith(pat, words[i]))
return words[i] + patSize;
}
// Ensembl appears to have changed their format recently; handle both formats.
wordCount = chopString(line+1, "|", words, ArraySize(words));
if (wordCount >= 3)
{
char *ptr = strchr(words[2], '.');
if (ptr != NULL) *ptr = 0;
return(words[2]);
}
errAbort("Couldn't find '%s' key for transcript name line %d of %s",
pat, lf->lineIx, lf->fileName);
return NULL;
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:27,代码来源:hgPepPred.c
示例10: main
int main(int argc, char *argv[])
{
char *inName, *name;
int chunkSize = 4048*1024;
FILE *in;
int accSize = 0;
int newAccSize;
int oneSize;
char line[512];
int lineCount;
char *words[16];
int wordCount;
struct slName *bacs = NULL, *bn;
char *dirName;
char *outDir;
if (argc != 4)
usage();
inName = argv[1];
dirName = argv[2];
outDir = argv[3];
in = mustOpen(inName, "r");
while (fgets(line, sizeof(line), in))
{
char *sizeString;
++lineCount;
wordCount = chopLine(line, words);
if (wordCount == 0)
continue;
if (wordCount != 9)
errAbort("Line %d of %s doesn't look like an ls -l line", lineCount, inName);
sizeString = words[4];
if (!isdigit(sizeString[0]))
errAbort("Line %d of %s doesn't look like an ls - l line", lineCount, inName);
name = words[8];
oneSize = atoi(sizeString);
newAccSize = accSize + oneSize;
if (newAccSize > chunkSize)
{
finishJob(&bacs, accSize);
accSize = oneSize;
if (oneSize > chunkSize)
warn("Size %d of %s exceed chunk size %d", oneSize, name, chunkSize);
}
else
{
accSize = newAccSize;
}
bn = newSlName(name);
slAddHead(&bacs, bn);
}
if (bacs != NULL)
finishJob(&bacs, accSize);
printf("%d total jobs\n", jobCount);
writeInLists(outDir, dirName);
//writeJobs("job", "in", startMachine, stopMachine, "cc");
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:60,代码来源:patJobs.c
示例11: trackDbSetting
struct consWiggle *wigMafWiggles(char *db, struct trackDb *tdb)
/* get conservation wiggle table names and labels from trackDb setting,
ignoring those where table doesn't exist */
{
char *fields[20];
int fieldCt;
int i;
char *wigTable, *wigLabel;
struct consWiggle *wig, *wigList = NULL;
char *setting = trackDbSetting(tdb, CONS_WIGGLE);
if (!setting)
return NULL;
fieldCt = chopLine(cloneString(setting), fields);
for (i = 0; i < fieldCt; i += 3)
{
wigTable = fields[i];
if (hTableExists(db, wigTable));
{
AllocVar(wig);
wig->table = cloneString(wigTable);
wigLabel = (i+1 == fieldCt ? DEFAULT_CONS_LABEL : fields[i+1]);
wig->leftLabel = cloneString(wigLabel);
wigLabel = (i+2 >= fieldCt ? wig->leftLabel : fields[i+2]);
wig->uiLabel = cloneString(wigLabel);
slAddTail(&wigList, wig);
}
}
return wigList;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:29,代码来源:hgMaf.c
示例12: getSizes
void getSizes(char *fileName, int *retU, int *retN)
/* Add together sizes in a gold file */
{
struct lineFile *lf = lineFileOpen(fileName, TRUE);
int lineSize, wordCount;
char *line, *words[16];
int start,end,size;
int u = 0, n = 0;
while (lineFileNext(lf, &line, &lineSize))
{
wordCount = chopLine(line, words);
if (wordCount < 8)
errAbort("Short line %d of %s\n", lf->lineIx, lf->fileName);
start = atoi(words[1]) - 1;
end = atoi(words[2]);
size = end-start;
if (words[4][0] == 'N' || words[4][0] == 'U')
n += size;
else
u += size;
}
lineFileClose(&lf);
*retU = u;
*retN = n;
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:26,代码来源:uniqSize.c
示例13: getXrefInfo
static void getXrefInfo(struct sqlConnection *conn,
char **retXrefTable, char **retIdField,
char **retAliasField)
/* See if curTrack specifies an xref/alias table for lookup of IDs. */
{
char *xrefSpec = curTrack ? trackDbSetting(curTrack, "idXref") : NULL;
char *xrefTable = NULL, *idField = NULL, *aliasField = NULL;
if (xrefSpec != NULL)
{
char *words[3];
chopLine(cloneString(xrefSpec), words);
if (isEmpty(words[2]))
errAbort("trackDb error: track %s, setting idXref must be followed "
"by three words (xrefTable, idField, aliasField).",
curTrack->track);
xrefTable = words[0];
idField = words[1];
aliasField = words[2];
if (!sqlTableExists(conn, xrefTable) ||
sqlFieldIndex(conn, xrefTable, idField) < 0 ||
sqlFieldIndex(conn, xrefTable, aliasField) < 0)
xrefTable = idField = aliasField = NULL;
}
if (retXrefTable != NULL)
*retXrefTable = xrefTable;
if (retIdField != NULL)
*retIdField = idField;
if (retAliasField != NULL)
*retAliasField = aliasField;
}
开发者ID:maximilianh,项目名称:kent,代码行数:30,代码来源:identifiers.c
示例14: rt1dFind
void rt1dFind(char *tabFile, char *treeFile, char *chrom, bits32 start, bits32 end)
/* rt1dCreate - find items in 1-D range tree. */
{
struct lineFile *lf = lineFileOpen(tabFile, TRUE);
struct crTreeFile *crf = crTreeFileOpen(treeFile);
struct fileOffsetSize *block, *blockList = crTreeFindOverlappingBlocks(crf, chrom, start, end);
verbose(2, "Got %d overlapping blocks\n", slCount(blockList));
for (block = blockList; block != NULL; block = block->next)
{
verbose(2, "block->offset %llu, block->size %llu\n", block->offset, block->size);
lineFileSeek(lf, block->offset, SEEK_SET);
bits64 sizeUsed = 0;
while (sizeUsed < block->size)
{
char *line;
int size;
if (!lineFileNext(lf, &line, &size))
errAbort("Couldn't read %s\n", lf->fileName);
char *parsedLine = cloneString(line);
char *row[3];
if (chopLine(parsedLine, row) != ArraySize(row))
errAbort("Badly formatted line of %s\n%s", lf->fileName, line);
char *bedChrom = row[0];
bits32 bedStart = sqlUnsigned(row[1]);
bits32 bedEnd = sqlUnsigned(row[2]);
if (sameString(bedChrom, chrom) && rangeIntersection(bedStart, bedEnd, start, end) > 0)
fprintf(stdout, "%s\n", line);
freeMem(parsedLine);
sizeUsed += size;
}
}
crTreeFileClose(&crf);
}
开发者ID:davidhoover,项目名称:kent,代码行数:33,代码来源:rt1dTest.c
示例15: main
int main(int argc, char *argv[])
{
FILE *in = stdin;
FILE *out = stdout;
char origLine[1024];
char line[1024];
char *words[256];
int wordCount;
struct hash *hash;
int wordIx;
char *word;
if (argc != 2 || !isdigit(argv[1][0]))
errAbort("Usage: %s wordIx", argv[0]);
wordIx = atoi(argv[1]);
hash = newHash(14);
while (fgets(line, sizeof(line), in))
{
strcpy(origLine, line);
wordCount = chopLine(line, words);
if (wordCount < 1 || words[0][0] == '#')
continue;
if (wordCount >= wordIx)
{
word = words[wordIx-1];
if (!hashLookup(hash, word))
{
fprintf(out, "%s", origLine);
hashAdd(hash, word, NULL);
}
}
}
}
开发者ID:davidhoover,项目名称:kent,代码行数:34,代码来源:sources.c
示例16: readMotionOnly
bool ProjectAnimData::readMotionOnly(QFile *file){
if (!file || !file->isOpen()){
return false;
}
QByteArray line;
auto ok = false;
auto lineCount = 0UL;
if (!chopLine(file, line, lineCount)){
return false;
}
auto blocksize = line.toULong(&ok);
if (!ok){
return false;
}
animationMotionDataLines = blocksize;
while (!file->atEnd()){ //Read individual projects...
lineCount = 0;
for (; lineCount < blocksize;){ //Get animation motion data...
animationMotionData.append(new SkyrimAnimationMotionData(this));
if (!animationMotionData.last()->read(file, lineCount)){
return false;
}
}
return true;
}
return false;
}
开发者ID:Zartar,项目名称:Skyrim-Behavior-Editor-,代码行数:27,代码来源:projectanimdata.cpp
示例17: mustOpen
struct hash *makePairHash(char *pairFile)
/* Make up a hash table out of paired ESTs. */
{
FILE *f = mustOpen(pairFile, "r");
char line[256];
char *words[3];
int wordCount;
int lineCount = 0;
struct hash *hash;
struct hashEl *h5, *h3;
struct estPair *ep;
char *name5, *name3;
hash = newHash(19);
while (fgets(line, sizeof(line), f))
{
++lineCount;
wordCount = chopLine(line, words);
if (wordCount == 0)
continue;
if (wordCount != 2)
errAbort("%d words in pair line %d of %s", wordCount, lineCount, pairFile);
name5 = words[0];
name3 = words[1];
AllocVar(ep);
h5 = hashAdd(hash, name5, ep);
h3 = hashAdd(hash, name3, ep);
ep->name5 = h5->name;
ep->name3 = h3->name;
slAddHead(&estPairList, ep);
}
printf("Read %d lines of pair info\n", lineCount);
return hash;
}
开发者ID:davidhoover,项目名称:kent,代码行数:34,代码来源:patSpace.c
示例18: chopLine
struct psl *nextPsl(struct lineFile *lf)
/* Read next line from file and convert it to psl. Return
* NULL at eof. */
{
char *line;
int lineSize;
char *words[32];
int wordCount;
struct psl *psl;
if (!lineFileNext(lf, &line, &lineSize))
{
return NULL;
}
wordCount = chopLine(line, words);
if (wordCount == 21)
{
return pslLoad(words);
}
else
{
errAbort("Bad line %d of %s, %d words expecting %d", lf->lineIx, lf->fileName, wordCount, 21);
return NULL;
}
}
开发者ID:CEpBrowser,项目名称:CEpBrowser--from-UCSC-CGI-BIN,代码行数:25,代码来源:pslSplit.c
示例19: parseBlockLine
static boolean parseBlockLine(struct blastFile *bf, int *startRet, int *endRet,
struct dyString *seq)
/* read and parse the next target or query line, like:
* Query: 26429 taccttgacattcctcagtgtgtcatcatcgttctctcctccaaacggcgagagtccgga 26488
*
* also handle broken NCBI tblastn output like:
* Sbjct: 1181YYGEQRSTNGQTIQLKTQVFRRFPDDDDESEDHDDPDNAHESPEQEGAEGHFDLHYYENQ 1360
*
* Ignores and returns FALSE on bogus records generated by PSI BLAST, such as
* Query: 0 --------------------------
* Sbjct: 38 PPGPPGVAGGNQTTVVVIYGPPGPPG 63
* Query: 0
* Sbjct: 63 63
* If FALSE is returned, the output parameters will be unchanged.
*/
{
char* line = bfNeedNextLine(bf);
int a, b, s, e;
char *words[16];
int wordCount = chopLine(line, words);
if ((wordCount < 2) || (wordCount > 4) || !(sameString("Query:", words[0]) || sameString("Sbjct:", words[0])))
bfSyntax(bf);
/* look for one of the bad formats to ignore, as described above */
if (((wordCount == 2) && isAllDigits(words[1]))
|| ((wordCount == 3) && isAllDigits(words[1]) && isAllDigits(words[2]))
|| ((wordCount == 3) && isAllDigits(words[1]) && isAllDashes(words[2])))
{
bfWarn(bf, "Ignored invalid alignment format for aligned sequence pair");
return FALSE;
}
/* special handling for broken output with no space between start and
* sequence */
if (wordCount == 3)
{
char *p;
if (!isdigit(words[1][0]) || !isdigit(words[2][0]))
bfSyntax(bf);
a = atoi(words[1]);
b = atoi(words[2]);
p = words[1];
while ((*p != '\0') && (isdigit(*p)))
p++;
dyStringAppend(seq, p);
}
else
{
if (!isdigit(words[1][0]) || !isdigit(words[3][0]))
bfSyntax(bf);
a = atoi(words[1]);
b = atoi(words[3]);
dyStringAppend(seq, words[2]);
}
s = min(a,b);
e = max(a,b);
*startRet = min(s, *startRet);
*endRet = max(e, *endRet);
return TRUE;
}
开发者ID:blumroy,项目名称:kentUtils,代码行数:60,代码来源:blastParse.c
示例20: addCtgFile
void addCtgFile(char *liftFileName, struct ctgPos **pCtgList)
/* Create ctgPos's out of liftSpecs in liftFile. */
{
struct lineFile *lf = lineFileOpen(liftFileName, TRUE);
int lineSize, wordCount;
char *line, *words[16];
struct liftSpec lift;
struct ctgPos *ctg;
printf("Processing %s\n", liftFileName);
while (lineFileNext(lf, &line, &lineSize))
{
wordCount = chopLine(line, words);
if (wordCount == 0)
continue;
if (wordCount != 5)
errAbort("Expecting 5 words line %d of %s", lf->lineIx, lf->fileName);
liftSpecStaticLoad(words, &lift);
AllocVar(ctg);
ctg->contig = cloneString(skipPastSlash(lift.oldName));
ctg->size = lift.oldSize;
ctg->chrom = cloneString(lift.newName);
ctg->chromStart = lift.offset;
ctg->chromEnd = lift.offset + lift.oldSize;
slAddHead(pCtgList, ctg);
}
lineFileClose(&lf);
}
开发者ID:elmargb,项目名称:kentUtils,代码行数:28,代码来源:hgCtgPos.c
注:本文中的chopLine函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论