eef3ac987538affd38eb38ccddf6ce6721f4c6f4 jcasper Sun Nov 23 22:03:29 2025 -0800 Removing bigCompositeUpdate CGI (folded into cartDump), and some kent-ifying of the remaining code. refs #36320 diff --git src/hg/hgTrackUi/hgTrackUi.c src/hg/hgTrackUi/hgTrackUi.c index dcba862c95d..fea1821b26e 100644 --- src/hg/hgTrackUi/hgTrackUi.c +++ src/hg/hgTrackUi/hgTrackUi.c @@ -2003,36 +2003,36 @@ char options[7][256]; int thisHeightPer; float thisMinYRange, thisMaxYRange; char *interpolate, *fill; char **row; int rowOffset; struct sample *sample; struct sqlResult *sr; char option[64]; struct sqlConnection *conn = hAllocConn(database); char newRow = 0; -snprintf( &options[0][0], 256, "%s.heightPer", tdb->track ); -snprintf( &options[1][0], 256, "%s.linear.interp", tdb->track ); -snprintf( &options[3][0], 256, "%s.fill", tdb->track ); -snprintf( &options[4][0], 256, "%s.min.cutoff", tdb->track ); -snprintf( &options[5][0], 256, "%s.max.cutoff", tdb->track ); -snprintf( &options[6][0], 256, "%s.interp.gap", tdb->track ); +safef(&options[0][0], 256, "%s.heightPer", tdb->track ); +safef(&options[1][0], 256, "%s.linear.interp", tdb->track ); +safef(&options[3][0], 256, "%s.fill", tdb->track ); +safef(&options[4][0], 256, "%s.min.cutoff", tdb->track ); +safef(&options[5][0], 256, "%s.max.cutoff", tdb->track ); +safef(&options[6][0], 256, "%s.interp.gap", tdb->track ); thisHeightPer = atoi(cartUsualString(cart, &options[0][0], "50")); interpolate = cartUsualString(cart, &options[1][0], "Linear Interpolation"); fill = cartUsualString(cart, &options[3][0], "1"); thisMinYRange = atof(cartUsualString(cart, &options[4][0], "0.0")); thisMaxYRange = atof(cartUsualString(cart, &options[5][0], "1000.0")); printf("
Interpolation: ");
wiggleDropDown(&options[1][0], interpolate );
printf(" ");
printf("
");
printf(" Fill Blocks: ");
cgiMakeRadioButton(&options[3][0], "1", sameString(fill, "1"));
printf(" on ");
@@ -2042,31 +2042,31 @@
printf("
Track Height: "); cgiMakeIntVar(&options[0][0], thisHeightPer, 5 ); printf(" pixels"); printf("
Vertical Range: \nmin:"); cgiMakeDoubleVar(&options[4][0], thisMinYRange, 6 ); printf(" max:"); cgiMakeDoubleVar(&options[5][0], thisMaxYRange, 6 ); printf("
Toggle Species on/off
" );
sr = hRangeQuery(conn, tdb->table, chromosome, 0, 1877426, NULL, &rowOffset);
while ((row = sqlNextRow(sr)) != NULL)
{
sample = sampleLoad(row + rowOffset);
- snprintf( option, sizeof(option), "zooSpecies.%s", sample->name );
+ safef(option, sizeof(option), "zooSpecies.%s", sample->name );
if( cartUsualBoolean(cart, option, TRUE ) )
cgiMakeCheckBox(option, TRUE );
else
cgiMakeCheckBox(option, FALSE );
printf("%s ", sample->name );
newRow++;
if( newRow % 5 == 0 ) printf("
");
sampleFree(&sample);
}
}
void chainColorUi(struct trackDb *tdb)
@@ -2273,36 +2273,36 @@
{
char *enz = cartUsualString(cart, cutterVar, cutterDefault);
puts("
Filter display by enzymes (separate with commas):
");
cgiMakeTextVar(cutterVar, enz, 100);
}
void genericWiggleUi(struct trackDb *tdb, int optionNum )
/* put up UI for any standard wiggle track (a.k.a. sample track)*/
{
char options[7][256];
int thisHeightPer, thisLineGap;
float thisMinYRange, thisMaxYRange;
char *interpolate, *fill;
-snprintf( &options[0][0], 256, "%s.heightPer", tdb->track );
-snprintf( &options[1][0], 256, "%s.linear.interp", tdb->track );
-snprintf( &options[3][0], 256, "%s.fill", tdb->track );
-snprintf( &options[4][0], 256, "%s.min.cutoff", tdb->track );
-snprintf( &options[5][0], 256, "%s.max.cutoff", tdb->track );
-snprintf( &options[6][0], 256, "%s.interp.gap", tdb->track );
+safef(&options[0][0], 256, "%s.heightPer", tdb->track );
+safef(&options[1][0], 256, "%s.linear.interp", tdb->track );
+safef(&options[3][0], 256, "%s.fill", tdb->track );
+safef(&options[4][0], 256, "%s.min.cutoff", tdb->track );
+safef(&options[5][0], 256, "%s.max.cutoff", tdb->track );
+safef(&options[6][0], 256, "%s.interp.gap", tdb->track );
thisHeightPer = atoi(cartUsualString(cart, &options[0][0], "50"));
interpolate = cartUsualString(cart, &options[1][0], "Linear Interpolation");
fill = cartUsualString(cart, &options[3][0], "1");
thisMinYRange = atof(cartUsualString(cart, &options[4][0], "0.0"));
thisMaxYRange = atof(cartUsualString(cart, &options[5][0], "1000.0"));
thisLineGap = atoi(cartUsualString(cart, &options[6][0], "200"));
printf("
Interpolation: ");
wiggleDropDown(&options[1][0], interpolate );
printf(" ");
printf("
");
printf(" Fill Blocks: ");
cgiMakeRadioButton(&options[3][0], "1", sameString(fill, "1"));
@@ -2340,36 +2340,36 @@
wigCfgUi(cart,tdb,tdb->track,
"Graph Plotting options:",FALSE);
printf("
" "View/Hide individual cell lines:"); } void humMusUi(struct trackDb *tdb, int optionNum ) /* put up UI for human/mouse conservation sample tracks (humMusL and musHumL)*/ { char options[7][256]; int thisHeightPer, thisLineGap; float thisMinYRange, thisMaxYRange; char *interpolate, *fill; -snprintf( &options[0][0], 256, "%s.heightPer", tdb->track ); -snprintf( &options[1][0], 256, "%s.linear.interp", tdb->track ); -snprintf( &options[3][0], 256, "%s.fill", tdb->track ); -snprintf( &options[4][0], 256, "%s.min.cutoff", tdb->track ); -snprintf( &options[5][0], 256, "%s.max.cutoff", tdb->track ); -snprintf( &options[6][0], 256, "%s.interp.gap", tdb->track ); +safef(&options[0][0], 256, "%s.heightPer", tdb->track ); +safef(&options[1][0], 256, "%s.linear.interp", tdb->track ); +safef(&options[3][0], 256, "%s.fill", tdb->track ); +safef(&options[4][0], 256, "%s.min.cutoff", tdb->track ); +safef(&options[5][0], 256, "%s.max.cutoff", tdb->track ); +safef(&options[6][0], 256, "%s.interp.gap", tdb->track ); thisHeightPer = atoi(cartUsualString(cart, &options[0][0], "50")); interpolate = cartUsualString(cart, &options[1][0], "Linear Interpolation"); fill = cartUsualString(cart, &options[3][0], "1"); thisMinYRange = atof(cartUsualString(cart, &options[4][0], "0.0")); thisMaxYRange = atof(cartUsualString(cart, &options[5][0], "8.0")); thisLineGap = atoi(cartUsualString(cart, &options[6][0], "200")); printf("
Interpolation: ");
wiggleDropDown(&options[1][0], interpolate );
printf(" ");
printf("
");
printf(" Fill Blocks: ");
cgiMakeRadioButton(&options[3][0], "1", sameString(fill, "1"));
@@ -2833,207 +2833,218 @@
char **ancestors;
AllocArray(ancestors, count);
count = 0;
for(sp=speciesList; sp; sp = sp->next)
{
ancestors[count] = sp->name;
count++;
}
char *coalescent = cartOptionalString(cart, codeVarName);
printf("Set Coalescent Ancestor to:");
cgiMakeDropListFull(codeVarName, ancestors, ancestors,
count, coalescent, NULL, NULL);
}
#endif
-static char **
-parseDataTypes(struct trackDb *tdb, int *out_count) {
+static char **parseDataTypes(struct trackDb *tdb, int *out_count)
+{
// ADS: almost certainly a function already exists to do this??
/* Get entries 'nDataTypes' and 'dataTypes' from the 'settings'
* field for the given 'trackDb' entry. 'nDataTypes' is a count, and
* 'dataTypes' is a space separated list of words, each indicating a
* data type. This function returns the array of data types. The
* caller must free the returned array and each member. If
* nDataTypes does not match the number of words parsed from
* 'dataTypes' it is an error. Return value is NULL on error.
*/
- const char *n_datatypes_str =
- (const char *)hashMustFindVal(tdb->settingsHash, "nDataTypes");
+const char *n_datatypes_str = (const char *)hashMustFindVal(tdb->settingsHash, "nDataTypes");
const int n_datatypes = atoi(n_datatypes_str);
- if (n_datatypes <= 0) return NULL;
+if (n_datatypes <= 0)
+ return NULL;
- const char *datatypes_str =
- (const char *)hashMustFindVal(tdb->settingsHash, "dataTypes");
- if (!datatypes_str) return NULL;
+const char *datatypes_str = (const char *)hashMustFindVal(tdb->settingsHash, "dataTypes");
+if (!datatypes_str)
+ return NULL;
// returned, must be freed
char **datatypes = calloc(n_datatypes, sizeof(char *));
- if (!datatypes) return NULL;
+if (!datatypes)
+ return NULL;
const char *name_start = datatypes_str;
int observed_count = 0;
- for (int i = 0; i < n_datatypes; ++i) {
+for (int i = 0; i < n_datatypes; ++i)
+ {
const char *name_end = strchr(name_start, ' ');
- if (!name_end) name_end = strchr(name_start, '\0');
+ if (!name_end)
+ name_end = strchr(name_start, '\0');
const int name_len = name_end - name_start;
- if (name_len <= 0) break; // skip empty segments
+ if (name_len <= 0)
+ break; // skip empty segments
datatypes[i] = calloc(name_len + 1, sizeof(char));
- if (!datatypes[i]) { // cleanup on failure
+ if (!datatypes[i])
+ { // cleanup on failure
for (int j = 0; j < i; ++j) free(datatypes[j]);
free(datatypes);
return NULL;
}
memcpy(datatypes[i], name_start, name_len);
datatypes[i][name_len] = '\0';
++observed_count;
- if (*name_end == '\0') break;
+ if (*name_end == '\0')
+ break;
name_start = name_end + 1;
}
- if (n_datatypes != observed_count) { // cleanup on failure
- for (int i = 0; i < n_datatypes; ++i) free(datatypes[i]);
+if (n_datatypes != observed_count)
+ { // cleanup on failure
+ for (int i = 0; i < n_datatypes; ++i)
+ free(datatypes[i]);
free(datatypes);
return NULL;
}
- if (out_count) *out_count = observed_count;
+if (out_count)
+ *out_count = observed_count;
return datatypes;
}
unsigned int cartDbParseId(char *, char **); // ADS: avoid extra include
#define COMMA_IF(x) (((x)++) ? "," : "") // ADS: pattern for JSON comma
-static void
-bigCompositeCfgUi(struct trackDb *tdb) {
- /* ADS: How bigComposite differs from other track types
- * - track name is bigComposite (!)
+static void facetedCompositeUi(struct trackDb *tdb)
+{
+/* ADS: How facetedComposite differs from other track types
+ * - compositeTrack track setting is "faceted"
* - Required fields in the 'settings' longblob for the trackDb entry:
* - 'metaDataUrl': a non-blocked URL (can be server-local) with
- * metadata to generate the table.
+ * metadata to generate the table. This might change to an existing metadata
+ * setting in the future.
* - 'nDataTypes': positive integer counting the data types for each sample.
* - 'dataTypes': the names of the data types, ordered and space separated.
*
* This function will embed sessionDb.settings/cart data in the
* generated HTML. Instead of embedding all relevant tracks, it
* parses the tracks named like:
*
- * bigCompositeName_dataElementName_dataTypeName_sel=1
+ * facetedCompositeName_dataElementName_dataTypeName_sel=1
*
* And only sends unique dataElement and dataTypes, which might be
- * much smaller. The bigComposite assumes that selection of
+ * much smaller. The faceted composite assumes that selection of
* dataTypes applies to all dataElements, but within the cart, these
* are separate tracks, and each must be present to be drawn. But
* the JS doesn't need the product {dataType} x {dataElement}, just
* the union {datType} U {dataElement}. These are put in two arrays
* in a JSON section of the HTML.
*/
const int token_size = 64;
const int query_buff_size = 256;
// html elements for the controls page (from singleCellMerged)
const char pageStyle[] =
"";
const char placeholderDiv[] = "