 (def ^:private features-defaults
   (into {} (map #(vector % nil) features-columns)))
 
+
 (def ^:private features-meta
   {:table features
    :defaults features-defaults

  (:require [clojure.data.json :as json])
  (:use [cavm.binner :only (calc-bin)])
  (:use [clj-time.format :only (formatter unparse)])
  (:use [cavm.hashable :only (ahashable get-array)])
  (:use [korma.core :rename {insert kcinsert}])
  (:require [cavm.query.sources :as sources])
  (:gen-class))

;(def db {:classname "org.h2.Driver"
;         :subprotocol "h2"
;         :subname "file:///data/TCGA/craft/h2/cavm.h2"})

; Coerce this sql fn name to a keyword so we can reference it.
(def KEY-ID (keyword "SCOPE_IDENTITY()"))


  ([files metadata matrix-fn features force]
   (kdb/transaction
     (let [exp (merge-m-ent experiments-meta metadata)
           files (map fmt-time files)]
       (when (or force
                 (not (= (set files) (set (related-sources experiments exp)))))
         (clear-by-exp exp)
         (load-related-sources
           experiment_sources :experiments_id exp files)
         (table-writer "/dev/shm" ; XXX use db dir? root dir? tmp dir?
                       (partial load-exp-matrix exp matrix-fn)))))))

; XXX factor out common parts with merge, above?
(defn del-exp [file]
