                  (case (first fields)
                    ; declaration line of variableStep
                    "variableStep"
-                   (let [{:keys [chrom span] :or {span 1}} (->> fields rest fields->map)
+                   (let [{:keys [chrom span]
+                          :or {span 1}} (->> fields rest fields->map)
                          span (as-long span)]
-                     (deserialize (rest lines) {:format :variable-step, :chr chrom, :pre-start nil, :span span, :step nil}))
+                     (deserialize (rest lines)
+                                  {:format :variable-step
+                                   :chr chrom
+                                   :pre-start nil
+                                   :span span
+                                   :step nil}))
 
                    ; declaration line of fixedStep
                    "fixedStep"
-                   (let [{:keys [chrom start span step] :or {span 1, step 1}} (->> fields rest fields->map)
+                   (let [{:keys [chrom start span step]
+                          :or {span 1, step 1}} (->> fields rest fields->map)
                          step (as-long step)
                          pre-start (- (as-long start) step)
                          span (as-long span)]
-                     (deserialize (rest lines) {:format :fixed-step, :chr chrom, :pre-start pre-start, :span span, :step step}))
+                     (deserialize (rest lines)
+                                  {:format :fixed-step
+                                   :chr chrom
+                                   :pre-start pre-start
+                                   :span span
+                                   :step step}))
 
                    ; data line
                    (let [m (case (:format current-track)

  {:pre [;; These fields are required.
         (map (fn [wig] (every? some? ((apply juxt wig-fields) wig))) wigs)
         ;; There are two options for formatting wiggle data.
         (map (fn [{:keys [format]} wig] (or (= format :fixed-step) (= format :variable-step))) wigs)]}
  (letfn [(same-track? [first-wig wig]
            (and (= (:format first-wig) (:format wig))
                 (= (- (:end first-wig) (:start first-wig))

                                   start (as-long start)
                                   end (dec (+ start span))
                                   value (str->wiggle-track-data value)]
                               {:format :variable-step
                                :chr chr
                                :start start
                                :end end
                                :value value})

                             :fixed-step
                             (let [{:keys [chr pre-start span step]} current-track
                                   start (+ pre-start step)
                                   end (dec (+ start span))
                                   value (-> fields first str->wiggle-track-data)]
                               {:format :fixed-step
                                :chr chr
                                :start start
                                :end end
                                :value value})

                             (throw
                               (IllegalArgumentException.
                                 "Invalid wiggle format")))]
                     (cons m (deserialize (rest lines)
                                          (assoc current-track
                                                 :pre-start
                                                 (:start m))))))))))]
    (deserialize lines {:format nil
                        :chr nil
                        :pre-start nil
                        :span nil
                        :step nil})))

(defn- serialize-wigs
  "Serialize a sequence of WIG fields into a lazy sequence of string."
