 (deftest parse-pileup-line
   (testing "without-ref"
     (are [?in ?out]
-        (= ?out (into {} (update (#'plpio/parse-pileup-line ?in) :pile (fn [xs] (mapv #(into {} %) xs)))))
+        (= ?out (rec->map (#'plpio/parse-pileup-line ?in)))
       "chr1\t10\tN\t0\t\t" {:rname "chr1", :pos 10, :ref \N, :count 0,
                             :pile []}
       "chr1\t10\tN\t1\tA\tI" {:rname "chr1", :pos 10, :ref \N, :count 1,

                                            {:start? false, :mapq nil, :base \A, :qual 33, :reverse? false, :end? true, :insertion nil, :deletion 2, :alignment nil}]}))
  (testing "with-ref"
    (are [?in ?out]
        (= ?out (into {} (update (#'plpio/parse-pileup-line ?in) :pile (fn [xs] (mapv #(into {} %) xs)))))
      "chr1\t10\tA\t0\t\t" {:rname "chr1", :pos 10, :ref \A, :count 0,
                            :pile []}
      "chr1\t10\ta\t1\t.\tI" {:rname "chr1", :pos 10, :ref \a, :count 1,

  (:import [java.io File StringWriter StringReader]
           [cljam.io.pileup PileupReader PileupWriter]))

(defn- rec->map [coll]
  (walk/postwalk
   (fn [x]
     (if (record? x)
       (into {} x)
       x))
   coll))

(def ^:private ^:const the-last-pile
  ;; ref2	36	N	1	A$	?
  {:rname "ref2",
   :pos 36,
   :ref \N,
   :count 1,
   :pile
   [{:start? false,
     :mapq nil,
     :base \A,
     :qual 30,
     :reverse? false,
     :end? true,
     :insertion nil,
     :deletion nil,
     :alignment nil}]})

;; Reader
;; ------

