output format:\n");
if (isBedGr)
{
if (! bedifiedOnly)
{
slAddTail(&otList, &otAllFields);
slAddTail(&otList, &otSelected);
}
slAddTail(&otList, &otWigData);
slAddTail(&otList, &otWigBed);
slAddTail(&otList, &otCustomTrack);
slAddTail(&otList, &otHyperlinks);
}
else if (isWig)
{
slAddTail(&otList, &otWigData);
slAddTail(&otList, &otWigBed);
slAddTail(&otList, &otCustomTrack);
// hyperlinks output works for db-wiggle but not for bigWig
}
else if (isHalSnake)
{
slAddTail(&otList, &otMaf);
}
else if (isMaf)
{
slAddTail(&otList, &otMaf);
if (! bedifiedOnly)
slAddTail(&otList, &otAllFields);
}
else if (isChromGraphCt)
{
slAddTail(&otList, &otChromGraphData);
}
else if (isMicroarray)
{
slAddTail(&otList, &otMicroarrayNames);
slAddTail(&otList, &otAllFields);
slAddTail(&otList, &otSelected);
slAddTail(&otList, &otHyperlinks);
}
else if (isPositional)
{
if (! bedifiedOnly)
{
slAddTail(&otList, &otAllFields);
slAddTail(&otList, &otSelected);
}
else
otDefault = &otBed;
slAddTail(&otList, &otSequence);
slAddTail(&otList, &otGff);
if (isPal)
slAddTail(&otList, &otPal);
slAddTail(&otList, &otBed);
slAddTail(&otList, &otCustomTrack);
slAddTail(&otList, &otHyperlinks);
}
else
{
slAddTail(&otList, &otAllFields);
slAddTail(&otList, &otSelected);
}
showOutDropDown(otList, otDefault);
}
void nbSpaces(int count)
/* Print some non-breaking spaces. */
{
int i;
for (i=0; i\n");
/* Print clade, genome and assembly line. */
{
if (gotClade)
{
hPrintf("clade:\n");
printCladeListHtml(hGenome(database), "change", onChangeClade());
nbSpaces(3);
hPrintf("genome:\n");
printGenomeListForCladeHtml(database, "change", onChangeOrg());
}
else
{
hPrintf(" | genome:\n");
printGenomeListHtml(database, "change", onChangeOrg());
}
nbSpaces(3);
hPrintf("assembly:\n");
printAssemblyListHtml(database, "change", onChangeDb());
hPrintf(" | \n");
}
/* Print group and track line. */
{
hPrintf("");
selGroup = showGroupField(hgtaGroup, "change", onChangeGroupOrTrack(), conn, hAllowAllTables());
nbSpaces(3);
curTrack = showTrackField(selGroup, hgtaTrack, "change", onChangeGroupOrTrack(), FALSE);
nbSpaces(3);
boolean hasCustomTracks = FALSE;
struct trackDb *t;
for (t = fullTrackList; t != NULL; t = t->next)
{
if (isCustomTrack(t->table))
{
hasCustomTracks = TRUE;
break;
}
}
hOnClickButton("showMainCtlTbl_Ct", "document.customTrackForm.submit();return false;",
hasCustomTracks ? CT_MANAGE_BUTTON_LABEL : CT_ADD_BUTTON_LABEL);
hPrintf(" ");
if (hubConnectTableExists())
hOnClickButton("showMainCtlTbl_Hub", "document.trackHubForm.submit();return false;", "track hubs");
hPrintf(" | \n");
}
/* Print table line. */
{
hPrintf("");
curTable = showTableField(curTrack, hgtaTable, TRUE);
if (isHubTrack(curTable) || (strchr(curTable, '.') == NULL)) /* In same database */
{
hti = getHti(database, curTable, conn);
isPositional = htiIsPositional(hti);
}
isLongTabix = isLongTabixTable( curTable);
isBam = isBamTable(curTable);
isHic = isHicTable(curTable);
isVcf = isVcfTable(curTable, NULL);
isWig = isWiggle(database, curTable);
if (isBigWigTable(curTable))
{
isPositional = TRUE;
isWig = TRUE;
}
isHalSnake = isHalTable( curTable);
isMaf = isMafTable(database, curTrack, curTable);
isBedGr = isBedGraph(curTable);
isArray = isMicroarray(curTrack, curTable);
struct trackDb *tdb = findTdbForTable(database, curTrack, curTable, ctLookupName);
isPal = isPalCompatible(conn, tdb, curTable);
nbSpaces(1);
if (isCustomTrack(curTable))
{
isChromGraphCt = isChromGraph(tdb);
}
cgiMakeButton(hgtaDoSchema, "describe table schema");
hPrintf(" | \n");
}
if (curTrack == NULL)
{
struct trackDb *tdb = hTrackDbForTrack(database, curTable);
struct trackDb *cTdb = hCompositeTrackDbForSubtrack(database, tdb);
if (cTdb)
curTrack = cTdb;
else
curTrack = tdb;
isMaf = isMafTable(database, curTrack, curTable);
}
/* Table-specific options */
if (isHicTable(curTable))
hicMainPageConfig(cart, hTrackDbForTrack(database,curTable));
/* Region line */
{
char *regionType;
if (cartVarExists(cart, "hgFind.matches")) // coming back from a search
regionType = cartUsualString(cart, hgtaRegionType, hgtaRegionTypeRange);
else
regionType = cartUsualString(cart, hgtaRegionType, hgtaRegionTypeGenome);
char *range = cartUsualString(cart, hgtaRange, "");
if (isPositional)
{
boolean doEncode = FALSE;
if (!trackHubDatabase(database))
doEncode = sqlTableExists(conn, "encodeRegions");
hPrintf("region:\n");
/* If regionType not allowed force it to "genome". */
if ((sameString(regionType, hgtaRegionTypeUserRegions) &&
userRegionsFileName() == NULL) ||
(sameString(regionType, hgtaRegionTypeEncode) && !doEncode))
regionType = hgtaRegionTypeGenome;
// Is "genome" is not allowed because of tdb 'tableBrowser noGenome'?
boolean disableGenome = ((curTrack && cartTrackDbIsNoGenome(database, curTrack->table)) ||
(curTable && cartTrackDbIsNoGenome(database, curTable)));
// If "genome" is selected but not allowed, force it to "range":
if (sameString(regionType, hgtaRegionTypeGenome) && disableGenome)
regionType = hgtaRegionTypeRange;
jsTrackingVar("regionType", regionType);
if (disableGenome)
{
makeRegionButtonExtraHtml(hgtaRegionTypeGenome, regionType, "DISABLED");
hPrintf(" genome (unavailable for selected track)"
" ");
}
else
{
makeRegionButton(hgtaRegionTypeGenome, regionType);
hPrintf(" genome ");
}
if (doEncode)
{
makeRegionButton(hgtaRegionTypeEncode, regionType);
hPrintf(" ENCODE Pilot regions ");
}
makeRegionButton(hgtaRegionTypeRange, regionType);
hPrintf(" position ");
hPrintf("\n",
hgtaRange, hgtaRange, range);
jsOnEventById("focus", hgtaRange,
jsRadioUpdate(hgtaRegionType, "regionType", "range"));
cgiMakeButton(hgtaDoLookupPosition, "lookup");
hPrintf(" ");
if (userRegionsFileName() != NULL)
{
makeRegionButton(hgtaRegionTypeUserRegions, regionType);
hPrintf(" defined regions ");
cgiMakeButton(hgtaDoSetUserRegions, "change");
hPrintf(" ");
cgiMakeButton(hgtaDoClearUserRegions, "clear");
}
else
cgiMakeButton(hgtaDoSetUserRegions, "define regions");
hPrintf(" | \n");
}
else
{
/* Need to put at least stubs of cgi variables in for JavaScript to work. */
jsTrackingVar("regionType", regionType);
cgiMakeHiddenVar(hgtaRange, range);
cgiMakeHiddenVar(hgtaRegionType, regionType);
}
/* Select identifiers line (if applicable). */
if (!isWig && getIdField(database, curTrack, curTable, hti) != NULL)
{
hPrintf("identifiers (names/accessions):\n");
cgiMakeButton(hgtaDoPasteIdentifiers, "paste list");
hPrintf(" ");
cgiMakeButton(hgtaDoUploadIdentifiers, "upload list");
if (identifierFileName() != NULL)
{
hPrintf(" ");
cgiMakeButton(hgtaDoClearIdentifiers, "clear list");
}
hPrintf(" | \n");
}
}
/* microarray options */
/* button for option page here (median/log-ratio, etc) */
/* Filter line. */
{
hPrintf("filter:\n");
if (anyFilter())
{
cgiMakeButton(hgtaDoFilterPage, "edit");
hPrintf(" ");
cgiMakeButton(hgtaDoClearFilter, "clear");
if (isWig || isBedGr)
wigShowFilter(conn);
}
else
{
cgiMakeButton(hgtaDoFilterPage, "create");
}
hPrintf(" | \n");
}
/* Composite track subtrack merge line. */
boolean canSubtrackMerge = (curTrack && tdbIsComposite(curTrack) && !isBam && !isVcf && !isLongTabix && !isHic);
if (canSubtrackMerge)
{
hPrintf("subtrack merge:\n");
if (anySubtrackMerge(database, curTable))
{
cgiMakeButton(hgtaDoSubtrackMergePage, "edit");
hPrintf(" ");
cgiMakeButton(hgtaDoClearSubtrackMerge, "clear");
}
else
{
cgiMakeButton(hgtaDoSubtrackMergePage, "create");
}
hPrintf(" | \n");
}
/* Intersection line. */
if (isPositional)
{
if (anyIntersection())
{
hPrintf("intersection with %s:\n",
cartString(cart, hgtaIntersectTable));
cgiMakeButton(hgtaDoIntersectPage, "edit");
hPrintf(" ");
cgiMakeButton(hgtaDoClearIntersect, "clear");
hPrintf(" | \n");
}
else if (canIntersect(database, curTable))
{
hPrintf("intersection:\n");
cgiMakeButton(hgtaDoIntersectPage, "create");
hPrintf(" | \n");
}
}
/* Correlation line. */
struct trackDb *tdb = findTdbForTable(database, curTrack, curTable, ctLookupName);
if (correlateTrackTableOK(tdb, curTable))
{
char *table2 = cartUsualString(cart, hgtaCorrelateTable, "none");
hPrintf("correlation:\n");
if (differentWord(table2, "none") && strlen(table2) && ! isNoGenomeDisabled(database, table2))
{
struct grp *groupList = fullGroupList;
struct grp *selGroup = findSelectedGroup(groupList, hgtaCorrelateGroup);
struct trackDb *tdb2 = findSelectedTrack(fullTrackList, selGroup,hgtaCorrelateTrack);
if (tdbIsComposite(tdb2))
{
struct slRef *tdbRefList = trackDbListGetRefsToDescendantLeaves(tdb2->subtracks);
struct slRef *tdbRef;
for (tdbRef = tdbRefList; tdbRef != NULL; tdbRef = tdbRef->next)
{
struct trackDb *subTdb = tdbRef->val;
if (sameString(table2, subTdb->table))
{
tdb2 = subTdb;
break;
}
}
slFreeList(&tdbRefList);
}
cgiMakeButton(hgtaDoCorrelatePage, "calculate");
cgiMakeButton(hgtaDoClearCorrelate, "clear");
if (tdb2 && tdb2->shortLabel)
hPrintf(" (with: %s)", tdb2->shortLabel);
#ifdef NOT_YET
/* debugging dbg vvvvv */
if (curTrack && curTrack->type) /* dbg */
{
hPrintf(" (debug: '%s', '%s(%s)')",
curTrack->type, tdb2->type, table2);
}
/* debugging debug ^^^^^ */
#endif
}
else
cgiMakeButton(hgtaDoCorrelatePage, "create");
hPrintf(" | \n");
}
/* Print output type line. */
showOutputTypeRow(isWig, isBedGr, isPositional, isMaf, isChromGraphCt, isPal, isArray, isHalSnake);
/* Print output destination line. */
{
char *compressType =
cartUsualString(cart, hgtaCompressType, textOutCompressNone);
char *fileName = cartUsualString(cart, hgtaOutFileName, "");
hPrintf("\n");
hPrintf("output file: ");
cgiMakeTextVar(hgtaOutFileName, fileName, 29);
hPrintf(" (leave blank to keep output in browser) | \n");
hPrintf("\n");
hPrintf("file type returned: ");
cgiMakeRadioButton(hgtaCompressType, textOutCompressNone,
sameWord(textOutCompressNone, compressType));
hPrintf(" plain text  ");
cgiMakeRadioButton(hgtaCompressType, textOutCompressGzip,
sameWord(textOutCompressGzip, compressType));
hPrintf(" gzip compressed");
hPrintf(" | \n");
}
hPrintf("\n");
/* Submit buttons. */
{
hPrintf(" \n");
if (isWig || isBam || isVcf || isLongTabix || isHic)
{
char *name;
extern char *maxOutMenu[];
char *maxOutput = maxOutMenu[0];
if (isCustomTrack(curTable))
name=filterFieldVarName("ct", curTable, "_", filterMaxOutputVar);
else
name=filterFieldVarName(database,curTable, "_",filterMaxOutputVar);
maxOutput = cartUsualString(cart, name, maxOutMenu[0]);
if (isWig)
hPrintf(
"Note: to return more than %s lines, change the filter setting"
" (above). The entire data set may be available for download as"
" a very large file that contains the original data values (not"
" compressed into the wiggle format) -- see the Downloads page."
" ", maxOutput);
else if (isBam || isVcf || isLongTabix || isHic)
hPrintf(
"Note: to return more than %s lines, change the filter setting"
" (above). Please consider downloading the entire data from our Download pages."
" ", maxOutput);
}
else if (anySubtrackMerge(database, curTable) || anyIntersection())
{
hPrintf("Note: The all fields and selected fields output formats "
"are not available when a%s has been specified. ",
canSubtrackMerge ? " subtrack merge or intersection" : "n intersection");
}
cgiMakeButton(hgtaDoTopSubmit, "get output");
hPrintf(" ");
if (isPositional || isWig)
{
cgiMakeButton(hgtaDoSummaryStats, "summary/statistics");
hPrintf(" ");
}
#ifdef SOMETIMES
hPrintf(" ");
cgiMakeButton(hgtaDoTest, "test");
#endif /* SOMETIMES */
}
hPrintf(""
"To reset all user cart settings (including custom tracks), \n"
"click here.\n",
getScriptName());
}
static char *getGenomeSpaceText()
/* fetch GenomeSpace text if enabled */
{
if (isGenomeSpaceEnabled())
{
return
"Send data to "
"GenomeSpace for use with diverse computational tools. ";
}
else
{
return "";
}
}
void mainPageAfterOpen(struct sqlConnection *conn)
/* Put up main page assuming htmlOpen()/htmlClose()
* will happen in calling routine. */
{
hPrintf(
"Use this program to retrieve the data associated with a track in text "
"format, to calculate intersections between tracks, and to retrieve "
"DNA sequence covered by a track. For help in using this application "
"see Using the Table Browser for a description "
"of the controls in this form, the "
"User's Guide for "
"general information and sample queries, and the OpenHelix Table Browser "
"tutorial for a narrated presentation of the software "
"features and usage. "
"For more complex queries, you may want to use "
"Galaxy or "
"our public "
"MySQL server. "
"To examine the biological function of your set through annotation "
"enrichments, send the data to "
"GREAT. "
"%s"
"Refer to the "
"Credits page for the list of "
"contributors and usage restrictions associated with these data. "
"All tables can be downloaded in their entirety from the "
"Sequence and Annotation Downloads page."
, getGenomeSpaceText()
);
// When GREAT is selected, disable the other checkboxes and force output to BED
jsInline(
"function onSelectGreat() {\n"
" document.getElementById('checkboxGalaxy').checked=false;\n");
if (isGenomeSpaceEnabled())
jsInline(
" document.getElementById('checkboxGenomeSpace').checked=false;\n");
jsInline(
" document.getElementById('outBed').selected=true;\n"
" return true;\n"
"}\n");
// Disable/enable noGenome tracks depending on whether region is genome.
jsInline(
"function maybeDisableNoGenome() {\n"
" var regionTypeSelected = $('input[name=\"hgta_regionType\"]:checked').val();\n"
" var regionIsGenome = (regionTypeSelected === 'genome');\n"
" var $noGenomeOptions = $('select[name=\"hgta_track\"] option.hgtaNoGenome');\n"
" $noGenomeOptions.attr('disabled', regionIsGenome)\n"
" .css('color', regionIsGenome ? '' : 'black');\n"
"}\n"
"$(document).ready(function() {\n"
// once when the page loads, and every time the user changes the region type:
" maybeDisableNoGenome();\n"
" $('input[name=\"hgta_regionType\"]').change(maybeDisableNoGenome);\n"
"});\n");
/* Main form. */
hPrintf(" \n");
/* Hidden form - for benefit of javascript. */
{
static char *saveVars[] = {
"clade", "org", "db", hgtaGroup, hgtaTrack, hgtaTable, hgtaRegionType,
hgtaRange, hgtaOutputType, hgtaOutFileName};
jsCreateHiddenForm(cart, getScriptName(), saveVars, ArraySize(saveVars));
}
/* Hidden form for jumping to custom tracks CGI. */
hPrintf("\n");
/* Hidden form for jumping to track hub manager CGI. */
hPrintf("\n");
webNewSection("Using the Table Browser\n");
printMainHelp();
cartFlushHubWarnings();
}
void doMainPage(struct sqlConnection *conn)
/* Put up the first page user sees. */
{
htmlOpen("Table Browser");
mainPageAfterOpen(conn);
htmlClose();
}
|