9f568df48c409c062eab6e3b2aa60bc8509bf120
angie
  Fri May 3 16:42:33 2019 -0700
binFromRange: util to convert start and end coords into a SQL '(bin = ### or bin = ### ...)' condition. refs #23429

diff --git src/hg/utils/binFromRange/binFromRange.c src/hg/utils/binFromRange/binFromRange.c
new file mode 100644
index 0000000..2b0ff1d
--- /dev/null
+++ src/hg/utils/binFromRange/binFromRange.c
@@ -0,0 +1,33 @@
+/* binFromRange - Translate a 0-based half open start and end into a bin range sql expression.. */
+#include "common.h"
+#include "options.h"
+#include "hdb.h"
+
+void usage()
+/* Explain usage and exit. */
+{
+errAbort(
+  "binFromRange - Translate a 0-based half open start and end into a bin range sql expression.\n"
+  "usage:\n"
+  "   binFromRange start end\n"
+  );
+}
+
+/* Command line validation table. */
+static struct optionSpec options[] = {
+    {NULL, 0},
+};
+
+int main(int argc, char *argv[])
+/* Process command line. */
+{
+optionInit(&argc, argv, options);
+if (argc != 3)
+    usage();
+int start = atoi(argv[1]);
+int end = atoi(argv[2]);
+struct dyString *query = dyStringNew(0);
+hAddBinToQuery(start, end, query);
+puts(query->string);
+return 0;
+}