 
 ; Delete experiment data & update experiment record.
 (defn- merge-exp [file timestamp filehash cohort]
-  (exec-raw ["MERGE INTO experiments (file, time, hash, cid) KEY(file) VALUES (?, ?, ?, ?)"
-             [file timestamp filehash cohort]])
+  (exec-raw ["MERGE INTO experiments (file, time, hash, cid, loaded) KEY(file) VALUES (?, ?, ?, ?, ?)"
+             [file timestamp filehash cohort false]])
   (let [[{exp :ID}] (select experiments (where {:file file}))]
     (clear-by-exp exp)
     exp))

           (let [sid (insert-scores-fn (ahashable (score-encode block)))]
             (insert-join pid i sid))) blocks indx))))

; insert matrix, updating scores, probes, and joins tables
(defn- load-exp-matrix [exp matrix]
  (let [loadp (partial load-probe (insert-unique-scores-fn) exp)]
    (dorun (map loadp matrix))))

(defn- cohort-sample-list [cid sample-list]
  (select samples (fields :id :sample)

                       `time` TIMESTAMP NOT NULL,
                       `hash` VARCHAR(40) NOT NULL,
                       `cid` INT NOT NULL,
                        `loaded` BOOLEAN NOT NULL,
                       FOREIGN KEY (cid) REFERENCES `cohorts` (`id`))"])

(def exp-samples-table ["CREATE TABLE IF NOT EXISTS `exp_samples` (
