a865b66cfeec6dea62ccdcd5a22c69e9a27335b6 hiram Wed Apr 3 12:01:04 2019 -0700 using new browser styles and allow genePred to print refs #18869 diff --git src/hg/hubApi/getData.c src/hg/hubApi/getData.c index 1c90e7e..8353baf 100644 --- src/hg/hubApi/getData.c +++ src/hg/hubApi/getData.c @@ -40,42 +40,51 @@ if (isEmpty(chrom)) sqlSafef(query, sizeof(query), "select * from %s", table); else if (0 == (start + end)) /* have chrom, no start,end == full chr */ { /* need to extend the chrom column check to allow tName also */ if (! sqlColumnExists(conn, table, "chrom")) apiErrAbort("track '%s' is not a position track, request track without chrom specification, genome: '%s'", table, db); jsonWriteString(jw, "chrom", chrom); struct chromInfo *ci = hGetChromInfo(db, chrom); jsonWriteNumber(jw, "start", (long long)0); jsonWriteNumber(jw, "end", (long long)ci->size); sqlSafef(query, sizeof(query), "select * from %s where chrom='%s'", table, chrom); } else /* fully specified chrom:start-end */ { + boolean useTxStartEnd = FALSE; if (! sqlColumnExists(conn, table, "chrom")) apiErrAbort("track '%s' is not a position track, request track without chrom specification, genome: '%s'", table, db); + if (! sqlColumnExists(conn, table, "chromStart")) + { + if (sqlColumnExists(conn, table, "txStart")) + useTxStartEnd = TRUE; + } jsonWriteString(jw, "chrom", chrom); jsonWriteNumber(jw, "start", (long long)start); jsonWriteNumber(jw, "end", (long long)end); if (startsWith("wig", tdb->type)) { wigTableDataOutput(jw, db, table, chrom, start, end); return; /* DONE */ } else { + if (useTxStartEnd) + sqlSafef(query, sizeof(query), "select * from %s where chrom='%s' AND txEnd > %u AND txStart < %u", table, chrom, start, end); + else sqlSafef(query, sizeof(query), "select * from %s where chrom='%s' AND chromEnd > %u AND chromStart < %u", table, chrom, start, end); } } /* continuing, not a wiggle output */ char **columnNames = NULL; char **columnTypes = NULL; int columnCount = tableColumns(conn, jw, table, &columnNames, &columnTypes); jsonWriteListStart(jw, table); struct sqlResult *sr = sqlGetResult(conn, query); char **row = NULL; unsigned itemCount = 0; while (itemCount < maxItemsOutput && (row = sqlNextRow(sr)) != NULL) { jsonWriteObjectStart(jw, NULL);