   (apply get-comparison-files- args))
 
 
+(defn get-xcomparison-files-
+  "Compute the set of Cross Experiment comparison bams and the
+  corresponding output csv for the count table matrix. Cross
+  comparison sets are based on the CrossComparisonSheet.csv for the
+  pseudo experiment of eid (the pseudo experiment id). If rep? is
+  true, returns the comparison sets for replicates of comparison
+  pairs, else returns comparison sets for combined bams."
+  ([eid rep?]
+   (get-xcomparison-files- eid "ComparisonSheet.csv" rep?))
+  ([eid comp-filename rep?]
+   (let [bpath (if rep? [:rep :bams] [:bams])
+         fpath (if rep? [:rep :fcnts] [:fcnts])
+         fcnts (apply cmn/get-exp-info eid fpath)
+         compvec (->> comp-filename
+                      (fs/join (pams/get-params :nextseq-base) eid)
+                      slurp csv/read-csv rest
+                      (map (fn[[c1 c2]]
+                             (let [[eid1 strain cond1] (str/split #"-" c1)
+                                   gb1 (str strain "-" cond1 "*.bam")
+                                   c1bams (apply cmn/get-exp-info eid1 bpath)
+                                   [eid2 strain cond2] (str/split #"-" c2)
+                                   gb2 (str strain "-" cond2 "*.bam")
+                                   c2bams (apply cmn/get-exp-info eid2 bpath)]
+                               [(fs/join c1bams gb1) (fs/join c2bams gb2)]))))
+         bamsvec (mapv (fn[v] (mapcat #(-> % fs/glob sort) v)) compvec)
+         otcsvs (mapv (fn[v] (fs/join
+                             fcnts
+                             (str (cljstr/join
+                                   "-" (mapv #(->> % fs/basename
+                                                   (str/split #"\*")
+                                                   first)
+                                             v))
+                                  ".csv")))
+                      compvec)]
+     (mapv #(vector %1 %2) bamsvec otcsvs))))
+
+(defmethod cmn/get-xcomparison-files :rnaseq
+  [_ & args]
+  (apply get-xcomparison-files- args))
+
+
+
+
 (defn split-filter-fastqs
   [eid]
   (cmn/split-filter-fastqs eid identity))

;;; Get primary phase 1 arguments. These are the bowtie index, the
;;; fastq set, output bam and bai file names
(defmethod cmn/get-phase-1-args :rnaseq
  [_ eid repname & {:keys [repk]}]
  (let [fqs (cljstr/join "," (cmn/get-replicate-fqzs eid repname repk))
        refnm (cmn/replicate-name->strain-name eid repname)
        btindex (fs/join (cmn/get-exp-info eid :index) refnm)
        otbam (fs/join (cmn/get-exp-info eid repk :bams) (str repname ".bam"))
        otbai (str otbam ".bai")
        refgtf (fs/join (cmn/get-exp-info eid :refs)
                        (str refnm ".gtf"))]
    (apply cmn/ensure-dirs (map fs/dirname [otbam otbai]))
    [btindex fqs otbam otbai]))


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

    [repjob cfgjob]))


#_(defmethod cmn/run-xcomparison :rnaseq
  [_ eid recipient compfile get-toolinfo template]
  (run-rnaseq-comparison
   eid recipient compfile get-toolinfo template))

(defmethod cmn/run-comparison :rnaseq
  [_ eid recipient compfile get-toolinfo template]
  (run-rnaseq-comparison
