void doMiddle() /* doMiddle - put up middle part of web page, not including http and html headers/footers */ { printf("<FORM ACTION=\"../cgi-bin/edwWebDeprecate\" METHOD=GET>\n"); struct sqlConnection *conn = edwConnectReadWrite(edwDatabase); userEmail = edwGetEmailAndVerify(); if (userEmail == NULL) logIn(); else if (cgiVarExists("fileList") && cgiVarExists("reason")) tryToDeprecate(conn); else getFileListAndReason(conn); printf("</FORM>"); }
int main(int argc, char *argv[]) /* Process command line. */ { struct hash *liftHash = NULL; cgiSpoof(&argc, argv); if (argc != 6) usage(); if (cgiVarExists("spacing")) chromInsertsSetDefaultGapSize(cgiInt("spacing")); if (cgiVarExists("lift")) liftHash = readLift(cgiString("lift")); ctgToChromFa(argv[1], argv[2], argv[3], argv[4], argv[5], liftHash); return 0; }
void doMiddle(struct cart *theCart) /* Set up globals and make web page */ { if (cgiVarExists("docId")) { if (cgiVarExists("meta")) doDocIdMeta(theCart); else if (cgiVarExists("report")) doDocIdReport(theCart); else if (cgiVarExists("lab")) doLabContacts(theCart); } else doStandard(theCart); }
void outputSeq(DNA *dna, int dnaSize, boolean hiliteRange, long startRange, long endRange, FILE *out) /* Write out sequence. */ { struct dfm dfm; int i; char *seq = dna; int size = dnaSize; if (cgiBoolean("translate")) { int utr5 = 0; int maxProtSize = (dnaSize+2)/3; char *prot = needMem(maxProtSize + 1); if (cgiVarExists("utr5")) utr5 = cgiInt("utr5")-1; startRange -= utr5; endRange -= utr5; startRange /= 3; endRange /= 3; dna += utr5; seq = prot; for (size = 0; size < maxProtSize; ++size) { if ((*prot++ = lookupCodon(dna)) == 0) break; dna += 3; } *prot = 0; } initDfm(&dfm, 10, 50, TRUE, hiliteRange, startRange, endRange, out); for (i=0; i<size; ++i) dfmOut(&dfm, seq[i]); }
void doMiddle(struct cart *theCart) /* Set up globals and make web page */ { char *database = cgiOptionalString("db"); char *rtdbServer = cfgOption("rtdb.server"); char *rtdbPort = cfgOption("rtdb.port"); char *rtdbChoices = cfgOption("rtdb.databases"); struct slName *dbs = slNameListFromComma(rtdbChoices); cart = theCart; cartWebStart(cart, database, "MGC RTDB Update"); if (!rtdbServer) errAbort("rtdb.update not defined in the hg.conf file. " "Chances are this CGI isn't meant for this machine."); if (!rtdbPort) errAbort("rtdb.update not defined in the hg.conf file. " "Chances are this CGI isn't meant for this machine."); /* create HMTL form if button wasn't pressed. Otherwise, run the update */ if (!cgiVarExists("RTDBSubmit")) makeForm(dbs); else if ((database == NULL) || (!slNameInList(dbs, database))) { makeForm(dbs); printf("<br>Error: Select one of databases listed."); } else updateServer(rtdbServer, rtdbPort, database); cartWebEnd(); slNameFreeList(&dbs); }
void checkYbr(char *agpFile, char *faFile, char *mdFile) /* checkYbr - Check NCBI assembly (aka Yellow Brick Road). */ { struct hash *hash = newHash(0); struct contig *contigList = NULL, *contig; int problemCount = 0; contigList = contigsFromAgp(agpFile, hash); printf("Read %d contigs from %s\n", slCount(contigList), agpFile); if (cgiVarExists("checkUs")) { printf("Checking our fa files for size\n"); checkOurDir(cgiString("checkUs"), contigList, hash); } else { problemCount += flagMd(mdFile, hash); printf("Verifying sequence sizes in %s\n", faFile); problemCount += flagFa(faFile, hash); for (contig = contigList; contig != NULL; contig = contig->next) { if (contig->gotFa && contig->gotMd) continue; ++problemCount; if (!contig->gotFa) printf("No %s in %s\n", contig->name, faFile); if (!contig->gotMd) printf("No %s in %s\n", contig->name, mdFile); } printf("%d problems detected\n", problemCount); } }
int main(int argc, char *argv[]) { cgiSpoof(&argc, argv); if (cgiVarExists("pbt.reset")) resetVars(); /* call cartHtmlShellPbGlobal to accomodate situations that PB not entered from GB */ cartHtmlShellPbGlobal("UCSC Proteome Browser V1.1", doMiddle, hUserCookie(), excludeVars, NULL); return 0; }
boolean okToDeprecateThisFile(struct sqlConnection *conn, int fId, char *userEmail) /* Return true if it is OK to deprecate this file */ { if (checkOwnership(conn, fId, userEmail)) return TRUE; else if (cgiVarExists("allowBox")) return TRUE; else return FALSE; }
void doMiddle() /* doMiddle - put up middle part of web page, not including http and html headers/footers */ { pushWarnHandler(localWarn); printf("<FORM ACTION=\"../cgi-bin/edwWebSubmit\" METHOD=GET>\n"); struct sqlConnection *conn = edwConnectReadWrite(edwDatabase); userEmail = edwGetEmailAndVerify(); if (userEmail == NULL) logIn(); else if (cgiVarExists(stopButtonName)) stopUpload(conn); else if (cgiVarExists("submitUrl")) submitUrl(conn); else if (cgiVarExists("monitor")) monitorSubmission(conn); else getUrl(conn); printf("</FORM>"); }
void doMiddle() /* Write middle part of .html. */ { DNA *targetDna; char *chrom; int tStart, tEnd; struct xaAli *xa; int bothStart, bothEnd; char cbCosmidName[256]; char *s; /* Get input variables from CGI. */ char *qOrganism = cgiString("qOrganism"); char *tOrganism = cgiString("tOrganism"); char *query = cgiString("query"); char *target = cgiString("target"); char *strandString = cgiString("strand"); char strand = strandString[0]; boolean showSym = cgiBoolean("symbols"); boolean gotClickPos = cgiVarExists("clickPos"); double clickPos; if (gotClickPos) clickPos = cgiDouble("clickPos"); strcpy(cbCosmidName, query); if ((s = strrchr(cbCosmidName, '.')) != NULL) *s = 0; /* Get xaAli. */ xa = getOneXaAli(qOrganism, query); printf("<H2>Alignment of <I>C. briggsae</I> %s:%d-%d and <I>C. elegans</I> %s</H2>\n", cbCosmidName, xa->qStart, xa->qEnd, target); htmlParagraph("<I>C. briggsae</I> appears on top. Coding regions in <I>C. elegans</I> are in upper case."); /* Get display window. */ if (!wormParseChromRange(target, &chrom, &tStart, &tEnd)) errAbort("Target %s isn't formatted correctly", target); /* Figure out intersection of display window and xeno-alignment */ bothStart = max(xa->tStart, tStart); bothEnd = min(xa->tEnd, tEnd); /* Get upper-cased-exon target DNA. */ targetDna = wormChromPartExonsUpper(chrom, bothStart, bothEnd - bothStart); upcCorresponding(targetDna, bothEnd - bothStart, xa->tSym, bothStart - xa->tStart); printf("<TT><PRE>"); showTargetRange(xa, bothStart - xa->tStart, bothEnd-bothStart, strand, showSym); printf("</TT></PRE>"); }
int main(int argc, char *argv[]) /* Process command line. */ { cgiSpoof(&argc, argv); if (cgiVarExists("db")) { database=cgiOptionalString("db"); } cartEmptyShell(doMiddle, hUserCookie(), excludeVars, oldVars); return 0; }
void dispatchPage() /* Look at command variables in cart and figure out which * page to draw. */ { struct sqlConnection *conn = hAllocConn(database); if (checkAndClear(hggConfigure)) { configurePage(); } else if (checkAndClear(hggConfigureOne)) { configureOnePage(); } else if (checkAndClear(hggUpload)) { uploadPage(); } else if (checkAndClear(hggSubmitUpload)) { submitUpload(conn); } else if (checkAndClear(hggImport)) { importPage(conn); } else if (checkAndClear(hggSubmitImport)) { submitImport(); } else if (checkAndClear(hggCorrelate)) { correlatePage(conn); } else if (checkAndClear(hggBrowse)) { browseRegions(conn); } else if (checkAndClear(hggSort)) { sortGenes(conn); } else { /* Default case - start fancy web page. */ if (cgiVarExists(hggPsOutput)) handlePostscript(conn); else mainPage(conn); } cartRemovePrefix(cart, hggDo); }
int main(int argc, char *argv[]) /* Process command line. */ { cgiSpoof(&argc, argv); userCount = cgiOptionalInt("userCount", userCount); randSeed = cgiOptionalInt("randSeed", (int)getpid()); verboseSetLevel(cgiOptionalInt("verbose", 1)); readOnly = cgiVarExists("readOnly"); srand(randSeed); if (argc != 7) usage(); cartSimNoInsert(argv[1], argv[2], argv[3], argv[4], argv[5], argv[6]); return 0; }
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; }
void doMiddle() { char *preIntron, *startIntron, *endIntron, *postIntron; int count = 0; int matchCount = 0; int maxCount; struct nameOff *matchList; boolean invert = cgiVarExists("Invert"); preIntron = cgiString("preIntron"); startIntron = cgiString("startIntron"); endIntron = cgiString("endIntron"); postIntron = cgiString("postIntron"); /* Just for debugging cut search short if matches special magic */ maxCount = atoi(preIntron); if (maxCount <= 0) maxCount = 0x7ffffff; eraseWhiteSpace(preIntron); eraseWhiteSpace(startIntron); eraseWhiteSpace(endIntron); eraseWhiteSpace(postIntron); tolowers(preIntron); tolowers(startIntron); tolowers(endIntron); tolowers(postIntron); matchList = scanIntronFile(preIntron, startIntron, endIntron, postIntron, invert); if (matchList == NULL) errAbort("Sorry, no matches to %s%s %s %s %s", (invert ? "inverted " : ""), preIntron, startIntron, endIntron, postIntron); printf("<P>%d introns matching %s%s(%s %s)%s. ", slCount(matchList), (invert ? "inverted " : ""), preIntron, startIntron, endIntron, postIntron); printf("Shortcut to <A HREF=\"#1\">frequency counts.</A></P>"); htmlHorizontalLine(); showMatches(matchList); htmlHorizontalLine(); printf("<TT><PRE>"); printf("<A NAME=\"1\"></A>"); printAllHistograms(); printf("</TT></PRE>"); }
void autoXml(char *dtdxFile, char *outRoot) /* autoXml - Generate structures code and parser for XML file from DTD-like spec. */ { struct dtdElement *elList = NULL; struct hash *elHash = NULL; char hName[512], cName[512]; char outDir[256]; splitPath(outRoot, outDir, prefix, NULL); if (cgiVarExists("prefix")) strcpy(prefix, cgiString("prefix")); if (outDir[0] != 0) makeDir(outDir); dtdParse(dtdxFile, prefix, textField, &elList, &elHash); printf("Parsed %d elements in %s\n", slCount(elList), dtdxFile); sprintf(hName, "%s.h", outRoot); makeH(elList, hName); sprintf(cName, "%s.c", outRoot); makeC(elList, cName, hName); printf("Generated code in %s\n", cName); }
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; }
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; }
void doMiddle() /* Write HTML file to stdout. */ { char *mapName; if ((mapName = cgiOptionalString("map")) != NULL) { printf("<TT>\n"); doMap(mapName); } else if (cgiVarExists("contig")) { doFuzzyFind(); } else { char *bacAcc = cgiString("bacAcc"); char *repeatMask = cgiString("repeatMask"); int trim = cgiInt("trim"); if (trim < 0) trim = 0; bacTrack(bacAcc, trim, repeatMask); } }
void doMiddle(struct cart *theCart) /* Print the body of an html file. */ { char cond_str[255]; struct sqlConnection *conn; char *proteinAC; char *chp, *chp1, *chp9; char *debugTmp = NULL; char *chromStr, *cdsStartStr, *cdsEndStr, posStr[255]; char *supportedGenomeDatabase; char *answer; char *queryID; /* Initialize layout and database. */ cart = theCart; /* Uncomment this to see parameters for debugging. */ /* Be careful though, it breaks if custom track * is more than 4k */ /* { struct dyString *state = cgiUrlString(); hPrintf("State: %s\n", state->string); } */ queryID = cartOptionalString(cart, "proteinID"); if (sameString(queryID, "")) { hUserAbort("Please go back and enter a gene symbol or a Swiss-Prot/TrEMBL protein ID.\n"); } if (cgiVarExists("db")) { /* if db is known, get key variables set */ proteinInSupportedGenome = TRUE; database = cgiOptionalString("db"); organism = hDbOrganism(database); protDbName = hPdbFromGdb(database); proteinID = strdup(queryID); } else { protCntInSwissByGene = searchProteinsInSwissProtByGene(queryID); /* no CGI 'db' variable means it did not come in from GB but from pbGateway */ /* search existing GB databases to see if this protein can be found */ protCntInSupportedGenomeDb = searchProteinsInSupportedGenomes(queryID, &supportedGenomeDatabase); if ((protCntInSupportedGenomeDb > 1) || protCntInSwissByGene >= 1) { /* more than 1 proteins match the query ID, present selection web page */ proteinInSupportedGenome = 1; presentProteinSelections(queryID, protCntInSwissByGene, protCntInSupportedGenomeDb); return; } else { if (protCntInSupportedGenomeDb == 1) { /* one and only one protein found in a genome DB that support KG and PB */ proteinInSupportedGenome = TRUE; database = strdup(supportedGenomeDatabase); organism = hDbOrganism(database); protDbName = hPdbFromGdb(database); proteinID=strdup(queryID); } else { /* not found in genome DBs that support KG/PB */ /* now search PROTEOME_DB_NAMES to see if this protein is there. */ answer = uniProtFindPrimAcc(queryID); if (answer == NULL) { hUserAbort("'%s' does not seem to be a valid UniProtKB protein ID or a gene " "symbol.<br><br>Click <A HREF=\"../cgi-bin/pbGateway\">here</A> " "to start another query.", queryID); } proteinInSupportedGenome = FALSE; database = strdup(GLOBAL_PB_DB); organism = strdup(""); protDbName = strdup(PROTEOME_DB_NAME); proteinID = strdup(answer); } } if (proteinInSupportedGenome) { spConn = sqlConnect(database); sqlSafefFrag(cond_str, sizeof(cond_str), "alias='%s'", queryID); proteinID = sqlGetField(database, "kgSpAlias", "spID", cond_str); sqlSafefFrag(cond_str, sizeof(cond_str), "spID='%s'", proteinID); answer = sqlGetField(database, "kgXref", "spDisplayID", cond_str); sqlSafefFrag(cond_str, sizeof(cond_str), "proteinID='%s'", answer); chromStr = sqlGetField(database, "knownGene", "chrom", cond_str); if (chromStr) { cdsStartStr = sqlGetField(database, "knownGene", "cdsStart", cond_str); cdsEndStr = sqlGetField( database, "knownGene", "cdsEnd", cond_str); safef(posStr, sizeof(posStr), "%s:%s-%s", chromStr, cdsStartStr, cdsEndStr); positionStr = strdup(posStr); cartSetString(cart, "position", positionStr); cartSetString(cart, "organism", organism); } } } /* print out key variables for debugging */ /* printf("<br>before enter main section: <br>proteinInSupportedGenome=%d<br>proteinID=%s <br>database=%s <br>organism=%s <br>protDbName=%s\n", proteinInSupportedGenome, proteinID, database, organism, protDbName);fflush(stdout); */ if (hTableExists(database, "kgProtMap2")) { kgVersion = KG_III; strcpy(kgProtMapTableName, "kgProtMap2"); } debugTmp = cartUsualString(cart, "hgDebug", "off"); if(sameString(debugTmp, "on")) hgDebug = TRUE; else hgDebug = FALSE; conn = hAllocConn(database); hgsid = cartOptionalString(cart, "hgsid"); if (hgsid != NULL) { safef(hgsidStr, sizeof(hgsidStr), "&hgsid=%s", hgsid); } else { strcpy(hgsidStr, ""); } /* check proteinID to see if it is a valid SWISS-PROT/TrEMBL accession or display ID */ /* then assign the accession number to global variable proteinID */ sqlSafefFrag(cond_str, sizeof(cond_str), "accession='%s'", proteinID); proteinAC = sqlGetField(protDbName, "spXref3", "accession", cond_str); if (proteinAC == NULL) { sqlSafefFrag(cond_str, sizeof(cond_str), "displayID='%s'", proteinID); proteinAC = sqlGetField(protDbName, "spXref3", "accession", cond_str); if (proteinAC == NULL) { hUserAbort("'%s' does not seem to be a valid Swiss-Prot/TrEMBL protein ID or gene symbol.<br><br>Click <A HREF=\"../cgi-bin/pbGateway\">here</A> to start another query." , proteinID); } else { protDisplayID = proteinID; proteinID = proteinAC; } } else { sqlSafefFrag(cond_str, sizeof(cond_str), "accession='%s'", proteinID); protDisplayID = sqlGetField(protDbName, "spXref3", "displayID", cond_str); } if (proteinInSupportedGenome) { if (kgVersion == KG_III) { sqlSafefFrag(cond_str, sizeof(cond_str), "spId='%s'", proteinID); mrnaID = sqlGetField(database, "kgXref", "kgId", cond_str); } else { sqlSafefFrag(cond_str, sizeof(cond_str), "proteinID='%s'", protDisplayID); mrnaID = sqlGetField(database, "knownGene", "name", cond_str); } } else { mrnaID = NULL; positionStr = NULL; } sqlSafefFrag(cond_str, sizeof(cond_str), "accession='%s'", proteinID); description = sqlGetField(protDbName, "spXref3", "description", cond_str); if (positionStr != NULL) { chp = strstr(positionStr, ":"); *chp = '\0'; prevGBChrom = cloneString(positionStr); chp1 = chp + 1; chp9 = strstr(chp1, "-"); *chp9 = '\0'; prevGBStartPos = atoi(chp1); chp1 = chp9 + 1; prevGBEndPos = atoi(chp1); } else { prevGBChrom = NULL; prevGBStartPos = -1; prevGBEndPos = -1; } /* Do main display. */ if (cgiVarExists("pbt.psOutput")) handlePostscript(); else { doTrackForm(NULL, NULL); } }
void doMiddle() { char *seqName; boolean intronsLowerCase = TRUE; boolean intronsParenthesized = FALSE; boolean hiliteNear = FALSE; int startRange = 0; int endRange = 0; boolean gotRange = FALSE; struct dnaSeq *cdnaSeq; boolean isChromRange = FALSE; DNA *dna; char *translation = NULL; seqName = cgiString("geneName"); seqName = trimSpaces(seqName); if (cgiVarExists("intronsLowerCase")) intronsLowerCase = cgiBoolean("intronsLowerCase"); if (cgiVarExists("intronsParenthesized")) intronsParenthesized = cgiBoolean("intronsParenthesized"); if (cgiVarExists("startRange") && cgiVarExists("endRange" )) { startRange = cgiInt("startRange"); endRange = cgiInt("endRange"); gotRange = TRUE; } if (cgiVarExists("hiliteNear")) { hiliteNear = TRUE; } fprintf(stdout, "<P><TT>\n"); /* The logic here is a little complex to optimize speed. * If we can decide what type of thing the name refers to by * simply looking at the name we do. Otherwise we have to * search the database in various ways until we get a hit. */ if (wormIsNamelessCluster(seqName)) { isChromRange = TRUE; } else if (wormIsChromRange(seqName)) { isChromRange = TRUE; } else if (getWormGeneDna(seqName, &dna, TRUE)) { if (cgiBoolean("litLink")) { char nameBuf[64]; char *geneName = NULL; char *productName = NULL; char *coding; int transSize; struct wormCdnaInfo info; printf("<H3>Information and Links for %s</H3>\n", seqName); if (wormInfoForGene(seqName, &info)) { if (info.description) printf("<P>%s</P>\n", info.description); geneName = info.gene; productName = info.product; } else { if (wormIsGeneName(seqName)) geneName = seqName; else if (wormGeneForOrf(seqName, nameBuf, sizeof(nameBuf))) geneName = nameBuf; } coding = cloneUpperOnly(dna); transSize = 1 + (strlen(coding)+2)/3; translation = needMem(1+strlen(coding)/3); dnaTranslateSome(coding, translation, transSize); freez(&coding); if (geneName) { printf("<A HREF=\"http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?form=4&db=m" "&term=C+elegans+%s&dispmax=50&relentrezdate=No+Limit\">", geneName); printf("PubMed search on gene: </A>%s<BR>\n", geneName); } if (productName) { char *encoded = cgiEncode(productName); printf("<A HREF=\"http://www.ncbi.nlm.nih.gov/htbin-post/Entrez/query?form=4&db=m" "&term=%s&dispmax=50&relentrezdate=No+Limit\">", encoded); printf("PubMed search on product:</A> %s<BR>\n", productName); freeMem(encoded); } /* Process name to get rid of isoform letter for Proteome. */ if (geneName) strcpy(nameBuf, geneName); else { strcpy(nameBuf, seqName); #ifdef NEVER /* Sometimes Proteome requires the letter after the orf name * in alt-spliced cases, sometimes it can't handle it.... */ nameLen = strlen(nameBuf); if (wormIsOrfName(nameBuf) && isalpha(nameBuf[nameLen-1])) { char *dotPos = strrchr(nameBuf, '.'); if (dotPos != NULL && isdigit(dotPos[1])) nameBuf[nameLen-1] = 0; } #endif /* NEVER */ } printf("<A HREF=\"http://www.wormbase.org/db/seq/sequence?name=%s;class=Sequence\">", seqName); printf("WormBase link on:</A> %s<BR>\n", seqName); printf("<A HREF=\"http://www.proteome.com/databases/WormPD/reports/%s.html\">", nameBuf); printf("Proteome link on:</A> %s<BR>\n<BR>\n", nameBuf); printf("<A HREF=#DNA>Genomic DNA Sequence</A><BR>\n"); if (hiliteNear) printf("<A HREF=\"#CLICKED\">Shortcut to where you clicked in gene</A><BR>"); printf("<A HREF=#protein>Translated Protein Sequence</A><BR>\n"); htmlHorizontalLine(); printf("<A NAME=DNA></A>"); printf("<H3>%s Genomic DNA sequence</H3>", seqName); } if (!intronsLowerCase) tolowers(dna); if (hiliteNear) { if (!gotRange) { double nearPos = cgiDouble("hiliteNear"); int rad = 5; int dnaSize = strlen(dna); long mid = (int)(dnaSize * nearPos); startRange = mid - rad; if (startRange < 0) startRange = 0; endRange = mid + rad; if (endRange >= dnaSize) endRange = dnaSize - 1; } } outputSeq(dna, strlen(dna), hiliteNear, startRange, endRange, stdout); freez(&dna); } else if (wormCdnaSeq(seqName, &cdnaSeq, NULL)) { outputSeq(cdnaSeq->dna, cdnaSeq->size, FALSE, 0, 0, stdout); } else { isChromRange = TRUE; } if (isChromRange) { char *chromId; int start, end; char strand = '+'; int size; if (!wormGeneRange(seqName, &chromId, &strand, &start, &end)) errAbort("Can't find %s",seqName); size = end - start; if (intronsLowerCase) dna = wormChromPartExonsUpper(chromId, start, size); else { dna = wormChromPart(chromId, start, size); touppers(dna); } if (cgiVarExists("strand")) strand = cgiString("strand")[0]; if (strand == '-') reverseComplement(dna, size); outputSeq(dna, size, FALSE, 0, 0, stdout); } if (translation != NULL) { htmlHorizontalLine(); printf("<A NAME=protein></A>"); printf("<H3>Translated Protein of %s</H3>\n", seqName); outputSeq(translation, strlen(translation), FALSE, 0, 0, stdout); freez(&translation); } fprintf(stdout, "</TT></P>\n"); }
void doTracks(char *proteinID, char *mrnaID, char *aa, int *yOffp, char *psOutput) /* draw various protein tracks */ { int l; char aaOrigOffsetStr[20]; int hasResFreq; char uniProtDbName[50]; char *protDbDate; char *chrom; char strand; char *kgId, *kgPep, *protPep; char cond_str[255]; char *answer; //int i, ll; //char *chp1, *chp2; g_font = mgSmallFont(); safef(pbScaleStr, sizeof(pbScaleStr), "%d", pbScale); if (psOutput != NULL) { pbScale = atoi(cartOptionalString(cart, "pbt.pbScaleStr")); } if (cgiOptionalString("trackOffset") != NULL) { trackOrigOffset = atoi(cgiOptionalString("trackOffset")); } if (cgiOptionalString("pbScaleStr") != NULL) { pbScale = atoi(cgiOptionalString("pbScaleStr")); } if (cgiOptionalString("pbScale") != NULL) { scaleButtonPushed = TRUE; if (strcmp(cgiOptionalString("pbScale"), "1/6") == 0) pbScale = 1; if (strcmp(cgiOptionalString("pbScale"), "1/2") == 0) pbScale = 3; if (strcmp(cgiOptionalString("pbScale"), "FULL") == 0) pbScale = 6; if (strcmp(cgiOptionalString("pbScale"), "DNA") == 0) pbScale =22; safef(pbScaleStr, sizeof(pbScaleStr), "%d", pbScale); cgiMakeHiddenVar("pbScaleStr", pbScaleStr); } else { scaleButtonPushed = FALSE; } if (psOutput == NULL) { if (cgiVarExists("pbt.left3")) { relativeScroll(-0.95); initialWindow = FALSE; } else if (cgiVarExists("pbt.left2")) { relativeScroll(-0.475); initialWindow = FALSE; } else if (cgiVarExists("pbt.left1")) { relativeScroll(-0.02); initialWindow = FALSE; } else if (cgiVarExists("pbt.right1")) { relativeScroll(0.02); initialWindow = FALSE; } else if (cgiVarExists("pbt.right2")) { relativeScroll(0.475); initialWindow = FALSE; } else if (cgiVarExists("pbt.right3")) { relativeScroll(0.95); initialWindow = FALSE; } } dnaUtilOpen(); l=strlen(aa); /* initialize AA properties */ aaPropertyInit(&hasResFreq); sfCount = getSuperfamilies2(proteinID); if (sfCount == 0) { sfCount = getSuperfamilies(proteinID); } if (mrnaID != NULL) { if (kgVersion == KG_III) { doExonTrack = FALSE; sqlSafefFrag(cond_str, sizeof(cond_str), "spId='%s'", proteinID); kgId = sqlGetField(database, "kgXref", "kgId", cond_str); if (kgId != NULL) { sqlSafefFrag(cond_str, sizeof(cond_str), "name='%s'", kgId); kgPep = sqlGetField(database, "knownGenePep", "seq", cond_str); //printf("<pre><br>%s", kgPep);fflush(stdout); if (kgPep != NULL) { if (strstr(protDbName, "proteins") != NULL) { protDbDate = strstr(protDbName, "proteins") + strlen("proteins"); safef(uniProtDbName, sizeof(uniProtDbName),"sp%s", protDbDate); sqlSafefFrag(cond_str, sizeof(cond_str), "acc='%s'", proteinID); protPep = sqlGetField(uniProtDbName, "protein", "val", cond_str); //printf("<br>%s\n", protPep);fflush(stdout); if (protPep != NULL) { if (sameWord(kgPep, protPep)) { //printf("<br>MATCH!\n");fflush(stdout); sqlSafefFrag(cond_str, sizeof(cond_str), "qName='%s'", kgId); answer = sqlGetField(database, kgProtMapTableName, "qName", cond_str); if (answer != NULL) { /* NOTE: passing in kgId instead of proteinID because kgProtMap2's qName uses kgId instead of protein display ID */ getExonInfo(kgId, &exCount, &chrom, &strand); assert(exCount > 0); doExonTrack = TRUE; } } /* else { chp1 = kgPep; printf("<br>"); chp2 = protPep; ll = strlen(kgPep); if (strlen(protPep) < ll) ll= strlen(protPep); for (i=0; i<ll; i++) { if (*chp1 != *chp2) { printf("%c", *chp1); } else { printf("."); } chp1++; chp2++; } } //printf("</pre>");fflush(stdout); */ } } } } } else { doExonTrack = TRUE; getExonInfo(proteinID, &exCount, &chrom, &strand); assert(exCount > 0); } /* do the following only if pbTracks called doTracks() */ if (initialWindow && IAmPbTracks) { prevGBOffsetSav = calPrevGB(exCount, chrom, strand, l, yOffp, proteinID, mrnaID); trackOrigOffset = prevGBOffsetSav; if (trackOrigOffset > (protSeqLen*pbScale - 600)) trackOrigOffset = protSeqLen*pbScale - 600; /* prevent negative value */ if (trackOrigOffset < 0) trackOrigOffset = 0; } /* if this if for PDF/Postscript, the trackOrigOffset is already calculated previously, use the saved value */ if (psOutput != NULL) { trackOrigOffset = atoi(cartOptionalString(cart, "pbt.trackOffset")); } } /*printf("<br>%d %d<br>%d %d\n", prevGBStartPos, prevGBEndPos, blockGenomeStartPositive[exCount-1], blockGenomeStartPositive[0]); fflush(stdout); */ if (strand == '-') { if ((prevGBStartPos <= blockGenomeStartPositive[exCount-1]) && (prevGBEndPos >= blockGenomeStartPositive[0])) { showPrevGBPos = FALSE; } } else { if ((prevGBStartPos <= blockGenomeStartPositive[0]) && (prevGBEndPos >= blockGenomeStartPositive[exCount-1])) { showPrevGBPos = FALSE; } } if ((cgiOptionalString("aaOrigOffset") != NULL) && scaleButtonPushed) { trackOrigOffset = atoi(cgiOptionalString("aaOrigOffset"))*pbScale; } pixWidth = 160+ protSeqLen*pbScale; if (pixWidth > MAX_PB_PIXWIDTH) { pixWidth = MAX_PB_PIXWIDTH; } if ((protSeqLen*pbScale - trackOrigOffset) < MAX_PB_PIXWIDTH) { pixWidth = protSeqLen*pbScale - trackOrigOffset + 160; } if (pixWidth < 550) pixWidth = 550; insideWidth = pixWidth-gfxBorder; if (proteinInSupportedGenome) { pixHeight = 250; } else { pixHeight = 215; } if (sfCount > 0) pixHeight = pixHeight + 20; /* make room for individual residues display */ if (pbScale >=6) pixHeight = pixHeight + 20; if (pbScale >=18) pixHeight = pixHeight + 30; if (psOutput) { vg = vgOpenPostScript(pixWidth, pixHeight, psOutput); suppressHtml = TRUE; hideControls = TRUE; } else { trashDirFile(&gifTn, "pbt", "pbt", ".png"); vg = vgOpenPng(pixWidth, pixHeight, gifTn.forCgi, FALSE); } /* Put up horizontal scroll controls. */ hWrites("Move "); hButton("pbt.left3", "<<<"); hButton("pbt.left2", " <<"); hButton("pbt.left1", " < "); hButton("pbt.right1", " > "); hButton("pbt.right2", ">> "); hButton("pbt.right3", ">>>"); hPrintf("     "); /* Put up scaling controls. */ hPrintf("Current scale: "); if (pbScale == 1) hPrintf("1/6 "); if (pbScale == 3) hPrintf("1/2 "); if (pbScale == 6) hPrintf("FULL "); if (pbScale == 22) hPrintf("DNA "); hPrintf("    Rescale to "); hPrintf("<INPUT TYPE=SUBMIT NAME=\"pbScale\" VALUE=\"1/6\">\n"); hPrintf("<INPUT TYPE=SUBMIT NAME=\"pbScale\" VALUE=\"1/2\">\n"); hPrintf("<INPUT TYPE=SUBMIT NAME=\"pbScale\" VALUE=\"FULL\">\n"); if (kgVersion == KG_III) { /* for KG III, the protein has to exist in the kgProtMap2 table (which will turn on doExonTrack flag) to provide the genomic position data needed for DNA sequence display */ if ((proteinInSupportedGenome) && (doExonTrack)) hPrintf("<INPUT TYPE=SUBMIT NAME=\"pbScale\" VALUE=\"DNA\">\n"); } else { if (proteinInSupportedGenome) hPrintf("<INPUT TYPE=SUBMIT NAME=\"pbScale\" VALUE=\"DNA\">\n"); } hPrintf("<FONT SIZE=1><BR><BR></FONT>\n"); g_vg = vg; pbRed = vgFindColorIx(g_vg, 0xf9, 0x51, 0x59); pbBlue = vgFindColorIx(g_vg, 0x00, 0x00, 0xd0); bkgColor = vgFindColorIx(vg, 255, 254, 232); vgBox(vg, 0, 0, insideWidth, pixHeight, bkgColor); /* Start up client side map. */ hPrintf("<MAP Name=%s>\n", mapName); vgSetClip(vg, 0, gfxBorder, insideWidth, pixHeight - 2*gfxBorder); /* start drawing indivisual tracks */ doAAScale(l, yOffp, 1); if (pbScale >= 6) doResidues(aa, l, yOffp); if (pbScale >= 18) doDnaTrack(chrom, strand, exCount, l, yOffp); if ((mrnaID != NULL) && showPrevGBPos) { doPrevGB(exCount, chrom, strand, l, yOffp, proteinID, mrnaID); } if (mrnaID != NULL) { if (doExonTrack) doExon(exCount, chrom, l, yOffp, proteinID, mrnaID); } doCharge(aa, l, yOffp); doHydrophobicity(aa, l, yOffp); doCysteines(aa, l, yOffp); if (sfCount > 0) doSuperfamily(ensPepName, sfCount, yOffp); if (hasResFreq) doAnomalies(aa, l, yOffp); doAAScale(l, yOffp, -1); vgClose(&vg); /* Finish map and save out picture and tell html file about it. */ hPrintf("</MAP>\n"); /* put tracks image here */ hPrintf( "\n<IMG SRC=\"%s\" BORDER=1 WIDTH=%d HEIGHT=%d USEMAP=#%s><BR>", gifTn.forCgi, pixWidth, pixHeight, mapName); if (proteinInSupportedGenome) { hPrintf("<A HREF=\"../goldenPath/help/pbTracksHelpFiles/pbTracksHelp.shtml#tracks\" TARGET=_blank>"); } else { if (hIsGsidServer()) { hPrintf("<A HREF=\"../goldenPath/help/pbTracksHelpFiles/pbGsid/pbTracksHelp.shtml#tracks\" TARGET=_blank>"); } else { hPrintf("<A HREF=\"../goldenPath/help/pbTracksHelpFiles/pbTracksHelp.shtml#tracks\" TARGET=_blank>"); } } hPrintf("Explanation of Protein Tracks</A><br>"); safef(trackOffset, sizeof(trackOffset), "%d", trackOrigOffset); cgiMakeHiddenVar("trackOffset", trackOffset); /* remember where the AA base origin is so that it can be passed to next PB page */ aaOrigOffset = trackOrigOffset/pbScale; safef(aaOrigOffsetStr, sizeof(aaOrigOffsetStr), "%d", aaOrigOffset); cgiMakeHiddenVar("aaOrigOffset", aaOrigOffsetStr); /* save the following state variables, to be used by PDF/Postcript processing */ cartSetString(cart,"pbt.pbScaleStr", pbScaleStr); cartSetString(cart,"pbt.trackOffset", trackOffset); cartSaveSession(cart); fflush(stdout); }
void ctgToChromFa(char *chromName, char *insertFile, char *chromDir, char *orderLst, char *outName, struct hash *liftHash) /* ctgToChromFa - convert contig level fa files to chromosome level. */ { struct hash *uniq = newHash(0); struct bigInsert *bi; struct chromInserts *chromInserts; struct hash *insertHash = newHash(9); struct lineFile *lf = lineFileOpen(orderLst, TRUE); FILE *f = mustOpen(outName, "w"); char ctgFaName[512]; char *words[2]; int liftChromSize = 0; int actualChromSize = 0; boolean isFirst = TRUE; chromInsertsRead(insertFile, insertHash); chromInserts = hashFindVal(insertHash, chromName); fprintf(f, ">%s\n", chromName); while (lineFileNextRow(lf, words, 1)) { char *contig = words[0]; int nSize; if (liftHash != NULL) { struct lift *lift = hashMustFindVal(liftHash, contig); nSize = lift->nBefore; liftChromSize = lift->chromSize; } else nSize = chromInsertsGapSize(chromInserts, rmChromPrefix(contig), isFirst); hashAddUnique(uniq, contig, NULL); addN(f, nSize); actualChromSize += nSize; isFirst = FALSE; sprintf(ctgFaName, "%s/%s/%s.fa", chromDir, contig, contig); if (fileExists(ctgFaName)) { actualChromSize += addFa(f, ctgFaName); } else { warn("%s does not exist\n", ctgFaName); if (!cgiVarExists("missOk")) noWarnAbort(); } } lineFileClose(&lf); if (chromInserts != NULL) if ((bi = chromInserts->terminal) != NULL) { addN(f, bi->size); actualChromSize += bi->size; } if (liftHash != NULL) { if (actualChromSize > liftChromSize) errAbort("Error: chromosome size from lift file is %d, but actual fa size is %d. Possible inconsistency between lift and inserts?", liftChromSize, actualChromSize); else if (actualChromSize < liftChromSize) addN(f, (liftChromSize - actualChromSize)); } if (linePos != 0) fputc('\n', f); fclose(f); }
void doMiddle() /* Write what goes between BODY and /BODY */ { pushWarnHandler(localWarn); if (!cgiServerHttpsIsOn()) usage(); struct sqlConnection *conn = edwConnectReadWrite(); printf("<FORM ACTION=\"edwWebRegisterScript\" METHOD=POST>\n"); printf("<B>Register Script with ENCODE Data Warehouse</B><BR>\n"); #ifdef SOON uglyf("HTTP_AUTHENTICATION: '%s'<BR>\n", getenv("HTTP_AUTHENTICATION")); uglyf("HTTP_AUTHORIZATION: '%s'<BR>\n", getenv("HTTP_AUTHORIZATION")); dumpEnv(mainEnv); #endif if (userEmail == NULL) { printf("Please sign in:"); printf("<INPUT TYPE=BUTTON NAME=\"signIn\" VALUE=\"sign in\" id=\"signin\">"); } else if (cgiVarExists("description")) { struct edwUser *user = edwUserFromEmail(conn, userEmail); if (user == NULL) edwWarnUnregisteredUser(userEmail); else { char password[HEXED_32_SIZE]; edwRandomHexed32(password); char babyName[HEXED_32_SIZE]; edwRandomBabble(babyName, sizeof(babyName)); edwRegisterScript(conn, user, babyName, password, cgiString("description")); printf("Script now registered.<BR>\n"); printf("The script user name is %s.<BR>\n", babyName); printf("The script password is %s.<BR>\n", password); printf("Please save the script user name and password somewhere. "); puts("Please pass these two and the URL"); puts(" of your validated manifest file (validated.txt) to our server to submit data."); puts("Construct a URL of the form:<BR>"); printf("<PRE>https://encodedcc.sdsc.edu/cgi-bin/edwScriptSubmit" "?user=%s&password=%s&url=%s\n</PRE>", babyName, password, cgiEncode("http://your.host.edu/your_dir/validated.txt")); puts("That is pass the CGI encoded variables user, password, and url to the "); puts("web services CGI at"); puts("https://encodedcc.sdsc.edu/cgi-bin/edwScriptSubmit. "); puts("You can use the http://encodedcc.sdsc.edu/cgi-bin/edwWebBrowse site to "); puts("monitor your submission interactively. Please contact your wrangler if you "); puts("have any questions.<BR>"); cgiMakeButton("submit", "Register another script"); } printf(" "); edwPrintLogOutButton(); } else { struct edwUser *user = edwUserFromEmail(conn, userEmail); edwPrintLogOutButton(); if (user == NULL) edwWarnUnregisteredUser(userEmail); else { printf("%s is authorized to register a new script<BR>\n", userEmail); printf("<BR>Script description:\n"); cgiMakeTextVar("description", NULL, 80); cgiMakeSubmitButton(); } } printf("</FORM>\n"); }
void wikiPlot() /* wikiPlot - Quick plots of maps vs. each other. */ { boolean gotDir = cgiVarExists("contigDir"); double step; contigDir = cgiUsualString("contigDir", contigDir); mapX = cgiUsualString("mapX", mapX); mapY = cgiUsualString("mapY", mapY); pix = cgiUsualInt("pix", pix); xOff = cgiUsualDouble("xOff", xOff); yOff = cgiUsualDouble("yOff", yOff); zoom = cgiUsualDouble("zoom", zoom); step = 0.1 * 1/zoom; if (cgiVarExists("boxOut")) { double invZoom = 1.0/zoom; double xCen = xOff + invZoom*0.5; double yCen = yOff + invZoom*0.5; zoom /= 2; invZoom = 1.0/zoom; xOff = xCen - invZoom*0.5; yOff = yCen - invZoom*0.5; } else if (cgiVarExists("boxUp")) yOff -= step; else if (cgiVarExists("boxDown")) yOff += step; else if (cgiVarExists("boxLeft")) xOff -= step; else if (cgiVarExists("boxRight")) xOff += step; else if (cgiVarExists("boxUpLeft")) { yOff -= step; xOff -= step; } else if (cgiVarExists("boxUpRight")) { yOff -= step; xOff += step; } else if (cgiVarExists("boxDownLeft")) { yOff += step; xOff -= step; } else if (cgiVarExists("boxDownRight")) { yOff += step; xOff += step; } else if (cgiVarExists("unzoom")) { xOff = yOff = -0.05; zoom = 0.9; } printf("<FORM ACTION=\"../cgi-bin/wikiPlot\" METHOD=\"GET\">\n"); printf("<TABLE BORDER=0 WIDTH=\"100%%\">\n"); printf("<TR>\n"); printf("<TD WIDTH=\"78%%\">\n"); printf("<B>Wiki Plotter</B><BR>\n"); printf("<B>Contig: </B>"); cgiMakeTextVar("contigDir", contigDir, 0); if (gotDir) { cgiMakeButton("refresh", "refresh"); } else cgiMakeButton("submit", "submit"); printf("<BR>\n"); printf("<B>Map X: </B>"); cgiMakeTextVar("mapX", mapX, 12); printf("<B>Map Y: </B>"); cgiMakeTextVar("mapY", mapY, 12); printf("<B>Pixels: </B>"); cgiMakeIntVar("pix", pix, 4); printf("</TD>\n"); printf("<TD WIDTH=\"22%%\">\n"); if (gotDir) printBox(); printf("</TD>\n"); printf("</TR>\n"); printf("</TABLE>\n"); if (gotDir) { char xFile[512], yFile[512]; struct hash *xHash = NULL, *yHash = NULL; struct clonePos *xList = NULL, *yList = NULL; sprintf(xFile, "%s/%s", contigDir, mapX); sprintf(yFile, "%s/%s", contigDir, mapY); loadMaps(xFile, yFile, &xList, &yList, &xHash, &yHash); makePlot(xList, yList, yHash); } /* Save hidden vars. */ { char buf[256]; sprintf(buf, "%f", zoom); cgiMakeHiddenVar("zoom", buf); sprintf(buf, "%f", xOff); cgiMakeHiddenVar("xOff", buf); sprintf(buf, "%f", yOff); cgiMakeHiddenVar("yOff", buf); } printf("</FORM>\n"); }
int main(int argc, char *argv[]) /* Process command line. */ { pushCarefulMemHandler(100000000); cgiSpoof(&argc, argv); htmlSetStyle(htmlStyleUndecoratedLink); htmlSetBgColor(HG_CL_OUTSIDE); oldCart = hashNew(10); cart = cartAndCookie(hUserCookie(), excludeVars, oldCart); getDbAndGenome(cart, &database, &genome, oldCart); //hSetDb(database); conn = hAllocConn(database); database = strdup("h1n1"); /* Get sortOn. Revert to default by subject Id. */ orderOn = cartUsualString(cart, orderVarName, "+subjId"); displayCountString = cartUsualString(cart, countVarName, "50"); if (sameString(displayCountString, "all")) displayCount = BIGNUM; else displayCount = atoi(displayCountString); colList = getColumns(conn); if (cgiVarExists("submit_filter")) { struct dyString *head = dyStringNew(1024); boolean redir = cgiVarExists(redirectName); struct subjInfo *subjList = NULL; struct column *ordList = colList; struct column *ord = curOrder(ordList); subjList = getOrderedList(ord, colList, conn, BIGNUM); saveSubjList(subjList); if ((!subjList || redir)) { if (subjList && redir) { dyStringPrintf(head, "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;URL=/cgi-bin/%s\">" "<META HTTP-EQUIV=\"Pragma\" CONTENT=\"no-cache\">" "<META HTTP-EQUIV=\"Expires\" CONTENT=\"-1\">" , cgiString(redirectName)); cartRemove(cart, redirectName); } htmStartWithHead(stdout, head->string, "GISAID Table View"); if (!subjList) /* if everything has been filtered out, we'll have to go back */ { hPrintf("No subject(s) found with the filtering conditions specified.<br>"); hPrintf("Click <a href=\"gisaidTable?gisaidTable.do.advFilter=filter+%%28now+on%%29\">here</a> " "to return to Select Subjects.<br>"); } cartCheckout(&cart); htmlEnd(); hFreeConn(&conn); return 0; } } htmStart(stdout, "GISAID Table View"); cartWarnCatcher(doMiddle, cart, htmlVaWarn); cartCheckout(&cart); htmlEnd(); hFreeConn(&conn); return 0; }