4e4629ec70e0b6635441790483d6d24bb30df91b
braney
  Fri May 13 17:00:35 2016 -0700
first cut at long range interaction track

diff --git src/lib/bedTabix.c src/lib/bedTabix.c
new file mode 100644
index 0000000..a10ced1
--- /dev/null
+++ src/lib/bedTabix.c
@@ -0,0 +1,39 @@
+#include "bedTabix.h"
+
+struct bedTabixFile *bedTabixFileMayOpen(char *fileOrUrl, char *chrom, int start, int end)
+{
+struct lineFile *lf = lineFileTabixMayOpen(fileOrUrl, TRUE);
+if (lf == NULL)
+    return NULL;
+
+struct bedTabixFile *btf;
+AllocVar(btf);
+btf->lf = lf;
+if (isNotEmpty(chrom) && start != end)
+    {
+    lineFileSetTabixRegion(lf, chrom, start, end);
+    }
+
+return btf;
+}
+
+struct bed *bedTabixReadBeds(struct bedTabixFile *btf, char *chrom, int start, int end, struct bed * (*loadBed)(void *tg), int minScore)
+{
+struct bed *bedList = NULL;
+
+int wordCount;
+char *words[100];
+
+lineFileSetTabixRegion(btf->lf, chrom, start, end);
+while ((wordCount = lineFileChopTab(btf->lf, words)) > 0)
+    {
+    struct bed *bed = loadBed(words);
+    slAddHead(&bedList, bed);
+    }
+return bedList;
+}
+
+void bedTabixFileClose(struct bedTabixFile *btf)
+{
+lineFileClose(&btf->lf);
+}