示例#1
0
int main(int argc, char *argv[])
{
    char *listName = "finished.new";
    char *fofName = "unfinished_acc.fof";
    char *outName = "frags.txt";
    FILE *out = mustOpen(outName, "w");
    struct fof *fof = fofOpen(fofName, NULL);
    struct kvt *kvt = newKvt(64);
    char line[512];
    int lineCount = 0;
    FILE *lf;
    char *keyText;
    char *s, *t;
    int size;

    lf = mustOpen(listName, "r");
    while (fgets(line, sizeof(line), lf))
    {
        ++lineCount;
        kvtClear(kvt);
        s = trimSpaces(line);
        t = strchr(s, '.');
        if (t != NULL)
            *t = 0;
        keyText = fofFetchString(fof, s, &size);
        kvtParseAdd(kvt, keyText);
        fprintf(out, "%s phase %s frags %s\n", s, kvtLookup(kvt, "pha"), kvtLookup(kvt, "frg"));
        freez(&keyText);
    }
    freeKvt(&kvt);
    return 0;
}
示例#2
0
int main(int argc, char *argv[])
/* Check parameters, set up, loop through each GenBank file. */
{
char *gbName;
int argi = 1;
struct hash *estAuthorHash = NULL;
char *pepFa;

optionInit(&argc, argv, optionSpecs);
if (argc < 4)
    usage();

gByAccPrefixSize = optionInt("byAccPrefix", 0);
gbIdxName = optionVal("gbidx", NULL);
pepFa = optionVal("pepFa", NULL);
gbType = gbParseType(optionVal("type", "mrna,est"));
gbOrg  = optionVal("org", NULL);
inclXMs = optionExists("inclXMs");

if (gByAccPrefixSize > 4)  /* keep small to avoid tons of open files */
    errAbort("max value of -byAccPrefix is 4");

gCurAccPrefix[0] = '\0';

faName = argv[argi++];
raName = argv[argi++];

estAuthorHash = newHash(23);
kvt = newKvt(5*1024);
gbfInit();

if (pepFa != NULL)
    gPepFa = gbFaOpen(pepFa,"w");

char *blackList = optionVal("blackList", NULL);
if (blackList != NULL)
    blackListRanges = genbankBlackListParse(blackList);

while (argi < argc)
    {
    gbName = argv[argi++];
    printf("Processing %s into %s and %s\n", gbName, faName, raName);
    procOneGbFile(gbName, estAuthorHash);
    }

gbFaClose(&faFile);
gbFaClose(&gPepFa);
carefulClose(&raFile);
carefulClose(&gbIdxFile);

return 0;
}
示例#3
0
int main(int argc, char *argv[])
{
char *com;
char **raFiles = NULL;
int raCount = 0;
char *expFile;
char *expression;
size_t size;
struct keyExp *exp;
int i;

if (argc < 4)
    usage();
expFile = argv[1];
com = argv[2];
if (sameWord(com, "count"))
    {
    command = ctCount;
    out = stdout;
    raCount = argc-3;
    raFiles = argv+3;
    }
else if (sameWord(com, "print"))
    {
    if (argc < 5)
        usage();
    command = ctPrint;
    selectKey = argv[3];
    out = stdout;
    raCount = argc-4;
    raFiles = argv+4;
    }
else if (sameWord(com, "save"))
    {
    if (argc < 6)
        usage();
    command = ctPrint;
    selectKey = argv[3];
    out = mustOpen(argv[4], "w");
    raCount = argc-5;
    raFiles = argv+5;
    }
else if (sameWord(com, "stats"))
    {
    if (argc < 6)
        usage();
    command = ctStats;
    selectKey = argv[3];
    out = mustOpen(argv[4], "w");
    raCount = argc-5;
    raFiles = argv+5;
    statHash = newHash(20);
    }
else if (sameWord(com, "hist"))
    {
    if (argc < 6)
        usage();
    command = ctHist;
    selectKey = argv[3];
    out = mustOpen(argv[4], "w");
    raCount = argc-5;
    raFiles = argv+5;
    statHash = newHash(18);
    }
if (sameWord(expFile, "all"))
    exp = NULL;
else
    {
    readInGulp(expFile, &expression, &size);
    exp = keyExpParse(expression);
    }
kvt = newKvt(128);
for (i=0; i<raCount; ++i)
    {
    scanFile(exp, raFiles[i]);
    }
printf("%d matched %s\n", matchCount, expFile);

if (command == ctStats)
    {
    struct useCount *u;
    slSort(&useCounts, cmpUse);
    for (u = useCounts; u != NULL; u = u->next)
        {
        fprintf(out, "%d %s\n", u->count, u->what);
        }
    printf("%d unique values for %s\n", slCount(useCounts), selectKey);
    }
else if (command == ctHist)
    {
    struct useCount *u;
    fillInVal(useCounts);
    slSort(&useCounts, cmpVal);
    fprintf(out, "value   uses\n");
    fprintf(out, "------------\n");
    for (u=useCounts; u != NULL; u = u->next)
        {
        fprintf(out, "%5d  %5d\n", u->val, u->count);
        }
    }
return 0;
}