c270525b2a0d56b8f3e5425e555f18066bfe4eec galt Tue Sep 24 16:33:31 2013 -0700 fixes #7472 deals with bed4 and bed9 when element has size=0 start==end diff --git src/hg/lib/hdb.c src/hg/lib/hdb.c index c31df64..84801a6 100644 --- src/hg/lib/hdb.c +++ src/hg/lib/hdb.c @@ -3363,32 +3363,34 @@ } else { table = rootTable; sqlDyStringPrintf(query, "%s where %s='%s' and ", table, hti->chromField, chrom); } } if (table != NULL) { if (hti->hasBin) { hAddBinToQuery(start, end, query); rowOffset = 1; } - sqlDyStringPrintf(query, "%s<%u and %s>%u", - hti->startField, end, hti->endField, start); + if (start == end) // e.g. size = 0 SNP insertion site + sqlDyStringPrintf(query, "%s=%u and %s=%u", hti->startField, end, hti->endField, start); + else + sqlDyStringPrintf(query, "%s<%u and %s>%u", hti->startField, end, hti->endField, start); if (extraWhere) { /* allow more flexible additions to where clause */ if (!startsWith("order", extraWhere) && !startsWith("limit", extraWhere)) dyStringAppend(query, " and "); dyStringPrintf(query, " %s", extraWhere); } if (order) sqlDyStringPrintf(query, " order by %s", hti->startField); sr = sqlGetResult(conn, query->string); } freeDyString(&query); if (retRowOffset != NULL) *retRowOffset = rowOffset;