void doLabContacts(struct cart *theCart)
{
char *subId = cartString(theCart, "lab");
cartWebStart(cart, database, "ENCODE DCC:  Contacts for submission: %s",subId);
struct sqlConnection *conn = sqlConnect(database);
char query[10 * 1024];
struct sqlResult *sr;
char **row;

printf("<a href=docIdView?db=%s> Return </a><BR>", database);
safef(query, sizeof query, "select user_id from %s where id = %s ", "projects",subId);
char *userId = sqlQuickString(conn, query);

safef(query, sizeof query, "select name,email,pi from %s where id = '%s' ", "users",userId);
sr = sqlGetResult(conn, query);
printf("<pre>");
while ((row = sqlNextRow(sr)) != NULL)
    {
    printf("Name:  %s\nEmail: %s\nPI:    %s", row[0], row[1], row[2]);
    }

sqlFreeResult(&sr);
sqlDisconnect(&conn);
cartWebEnd();
}
void doDocIdReport(struct cart *theCart)
{
char *docId = cartString(theCart, "docId");
cartWebStart(cart, database, "ENCODE DCC:  Validation report for docId %s",docId);
struct sqlConnection *conn = sqlConnect(database);
char query[10 * 1024];
struct sqlResult *sr;
char **row;
boolean beenHere = FALSE;

printf("<a href=docIdView?db=%s> Return </a><BR>", database);
safef(query, sizeof query, "select * from %s where ix=%s", docIdTable,docId);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    if (beenHere)
        errAbort("found more than one record with ix value %s in table %s", 
            docId, docIdTable);
    beenHere = TRUE;

    struct docIdSub *docIdSub = docIdSubLoad(row);
    cgiDecode(docIdSub->valReport, docIdSub->valReport, strlen(docIdSub->valReport));
    //printf("tempFile is %s\n<BR>", tempFile);
    printf("<pre>%s", docIdSub->valReport);
    }

cartWebEnd();
}
void doMiddle(struct cart *theCart)
/* Set up pretty web display and save cart in global. */
{
char *key = NULL;
char *file = NULL;

cart = theCart;

key = cartOptionalString(cart, "key");
if (isValidKey(key))
    {
    file = cartOptionalString(cart, "file");
    if(NULL == file)
        {
        printIndexFile();
        }
    else
        {
        printFile(file);
        }
    }
else
    {
    cartWebStart(theCart, database, "SECURE CGI \n");
    cartRemove(cart, "key");
    printf("INVALID KEY\n");
    cartWebEnd();
    }
}
/* Mimic behaviour of doGoodReport do less stuff... */
void doGoodReportZoo(FILE *dummy, struct coordConvRep *ccr) 
/** output the result of a successful conversion */
{
cartWebStart(cart, database, "Coordinate Conversion for %s %s:%d-%d", 
	     ccr->from->date, ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd);
printWebWarnings();
printf("<p><b>Success:</b> %s\n", ccr->msg);

printSucessWarningZoo(); 

printf("<ul><li><b>Original Coordinates:</b> %s %s:%d-%d  ", 
       ccr->from->date ,ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd);

printf("<a href=\"%s\">[browser]</a></li>\n", 
       makeBrowserUrl(ccr->from->version, ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd));

printf("<li><b>Region of Original Coordinates Converted:</b> %s %s:%d-%d  ", 
       ccr->from->date ,ccr->from->chrom, ccr->from->next->chromStart, ccr->from->next->chromEnd);

printf("<a href=\"%s\">[browser]</a></li>\n", 
       makeBrowserUrl(ccr->from->version, ccr->from->chrom, ccr->from->next->chromStart, ccr->from->next->chromEnd));

printf("<li><b>New Coordinates:</b> %s %s:%d-%d  ", 
       ccr->to->date ,ccr->to->chrom, ccr->to->chromStart, ccr->to->chromEnd);

printf("<a href=\"%s\">[browser]</a></li></ul>\n", 
       makeBrowserUrl(ccr->to->version, ccr->to->chrom, ccr->to->chromStart, ccr->to->chromEnd));

/* Trouble shooting isn't applicable in this case yet... ccr doesn't contain proper info.. */
/*  printTroubleShooting(ccr); */

cartWebEnd();
}
Ejemplo n.º 5
0
void doParDetails(struct trackDb *tdb, char *name)
/* show details of a PAR item. */
{
// load entire PAR table (t's tiny) and partition
struct bed *pars = loadParTable(tdb);
if (slCount(pars) & 1)
    errAbort("par items not paired in %s", tdb->table);

struct bed *clickedPar = getClickedPar(name, &pars);
struct bed *homPar = getHomologousPar(clickedPar, &pars);
slSort(&pars, parCmp);

cartWebStart(cart, database, "Pseudoautosomal regions");
webPrintLinkTableStart();

// header
webPrintLabelCell("");
webPrintLabelCell("Selected PAR");
webPrintLabelCell("Homologous PAR");

// selected
webPrintLinkTableNewRow();
printHomPairRow(clickedPar, homPar);
if (pars != NULL)
    printOtherPars(clickedPar, pars);

webPrintLinkTableEnd();
printTrackHtml(tdb);
webEnd();

bedFreeList(&pars);
bedFree(&clickedPar);
bedFree(&homPar);
}
Ejemplo n.º 6
0
void doTriangle(struct trackDb *tdb, char *item, char *motifTable)
/* Display detailed info on a regulatory triangle item. */
{
int start = cartInt(cart, "o");
struct dnaSeq *seq = NULL;
struct dnaMotif *motif = loadDnaMotif(item, motifTable);
char *table = tdb->table;
int rowOffset = hOffsetPastBin(database, seqName, table);
char query[256];
struct sqlResult *sr;
char **row;
struct bed *hit = NULL;
struct sqlConnection *conn = hAllocConn(database);

cartWebStart(cart, database, "Regulatory Motif Info");
genericBedClick(conn, tdb, item, start, 6);

sqlSafef(query, sizeof query,
	"select * from %s where  name = '%s' and chrom = '%s' and chromStart = %d",
	table, item, seqName, start);
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
    hit = bedLoadN(row + rowOffset, 6);
sqlFreeResult(&sr);

if (hit != NULL)
    {
    seq = hDnaFromSeq(database, hit->chrom, hit->chromStart, hit->chromEnd, dnaLower);
    if (hit->strand[0] == '-')
	reverseComplement(seq->dna, seq->size);
    }
motifHitSection(seq, motif);
printTrackHtml(tdb);
}
Ejemplo n.º 7
0
void doMiddle(struct cart *theCart)
/* Set up globals and make web page */
{
cart = theCart;
char *db = cartUsualString(cart, "db", hDefaultDb());
cartWebStart(cart, db, "Public Sessions");

/* Not in a form; can't use cartSaveSession() to set up an hgsid input */
printf ("<script>var common = {hgsid:\"%s\"};</script>\n", cartSessionId(cart));

jsIncludeDataTablesLibs();

printf("<p>Sessions allow users to save snapshots of the Genome Browser "
"and its current configuration, including displayed tracks, position, "
"and custom track data. The Public Sessions tool allows users to easily "
"share those sessions that they deem interesting with the rest of the "
"world's researchers. You can add your own sessions to this list by "
"checking the appropriate box on the "
"<a href=\"../cgi-bin/hgSession?%s\">Session Management</a> page.</p>\n"
"<p>See the "
"<a href=\"../goldenPath/help/hgSessionHelp.html\">Sessions User's Guide</a> "
"for more information.\n</p>", cartSidUrlString(cart));

showGalleryTab();

cartWebEnd();
}
Ejemplo n.º 8
0
void doMiddle(struct cart *cart)
/* Write body of web page. */
{
struct trackDb *tdbList = NULL;
char *organism = NULL;
char *db = NULL;
getDbAndGenome(cart, &db, &organism, NULL);
char *chrom = cartUsualString(cart, "c", hDefaultChrom(db));
measureTiming = isNotEmpty(cartOptionalString(cart, "measureTiming"));

// QUESTION: Do We need track list ???  trackHash ??? Can't we just get one track and no children
trackHash = trackHashMakeWithComposites(db,chrom,&tdbList,FALSE);

cartWebStart(cart, db, "Search for " FILE_SEARCH_WHAT " in the %s %s Assembly", 
             organism, hFreezeFromDb(db));

webIncludeResourceFile("HGStyle.css");
webIncludeResourceFile("jquery-ui.css");
webIncludeResourceFile("ui.dropdownchecklist.css");
jsIncludeFile("jquery.js", NULL);
jsIncludeFile("jquery-ui.js", NULL);
jsIncludeFile("ui.dropdownchecklist.js",NULL);
jsIncludeFile("utils.js",NULL);

// This line is needed to get the multi-selects initialized
jsIncludeFile("ddcl.js",NULL);
printf("<script type='text/javascript'>$(document).ready(function() "
       "{ findTracks.updateMdbHelp(0); });</script>\n");

doFileSearch(db,organism,cart,tdbList);


printf("<BR>\n");
webEnd();
}
Ejemplo n.º 9
0
void doCcdsGene(struct trackDb *tdb, char *ccdsId)
/* Process click on a CCDS gene. */
{
struct sqlConnection *conn = hAllocConn(database);
struct ccdsInfo *rsCcds = ccdsInfoSelectByCcds(conn, ccdsId, ccdsInfoNcbi);
struct ccdsInfo *vegaCcds = ccdsInfoSelectByCcds(conn, ccdsId, ccdsInfoVega);
struct ccdsInfo *ensCcds = ccdsInfoSelectByCcds(conn, ccdsId, ccdsInfoEnsembl);

if (rsCcds == NULL)
    errAbort("database inconsistency: no NCBI ccdsInfo entries found for %s", ccdsId);
if ((vegaCcds == NULL) && (ensCcds == NULL))
    errAbort("database inconsistency: no Hinxton ccdsInfo entries found for %s", ccdsId);

ccdsInfoMRnaSort(&rsCcds);
ccdsInfoMRnaSort(&vegaCcds);
ccdsInfoMRnaSort(&ensCcds);

cartWebStart(cart, database, "CCDS Gene");

printf("<H2>Consensus CDS Gene %s</H2>\n", ccdsId);

writeBasicInfoHtml(conn, ccdsId, rsCcds, vegaCcds, ensCcds);
writeLinksHtml(conn, ccdsId, rsCcds, vegaCcds, ensCcds);
writePublicNotesHtml(conn, ccdsId);
writeRefSeqSummaryHtml(conn, ccdsId, rsCcds);
htmlHorizontalLine();

printTrackHtml(tdb);
ccdsInfoFreeList(&rsCcds);
ccdsInfoFreeList(&vegaCcds);
ccdsInfoFreeList(&ensCcds);
hFreeConn(&conn);
}
void mainPage(struct sqlConnection *conn, int id, char *geneName)
/* Put up fancy main page - image, caption, and then a bunch of thumbnails. */
{
struct slInt *thumbList = NULL, *thumb;

cartWebStart(cart, NULL, "UCSC BioImage Browser on %s", geneName);
printf("<A HREF=\"");
printf("../cgi-bin/hgBioImage?%s=%d&%s=on", hgbiId, id, hgbiDoFullSize);
printf("\">");
printf("<IMG SRC=\"/%s\" BORDER=1></A><BR>\n", bioImageScreenSizePath(conn, id));
printf("\n");
printCaption(conn, id, geneName);

htmlHorizontalLine();
printf("Other images associated with gene.  Click to view details.<BR>");
thumbList = bioImageOnSameGene(conn, id);
for (thumb = thumbList; thumb != NULL; thumb = thumb->next)
    {
    char *imageFile = bioImageThumbSizePath(conn, thumb->val);
    printf("<A HREF=\"../cgi-bin/hgBioImage?%s=%d\">", hgbiId, thumb->val);
    printf("<IMG SRC=\"/%s\" BORDER=1></A>\n", imageFile);
    printf("&nbsp;");
    }
cartWebEnd();
}
Ejemplo n.º 11
0
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);
}
Ejemplo n.º 12
0
void doKgMethod()
/* display knownGene.html content (UCSC Known Genes
 * Method, Credits, and Data Use Restrictions) */
{
cartWebStart(cart, database, "Methods, Credits, and Use Restrictions");
struct trackDb *tdb = hTrackDbForTrack(database, genomeSetting("knownGene"));
hPrintf("%s", tdb->html);
cartWebEnd();
}
Ejemplo n.º 13
0
void doMiddle(struct cart *theCart)
/* Write header and body of html page. */
{
    cart = theCart;
    dnaUtilOpen();
    cartWebStart(cart, NULL, "UCSC In-Silico PCR");
    dispatch();
    cartWebEnd();
}
Ejemplo n.º 14
0
void doPeakClusters(struct trackDb *tdb, char *item)
/* Display detailed info about a cluster of DNase peaks from other tracks. */
{
int start = cartInt(cart, "o");
char *table = tdb->table;
int rowOffset = hOffsetPastBin(database, seqName, table);
char query[256];
struct sqlResult *sr;
char **row;
struct bed *cluster = NULL;
struct sqlConnection *conn = hAllocConn(database);

cartWebStart(cart, database, "%s item details", tdb->shortLabel);
sqlSafef(query, sizeof(query),
	"select * from %s where  name = '%s' and chrom = '%s' and chromStart = %d",
	table, item, seqName, start);
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
    cluster = bedLoadN(row+rowOffset, 5);
sqlFreeResult(&sr);

if (cluster != NULL)
    {
    /* Get list of subgroups to display */
    char *inputTableFieldDisplay = trackDbSetting(tdb, "inputTableFieldDisplay");
    if (inputTableFieldDisplay != NULL)
        {
	struct slName *fieldList = stringToSlNames(inputTableFieldDisplay);
	char *inputTrackTable = trackDbRequiredSetting(tdb, "inputTrackTable");

	/* Print out some information about the cluster overall. */
	printf("<B>Items in Cluster:</B> %s of %d<BR>\n", cluster->name, 
	    sqlRowCount(conn, sqlCheckIdentifier(inputTrackTable)));
	printf("<B>Cluster Score (out of 1000):</B> %d<BR>\n", cluster->score);
	printPos(cluster->chrom, cluster->chromStart, cluster->chromEnd, NULL, TRUE, NULL);

	/* In a new section put up list of hits. */
	webNewSection("List of Items in Cluster");
	webPrintLinkTableStart();
	printClusterTableHeader(fieldList, FALSE, FALSE, TRUE);
	printPeakClusterInfo(tdb, cart, conn, inputTrackTable, fieldList, cluster);
	}
    else
	errAbort("Missing required trackDb setting %s for track %s",
	    "inputTableFieldDisplay", tdb->track);
    webPrintLinkTableEnd();
    }
printf("<A HREF=\"%s&g=htcListItemsAssayed&table=%s\" TARGET_blank>", hgcPathAndSettings(),
	tdb->track);
printf("List all items assayed");
printf("</A><BR>\n");
webNewSection("Track Description");
printTrackHtml(tdb);
hFreeConn(&conn);
}
Ejemplo n.º 15
0
void doTransRegCode(struct trackDb *tdb, char *item, char *motifTable)
/* Display detailed info on a transcriptional regulatory code item. */
{
struct dnaMotif *motif = loadDnaMotif(item, motifTable);
int start = cartInt(cart, "o");
struct dnaSeq *seq = NULL;
char *table = tdb->table;
int rowOffset = hOffsetPastBin(database, seqName, table);
char query[256];
struct sqlResult *sr;
char **row;
struct sqlConnection *conn = hAllocConn(database);
struct transRegCode *trc = NULL;

cartWebStart(cart, database, "Regulatory Code Info");
sqlSafef(query, sizeof query,
	"select * from %s where  name = '%s' and chrom = '%s' and chromStart = %d",
	table, item, seqName, start);
sr = sqlGetResult(conn, query);
row = sqlNextRow(sr);
if (row != NULL)
    trc = transRegCodeLoad(row+rowOffset);
sqlFreeResult(&sr);

if (trc != NULL)
    {
    char strand[2];
    seq = hDnaFromSeq(database, trc->chrom, trc->chromStart, trc->chromEnd, dnaLower);
    if (seq->size != motif->columnCount)
	{
        printf("WARNING: seq->size = %d, motif->colCount=%d<BR>\n",
		seq->size, motif->columnCount);
	strand[0] = '?';
	seq = NULL;
	}
    else
	{
	strand[0] = dnaMotifBestStrand(motif, seq->dna);
	if (strand[0] == '-')
	    reverseComplement(seq->dna, seq->size);
	}
    strand[1] = 0;
    printf("<B>Name:</B> ");
    sacCerHgGeneLinkName(conn, trc->name);
    printf("<BR>\n");
    printf("<B>ChIP-chip Evidence:</B> %s<BR>\n", trc->chipEvidence);
    printf("<B>Species conserved in:</B> %d of 2<BR>\n", trc->consSpecies);
    if (seq != NULL)
	printf("<B>Bit Score of Motif Hit:</B> %4.2f<BR>\n",
	    dnaMotifBitScore(motif, seq->dna));
    printf("<B>Item score:</B> %d<BR>\n", trc->score);
    printPosOnChrom(trc->chrom, trc->chromStart, trc->chromEnd, strand, TRUE, trc->name);
    }
motifHitSection(seq, motif);
printTrackHtml(tdb);
}
/* This is very similar to doForm except it's for Zoo species */
void doFormZoo(struct cart *lCart) 
/** Print out the form for users */
{
char **genomeList = NULL;
int genomeCount = 0;
char *dbChoice = NULL;
int i = 0;
cart = lCart;
cartWebStart(cart, databases, "Converting Coordinates Between Species");
puts( 
     "<p>This page attempts to convert coordinates from one Zoo species' CFTR region\n"
     "to another. The mechanism for doing this is to use the blastz alignments which have been\n"
     "done between each Zoo species and use this to convert coordinates.  In general these should\n"
     "be reasonable conversions however the user is advised to not take the conversions as absolute \n"
     "standards.  Furthermore a given region from a given species is not necessarily alignable to any\n"
     "region in a different species.\n"
     );

/* Get all Zoo species since we are using blastz static alignments */ 
getIndexedGenomeDescriptionsZoo(&genomeList, &genomeCount,FALSE);

/* choose whether to use the db supplied by cgi or our default */
if(origDb != NULL && strstr(origDb, "zoo") == NULL)
    errAbort("Sorry, this mode of the program only works between zoo species.");
dbChoice = chooseDb(origDb, genomeList[0]); 

printf("<form action=\"../cgi-bin/hgCoordConv\" method=get>\n");
printf("<br><br>\n");
printf("<table><tr>\n");
printf("<b><td><table><tr><td>Original Species: </b>\n");
cgiMakeDropList("origGenome", genomeList, genomeCount, dbChoice);
printf("</td></tr></table></td>\n");
printf("  <b><td><table><tr><td>Original Position:  </b>\n");

/* if someone has passed in a position fill it in for them */
if(position == NULL) 
    cgiMakeTextVar("position",defaultPos, 30);
else
    cgiMakeTextVar("position",position, 30);
printf("</td></tr></table></td>\n");
printf("<b><td><table><tr><td>New Species: </b>\n");

freez(&genomeList);
genomeCount =0;
getIndexedGenomeDescriptionsZoo(&genomeList, &genomeCount, FALSE);
cgiMakeDropList("newGenome", genomeList, genomeCount, genomeList[genomeCount -1]);
printf("</td></tr></table></td></tr>\n");
printf("<tr><td colspan=6 align=right><br>\n");
cgiMakeButton("Submit","submit");
printf("</center></td></tr></table>\n");
cgiMakeHiddenVar("calledSelf", "on");
printf("</form>\n");
cartWebEnd();
}
void doBadReport(FILE *dummy, struct coordConvRep *ccr) 
/** output the result of a flawed conversion */{
cartWebStart(cart, database, "Coordinate Conversion for %s %s:%d-%d", 
	     ccr->from->date, ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd);
printWebWarnings();
printf("<p><b>Conversion Not Successful:</B> %s\n", ccr->msg);
printf("<p><a href=\"%s\">View old Coordinates in %s browser.</a>\n", 
       makeBrowserUrl(ccr->from->version, ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd),
       ccr->from->date);
printTroubleShooting(ccr);
cartWebEnd();
}
void doForm(struct cart *lCart) 
/** Print out the form for users */
{
char **genomeList = NULL;
int genomeCount = 0;
char *dbChoice = NULL;
int i = 0;
cart = lCart;
cartWebStart(cart, databases, "Converting Coordinates Between Drafts");
puts( 
     "<p>This page attempts to convert coordinates from one draft of the human genome\n"
     "to another. The mechanism for doing this is to cut out and align pieces from the\n"
     "old draft and align them to the new draft making sure that\n"
     "they are in the same order and orientation. In general the smaller the sequence the better\n"
     "the chances of successful conversion.\n"
     );

getIndexedGenomeDescriptions(&genomeList, &genomeCount, TRUE);

/* choose whether to use the db supplied by cgi or our default */
if(origDb != NULL && strstr(origDb, "hg") == NULL)
    errAbort("Sorry, currently the conversion program only works with human genomes.");
dbChoice = chooseDb(origDb, genomeList[0]); 

printf("<form action=\"../cgi-bin/hgCoordConv\" method=get>\n");
printf("<br><br>\n");
printf("<table><tr>\n");
printf("<b><td><table><tr><td>Original Draft: </b>\n");
cgiMakeDropList("origGenome", genomeList, genomeCount, dbChoice);
printf("</td></tr></table></td>\n");
printf("  <b><td><table><tr><td>Original Position:  </b>\n");

/* if someone has passed in a position fill it in for them */
if(position == NULL) 
    cgiMakeTextVar("position",defaultPos, 30);
else
    cgiMakeTextVar("position",position, 30);
printf("</td></tr></table></td>\n");
printf("<b><td><table><tr><td>New Draft: </b>\n");

freez(&genomeList);
genomeCount =0;
getIndexedGenomeDescriptions(&genomeList, &genomeCount, TRUE);
cgiMakeDropList("newGenome", genomeList, genomeCount, genomeList[genomeCount -1]);
printf("</td></tr></table></td></tr>\n");
printf("<tr><td colspan=6 align=right><br>\n");
cgiMakeButton("Submit","submit");
printf("</center></td></tr></table>\n");
cgiMakeHiddenVar("calledSelf", "on");
printf("</form>\n");
cartWebEnd();
}
void doDocIdMeta(struct cart *theCart)
{
char *docId = cartString(theCart, "docId");
cartWebStart(cart, database, "ENCODE DCC:  Metadata for docId %s",docId);
struct sqlConnection *conn = sqlConnect(database);
char query[10 * 1024];
struct sqlResult *sr;
char **row;
struct tempName tn;
trashDirFile(&tn, "docId", "meta", ".txt");
char *tempFile = tn.forCgi;
boolean beenHere = FALSE;

printf("<a href=docIdView?db=%s> Return </a><BR>", database);
safef(query, sizeof query, "select * from %s where ix=%s", docIdTable,docId);
sr = sqlGetResult(conn, query);
while ((row = sqlNextRow(sr)) != NULL)
    {
    if (beenHere)
        errAbort("found more than one record with ix value %s in table %s", 
            docId, docIdTable);
    beenHere = TRUE;

    struct docIdSub *docIdSub = docIdSubLoad(row);
    cgiDecode(docIdSub->metaData, docIdSub->metaData, strlen(docIdSub->metaData));
    //printf("tempFile is %s\n<BR>", tempFile);
    FILE *f = mustOpen(tempFile, "w");
    fwrite(docIdSub->metaData, strlen(docIdSub->metaData), 1, f);
    fclose(f);
    boolean validated;
    struct mdbObj *mdbObj = mdbObjsLoadFromFormattedFile(tempFile, &validated);
    unlink(tempFile);

    if (mdbObj->next)
        errAbort("got more than one metaObj from metaData");

    for(; mdbObj; mdbObj = mdbObj->next)
        {
        printf("<BR>object: %s\n", mdbObj->obj);
        struct mdbVar *vars = mdbObj->vars;
        for(; vars; vars = vars->next)
            {
            printf("<BR>%s %s\n", vars->var, vars->val);
            }
        }
    }

cartWebEnd();
}
Ejemplo n.º 20
0
void webVaWarn(char *format, va_list args)
/* Warning handler that closes out page and stuff in
 * the fancy form. */
{
gotWarnings = TRUE;
boolean needStart = !webHeadAlreadyOutputed;
if (needStart)
    {
    // All callers of this (via webPushErrHandlersCartDb) have skipped Content-type
    // because they want to output text unless we hit this condition:
    puts("Content-type:text/html\n");
    cartWebStart(errCart, errDb, "Error");
    }
htmlVaWarn(format, args);
printf("\n<!-- HGERROR -->\n\n\n");
}
Ejemplo n.º 21
0
static void prInitialSection(struct cloneInfo *ci, char *collection)
/* start page and print initial section */
{
cartWebStart(cart, database, "%s Clone %s.%d", collection, ci->acc, ci->version);
printf("<B>%s</B>\n", ci->geneName);
printf("<BR>%s\n", ci->desc);
if (ci->refSeqAccv != NULL)
    printf("<BR><B>RefSeq</B>: %s\n", ci->refSeqAccv);
if (ci->refSeqSum != NULL)
    {
    printf("<BR><B>RefSeq Summary</B>:");
    if (!sameString(ci->refSeqSumAccv, ci->refSeqAccv))
        printf(" <EM>(summary from %s)</EM>:", ci->refSeqAccv); // no summary for best match
    printf(" %s\n", ci->refSeqSum);
    }
}
void doMiddle(struct cart *theCart)
/* Set up globals and make web page */
{
char *db = NULL;
char *ignored;
struct trackDb *tracks;
struct trackRef *tr;
struct group *group, *groups = NULL;

cart = theCart;
cartWebStart(cart, NULL, "ENCODE Track Data Versions (%s)", db);
getDbAndGenome(cart, &db, &ignored, NULL);
tracks = hTrackDb(db);
groups = groupTracks(db, tracks);
for (group = groups; group != NULL; group = group->next)
    {
    if (group->tracks == NULL || !startsWith("encode", group->name))
        continue;
    hTableStart();
    puts("<TR>");
    puts("<TH align=LEFT colspan=3 BGCOLOR=#536ED3>");
    printf("<B>&nbsp;%s</B> ", wrapWhiteFont(group->label));
    printf("&nbsp;&nbsp;&nbsp; ");
    puts("</TH>\n");
    puts("</TR>");
    for (tr = group->tracks; tr != NULL; tr = tr->next)
        {
        char *version = trackDbSetting(tr->track, "dataVersion");
        if (version)
            stripString(version, "ENCODE ");
	puts("<TR><TD>");
	printf(" %s", tr->track->shortLabel);
	puts("</TD><TD>");
	printf(" %s", version ? version : "&nbsp;");
	puts("</TD><TD>");
	printf(" %s", tr->track->longLabel);
	puts("</TD></TR>");
	}
    /*
        printf("\t%s\t%s\t%s\n", version, 
                tr->track->shortLabel, tr->track->longLabel);
                */
    hTableEnd();
    puts("<BR>");
    }
cartWebEnd();
}
Ejemplo n.º 23
0
void doMiddle(struct cart *theCart)
/* Write header and body of html page. */
{
char *userSeq;
char *db, *organism;
boolean clearUserSeq = cgiBoolean("Clear");

cart = theCart;
dnaUtilOpen();

orgChange = sameOk(cgiOptionalString("changeInfo"),"orgChange");
if (orgChange)
    {
    cgiVarSet("db", hDefaultDbForGenome(cgiOptionalString("org"))); 
    }
getDbAndGenome(cart, &db, &organism, oldVars);
char *oldDb = cloneString(db);
findClosestServer(&db, &organism);

/* Get sequence - from userSeq variable, or if 
 * that is empty from a file. */
if (clearUserSeq)
    {
    cartSetString(cart, "userSeq", "");
    cartSetString(cart, "seqFile", "");
    }
userSeq = cartUsualString(cart, "userSeq", "");
if (isEmpty(userSeq))
    {
    userSeq = cartOptionalString(cart, "seqFile");
    }
if (isEmpty(userSeq) || orgChange)
    {
    cartWebStart(theCart, db, "%s BLAT Search", trackHubSkipHubName(organism));
    if (differentString(oldDb, db))
	printf("<HR><P><EM><B>Note:</B> BLAT search is not available for %s %s; "
	       "defaulting to %s %s</EM></P><HR>\n",
	       hGenome(oldDb), hFreezeDate(oldDb), organism, hFreezeDate(db));
    askForSeq(organism,db);
    cartWebEnd();
    }
else 
    {
    blatSeq(skipLeadingSpaces(userSeq), organism);
    }
}
Ejemplo n.º 24
0
void correlatePage(struct sqlConnection *conn)
/* Put up correlation page. */
{
cartWebStart(cart, database, "Correlations of all pairs of graphs");
hPrintf("<FORM ACTION=\"../cgi-bin/hgGenome\" METHOD=GET>\n");
cartSaveSession(cart);
struct slRef *ggRefList = ggAllVisible(conn);
struct slRef *aRef, *bRef;
hPrintf("<TABLE><TR><TD>");
webPrintLinkTableStart();
webPrintLabelCell("Graph A");
webPrintLabelCell("Graph B");
webPrintLabelCell("R");
webPrintLabelCell("R-Squared");
for (aRef = ggRefList; aRef != NULL; aRef = aRef->next)
    {
    for (bRef = aRef->next; bRef != NULL; bRef = bRef->next)
        {
	hPrintf("</TR><TR>");
	correlateGraphs(aRef->val, bRef->val);
	}
    }
webPrintLinkTableEnd();
hPrintf("</TD><TD>");
hPrintf("<CENTER>");
cgiMakeButton("submit", "return to graphs");
hPrintf("</CENTER>");
hPrintf("</TD></TR></TABLE>");

hPrintf("<P>R, also known as Pearson's correlation coefficient, is a measure ");
hPrintf("of the extent that two graphs move together.  The value of R ranges ");
hPrintf("between -1 and 1.  A positive R indicates that the graphs tend to ");
hPrintf("move in the same direction, while a negative R indicates that they ");
hPrintf("tend to move in opposite directions.</P>\n");
hPrintf("<P>R-Squared (which is indeed just R*R) measures how much of the ");
hPrintf("variation in one graph can be explained by a linear dependence on ");
hPrintf("the other graph. R-Squared ranges between 0 when the two graphs are ");
hPrintf("independent to 1 when the graphs are completely dependent.</P>");
hPrintf("</FORM>");
cartWebEnd();
}
Ejemplo n.º 25
0
void doMiddle(struct cart *theCart)
/* Set up globals and make web plabel */
{
cart = theCart;
char *db = cartUsualString(cart, "db", hDefaultDb());
cartWebStart(cart, db, "Try and get some simple D3 things running inside of Genome Browser web framework.");
printf("<script src=\"//cdnjs.cloudflare.com/ajax/libs/d3/3.4.4/d3.min.js\"></script>");
printf("<script src=\"/js/d3pie.min.js\"></script>");
struct slPair *data= slPairNew("A","100");
slPairAdd(&data, "B", "10");
slPairAdd(&data, "C", "1");
slReverse(&data);
printf("<div id=\"pieChart1\">\n");
drawPrettyPieGraph(data, "pieChart1", "Title", "Subtitle");
printf("</div>\n");
slPairAdd(&data, "D", "10");
printf("<div id=\"pieChart2\">\n");
drawPrettyPieGraph(data, "pieChart1", "A new title", "cool subtitle!");
printf("</div>\n");
slPairAdd(&data, "W", "15");
printf("<div id=\"pieChart3\">\n");
drawPrettyPieGraph(data, "pieChart1", "Title", "Testing out what a much longer subtitle will look like... How many characters can I put here?");
printf("</div>\n");
slPairAdd(&data, "Z", "30");
printf("<div id=\"pieChart4\">\n");
drawPrettyPieGraph(data, "pieChart1", "How do much largers titles look?", "Subtitle");
printf("</div>\n");
printf("<style>\npieChart1{\n align:center;} </style>");
#ifdef SOON
drawPieGraph(data);
drawPieGraph(data);
slPairAdd(&data, "E", "15");
drawPieGraph(data);
slPairAdd(&data, "F", "25");
drawPieGraph(data);
slPairAdd(&data, "G", "50");
drawPieGraph(data);
#endif /* SOON */
cartWebEnd();
}
Ejemplo n.º 26
0
void doPeakClusterListItemsAssayed()
/* Put up a page that shows all experiments associated with a cluster track. */
{
struct trackDb *clusterTdb = tdbForTableArg();
cartWebStart(cart, database, "List of items assayed in %s", clusterTdb->shortLabel);
struct sqlConnection *conn = hAllocConn(database);

char *inputTableFieldDisplay = trackDbSetting(clusterTdb, "inputTableFieldDisplay");
webPrintLinkTableStart();
if (inputTableFieldDisplay)
    {
    struct slName *fieldList = stringToSlNames(inputTableFieldDisplay);
    printClusterTableHeader(fieldList, FALSE, FALSE, FALSE);
    char *inputTrackTable = trackDbRequiredSetting(clusterTdb, "inputTrackTable");
    printPeakClusterInfo(clusterTdb, cart, conn, inputTrackTable, fieldList, NULL);
    }
else
    errAbort("Missing required trackDb setting %s for track %s", "inputTableFieldDisplay", 
                clusterTdb->track);
webPrintLinkTableEnd();
hFreeConn(&conn);
}
void configureOnePage()
/* Put up configuration for one graph. */
{
/* Figure out which graph we're configuring. */
char *graphName = cartString(cart, "g");
struct genoGraph *gg = hashFindVal(ggHash, graphName);
if (gg == NULL)
    {
    /* Warn/return rather than abort if have problems, so that 
     * cartRemovePrefix(hggDo) is executed to keep us from error
     * loop forever... */
    warn("Graph %s not found", graphName);
    return;
    }

/* Put up web page with controls */
cartWebStart(cart, database, "Configure %s", gg->shortLabel);
hPrintf("<FORM ACTION=\"../cgi-bin/hgGenome\" METHOD=GET>\n");
cartSaveSession(cart);
cgiMakeHiddenVar(hggConfigure, "on");
struct chromGraphSettings *cgs = gg->settings;
char varName[chromGraphVarNameMaxSize];
chromGraphVarName(gg->name, "minVal", varName);
hPrintf("display min value: ");
cartMakeIntVar(cart, varName, cgs->minVal, 5);
chromGraphVarName(gg->name, "maxVal", varName);
hPrintf(" max value: ");
cartMakeIntVar(cart, varName, cgs->maxVal, 5);
hPrintf("<BR>\n");
hPrintf("draw connecting lines between markers separated by up to ");
chromGraphVarName(gg->name, "maxGapToFill", varName);
cartMakeIntVar(cart, varName, cgs->maxGapToFill, 8);
hPrintf(" bases.");
hPrintf("<BR>\n");
cgiMakeButton("submit", "submit");
hPrintf("</FORM>\n");
cartWebEnd();
}
void submitUpload(struct sqlConnection *conn)
/* Called when they've submitted from uploads page */
{
char *urlText = cartUsualString(cart, hggUploadUrl, NULL);
char *fileText = cartUsualString(cart, hggUploadFile, NULL);
char *rawText = urlText;
if (isNotEmpty(fileText))
  rawText = fileText; 
int rawTextSize = strlen(rawText);
struct errCatch *errCatch = errCatchNew();
cartWebStart(cart, database, "Data Upload Complete (%d bytes)", rawTextSize);
hPrintf("<FORM ACTION=\"../cgi-bin/hgGenome\">");
cartSaveSession(cart);
if (errCatchStart(errCatch))
     trySubmitUpload(conn, rawText);
errCatchFinish(&errCatch);
cartRemove(cart, hggUploadFile);
hPrintf("<CENTER>");
cgiMakeButton("submit", "OK");
hPrintf("</CENTER>");
hPrintf("</FORM>");
cartWebEnd();
}
void doGoodReport(FILE *dummy, struct coordConvRep *ccr) 
/** output the result of a successful conversion */
{
cartWebStart(cart, database, "Coordinate Conversion for %s %s:%d-%d", 
	     ccr->from->date, ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd);
printWebWarnings();
printf("<p><b>Success:</b> %s\n", ccr->msg);
if(sameString(ccr->midPsl->strand, "-")) 
    {
    printf(" It appears that the orientation of your coordinate range has been inverted.\n");
    }
printSucessWarning(); 
printf("<ul><li><b>Old Coordinates:</b> %s %s:%d-%d  ", 
       ccr->from->date ,ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd);
printf("<a href=\"%s\">[browser]</a></li>\n", 
       makeBrowserUrl(ccr->from->version, ccr->from->chrom, ccr->from->chromStart, ccr->from->chromEnd));
printf("<li><b>New Coordinates:</b> %s %s:%d-%d  ", 
       ccr->to->date ,ccr->to->chrom, ccr->to->chromStart, ccr->to->chromEnd);
printf("<a href=\"%s\">[browser]</a></li></ul>\n", 
       makeBrowserUrl(ccr->to->version, ccr->to->chrom, ccr->to->chromStart, ccr->to->chromEnd));
printTroubleShooting(ccr);
cartWebEnd();
}
Ejemplo n.º 30
0
void cartMain(struct cart *theCart)
/* We got the persistent/CGI variable cart.  Now
 * set up the globals and make a web page. */
{
hgBotDelay();
cart = theCart;
getDbAndGenome(cart, &database, &genome, oldVars);
initGenbankTableNames(database);
getGenomeSettings();
if (cartVarExists(cart, hggDoKgMethod))
    doKgMethod();
else if (cartVarExists(cart, hggDoTxInfoDescription))
    doTxInfoDescription();
else
    {
    struct sqlConnection *conn = NULL;
    char *geneName = cartUsualString(cart, hggGene, NULL);
    if (isEmpty(geneName))
	{
	// Silly googlebots.
	hUserAbort("Error: the hgg_gene parameter is missing from the cart and the CGI params.");
	}

    /* if kgProtMap2 table exists, this means we are doing KG III */
    if (hTableExists(database, "kgProtMap2")) kgVersion = KG_III;

    conn = hAllocConn(database);
    curGeneId = findGeneId(conn, geneName);
    getGenePosition(conn);
    curGenePred = getCurGenePred(conn);
    curGeneName = getGeneName(curGeneId, conn);
    spConn = hAllocConn(UNIPROT_DB_NAME);
    swissProtAcc = getSwissProtAcc(conn, spConn, curGeneId);

    if (isRgdGene(conn)) swissProtAcc=getRgdGeneUniProtAcc(curGeneId, conn);
    /* Check command variables, and do the ones that
     * don't want to put up the hot link bar etc. */
    if (cartVarExists(cart, hggDoGetMrnaSeq))
	doGetMrnaSeq(conn, curGeneId, curGeneName);
    else if (cartVarExists(cart, hggDoWikiTrack))
	doWikiTrack(conn);
    else if (cartVarExists(cart, hggDoGetProteinSeq))
	doGetProteinSeq(conn, curGeneId, curGeneName);
    else if (cartVarExists(cart, hggDoRnaFoldDisplay))
	doRnaFoldDisplay(conn, curGeneId, curGeneName);
    else if (cartVarExists(cart, hggDoOtherProteinSeq))
	doOtherProteinSeq(conn, curGeneName);
    else if (cartVarExists(cart, hggDoOtherProteinAli))
	doOtherProteinAli(conn, curGeneId, curGeneName);
    else
	{
	/* Default case - start fancy web page. */
	measureTiming =  isNotEmpty(cartOptionalString(cart, "measureTiming"));
        struct trackDb *tdb = hTrackDbForTrack(database, genomeSetting("knownGene"));
        isGencode = trackDbSettingOn(tdb, "isGencode");
        isGencode2 = trackDbSettingOn(tdb, "isGencode2");
	cartWebStart(cart, database, "%s Gene %s (%s) Description and Page Index",
	    genome, curGeneName, isGencode2 ? curGeneId : curAlignId);
	webMain(conn, tdb);
	cartWebEnd();
	}
    hFreeConn(&spConn);
    hFreeConn(&conn);
    }
cartRemovePrefix(cart, hggDoPrefix);
}