示例#1
0
struct ernaHit *parseHit(char *line)
/* Convert hit from text format to binary. */
{
char *words[32];
int wordCount;
char *parts[3];
int partCount;
char *nucs[2];
int nucCount;
struct ernaHit *hit;

AllocVar(hit);
wordCount = chopLine(line, words);
hit->score = atof(words[0]);
partCount = chopString(words[1], ":", parts, ArraySize(parts));
hit->chrom = wormOfficialChromName(parts[0]);
hit->pos = atoi(parts[1])-1;
nucCount = chopString(words[2], "->", nucs, ArraySize(nucs));
hit->from = nucs[0][0];
hit->to = nucs[1][0];
hit->totalCdna = atoi(words[10]);
hit->commonErr = atoi(words[7]);
return hit;
}
示例#2
0
boolean wormParseChromRange(char *in, char **retChromId, int *retStart, int *retEnd)
/* Chop up a string representation of a range within a chromosome and put the
 * pieces into the return variables. Return FALSE if it isn't formatted right. */
{
char *words[5];
int wordCount;
char *chromId;
char buf[128];

strncpy(buf, in, sizeof(buf));
wordCount = chopString(buf, "- \t\r\n:", words, ArraySize(words));
if (wordCount != 3)
    return FALSE;
chromId = wormOfficialChromName(words[0]);
if (chromId == NULL)
    return FALSE;
if (!isdigit(words[1][0]) || !isdigit(words[2][0]))
    return FALSE;
*retChromId = chromId;
*retStart = atoi(words[1]);
*retEnd = atoi(words[2]);
wormClipRangeToChrom(chromId, retStart, retEnd);
return TRUE;
}