コード例 #1
0
struct hash *rbMerging(struct sqlConnection *conn, char *table)
/* Grab contents of bed table ordered by chrom but not sorted, 
 * then convert to chrom-hashed rbmTrees to handle merging of 
 * overlapping ranges. */
{
char *query = makeQuery(table, FALSE);
struct sqlResult *sr = NULL;
struct hash *chromTrees = NULL;
int startMs = 0, endMs = 0, totalMs = 0;

sqlUpdate(conn, "reset query cache");
startMs = clock1000();
sr = sqlGetResult(conn, query);
endMs = clock1000();
verbose(1, "rbMerging: Took %dms to do plain query.\n", endMs - startMs);
printf("%d\t", endMs - startMs);
totalMs += (endMs - startMs);

startMs = clock1000();
chromTrees = resultsToMergedTrees(sr);
endMs = clock1000();
verbose(1, "rbMerging: Took %dms to make merged trees.\n", endMs - startMs);
printf("%d\t", endMs - startMs);
totalMs += (endMs - startMs);

verbose(1, "rbMerging: Took %dms total.\n\n", totalMs);
printf("%d\n", totalMs);
freeMem(query);
sqlFreeResult(&sr);
return chromTrees;
}
コード例 #2
0
struct hash *jkSorting(struct sqlConnection *conn, char *table)
/* Grab contents of bed table into chrom-hashed range lists, 
 * using slSort() to sort by start; then merge ranges and 
 * convert to chrom-hashed rbTrees with normal rbTreeAdd. */
{
char *query = makeQuery(table, FALSE);
struct sqlResult *sr = NULL;
struct hash *chromTrees = NULL;
int startMs = 0, endMs = 0, totalMs = 0;

sqlUpdate(conn, "reset query cache");
startMs = clock1000();
sr = sqlGetResult(conn, query);
endMs = clock1000();
verbose(1, "jkSorting: Took %dms to do plain query.\n", endMs - startMs);
printf("%d\t", endMs - startMs);
totalMs += (endMs - startMs);

startMs = clock1000();
chromTrees = resultsToTrees(sr, TRUE);
endMs = clock1000();
verbose(1, "jkSorting: Took %dms to build, sort, merge, and convert.\n",
       endMs - startMs);
printf("%d\t", endMs - startMs);
totalMs += (endMs - startMs);

verbose(1, "jkSorting: Took %dms total.\n\n", totalMs);
printf("%d\t", totalMs);
freeMem(query);
sqlFreeResult(&sr);
return chromTrees;
}
コード例 #3
0
void chainPair(struct seqPair *sp,
	struct dnaSeq *qSeq, struct dnaSeq *tSeq, struct chain **pChainList,
	FILE *details)
/* Chain up blocks and output. */
{
struct chain *chainList, *chain, *next;
struct cBlock *b;
long startTime, dt;
int size = 0;
struct chainConnect cc;

verbose(1, "chainPair %s\n", sp->name);

/* Set up info for connect function. */
ZeroVar(&cc);
cc.query = qSeq;
cc.target = tSeq;
cc.ss = scoreScheme;
cc.gapCalc = gapCalc;

/* Score blocks. */
for (b = sp->blockList; b != NULL; b = b->next)
    {
    size = b->qEnd - b->qStart;
    checkBlockRange("query", qSeq, b->qStart, b->qEnd);
    checkBlockRange("target", tSeq, b->tStart, b->tEnd);
    b->score = axtScoreUngapped(scoreScheme, qSeq->dna + b->qStart, tSeq->dna + b->tStart, size);
    }


/* Get chain list and clean it up a little. */
startTime = clock1000();
chainList = chainBlocks(sp->qName, qSeq->size, sp->qStrand,
	sp->tName, tSeq->size, &sp->blockList,
	(ConnectCost)chainConnectCost, (GapCost)chainConnectGapCost,
	&cc, details);
dt = clock1000() - startTime;
verbose(1, "Main chaining step done in %ld milliseconds\n", dt);
for (chain = chainList; chain != NULL; chain = chain->next)
    {
    chainRemovePartialOverlaps(chain, qSeq, tSeq, scoreScheme->matrix);
    chainMergeAbutting(chain);
    chain->score = chainCalcScore(chain, scoreScheme, gapCalc,
    	qSeq, tSeq);
    }

/* Move chains scoring over threshold to master list. */
for (chain = chainList; chain != NULL; chain = next)
    {
    next = chain->next;
    if (chain->score >= minScore)
        {
	slAddHead(pChainList, chain);
	}
    else
        {
	chainFree(&chain);
	}
    }
}
コード例 #4
0
void relationRecon(char *fileName)
/* Do relationship based reconstruction. */
{
char **words;
long start, end;
struct sqlConnection *conn = sqlConnect(database);
struct sqlResult *sr;
char **row;
FILE *f = mustOpen(fileName, "w");
int lineCount;
int i;
char query[256];

start = clock1000();
words = loadWords();
end = clock1000();
printf("Time to load words: %4.3f\n", 0.001*(end-start));
start = clock1000();

lineCount = sqlTableSize(conn, "lineSize");
for (i=0; i<lineCount; ++i)
    {
    sprintf(query, "select * from lineWords where line = %d", i);
    sr = sqlQuery(conn, query);
    while ((row = sqlNextRow(sr)) != NULL)
	fileOutput(f,words[sqlUnsigned(row[1])]);
    sqlFreeResult(&sr);
    }
end = clock1000();
printf("Time to relation reconstruct file: %4.3f\n", 0.001*(end-start));
sqlDisconnect(&conn);
}
コード例 #5
0
ファイル: newStitch4.c プロジェクト: davidhoover/kent
void chainPair(struct seqPair *sp, FILE *f)
/* Make chains for all alignments in sp. */
{
long startTime, dt;
struct axt *axt;
struct cBlock *blockList, *block;
struct chain *chainList = NULL, *chain;

uglyf("%s %d nodes\n", sp->name, slCount(sp->blockList));

/* Make up tree and time it for debugging. */
startTime = clock1000();
chainList = chainBlocks(&sp->blockList, gapCost);
dt = clock1000() - startTime;
uglyf("Made %d chains in %5.3f seconds\n", slCount(chainList), dt*0.001);

/* Dump chains to file. */
for (chain = chainList; chain != NULL; chain = chain->next)
    {
    struct cBlock *first = chain->blockList;
    struct cBlock *last = slLastEl(first);
    struct cBlock *block;
    fprintf(f, "%s Chain %d, score %d, %d %d, %d %d:\n", 
	sp->name, slCount(chain->blockList), chain->score,
	first->qStart, last->qEnd, first->tStart, last->qEnd);
    for (block = chain->blockList; block != NULL; block = block->next)
        {
	fprintf(f, " %s q %d, t %d, score %d\n", sp->name,
		block->qStart, block->tStart, block->score);
	}
    fprintf(f, "\n");
    }
chainFreeList(&chainList);
uglyf("\n");
}
コード例 #6
0
ファイル: hgGene.c プロジェクト: ucscGenomeBrowser/kent
void printSections(struct section *sectionList, struct sqlConnection *conn,
	char *geneId)
/* Print each section in turn. */
{
struct section *section;
for (section = sectionList; section != NULL; section = section->next)
    {
    boolean isOpen = sectionIsOpen(section);
    char *otherState = (isOpen ? "1" : "0");
    char *indicator = (isOpen ? "-" : "+");
    char *indicatorImg = (isOpen ? "../images/remove.gif" : "../images/add.gif");
    struct dyString *header = dyStringNew(0);
    //keep the following line for future debugging need
    //printf("<br>printing %s section\n", section->name);fflush(stdout);
    dyStringPrintf(header, "<A NAME=\"%s\"></A>", section->name);
    char *closeVarName = sectionCloseVar(section->name);
    dyStringPrintf(header, "<A HREF=\"%s?%s&%s=%s#%s\" class=\"bigBlue\"><IMG src=\"%s\" alt=\"%s\" class=\"bigBlue\"></A>&nbsp;&nbsp;",
    	geneCgi, cartSidUrlString(cart), closeVarName, otherState, section->name, indicatorImg, indicator);
    dyStringAppend(header, section->longLabel);
    webNewSection("%s",header->string);
    if (isOpen)
	{
        long startTime = clock1000();
	section->print(section, conn, geneId);
        section->printTime = clock1000() - startTime;
	}
    else
	{
	printf("Press \"+\" in the title bar above to open this section.");
	}
    dyStringFree(&header);
    }
}
コード例 #7
0
ファイル: hgGene.c プロジェクト: ucscGenomeBrowser/kent
static void addGoodSection(struct section *section,
	struct sqlConnection *conn, struct section **pList)
/* Add section to list if it is non-null and exists returns ok. */
{
//uglyf("<br>adding %s section \n", section->name);fflush(stdout); 
if (section == NULL || hashLookup(section->settings, "hide") != NULL)
    return;
long startTime = clock1000();
if (section->exists(section, conn, curGeneId))
    {
    section->checkTime = clock1000() - startTime;
    slAddHead(pList, section);
    }
}
コード例 #8
0
ファイル: mainMain.c プロジェクト: maximilianh/kent
int main(int argc, char *argv[])
{
long enteredMainTime = clock1000();
measureTime(NULL);
setUdcCacheDir();
browserName = hBrowserName();
organization = "UCSC";

/* Push very early error handling - this is just
 * for the benefit of the cgiVarExists, which
 * somehow can't be moved effectively into doMiddle. */
htmlPushEarlyHandlers();
cgiSpoof(&argc, argv);
char * link = webTimeStampedLinkToResourceOnFirstCall("HGStyle.css",TRUE); // resource file link
if (link)                                                                  // wrapped in html
    htmlSetStyle(link);

oldVars = hashNew(10);

if (cgiVarExists("hgt.redirectTool"))
    {
    printf("Content-type: text/html\n\n");

    cart = cartForSession(hUserCookie(), NULL, NULL);
    printf("<html><body>\n");
    printf("<form id=\"redirForm\" method=\"POST\" action=\"http://tefor.net/crisporMax/crispor.cgi\">\n");
    printf("<input type=\"hidden\" name=\"pos\" value=\"%s\">", cartString(cart, "position"));
    printf("<input type=\"hidden\" name=\"org\" value=\"%s\">", cartString(cart, "db"));
    printf("<input type=\"hidden\" name=\"pam\" value=\"NGG\">\n");
    // a hidden submit button, see
    // http://stackoverflow.com/questions/477691/submitting-a-form-by-pressing-enter-without-a-submit-button
    printf("<input type=\"submit\" style=\"position: absolute; left: -9999px; width: 1px; height: 1px;\">\n");
    printf("</form>\n");
    // a little javascript that clicks the submit button
    printf("<script>document.getElementById(\"redirForm\").submit();</script>\n");
    printf("</body></html>\n");
    }
else
    cartHtmlShell("UCSC Genome Browser v"CGI_VERSION, doMiddle, hUserCookie(), excludeVars, oldVars);

if (measureTiming)
    measureTime("Time to write and close cart");
if (measureTiming)
    {
    fprintf(stdout, "<span class='timing'>Overall total time: %ld millis<br /></span>\n",
            clock1000() - enteredMainTime);
    }
cgiExitTime("hgTracks", enteredMainTime);
return 0;
}
コード例 #9
0
ファイル: ps02.c プロジェクト: bowhan/kent
struct patSpace *newPatSpace()
/* Return an empty pattern space. */
{
struct patSpace *ps;
long startTime, endTime;

startTime = clock1000();
ps = needLargeMem(sizeof(*ps));
endTime = clock1000();
startTime = clock1000();
memset(ps, 0, sizeof(*ps));
endTime = clock1000();
return ps;
}
コード例 #10
0
ファイル: synteny.c プロジェクト: davidhoover/kent
int main(int argc, char *argv[])
{
char *inName = "C:/biodata/cbriggsae/test/all.dyn";
char *outName = "synteny.out";
FILE *out = mustOpen(outName, "w");
long start, end;

dnaUtilOpen();
start = clock1000();
figureSynteny(inName, out);
countCosmids("C:/biodata/cbriggsae/finish/allcosmi.txt", out);
end = clock1000();
printf("%4.2f seconds to process\n", (end-start)*0.001);
return 0;
}
コード例 #11
0
ファイル: hgTracksRandom.c プロジェクト: elmargb/kentUtils
long hgTracksRandom(char *url)
/* hgTracksRandom - Time default view for random position. */
/* The URL can include position. */
{
long startTime, endTime;
struct htmlPage *rootPage;

startTime = clock1000();
rootPage = htmlPageGet(url);
endTime = clock1000();

htmlPageValidateOrAbort(rootPage);
if (rootPage->status->status != 200)
   errAbort("%s returned with status code %d", url, rootPage->status->status);

return endTime - startTime;
}
コード例 #12
0
ファイル: timePosTable.c プロジェクト: davidhoover/kent
static double timePass(int pass, struct sqlConnection *conn, char *table,
                       int size, struct chromSize *chroms)
/* one time pass for the given size */
{
struct chromRange *ranges = buildRanges(size, chroms);
long startTime = clock1000();
struct chromRange *range;
for (range = ranges; range != NULL; range = range->next)
    queryRange(conn, table, range);

double elapsed = ((double)(clock1000()-startTime))/1000.0;
printf("pass: %d  range size: %d  ranges: %d  time: %g seconds\n", pass, size,
       slCount(ranges), elapsed);
slFreeList(&ranges);
sqlUpdate(conn, NOSQLINJ "flush tables");
return elapsed;
}
コード例 #13
0
void pf_milliTicks(_pf_Stack *stack)
/* Return a long value that counts up pretty
 * quickly.  Units are milliseconds.   It may
 * either be starting since program startup or
 * relative to some other absolute number depending
 * on the system it is running on. */
{
stack[0].Long = clock1000();
}
コード例 #14
0
ファイル: hgFileSearch.c プロジェクト: maximilianh/kent
int main(int argc, char *argv[])
/* Process command line. */
{
long enteredMainTime = clock1000();
cgiSpoof(&argc, argv);
cartEmptyShell(doMiddle, hUserCookie(), excludeVars, NULL);
cgiExitTime("hgFileSearch", enteredMainTime);
return 0;
}
コード例 #15
0
ファイル: hgPcr.c プロジェクト: ucsc-mus-strain-cactus/kent
int main(int argc, char *argv[])
/* Process command line. */
{
    long enteredMainTime = clock1000();
    oldVars = hashNew(10);
    cgiSpoof(&argc, argv);
    cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
    cgiExitTime("hgPcr", enteredMainTime);
    return 0;
}
コード例 #16
0
ファイル: rangeQuery.c プロジェクト: blumroy/kentUtils
void doQuery(char *database, char *table, char *chrom, int start, int end)
/* doQuery */
{
struct sqlConnection *conn = NULL;
struct sqlResult *sr = NULL;
char *empty = NULL;
int rowOffset = 0;
// char **row;
// int count = 0;
long startTime = 0;
long deltaTime = 0;
int i;

conn = sqlConnect(database);


// hSetDb(database);

for (i = 0; i < iterations; i++)
{
  startTime = clock1000();
  sr = hRangeQuery(conn, table, chrom, start, end, empty, &rowOffset);
  deltaTime = clock1000() - startTime;
  printf("time for hRangeQuery = %0.3fs\n", ((double)deltaTime)/1000.0);
  end++;
  sqlFreeResult(&sr);
  sleep1000(500);
}

// startTime = clock1000();

// while ((row = sqlNextRow(sr)) != NULL)
// {
    // count++;
// }
// printf("got %d rows\n", count);

// sqlFreeResult(&sr);
// deltaTime = clock1000() - startTime;
// printf("time for sqlFreeResult = %0.3fs\n", ((double)deltaTime)/1000.0);

// sqlDisconnect(&conn);
}
コード例 #17
0
ファイル: hgGene.c プロジェクト: ucscGenomeBrowser/kent
int main(int argc, char *argv[])
/* Process command line. */
{
long enteredMainTime = clock1000();
cgiSpoof(&argc, argv);
htmlSetStyle(htmlStyleUndecoratedLink);
if (argc != 1)
    usage();
oldVars = hashNew(10);
cartEmptyShell(cartMain, hUserCookie(), excludeVars, oldVars);
cgiExitTime("hgGene", enteredMainTime);
return 0;
}
コード例 #18
0
ファイル: testTableExists.c プロジェクト: davidhoover/kent
void testTableExistsRepeatedly(char *sql, int kind)
/* testTableExistsRepeatedly - Experiments with ways to test for table existence ... */
{
int i=0;

int rows=0;
unsigned int errorNo=0;

//verbose(1, "got here 2 %s\n", existingMyIsamDb); //debug

verbose(1, "\nQuery: [%s]\n", sql); 

useDb(existingMyIsamDb);

//verbose(1, "got here 3\n"); //debug

long time = clock1000();

for(i=0; i<numReps; ++i)
    {
    //verbose(1, "got here 3.1 [%s] %s\n", sql, existingMyIsamTable); //debug
    testSqlTableExists(conn, sql, existingMyIsamTable, &rows, &errorNo);
    //verbose(1, "got here 3.2  kind=%d rows=%d\n", kind, rows); fflush(stderr); //debug
    if ((kind==0 && errorNo!=0) || (kind==1 && rows==0))
	errAbort("Unexpected error: table should exist: %s", existingMyIsamTable);
    //verbose(1, "got here 3.3\n"); //debug
    }
verbose(1, "MyISAM time: %.2f seconds\n", (clock1000() - time) / 1000.0);

//verbose(1, "got here 4\n"); //debug

if (!sameString(existingInnodbDb, "NULL"))
{
useDb(existingInnodbDb);
time = clock1000();
for(i=0; i<numReps; ++i)
    {
    testSqlTableExists(conn, sql, existingInnodbTable, &rows, &errorNo);
    if ((kind==0 && errorNo!=0) || (kind==1 && rows==0))
	errAbort("Unexpected error: innodb table should exist: %s", existingInnodbTable);
    }
verbose(1, "InnoDb time: %.2f seconds\n", (clock1000() - time) / 1000.0);
}
//verbose(1, "got here 5\n"); //debug

useDb(nonExistingTableDb);
time = clock1000();
for(i=0; i<numReps; ++i)
    {
    testSqlTableExists(conn, sql, nonExistingTable, &rows, &errorNo);
    if ((kind==0 && errorNo==0) || (kind==1 && rows!=0))
	errAbort("Unexpected success: table not existing should not exist: %s", nonExistingTable);
    }
verbose(1, "notExist time: %.2f seconds\n", (clock1000() - time) / 1000.0);


//verbose(1, "got here 5\n"); //debug
}
コード例 #19
0
ファイル: mainMain.c プロジェクト: ucscGenomeBrowser/kent
int main(int argc, char *argv[])
{
long enteredMainTime = clock1000();
measureTime(NULL);
browserName = hBrowserName();
organization = "UCSC";

/* Push very early error handling - this is just
 * for the benefit of the cgiVarExists, which
 * somehow can't be moved effectively into doMiddle. */
htmlPushEarlyHandlers();
cgiSpoof(&argc, argv);
char * link = webTimeStampedLinkToResourceOnFirstCall("HGStyle.css",TRUE); // resource file link
if (link)                                                                  // wrapped in html
    htmlSetStyle(link);

oldVars = hashNew(10);

if (cgiVarExists("hgt.redirectTool"))
    {
    printf("Content-type: text/html\n\n");
    errAbortSetDoContentType(FALSE);
    cart = cartForSession(hUserCookie(), NULL, NULL);
    extToolRedirect(cart, cgiString("hgt.redirectTool"));
    }
else
    cartHtmlShell("UCSC Genome Browser v"CGI_VERSION, doMiddle, hUserCookie(), excludeVars, oldVars);

if (measureTiming)
    measureTime("Time to write and close cart");
if (measureTiming)
    {
    fprintf(stdout, "<span class='timing'>Overall total time: %ld millis<br /></span>\n",
            clock1000() - enteredMainTime);
    }
cgiExitTime("hgTracks", enteredMainTime);
return 0;
}
コード例 #20
0
void commaRecon(char *fileName)
/* Do comma based reconstruction. */
{
char **words;
long start, end;
struct sqlConnection *conn = sqlConnect(database);
struct sqlResult *sr;
char **row;
FILE *f = mustOpen(fileName, "w");

start = clock1000();
words = loadWords();
end = clock1000();
printf("Time to load words: %4.3f\n", 0.001*(end-start));
start = clock1000();

sr = sqlQuery(conn, "SELECT * from commaLine");
while ((row = sqlNextRow(sr)) != NULL)
    {
    int wordCount = sqlUnsigned(row[1]);
    int i;
    char *s = row[2],*e;
    int wordIx;
    for (i=0; i<wordCount; ++i)
	{
	e = strchr(s,',');
	*e++ = 0;
	wordIx = sqlUnsigned(s);
	s = e;
	fileOutput(f,words[wordIx]);
	}
    }
end = clock1000();
printf("Time to comma reconstruct file: %4.3f\n", 0.001*(end-start));
sqlDisconnect(&conn);
}
コード例 #21
0
ファイル: hgBlat.c プロジェクト: maximilianh/kent
int main(int argc, char *argv[])
/* Process command line. */
{
long enteredMainTime = clock1000();
oldVars = hashNew(10);
cgiSpoof(&argc, argv);

setUdcCacheDir();

/* org has precedence over db when changeInfo='orgChange' */

cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars);
cgiExitTime("hgBlat", enteredMainTime);
return 0;
}
コード例 #22
0
ファイル: verbose.c プロジェクト: CRG-Barcelona/libbeato
void verboseTime(int verbosity, char *label, ...)
/* Print label and how long it's been since last call.  Start time can be
 * initialized with verboseTimeInit, otherwise the elapsed time will be
 * zero. */
{
assert(label != NULL);  // original version allowed this, but breaks some GCCs
if (lastTime < 0)
    verboseTimeInit();
long time = clock1000();
va_list args;
va_start(args, label);
verboseVa(verbosity, label, args);
verbose(verbosity, ": %ld millis\n", time - lastTime);
lastTime = time;
va_end(args);
}
コード例 #23
0
ファイル: cartReset.c プロジェクト: ucscGenomeBrowser/kent
int main(int argc, char *argv[])
/* Process command line. */
{
long enteredMainTime = clock1000();
struct dyString *headText = newDyString(512);
char *destination = cgiUsualString("destination", defaultDestination);
if (strstr(destination, "://"))
    errAbort("To stop Open Redirect abuse, only relative URLs are supported. "
	    "Request for destination=[%s] rejected.\n", destination);

dyStringPrintf(headText,
	       "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;URL=%s\">"
	       "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">"
	       "<META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">"
	       ,destination);
htmShellWithHead("Reset Cart", headText->string, doMiddle, NULL);
dyStringFree(&headText);
cgiExitTime("cartReset", enteredMainTime);
return 0;
}
コード例 #24
0
ファイル: hgSuggest.c プロジェクト: ucscGenomeBrowser/kent
int main(int argc, char *argv[])
{
long enteredMainTime = clock1000();

cgiSpoof(&argc, argv);
char *database = cgiOptionalString("db");
char *prefix = cgiOptionalString("prefix");
char *type = cgiOptionalString("type");
char *table = checkParams(database, prefix, type);

puts("Content-Type:text/plain");
puts("\n");

if (sameOk(type, ALT_OR_PATCH))
    suggestAltOrPatch(database, prefix);
else
    suggestGene(database, table, prefix);

cgiExitTime("hgSuggest", enteredMainTime);
return 0;
}
コード例 #25
0
ファイル: qa.c プロジェクト: kenongit/sequencing
struct qaStatus *qaPageGet(char *url, struct htmlPage **retPage)
/* Get info on given url, (and return page if retPage non-null). */
{
struct errCatch *errCatch = errCatchNew();
struct qaStatus *qs;
struct htmlPage *page = NULL;
long startTime = clock1000();
if (errCatchStart(errCatch))
    {
    page = htmlPageGet(url);
    htmlPageValidateOrAbort(page);
    }
else
    {
    htmlPageFree(&page);
    }
errCatchEnd(errCatch);
qs = qaStatusOnPage(errCatch, page, startTime, retPage);
errCatchFree(&errCatch);
return qs;
}
コード例 #26
0
ファイル: qa.c プロジェクト: kenongit/sequencing
static struct qaStatus *qaStatusOnPage(struct errCatch *errCatch, 
	struct htmlPage *page, long startTime, struct htmlPage **retPage)
/* Assuming you have fetched page with the given error catcher,
 * starting the fetch at the given startTime, then create a
 * qaStatus that describes how the fetch went.  If *retPage is non-null
 * then return the page there, otherwise free it. */
{
char *errMessage = NULL;
struct qaStatus *qs;
AllocVar(qs);
if (errCatch->gotError || page == NULL)
    {
    errMessage = errCatch->message->string;
    qs->hardError = TRUE;
    }
else
    {
    if (page->status->status != 200)
	{
	dyStringPrintf(errCatch->message, "HTTP status code %d\n", 
		page->status->status);
	errMessage = errCatch->message->string;
	qs->hardError = TRUE;
	htmlPageFree(&page);
	}
    else
        {
	errMessage = qaScanForErrorMessage(page->fullText);
	}
    }
qs->errMessage = cloneString(errMessage);
if (qs->errMessage != NULL)
    subChar(qs->errMessage, '\n', ' ');
qs->milliTime = clock1000() - startTime;
if (retPage != NULL)
    *retPage = page;
else
    htmlPageFree(&page);
return qs;
}
コード例 #27
0
ファイル: hgVisiGene.c プロジェクト: davidhoover/kent
int main(int argc, char *argv[])
/* Process command line. */
{
long enteredMainTime = clock1000();
uglyTime(NULL);
cgiSpoof(&argc, argv);
setUdcCacheDir();
oldCart = hashNew(0);
if (cgiVarExists(hgpDoDownload))  /* use cgiVars -- do not commit to any cart method yet */
    {
    struct sqlConnection *conn = sqlConnect(visiDb);
    cart = cartAndCookieNoContent(hUserCookie(), excludeVars, oldCart);
    doDownload(conn);
    cartCheckout(&cart);
    }
else
    {
    cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldCart);
    }
cgiExitTime("hgVisiGene", enteredMainTime);
return 0;
}
コード例 #28
0
ファイル: qa.c プロジェクト: kenongit/sequencing
struct qaStatus *qaPageFromForm(struct htmlPage *origPage, struct htmlForm *form, 
	char *buttonName, char *buttonVal, struct htmlPage **retPage)
/* Get update to form based on pressing a button. */
{
struct errCatch *errCatch = errCatchNew();
struct qaStatus *qs;
struct htmlPage *page = NULL;
long startTime = clock1000();
if (errCatchStart(errCatch))
    {
    page = htmlPageFromForm(origPage, form, buttonName, buttonVal);
    htmlPageValidateOrAbort(page);
    }
else
    {
    htmlPageFree(&page);
    }
errCatchEnd(errCatch);
qs = qaStatusOnPage(errCatch, page, startTime, retPage);
errCatchFree(&errCatch);
return qs;
}
コード例 #29
0
ファイル: fragFind.c プロジェクト: ENCODE-DCC/kentUtils
void fragFind(struct seqList *goodSeq, char *badName, int fragSize, int mismatchesAllowed, 
    boolean considerRc, double profile[16][4])
/* Do fast finding of patterns that are in FA file "goodName", but not in FA file
 * "badName."  BadName can be null.  Pass in the size of the pattern (fragSize) and
 * the number of mismatches to pattern you're willing to tolerate (mismatchesAllowed).
 * It returns the pattern in profile. */
{
int *goodTable, *badTable = NULL;
int goodCount, badCount = 0;
int goodIx;
long startTime;
DNA unpacked[17];

if (mismatchesAllowed > 3)
    errAbort("Sorry, fragFind can only handle 0-3 mismatches.");
if (fragSize > 10)
    errAbort("Sorry, fragFind can only handle fragments up to 10 bases.");

startTime = clock1000();
makeOligoHistogram(NULL, goodSeq, fragSize, &goodTable, &goodCount);
if (badName)
    makeOligoHistogram(badName, NULL, fragSize, &badTable, &badCount);
if (badName)
    {
    normalizeTable(goodTable, fragSize);
    normalizeTable(badTable, fragSize);
    diffTables(goodTable, badTable, fragSize);
    goodIx = fuzzVal(badTable, fragSize, mismatchesAllowed, considerRc);
    }
else
    {
    goodIx = fuzzVal(goodTable, fragSize, mismatchesAllowed, considerRc);
    }
freez(&goodTable);
freez(&badTable);
unpackVal(goodIx, fragSize, unpacked);
makeProfile(unpacked, fragSize, mismatchesAllowed, goodSeq, considerRc, profile);
}
コード例 #30
0
int main(int argc, char *argv[])
/* Process command line */
{
long enteredMainTime = clock1000();
cgiSpoof(&argc, argv);
termOpt = cgiOptionalString(CV_TERM);
tagOpt = cgiOptionalString(CV_TAG);
typeOpt = cgiOptionalString(CV_TYPE);
targetOpt = cgiOptionalString(CV_TARGET);
labelOpt = cgiOptionalString(CV_LABEL);
organismOpt = cgiUsualString(ORGANISM, organismOpt);
if (organismOpt != NULL)
    {
    organismOptLower=cloneString(organismOpt);
    strLower(organismOptLower);
    }
char *bgColor = cgiOptionalString("bgcolor");
if (bgColor)
    htmlSetBgColor(strtol(bgColor, 0, 16));
htmlSetStyle(htmlStyleUndecoratedLink);
htmShell("ENCODE Controlled Vocabulary", doMiddle, "get");
cgiExitTime("hgEncodeVocab", enteredMainTime);
return 0;
}