                              :end right
                              :depth :deep})))
 
+(defn- read-ref-fasta-line
+  [fa-rdr rname]
+  (if-not (nil? fa-rdr)
+   (first
+    (filter #(= (:rname %) rname) (fa/read fa-rdr)))))
+
 (defn- search-ref
   [refs rname]
   (first

               (PileupStatus. 0 nil nil))) positions))
    (repeat (count positions) (PileupStatus. 0 nil nil))))

(defn- count-for-positions
  [alns rname positions]
  (if (pos? (count alns))
    (let [cfas (map #(count-for-alignment % rname positions) alns)]
      (wrap rname positions
            (apply map (fn [& args]
                         (reduce + (map :count args))) cfas)
            (apply map (fn [& args]

            [cljam.cigar :as cgr]
            [cljam.sequence :as cseq]
            [cljam.io :as io]
            [cljam.fasta :as fa]
            [cljam.util :refer [ubyte]]
            [cljam.util.sam-util :refer [phred->fastq fastq->phred]]
            [cljam.pileup.common :refer [window-width step center]]
            [cljam.pileup.pileup :refer [rpositions]])
  (:import cljam.fasta.FASTAReader))

(defn- pickup-qual [aln pos]
  (if (= (:qual aln) "*")
