exonEnds[i]) &&
(cdsEnd >= curGenePred->exonStarts[i]) )
cdsExonCnt++;
}
hPrintf("Coding Region
\n");
safef(buffer, sizeof buffer, "%s:%d-%d", curGeneChrom, cdsStart+1, cdsEnd);
commaPos = addCommasToPos(database, buffer);
- hPrintf(" Position: %s ",commaPos);
+ hPrintf(" Position: %s %s ",database, commaPos);
sprintLongWithCommas(buffer, (long long)cdsEnd - cdsStart);
- hPrintf("Size: %s ", buffer);
- hPrintf("Coding Exon Count: %d \n", cdsExonCnt);
+ hPrintf("Size: %s ", buffer);
+ hPrintf("Coding Exon Count: %d \n", cdsExonCnt);
}
fflush(stdout);
}
char *sectionSetting(struct section *section, char *name)
/* Return section setting value if it exists. */
{
return hashFindVal(section->settings, name);
}
char *sectionRequiredSetting(struct section *section, char *name)
/* Return section setting. Squawk and die if it doesn't exist. */
{
char *res = sectionSetting(section, name);
if (res == NULL)
@@ -475,76 +475,84 @@
section->name, section->shortLabel);
webPrintLinkCellEnd();
}
webFinishPartialLinkTable(rowIx, itemPos, maxPerRow);
webPrintLinkTableEnd();
}
char *sectionCloseVar(char *section)
/* Get close variable for given section */
{
static char buf[128];
safef(buf, sizeof(buf), "%s%s_%s_%s", hggPrefix, "section", section, "close");
return buf;
}
+boolean sectionIsOpen(struct section *section)
+/* Check cart and ra to see if section is open(-) or closed(+) */
+{
+char *closeVarName = sectionCloseVar(section->name);
+char *vis = sectionSetting(section, "visibility");
+int defaultClosed = (vis && sameString(vis, "hide")) ? 1 : 0;
+return !(cartUsualInt(cart, closeVarName, defaultClosed));
+}
+
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)
{
- char *closeVarName = sectionCloseVar(section->name);
- boolean isOpen = !(cartUsualInt(cart, closeVarName, 0));
+ 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("
printing %s section\n", section->name);fflush(stdout);
dyStringPrintf(header, "", section->name);
+ char *closeVarName = sectionCloseVar(section->name);
dyStringPrintf(header, "
",
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);
}
}
void printTiming(struct section *sectionList)
/* Print timing for each section, if measureTiming is set */
{
if (!measureTiming)
return;
struct section *section;
int total = 0;
printf("section, check time, print time, total
\n");
for (section = sectionList; section != NULL; section = section->next)
{
- char *closeVarName = sectionCloseVar(section->name);
- boolean isOpen = !(cartUsualInt(cart, closeVarName, 0));
+ boolean isOpen = sectionIsOpen(section);
int sectionTime = section->checkTime + section->printTime;
printf("%s, %d, %d, %d %s
\n", section->shortLabel, section->checkTime, section->printTime,
sectionTime, isOpen ? "" : "closed");
total += sectionTime;
}
printf("total = %d\n", total);
printf("
");
}
void webMain(struct sqlConnection *conn)
/* Set up fancy web page with hotlinks bar and
* sections. */
{
struct section *sectionList = NULL;
struct trackDb *tdb = hTrackDbForTrack(database, genomeSetting("knownGene"));