void bigWigInfo(char *fileName)
/* bigWigInfo - Print out information about bigWig file.. */
{
struct bbiFile *bwf = bigWigFileOpen(fileName);

if (optionExists("minMax"))
    {
    struct bbiSummaryElement sum = bbiTotalSummary(bwf);
    printf("%f %f\n", sum.minVal, sum.maxVal);
    return;
    }

printf("version: %d\n", bwf->version);
printf("isCompressed: %s\n", (bwf->uncompressBufSize > 0 ? "yes" : "no"));
printf("isSwapped: %d\n", bwf->isSwapped);
printLabelAndLongNumber("primaryDataSize", bwf->unzoomedIndexOffset - bwf->unzoomedDataOffset);
if (bwf->levelList != NULL)
    {
    long long indexEnd = bwf->levelList->dataOffset;
    printLabelAndLongNumber("primaryIndexSize", indexEnd - bwf->unzoomedIndexOffset);
    }
printf("zoomLevels: %d\n", bwf->zoomLevels);
if (optionExists("zooms"))
    {
    struct bbiZoomLevel *zoom;
    for (zoom = bwf->levelList; zoom != NULL; zoom = zoom->next)
	printf("\t%d\t%d\n", zoom->reductionLevel, (int)(zoom->indexOffset - zoom->dataOffset));
    }
struct bbiChromInfo *chrom, *chromList = bbiChromList(bwf);
printf("chromCount: %d\n", slCount(chromList));
if (optionExists("chroms"))
    for (chrom=chromList; chrom != NULL; chrom = chrom->next)
	printf("\t%s %d %d\n", chrom->name, chrom->id, chrom->size);
struct bbiSummaryElement sum = bbiTotalSummary(bwf);
printLabelAndLongNumber("basesCovered", sum.validCount);
printf("mean: %f\n", sum.sumData/sum.validCount);
printf("min: %f\n", sum.minVal);
printf("max: %f\n", sum.maxVal);
printf("std: %f\n", calcStdFromSums(sum.sumData, sum.sumSquares, sum.validCount));
}
int main(int argc, char *argv[])
/* Process command line. */
{
    optionInit(&argc, argv, options);
    if (argc != 2)
        usage();
    fieldListIn = optionVal("fieldListIn", NULL);
    fieldListOut = optionVal("fieldListOut", NULL);
    identifier = optionVal("identifier", NULL);
    database = optionVal("database", NULL);
    checkFields = optionExists("fields");
    foreignKeys = optionExists("keys");
    dbCoverage = optionExists("dbCoverage");
    tableCoverage = optionExists("tableCoverage");
    checkTimes = optionExists("times");
    if (optionExists("all"))
    {
        checkFields = foreignKeys = dbCoverage = tableCoverage = checkTimes = TRUE;
    }
    allDbHash = sqlHashOfDatabases();
    if (database)
    {
        if (! hashLookup(allDbHash, database))
            errAbort("specified database '%s' not available", database);
    }
    joinerCheck(argv[1]);
    return 0;
}
Ejemplo n.º 3
0
CmdArgs::CmdArgs(int argc, char **argv) {
    if(optionExists(argv, argv + argc, "--help"))
        printHelpAndQuit(argc, argv);
    if(argc < 4)
        printErrorAndQuit(argc, argv);

    // Parse positional arguments.
    _input = argv[1];
    _output = argv[2];
    _numSamples = (int) strtol(argv[3], NULL, 10);
    stop_if(_numSamples <= 0, "Number of samples must be > 0.");

    // Init options with default values.
    _width = 800;
    _height = 600;
    _aaLevel = 1; // No AA.

    // Parse options.
    if(optionExists(argv, argv + argc, "-w")) {
        char *opt = getOption(argv, argv + argc, "-w");
        if(!opt) printErrorAndQuit(argc, argv);

        _width = (int) strtol(opt, NULL, 10);
    }
    if(optionExists(argv, argv + argc, "-h")) {
        char *opt = getOption(argv, argv + argc, "-h");
        if(!opt) printErrorAndQuit(argc, argv);

        _height = (int) strtol(opt, NULL, 10);
    }
    if(optionExists(argv, argv + argc, "-aa")) {
        char *opt = getOption(argv, argv + argc, "-aa");
        if(!opt) printErrorAndQuit(argc, argv);

        _aaLevel = (int) strtol(opt, NULL, 10);

        stop_if(_aaLevel <= 0,
                "Invalid anti aliasing level: must be > 0.");
    }
}
Ejemplo n.º 4
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;
}
Ejemplo n.º 5
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 3)
    usage();
workChr = optionVal("chr", NULL);
bedFileName = optionVal("bedFile", NULL);
insane = optionExists("insane");
minGap = optionInt("minGap", minGap);
gapToLift(argv[1], argv[2]);
return 0;
}
int main(int argc, char *argv[])
/* Process command line. */
{
    boolean doGl = FALSE;

    optionHash(&argc, argv);

    if (argc != 4 && argc != 3)
        usage();

    noLoad = optionExists("noLoad");
    if (noLoad)
        verbose(2,"#\tnoLoad option, leaving SQL files, no table loading\n");

    doGl = !(optionExists("noGl") || optionExists("nogl"));

    if (argc == 3)
        hgGoldGap(argv[1], argv[2]);
    else
        hgGoldGapGl(argv[1], argv[2], argv[3], doGl, optionVal("chrom", NULL));
    return 0;
}
Ejemplo n.º 7
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 3)
    usage();
clMaxErr = optionInt("maxErr", clMaxErr);
clSqlSymbols = optionExists("sqlSymbols");
if (!clSqlSymbols)
    gReservedHash = sqlReservedHash();
tagStormCheck(argv[1], argv[2]);
return 0;
}
Ejemplo n.º 8
0
void alphaChain(char *readsFile, char *monomerOrderFile, char *outFile)
/* alphaChain - Create Markov chain of words and optionally output chain in two formats. */
{
struct wordStore *store = wordStoreForChainsInFile(readsFile, maxChainSize);
struct wordTree *wt = store->markovChains;
wordStoreLoadMonomerOrder(store, readsFile, monomerOrderFile);
wordStoreNormalize(store, outSize);

if (optionExists("chain"))
    {
    char *fileName = optionVal("chain", NULL);
    wordTreeWrite(wt, store->maxChainSize, fileName);
    }

wordTreeGenerateFile(store, store->maxChainSize, pickRandom(wt->children), outSize, outFile);

if (optionExists("afterChain"))
    {
    char *fileName = optionVal("afterChain", NULL);
    wordTreeWrite(wt, store->maxChainSize, fileName);
    }
}
Ejemplo n.º 9
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, optionSpecs);
if (argc != 6)
    usage();
minSpace = optionInt("minSpace", minSpace);
minFill = optionInt("minFill", minSpace/2);
minScore = optionInt("minScore", minScore);
inclHap = optionExists("inclHap");
chainNet(argv[1], argv[2], argv[3], argv[4], argv[5]);
return 0;
}
Ejemplo n.º 10
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);

if (argc != 7)
    usage();

geneName = optionVal("geneName", geneName);
geneList = optionVal("geneList", geneList);
onlyChrom = optionVal("chrom", onlyChrom);
inExons = optionExists("exons");
noTrans = optionExists("noTrans");
transUC = optionExists("transUC");
delay = optionInt("delay", delay);

if ((geneName != NULL) && (geneList != NULL))
    errAbort("cannot specify both geneList and geneName");

mafToProtein(argv[1],argv[2],argv[3],argv[4],argv[5],argv[6]);
return 0;
}
Ejemplo n.º 11
0
void borfMatcher(char *bedIn, char *borfIn, char *bedOutFile, char *genePredOutFile)
/* Top level function to open files and call other functions. */
{
struct borf *borf = NULL, *borfList = NULL;
struct bed *bed = NULL, *bedList = NULL;
struct genePred *gp = NULL;
float threshold = optionFloat("minScore", 50);
FILE *bedOut = mustOpen(bedOutFile, "w");
FILE *genePredOut = mustOpen(genePredOutFile, "w");
boolean keepSmall = optionExists("keepSmall");
boolean keepNmd = optionExists("keepNmd");

borfList = borfLoadAll(borfIn);
bedList = bedLoadAll(bedIn);
dotForUserInit(slCount(bedList)/10);
for(bed = bedList, borf = borfList; bed != NULL && borf != NULL; bed = bed->next, borf = borf->next)
    {
    dotForUser();
    if(!stringIn(bed->name, borf->name))
	errAbort("Trying to match up %s bed with %s borf - bad idea!", bed->name, borf->name);
    /* Have to adjust cds end. Borf puts stop codon outside of cds, 
       we put it inside. */
    borf->cdsEnd = min(borf->cdsEnd+3, borf->size);
    if((borf->score > threshold || (keepSmall && borf->cdsSize > 0)) && sameString(borf->strand, "+"))
	{
	setThickStartStop(bed, borf);
	if(keepNmd || !nmdTarget(bed))
	    {
	    gp = bedToGenePred(bed);
	    bedTabOutN(bed, 12, bedOut);
	    genePredTabOut(gp, genePredOut);
	    genePredFree(&gp);
	    }
	}
    }
warn("Done.");
carefulClose(&bedOut);
carefulClose(&genePredOut);
}
Ejemplo n.º 12
0
void hgLoadSqlTab(char *database, char *table, char *createFile,
                  int inCount, char *inNames[])
/* hgLoadSqlTab - Load table into database from SQL and text files. */
{
    struct sqlConnection *conn = sqlConnect(database);

    int loadOptions = 0;
    int i=0;
    boolean oldTable = optionExists("oldTable") || optionExists("append");
    if (optionExists("warn"))
        loadOptions |= SQL_TAB_FILE_WARN_ON_ERROR;

    if (! optionExists("notOnServer"))
        loadOptions |= SQL_TAB_FILE_ON_SERVER;

    if (! oldTable)
    {
        struct dyString *dy = readAndReplaceTableName(createFile, table);
        sqlRemakeTable(conn, table, dy->string);
        dyStringFree(&dy);
    }
    verbose(1, "Scanning through %d files\n", inCount);
    for (i=0;  i < inCount;  i++)
    {
        verbose(2, "Loading file %s into table %s\n", inNames[i], table);
        if (sameString("stdin", inNames[i]))
            sqlLoadTabFile(conn, "/dev/stdin", table,
                           (loadOptions & ~SQL_TAB_FILE_ON_SERVER));
        else
            sqlLoadTabFile(conn, inNames[i], table, loadOptions);
    }
    if (oldTable)
        hgHistoryComment(conn, "Add contents of %d text file(s) to table %s.",
                         inCount, table);
    else
        hgHistoryComment(conn, "Load table %s directly from .sql and %d text file(s).",
                         table, inCount);
    sqlDisconnect(&conn);
}
int main(int argc, char *argv[])
/* Process command line. */
{
char *database, *accFile, *outFaFile;

optionInit(&argc, argv, optionSpecs);
if (argc != 4)
    usage();
database = argv[1];
accFile = argv[2];
outFaFile = argv[3];
cdsUpper = optionExists("cdsUpper");
cdsUpperAll = optionExists("cdsUpperAll");
if (cdsUpperAll)
    cdsUpper = TRUE;
inclVer = optionExists("inclVer");
peptides = optionExists("peptides");
if (peptides && (cdsUpper || cdsUpperAll))
    errAbort("can't specify -peptides with -cdsUpper or -cdsUpperAll");
getRna(database, accFile, outFaFile);
return 0;
}
Ejemplo n.º 14
0
void doGenePreds(struct sqlConnection *conn, char *db, char *orthoDb, char *chrom, 
	    char *netTable, char *geneFileName, char *geneTableName,
	    char *outBedName, char *selectedFileName, int *foundCount, int *notFoundCount)	
/* Map over genePreds. */
{
FILE *bedOut = NULL;
FILE *selectedOut = NULL;
FILE *cdsErrorFp = NULL;
struct genePred *gene = NULL, *geneList = NULL;
struct bed *bed = NULL;

//init output files
if(optionExists("cdsErrorFile"))
{
    cdsErrorFp = fopen( optionVal("cdsErrorFile", NULL), "w" );
    fprintf( cdsErrorFp, "#name\tchrom\ttxStart\ttxEnd\tcdsStart\tcdsEnd\tstrand\texonCount\n" );
    fclose(cdsErrorFp);
}

warn("Loading Gene Predictions.");
assert(outBedName);
if(geneFileName)
    geneList=genePredLoadAll(geneFileName);
else
    geneList=loadGeneFromTable(conn, geneTableName, chrom, 0, BIGNUM);
/* Convert genePreds. */
warn("Converting genes.");
bedOut = mustOpen(outBedName, "w");
if (selectedFileName != NULL)
    selectedOut = mustOpen(selectedFileName, "w");
for(gene = geneList; gene != NULL; gene = gene->next)
    {
    struct genePred *synGene = NULL;
    if(differentString(gene->chrom, chrom))
	continue;
    synGene = orthoBedFromGene(conn, db, orthoDb, netTable, gene);
    occassionalDot();
    if(synGene != NULL && synGene->exonCount > 0)
	{
	(*foundCount)++;
	genePredTabOut(synGene, bedOut);
        if (selectedOut != NULL)
            genePredTabOut(gene, selectedOut);
	}
    else
	(*notFoundCount)++;
    genePredFree(&synGene);
    }
carefulClose(&selectedOut);
 carefulClose(&bedOut);
}
void weedLines(char *weedFile, char *file, char *output, 
	boolean invert, char *invertOutput)
/* weedLines - Selectively remove lines from file. */
{
struct hash *hash = hashWordsInFile(weedFile, 16);
struct hashEl *weedList = hashElListHash(hash);
verbose(2, "%d words in weed file %s\n", hash->elCount, weedFile);
struct lineFile *lf = lineFileOpen(file, TRUE);
char *line, *word;
FILE *f = mustOpen(output, "w");
FILE *fInvert = NULL;
boolean embedded = optionExists("embedded");
if (invertOutput != NULL)
    fInvert = mustOpen(invertOutput, "w");

while (lineFileNext(lf, &line, NULL))
    {
    boolean doWeed = FALSE;
    char *dupe = NULL;
    if (embedded)
	{
	struct hashEl *hel;
	for (hel = weedList; hel != NULL; hel = hel->next)
	    {
	    if (stringIn(hel->name, line))
	        doWeed = TRUE;
	    }
	}
    else
	{
	dupe = cloneString(line);
	while ((word = nextWord(&line)) != NULL)
	    {
	    if (hashLookup(hash, word))
		doWeed = TRUE;
	    }
	line = dupe;
	}
    if (invert)
	doWeed = !doWeed;
    if (!doWeed)
	fprintf(f, "%s\n", line);
    else
	{
	if (fInvert != NULL)
	    fprintf(fInvert, "%s\n", line);
	}
    freez(&dupe);
    }
}
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
maxGap = optionInt("maxGap", maxGap);
maxChain = optionInt("maxChain", maxChain);
minIdRatio = optionFloat("minId", 0.0)/100.0;
minScore = optionFloat("minScore", minScore);
bedOut = optionExists("bed");
if (argc != 5)
    usage();
doIt(argv[1], argv[2], argv[3], argv[4]);
return 0;
}
Ejemplo n.º 17
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 3)
    usage();
database = optionVal("database", database);
doAverage = optionExists("average");
transpose = optionExists("transpose");
minAbsVal = optionFloat("minAbsVal", minAbsVal);
minMaxVal = optionInt("minMaxVal", minMaxVal);
c = optionDouble("addConst", c);
clump = optionVal("clump", clump);
doLoad = !optionExists("noLoad");
if (optionExists("tab"))
    {
    tabDir = optionVal("tab", tabDir);
    makeDir(tabDir);
    }
limit = optionInt("limit", limit);
hgRatioMicroarray(argv[1], argv[2]);
return 0;
}
Ejemplo n.º 18
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
struct hash *totals = NULL;
if (optionExists("total"))
    totals = newHash(0);
char *hubUrl = NULL;
if (argc == 2)
    hubUrl = argv[1];
else if (argc != 1)
    usage();
return hubTrackSettings(hubUrl, totals);
}
Ejemplo n.º 19
0
int main(int argc, char *argv[])
/* Process command line. */
{
    optionInit(&argc, argv, optionSpecs);
    if (argc != 6)
        usage();
    raName = optionVal("raName", raName);
    release = optionVal("release", release);
    releaseBit = getReleaseBit(release);
    adjustTrackDbName(argv[3]);
    hgFindSpec(argv[1], argv[2], argv[3], argv[4], argv[5],
               optionExists("strict"));
    return 0;
}
Ejemplo n.º 20
0
int main(int argc, char *argv[])
{
optionInit(&argc, argv, optionSpecs);

if(argc < 2)
    usage();

convolve_count = optionInt("count", 4);
logs = optionExists("logs");
html = optionExists("html");

if (verboseLevel() >= 2)
    {
    printf("options: -verbose, input file(s):\n");
    printf("-count=%d\n", convolve_count);
    printf("data input is in %s format\n", logs ? "log" : "probability");
    if (html) printf ("output in html format\n");
    }

convolve(argc, argv);

return(0);
}
Ejemplo n.º 21
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc < 3)
    usage();
if (optionExists("clampMax"))
    {
    gotClampMax = TRUE;
    clampMax = optionDouble("clampMax", clampMax);
    }
wigCorrelate(argc-1, argv+1, "stdout");
return 0;
}
Ejemplo n.º 22
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
database = optionVal("database", database);
chip = optionVal("chip", chip);
doLoad = !optionExists("noLoad");
noRound = optionExists("noRound");
chopName = optionVal("chopName", chopName);
expUrl = optionVal("url", expUrl);
expRef = optionVal("ref", expRef);
expCredit = optionVal("credit", expCredit);
if (optionExists("tab"))
    {
    tabDir = optionVal("tab", tabDir);
    makeDir(tabDir);
    }
limit = optionInt("limit", limit);
if (argc != 4)
    usage();
hgGnfMicroarray(argv[1], argv[2], argv[3]);
return 0;
}
Ejemplo n.º 23
0
int main(int argc, char *argv[])
/* Process command line. */
{
struct tm *tm;

if (argc < 2)
    usage();
optionInit(&argc, argv, options);

if (!optionExists("age"))
    {
    verbose(1,"ERROR: must specify an age argument, e.g.: -age=8\n");
    usage();
    }
if (time(&timeNow) < 1)
    errAbort("can not obtain current time via time() function\n");
tm = localtime(&timeNow);
ageHours = optionFloat("age", 0.0);
time_t ageSeconds = (time_t)(ageHours * 3600);	/*	age in seconds	*/
dropTime = timeNow - ageSeconds;
if (ageHours > 0.0)
    {
    verbose(2,"#	specified age = %f hours = %ld seconds\n", ageHours,
	(unsigned long)ageSeconds);
    verbose(2,"#	current time: %d-%02d-%02d %02d:%02d:%02d %ld\n",
	1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
        tm->tm_hour, tm->tm_min, tm->tm_sec, (unsigned long)timeNow);
    tm = localtime(&dropTime);
    verbose(2,"#	   drop time: %d-%02d-%02d %02d:%02d:%02d %ld\n",
	1900+tm->tm_year, 1+tm->tm_mon, tm->tm_mday,
        tm->tm_hour, tm->tm_min, tm->tm_sec, (unsigned long)dropTime);
    }
else
    {
    verbose(1,"ERROR: specified age %.f must be greater than 0.0\n", ageHours);
    usage();
    }
drop = optionExists("drop");
historyToo = optionExists("historyToo");
db = optionVal("db",db);
extFileCheck = optionExists("extFile");
extDel = optionExists("extDel");
tableStatus = optionExists("tableStatus");
topDir = optionVal("topDir", topDir);
verbose(2,"#	drop requested: %s\n", drop ? "TRUE" : "FALSE");
verbose(2,"#	    historyToo: %s\n", historyToo ? "TRUE" : "FALSE");
verbose(2,"#	       extFile: %s\n", extFileCheck ? "TRUE" : "FALSE");
verbose(2,"#	        extDel: %s\n", extDel ? "TRUE" : "FALSE");
verbose(2,"#	   tableStatus: %s\n", tableStatus ? "TRUE" : "FALSE");
verbose(2,"#	        topDir: %s\n", topDir);
verbose(2,"#	database: %s\n", db);

dbTrash(db);
if (verboseLevel() > 1)
    printVmPeak();
return 0;
}
Ejemplo n.º 24
0
int main(int argc, char *argv[])
/* Process command line. */
{
warn("Program obsolete - try using alphaAsm instead");
optionInit(&argc, argv, options);
if (argc != 4)
    usage();
maxChainSize = optionInt("size", maxChainSize);
outSize = optionInt("outSize", outSize);
fullOnly = optionExists("fullOnly");
int seed = optionInt("seed", (int)time(0));
srand(seed);
alphaChain(argv[1], argv[2], argv[3]);
return 0;
}
Ejemplo n.º 25
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);

if (argc != 3)
    usage();

ref    = optionVal("ref", ref);
number = optionExists("number");

segSplitPairwise(argv[1], argv[2]);

return(EXIT_SUCCESS);
}
Ejemplo n.º 26
0
int main(int argc, char* argv[])
{
optionInit(&argc, argv, options);
if (argc != 3)
    usage();
char *cdsFile = optionVal("cds", NULL);
bool doPosName = optionExists("posName");
struct hash *cdsHash = NULL;

if (cdsFile != NULL)
    cdsHash = getCdsHash(cdsFile);

pslToBed(argv[1], argv[2], cdsHash, doPosName);
return 0;
}
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, optionSpecs);
test = optionExists("test");
mergeGap = optionInt("mergeGap", mergeGap);
minSize = optionInt("minSize", minSize);
maxSize = optionInt("maxSize", maxSize);
minSeqSize = optionInt("minSeqSize", minSeqSize);
if (argc != 4)
    usage();
database = argv[1];
hgLoadMafSummary(database, argv[2], argv[3]);
return 0;
}
Ejemplo n.º 28
0
void paraTestJob(char *countString)
/* paraTestJob - A good test job to run on Parasol.  Can be configured to take a long time or crash. */
{
    int i, count = atoi(countString);
    char *outName = optionVal("output", NULL);
    int heavy = optionInt("heavy", 0);
    FILE *f = NULL;
    if (optionExists("input"))
        countLines(optionVal("input", NULL));
    if (outName != NULL)
        f = mustOpen(outName, "w");
    for (i=0; i<count; ++i)
    {
        compute();
        if (f != NULL)
        {
            int j;
            fprintf(f, "Computation number %d of %d.  Error so far is %f\n",
                    i+1, count, cumErr);
            for (j=0; j<heavy; ++j)
            {
                fprintf(f, "  I'm a lumberjack and I'm ok.  I work all night and I sleep all day\n");
            }
        }
    }
    printf("Cumulative error %f\n", cumErr);
    if (optionExists("sleep"))
        sleep(optionInt("sleep", 1));
    if (optionExists("err"))
        errAbort("Aborting with error");
    if (optionExists("crash"))
    {
        char *s = NULL;
        s[0] = 0;
    }
}
Ejemplo n.º 29
0
int main(int argc, char *argv[])
/* Process command line. */
{
optionInit(&argc, argv, options);
if (argc != 2 && argc != 3)
    usage();
restrictFile = optionVal("restrict", restrictFile);
threshold = optionDouble("threshold", threshold);
rootNames = optionExists("rootNames");
if (argc == 3)
    bigWigCorrelatePair(argv[1], argv[2]);
else
    bigWigCorrelateList(argv[1]);
return 0;
}
void testIntersect(char *db, char *track1, char *track2)
/* testIntersect - Test some ideas on intersections. */
{
struct slName *chromList = NULL, *chrom;
struct sqlConnection *conn;

hSetDb(db);
if (optionExists("chrom"))
    chromList = slNameNew(optionVal("chrom", NULL));
else
    chromList = hAllChromNames();
conn = hAllocConn();
for (chrom = chromList; chrom != NULL; chrom = chrom->next)
     intersectOnChrom(db, conn, chrom->name, track1, track2);
hFreeConn(&conn);
}