             [cljam.util :refer [gen-vec]]
             [cljam.util.sam-util :as sam-util]
             [cljam.util.bgzf-util :as bgzf-util]
-            [cljam.bam-index.common :refer :all])
+            [cljam.bam-index.common :refer :all]
+            [cljam.bam-index.chunk :as chunk])
   (:import [java.io DataOutputStream FileOutputStream Closeable]))
 
 (defn- find-ref

                                :unaligned-alns 0}
                         :bins {}
                         :lidx []}) refs))
   (make-index! refs alns)))

;;;
;;; Write index

                                                    (:largest-seen (:linear-index idx-status)))}
                     :no-coordinate-alns no-coordinate-alns))))

(defn make-index
  [refs alns]
  (merge
   (zipmap (map :name refs)
