   ([eid aggr?]
    (get-comparison-files- eid "ComparisonSheet.csv" aggr?))
   ([eid comp-filename aggr?]
-   (let [maps (cmn/get-exp-info eid :rep :maps)
+   (let [refs (cmn/get-exp-info eid :refs)
+         maps (cmn/get-exp-info eid :rep :maps)
          fit  (cmn/get-exp-info eid :rep :fit)
          aggr (cmn/get-exp-info eid :rep :aggrs)
          compvec (->> comp-filename

     otmap otbam otbai]))


(def offsets
  (let [llets "abcdefghijklmnopqrstuvwxyz"
        offset (-> "a" str/codepoints first dec)
        chints (mapv #(- % offset) (str/codepoints llets))
        offmap (into {} (map
                         (fn[[k v]] [(str k) v])
                         (partition 2 (interleave (seq llets) chints))))
        offmap (into offmap (map #(vector (str %) %) (range 1 27)))]
    offmap))

(defn get-comparison-files-
  "Compute the set of comparison pairs for tnseq fitness

                                    (conj v csv ef (offsets k))))
                                %1))
                       mapsvec
                       compvec)
         refinfo (volatile! {})]
     (if aggr?
       (->>
        cmpgrps
        (mapcat (fn[grp]
                  (when (seq grp)
                    (let [grp (sort-by last grp)
                          l (->> grp last first fs/basename (str/split #"-")
                                 last (str/split #"\.") first)
                          g (mapv (fn[[_ _ csv _]]
                                    [(fs/join aggr csv) (fs/join fit csv)])
                                  grp)
                          strain-map (cmn/get-exp-info eid :ncbi-sample-xref)
                          refnm (-> g ffirst fs/basename
                                    (cljstr/split #"-") first
                                    strain-map)
                          allcsv (-> g first first
                                     (fs/replace-type (str "-" l ".csv")))
                          newgrp (conj g [refnm allcsv])]
                      (when (not (@refinfo refnm))
                        (vswap! refinfo
                                (fn[refm]
                                  (assoc refm refnm (refloci refnm refs)))))
                      (if (> (count (@refinfo refnm)) 1)
                        (expand-by-refs newgrp (@refinfo refnm))
                        [newgrp])))))
        vec)
       ;; else fitness groups
       (mapcat (fn[grp]
                 (mapv (fn[[t1 t2 csv ef]] [t1 t2 (fs/join fit csv) ef]) grp))
               cmpgrps)
       ))))

#_(let [eid "JSA-TEST-MULTI-TNSEQ"
      compfile "ComparisonSheet.csv"
      refdir (cmn/get-exp-info eid :refs)
      grps (cmn/get-comparison-files :tnseq eid compfile true)
      grp (first grps)
      pairs (butlast grp)
      allins (mapv second pairs)
      [refnm allcsv] (last grp)
      gtf (fs/join refdir (str refnm ".gbk"))
      norm   (fs/join refdir "NormGenes" (str refnm ".txt"))]
  [gtf norm])

(defmethod cmn/get-comparison-files :tnseq
  [_ & args]
  (apply get-comparison-files- args))




(defn get-phase-2-dirs [eid]
