         skip   (lsb/read-int rdr)
         len    (lsb/read-int rdr)
         buf    (lsb/read-bytes rdr len)
+        seq    (read-seq buf len)
         index  (loop [i 0
                       bin-index []
                       linear-index []]

                            (conj linear-index new-linear-index)))
                   [bin-index linear-index]))]
    {:n-seq n-seq, :preset preset, :sc sc, :bc bc, :ec ec, :meta meta,
     :skip skip, :bin-index (first index), :linear-index (last index)}
    ))

(deftype TABIXReader [f ^DataInputStream reader]
  java.io.Closeable
  (close [this]
    (.close ^DataInputStream (.reader this))))

(defn read-index
  [^TABIXReader rdr]
  (read-index* (.reader rdr)))

(defn reader [f]
  (->TABIXReader f (DataInputStream. (BGZFInputStream. (io/file f)))))

  (:import java.util.Arrays
           [java.io DataInputStream IOException]
           bgzf4j.BGZFInputStream))

(def tabix-magic "TBI\1")

