From dd4af9a85b8daf2971ccb55eb7672ce64ba8460a Mon Sep 17 00:00:00 2001 From: Leandro Doctors Date: Wed, 27 Mar 2019 20:25:23 -0300 Subject: [PATCH] Fix indenting --- project.clj | 4 +-- src/cavm/auth.clj | 12 +++---- src/cavm/core.clj | 60 ++++++++++++++++----------------- src/cavm/h2.clj | 32 +++++++++--------- src/cavm/huffman.clj | 32 +++++++++--------- src/cavm/pfc.clj | 19 +++++------ src/cavm/statement.clj | 4 +-- src/cavm/views/datasets.clj | 4 +-- src/cgdata/core.clj | 18 +++++----- test/cavm/benchmark/core.clj | 34 +++++++++---------- test/cavm/benchmark/install.clj | 4 +-- test/cavm/db_test.clj | 28 +++++++-------- test/cavm/sqleval_test.clj | 4 +-- test/float/ryu_test.clj | 16 ++++----- 14 files changed, 134 insertions(+), 137 deletions(-) diff --git a/project.clj b/project.clj index d7cbe80..12df418 100644 --- a/project.clj +++ b/project.clj @@ -10,8 +10,8 @@ ;; If nREPL takes too long to load it may timeout, ;; increase this to wait longer before timing out. ;; Defaults to 30000 (30 seconds) - :timeout 12000000 - } + :timeout 12000000} + :profiles {:dev {:source-paths ["src-dev" "src"] :dependencies [[org.jumpmind.symmetric.schemaspy/schemaspy "5.0.0"] [com.clojure-goes-fast/clj-java-decompiler "0.1.0"] diff --git a/src/cavm/auth.clj b/src/cavm/auth.clj index 16f89b2..d7ff0e1 100644 --- a/src/cavm/auth.clj +++ b/src/cavm/auth.clj @@ -109,12 +109,12 @@ (do (info "Login:" email) (-> (response/redirect - (let [{:keys [redirect-to]} session] - (if (string? redirect-to) - redirect-to - (let [{:keys [uri params]} redirect-to] - (str server-address (subs uri 1) - (and (seq params) (str "?" (client/generate-query-string params)))))))) + (let [{:keys [redirect-to]} session] + (if (string? redirect-to) + redirect-to + (let [{:keys [uri params]} redirect-to] + (str server-address (subs uri 1) + (and (seq params) (str "?" (client/generate-query-string params)))))))) (assoc :session {:user {:authenticated? true :email email}}))) (login-failed-page (str "Invalid user email: " email ".")))) diff --git a/src/cavm/core.clj b/src/cavm/core.clj index ee7cbe6..a4ea2da 100644 --- a/src/cavm/core.clj +++ b/src/cavm/core.clj @@ -146,10 +146,10 @@ (throw ex))))) (comment (defn- del-datasets [args] - (dorun (map del-exp args)))) + (dorun (map del-exp args)))) (comment (defn- print-datasets [] - (dorun (map println (datasets))))) + (dorun (map println (datasets))))) (defn load-edn-from [filename] @@ -239,23 +239,23 @@ ; XXX call clean-sources somewhere?? Should be automated. (comment (defn- loadfiles [load-fn root args] - (when (not (> (count args) 0)) - (println "Usage\nload ") - (System/exit 0)) + (when (not (> (count args) 0)) + (println "Usage\nload ") + (System/exit 0)) ; Skip files outside the designated path - (let [{in-path true, not-in-path false} - (group-by #(in-data-path root %) args)] - (when not-in-path - (binding [*out* *err*] - (println "These files are outside the CAVM data path and will not be served:") - (println (s/join "\n" (in-path false))))) - (create) - (println "Loading " (count in-path) " file(s)") - (dorun (map #(do (print %2 %1 "") (time (load-report load-fn root %1))) - in-path - (range (count in-path) 0 -1))) - (clean-sources)))) + (let [{in-path true, not-in-path false} + (group-by #(in-data-path root %) args)] + (when not-in-path + (binding [*out* *err*] + (println "These files are outside the CAVM data path and will not be served:") + (println (s/join "\n" (in-path false))))) + (create) + (println "Loading " (count in-path) " file(s)") + (dorun (map #(do (print %2 %1 "") (time (load-report load-fn root %1))) + in-path + (range (count in-path) 0 -1))) + (clean-sources)))) (defn- load-files [port always files] (client/post (str "http://localhost:" port "/update/") @@ -446,12 +446,12 @@ (System/exit 1)) (throw ex))))))] (when (and gui serve) (try - (reset! xena-import (XenaImport/start)) - (catch Exception ex - (binding [*out* *err*] - (println "Failed to start gui. Logging error.") - (error "Failed to start gui." ex) - nil)))) + (reset! xena-import (XenaImport/start)) + (catch Exception ex + (binding [*out* *err*] + (println "Failed to start gui. Logging error.") + (error "Failed to start gui." ex) + nil)))) (Splash/close) (reset! db (h2/create-xenadb database)) (when server @@ -467,10 +467,10 @@ ; When logging to the repl from a future, *err* gets lost. ; This will set it to the repl terminal, for reasons I don't understand. (comment (defn snoop [msg x] - (.start (Thread. #(binding [*out* *err*] - (println msg x) - (flush)))) - x)) + (.start (Thread. #(binding [*out* *err*] + (println msg x) + (flush)))) + x)) (comment @@ -485,7 +485,7 @@ (def testloader (cl/loader-agent testdb testdetector docroot)) ; (watch (partial file-changed #'testloader docroot-default) docroot-default) (def keystore {:keystore (.toString (io/resource "localhost.keystore")) - :password "localxena"}) + :password "localxena"}) (let [[loader load-queue] testloader] (def ws-config (events/jetty-config load-queue)) @@ -493,8 +493,8 @@ (re-pattern (s/join "|" (conj trusted-hosts local-trusted-host)))))) (defonce server (serv #'app "localhost" 7222 keystore ws-config)) - (.start server) - ) + (.start server)) + (.stop server) (cavm.db/close testdb)) diff --git a/src/cavm/h2.clj b/src/cavm/h2.clj index 65e4208..436963b 100644 --- a/src/cavm/h2.clj +++ b/src/cavm/h2.clj @@ -449,8 +449,8 @@ ; create the sequence separately in order to set the cache parameter. (comment (defn- sequence-seq [seqname] - (let [[{val :i}] (exec-raw (format "SELECT CURRVAL('%s') AS I" seqname) :results)] - (range (+ val 1) Double/POSITIVE_INFINITY 1)))) + (let [[{val :i}] (exec-raw (format "SELECT CURRVAL('%s') AS I" seqname) :results)] + (range (+ val 1) Double/POSITIVE_INFINITY 1)))) (comment (defn- sequence-seq @@ -530,7 +530,7 @@ (defn- sequence-stmt ^cavm.statement.PStatement [db-seq] (sql-stmt-result (jdbcd/find-connection) - (format "SELECT NEXT VALUE FOR %s AS i" db-seq))) + (format "SELECT NEXT VALUE FOR %s AS i" db-seq))) (defn- run-delays [m] (into {} (for [[k v] m] [k (force v)]))) @@ -681,9 +681,9 @@ (let [[{text :text :or {text "{}"}}] rows metadata (json/read-str text)] (jdbcd/update-values :dataset ["`id` = ?" dataset-id] {:text - (json/write-str - (assoc metadata "error" (str ex)) - :escape-slash false)})))) + (json/write-str + (assoc metadata "error" (str ex)) + :escape-slash false)})))) (defn- with-load-status* [dataset-id func] (try @@ -781,7 +781,7 @@ :subname file :conn-customizer "conn_customizer" :make-pool? make-pool?}] - (if make-pool? (delay (pool spec)) (delay (-> spec))))) + (if make-pool? (delay (pool spec)) (delay (-> spec))))) ; XXX should sanitize the query (defn- run-query [q] @@ -1063,7 +1063,7 @@ (map (juxt :i :scores)) (into (or cache {})))] (update-in new-cache [:codes] update-codes-cache field-id missing new-cache)) - cache))) + cache))) ; ; @@ -1260,9 +1260,9 @@ (if (not-empty rows) (fetch-rows cache rows (fields field)) {}))] - (evaluate (set-of-all-cache N) {:fetch fetch - :fetch-indexed (partial fetch-indexed fields) - :indexed? (partial has-index? fields)} exp))) + (evaluate (set-of-all-cache N) {:fetch fetch + :fetch-indexed (partial fetch-indexed fields) + :indexed? (partial has-index? fields)} exp))) ;(jdbcd/with-connection @(:db cavm.core/testdb) ; (eval-sql {:select ["sampleID"] :from ["BRCA1"] :where [:in "sampleID" @@ -1328,9 +1328,9 @@ "ALTER TABLE `dataset` ADD FOREIGN KEY (`probeMap`) REFERENCES `dataset` (`name`)")))) (defn- migrate [] - (migrate-probemap) + (migrate-probemap)) ; ...add more here - ) + (defn- create[] (jdbcd/transaction @@ -1353,9 +1353,9 @@ (defmethod hsqlfmt/format-clause :table [[_ [fields alias]] _] (str "TABLE(" (clojure.string/join ", " - (map (fn [[name type values]] - (str (hsqlfmt/to-sql name) " " (hsqlfmt/to-sql type) "=" - (hsqlfmt/paren-wrap (clojure.string/join ", " (map hsqlfmt/to-sql values))))) fields)) + (map (fn [[name type values]] + (str (hsqlfmt/to-sql name) " " (hsqlfmt/to-sql type) "=" + (hsqlfmt/paren-wrap (clojure.string/join ", " (map hsqlfmt/to-sql values))))) fields)) ") " (hsqlfmt/to-sql alias))) ; Fix GROUP_CONCAT in honeysql diff --git a/src/cavm/huffman.clj b/src/cavm/huffman.clj index e367e27..586500b 100644 --- a/src/cavm/huffman.clj +++ b/src/cavm/huffman.clj @@ -38,7 +38,7 @@ ;(byte-freqs-p (mapv #(.getBytes ^String %) ["foo" "bar" "baz" "horse" "fly"])) (defn- take-lowest [^ArrayBlockingQueue q0 - ^ArrayBlockingQueue q1] + ^ArrayBlockingQueue q1] (let [v0 (.peek q0) v1 (.peek q1)] (if (or (not v1) (and v0 (>= (:priority v1) (:priority v0)))) (.take q0) @@ -126,10 +126,10 @@ (defn- ht-coded-dictionary [codes ^java.io.ByteArrayOutputStream out] (write-int (count codes) out) (doseq [{:keys [code length]} codes] - (write-int code out) - (write-int length out)) + (write-int code out) + (write-int length out)) (doseq [{:keys [symbol]} codes] - (.write out ^byte symbol)) + (.write out ^byte symbol)) (dotimes [i (rem (- 4 (rem (count codes) 4)) 4)] ; extend to word boundary (.write out 0))) @@ -158,7 +158,7 @@ (rest groups) (+ start (count nodes)) depth1 - (conj! acc + (conj! acc (assoc group :length depth1 :symbols (map #(assoc %1 :code %2) @@ -175,9 +175,9 @@ groups))) (comment -(defn spy [msg x] - (println msg x) - x)) + (defn spy [msg x] + (println msg x) + x)) ; Return the compactly-encoded canonical dictionary ; len count, lens, bytes @@ -238,10 +238,10 @@ (.write output (bit-and 0xff (bit-shift-right out 8))) (when (= m 64) (.write output (bit-and 0xff out)))))))))) - (if (>= m 8) - (let [shift (* 8 (quot m 8))] - (recur (inc i) (bit-shift-left out shift) (long (- m shift)))) - (recur (inc i) out m))) + (if (>= m 8) + (let [shift (* 8 (quot m 8))] + (recur (inc i) (bit-shift-left out shift) (long (- m shift)))) + (recur (inc i) out m))) (when (not= m 0) ; write last partial byte (.write output (bit-and 0xff (bit-shift-right out 56)))))))) @@ -319,7 +319,7 @@ (if (= 0 (bit-and (bit-shift-left 1 i) code)) :right :left)) - assoc :symbol sym)) + assoc :symbol sym)) ; build decoding tree for huffman encoding (defn huff-tree [^ByteBufferAsIntBufferL buff32 ^ByteBuffer buff8 offset32] @@ -424,11 +424,11 @@ (println disa) (= disa disb) (let [s (map #(.getBytes ^String %) ["foo" "bar" "baz" "one" "two" "three"])] - (display-dictionary (dictionary (build s)))) + (display-dictionary (dictionary (build s)))) (let [s (map #(.getBytes ^String %) ["foo" "bar" "baz" "one" "two" "three" "zzzzzzz"]) huffman (build s) dict (dictionary huffman) - encoded (encode-bytes dict (apply concat s)) - ] + encoded (encode-bytes dict (apply concat s))] + (display-dictionary dict) [(count encoded) (into [] encoded)])) diff --git a/src/cavm/pfc.clj b/src/cavm/pfc.clj index f5e55b1..b7379f9 100644 --- a/src/cavm/pfc.clj +++ b/src/cavm/pfc.clj @@ -76,9 +76,9 @@ [(.toByteArray acc)])))) (comment -(defn decompress [[init diffs]] - (reductions (fn [^String prev [n suffix]] (str (.substring prev 0 n) suffix)) - init diffs))) + (defn decompress [[init diffs]] + (reductions (fn [^String prev [n suffix]] (str (.substring prev 0 n) suffix)) + init diffs))) (defn compress-bin [strings] {:header (into-array Byte/TYPE (concat (.getBytes ^String (first strings)) [0])) ; XXX eliminate concat. use implicit zero? @@ -140,10 +140,10 @@ ht (huffman/make-hu-tucker (map #(:header %) front-coded)) ; XXX Does get-bytes make sense? Why do we need to do this? compressed-headers (map #(get-bytes huffman/write ht (:header %)) - front-coded) + front-coded) huff (huffman/make-huffman (r/mapcat :inner front-coded)) compressed (r/foldcat (r/map #(get-bytes huffman/write huff (:inner %)) - front-coded)) + front-coded)) sizes (map #(+ (count %1) (count %2)) compressed-headers compressed) offsets (reductions + 0 (take (dec (count sizes)) sizes))] {:length (count ordered) @@ -319,8 +319,8 @@ ;(merge-sorted-v [] ["boo" "bff" "foo" "goo" "hoo"]) ;(merge-sorted-v ["boo" "foo"] []) ;(merge-sorted-v ["boo" "foo" "zoo"] ["boo" "foo" "goo" "hoo"]) -(defn lookup-htfc [htfc i] - ) +(defn lookup-htfc [htfc i]) + (defn find-htfc [htfc s]) @@ -356,7 +356,7 @@ (let [strings strings in (time (serialize-htfc (compress-htfc strings 256))) out (time (into [] (uncompress-dict (htfc-offsets (doto (ByteBuffer/wrap in) - (.order java.nio.ByteOrder/LITTLE_ENDIAN))))))] + (.order java.nio.ByteOrder/LITTLE_ENDIAN))))))] (= (sort strings) out)) (time @@ -434,5 +434,4 @@ ; more entropy in tcga/gtex ids? (float (/ 207422 22000)) ; 9.42 bytes per string, toil - (float (/ 8900000 1300000)) ; 6.8 bytes per string, singlecell -) + (float (/ 8900000 1300000))) ; 6.8 bytes per string, singlecell diff --git a/src/cavm/statement.clj b/src/cavm/statement.clj index 05f9c82..86540e2 100644 --- a/src/cavm/statement.clj +++ b/src/cavm/statement.clj @@ -106,8 +106,8 @@ (throw-non-rte e)))) (do (doseq [param-group param-groups] - ((or (:set-parameters db) set-parameters) stmt param-group) - (.addBatch stmt)) + ((or (:set-parameters db) set-parameters) stmt param-group) + (.addBatch stmt)) (if transaction? (with-db-transaction [t-db (add-connection db (.getConnection stmt))] (execute-batch stmt)) diff --git a/src/cavm/views/datasets.clj b/src/cavm/views/datasets.clj index 9c29535..1f5789d 100644 --- a/src/cavm/views/datasets.clj +++ b/src/cavm/views/datasets.clj @@ -4,8 +4,8 @@ (:require [cavm.query.expression :as expr]) (:require [cavm.query.functions :as f]) (:require [ring.util.codec :as codec]) - (:require [ring.util.response :as response ]) - (:require [ring.util.request :refer [body-string] ]) + (:require [ring.util.response :as response]) + (:require [ring.util.request :refer [body-string]]) (:require [clojure.edn :as edn]) (:require [cavm.json :as json]) (:require [cavm.h2 :as h2]) diff --git a/src/cgdata/core.clj b/src/cgdata/core.clj index 2dc37d4..d40ecde 100644 --- a/src/cgdata/core.clj +++ b/src/cgdata/core.clj @@ -326,7 +326,7 @@ (with-meta (cons (data-line features (drop-rows header) "category") ; coerce sampleID type (pmap #(data-line features (drop-rows (fix-vec (parse %) ncols))) - (rest lines))) + (rest lines))) (when dup-samples {:duplicate-keys {:sampleID dup-samples}})))) (defmethod matrix-data :default @@ -585,13 +585,13 @@ (let [[header-i header-content] (pick-header (line-seq ((:reader in)))) in (drop-from-reader in (inc header-i)) header (-> (columns-from-header columns (drop-hash header-content) fixed-columns) - (#(for [[c i] (map vector % (range))] - {:header c - :type (or (column-types c) (guess-column-type in i)) - :start-index start-index - :i i})) - (find-position-fields start-index) - assign-unique-names) + (#(for [[c i] (map vector % (range))] + {:header c + :type (or (column-types c) (guess-column-type in i)) + :start-index start-index + :i i})) + (find-position-fields start-index) + assign-unique-names) fields (mapv #(field-spec % in) header)] ; vector of field-specs, each holding vector of rows in :rows (if (= "position" (get-in fields [0 :valueType])) (let [pos-rows (force (get-in fields [0 :rows])) @@ -852,5 +852,5 @@ "Return ::tsv if the file is tsv, or nil" [file] (when (with-open [in (io/reader file)] - (is-tsv? (line-seq in))) + (is-tsv? (line-seq in))) ::tsv)) diff --git a/test/cavm/benchmark/core.clj b/test/cavm/benchmark/core.clj index 7e4e1bf..eedb14c 100644 --- a/test/cavm/benchmark/core.clj +++ b/test/cavm/benchmark/core.clj @@ -127,7 +127,7 @@ (with-open [rdr (clojure.java.io/reader file)] (let [samples (rest (s/split (first (line-seq rdr)) #"\t")) N (count samples)] - (doall (rnd-lines samples N c)))))) + (doall (rnd-lines samples N c)))))) (defn gene-line [[chr start end gene]] {:chr chr @@ -149,51 +149,51 @@ {:desc "1 probe from probemap of 1.4M rows" :id :probemap-large-one :params (fn [] - [(get-probes (dataset-map :probemap-large) 1)]) + [(get-probes (dataset-map :probemap-large) 1)]) :body (fn [xena probes] (probemap-probe xena (dataset-map :probemap-large) probes))} ^:probemap {:desc "2 probe from probemap of 1.4M rows" :id :probemap-large-two :params (fn [] - [(get-probes (dataset-map :probemap-large) 2)]) + [(get-probes (dataset-map :probemap-large) 2)]) :body (fn [xena probes] (probemap-probe xena (dataset-map :probemap-large) probes))} ^:cnv {:desc "3 gene positions from CNV of 970k rows" :id :cnv-large-three-gene :params (fn [] - [(get-genes (dataset-map :refgene-hg19) 3)]) + [(get-genes (dataset-map :refgene-hg19) 3)]) :body (fn [xena genes] (cnv-gene xena (dataset-map :cnv-large) genes))} ^:cnv {:desc "30 gene positions from CNV of 970k rows" :id :cnv-large-thirty-gene :params (fn [] - [(get-genes (dataset-map :refgene-hg19) 30)]) + [(get-genes (dataset-map :refgene-hg19) 30)]) :body (fn [xena genes] (cnv-gene xena (dataset-map :cnv-large) genes))} ^:cnv {:desc "300 gene positions from CNV of 970k rows" :id :cnv-large-three-hundred-gene :params (fn [] - [(get-genes (dataset-map :refgene-hg19) 300)]) + [(get-genes (dataset-map :refgene-hg19) 300)]) :body (fn [xena genes] (cnv-gene xena (dataset-map :cnv-large) genes))} ^:matrix {:desc "30 probes * 500 samples from matrix of 17k rows" :id :matrix-medium-thirty-probe :params (fn [] - [(get-probes (dataset-map :matrix-medium) 30) - (get-samples (dataset-map :matrix-medium) 500)]) + [(get-probes (dataset-map :matrix-medium) 30) + (get-samples (dataset-map :matrix-medium) 500)]) :body (fn [xena probes samples] (probe-fetch xena (dataset-map :matrix-medium) probes samples))} ^:matrix {:desc "300 probes * 500 samples from matrix of 17k rows" :id :matrix-medium-three-hundred-probe :params (fn [] - [(get-probes (dataset-map :matrix-medium) 300) - (get-samples (dataset-map :matrix-medium) 500)]) + [(get-probes (dataset-map :matrix-medium) 300) + (get-samples (dataset-map :matrix-medium) 500)]) :body (fn [xena probes samples] (probe-fetch xena (dataset-map :matrix-medium) probes samples))} @@ -201,8 +201,8 @@ {:desc "300 probes * 500 samples from matrix of 17k rows, xena-query" :id :matrix-medium-three-hundred-probe-xena :params (fn [] - [(get-probes (dataset-map :matrix-medium) 300) - (get-samples (dataset-map :matrix-medium) 500)]) + [(get-probes (dataset-map :matrix-medium) 300) + (get-samples (dataset-map :matrix-medium) 500)]) :body (fn [xena probes samples] (probe-fetch-xena xena (dataset-map :matrix-medium) probes samples))} @@ -224,15 +224,15 @@ :id :codes-medium3 :params (fn [] []) :body (fn [xena] - (code-fetch3 xena (dataset-map :matrix-medium) "sampleID"))} - ]) + (code-fetch3 xena (dataset-map :matrix-medium) "sampleID"))}]) + (def test-map (into {} (map #(-> [(:id %) %]) tests))) (defn print-results [results] (doseq [{:keys [id result]} results] - (println (report (:desc (test-map id)) result))) ) + (println (report (:desc (test-map id)) result)))) (defn- mkdir [dir] (.mkdirs (io/file dir)) @@ -289,8 +289,8 @@ (run "benchmark" "-i" "matrix-medium-three-hundred-probe-xena") (run "benchmark" "-i" "codes") (run "benchmark") - (.printStackTrace *e) - ) + (.printStackTrace *e)) + (defn -main [& args] (try diff --git a/test/cavm/benchmark/install.clj b/test/cavm/benchmark/install.clj index 10212f9..4cf1c1d 100644 --- a/test/cavm/benchmark/install.clj +++ b/test/cavm/benchmark/install.clj @@ -45,7 +45,7 @@ (download (format "%s/download/%s" (:host ds) (:remote-id ds)) (io/file docroot (:id ds))) (download (format "%s/download/%s.json" (:host ds) (:remote-id ds)) (io/file docroot (str (:id ds) ".json"))) (println "Loading" (:id ds)) - (loader/loader xenadb detector docroot (io/file docroot (:id ds))))) + (loader/loader xenadb detector docroot (io/file docroot (:id ds)))))) ; query remotes to get sha1 ; there may be multiple files, e.g. for clinical. In that case we will @@ -55,5 +55,3 @@ ; :join [:dataset_source [:= :dataset.id :dataset_id] ; :source [:= :source.id :source_id]] ; :where [:like :dataset.name "%copynumber_donor"]} - - ) diff --git a/test/cavm/db_test.clj b/test/cavm/db_test.clj index 43ed451..8a707db 100644 --- a/test/cavm/db_test.clj +++ b/test/cavm/db_test.clj @@ -28,7 +28,7 @@ (print " ") (clojure.pprint/write b#) (println "))")) - r#)) + r#)) (def ^:dynamic *eps* 0.0001) @@ -101,9 +101,9 @@ (def gen-names "Generate a list of names which are non-empty after trimming." (gen/sized (fn [size] - (gen/vector - (gen-name *name-max*) - 1 (max 1 size))))) + (gen/vector + (gen-name *name-max*) + 1 (max 1 size))))) (def gen-distinct-names "Generate a list of names which are non-empty after trimming, and @@ -403,7 +403,7 @@ {:name "probe2" :id 3 :dataset_id 1} {:name "probe3" :id 4 :dataset_id 1} {:name "probe4" :id 5 :dataset_id 1} - {:name "probe5" :id 6 :dataset_id 1} ])) + {:name "probe5" :id 6 :dataset_id 1}])) (let [[probe1 probe2] (vec (map #(into [] %) (map ((first data) :data) ["probe1" "probe2"])))] (ct/is (nearly-equal probe1 [2.1 1.1])) @@ -436,7 +436,7 @@ {:name "probe2" :id 9 :dataset_id 1} {:name "probe3" :id 10 :dataset_id 1} {:name "probe4" :id 11 :dataset_id 1} - {:name "probe5" :id 12 :dataset_id 1} ])) + {:name "probe5" :id 12 :dataset_id 1}])) (let [[probe1 probe2] (vec (map #(into [] %) (map ((first data) :data) ["probe1" "probe2"])))] (ct/is (nearly-equal probe1 [2.1 1.1])) @@ -468,7 +468,7 @@ {:name "probe2" :id 3 :dataset_id 1} {:name "probe2 (2)" :id 4 :dataset_id 1} {:name "probe4" :id 5 :dataset_id 1} - {:name "probe5" :id 6 :dataset_id 1} ])) + {:name "probe5" :id 6 :dataset_id 1}])) (let [[probe1 probe2] (vec (map #(into [] %) (map ((first data) :data) ["probe1" "probe2"])))] (ct/is (nearly-equal probe1 [2.1 1.1])) @@ -500,7 +500,7 @@ {:name "probe2" :id 3 :dataset_id 1} {:name "probe3aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" :id 4 :dataset_id 1} ; truncated to 250 chars {:name "probe4" :id 5 :dataset_id 1} - {:name "probe5" :id 6 :dataset_id 1} ])) + {:name "probe5" :id 6 :dataset_id 1}])) (let [[probe1 probe2] (vec (map #(into [] %) (map ((first data) :data) ["probe1" "probe2"])))] (ct/is (nearly-equal probe1 [2.1 1.1])) @@ -863,10 +863,10 @@ order (zipmap not-nil (range)) nil-order (assoc order "" Double/NaN)] {:rows (map nil-order values) - :field name - :valueType "category" - :feature {:state values - :order order}})) + :field name + :valueType "category" + :feature {:state values + :order order}})) (ct/deftest gene-test (let [field0 (gene-field "genes" @@ -902,8 +902,8 @@ {:select ["name"] :from ["foo"] :where [:in :any "genes" ["a"]]}) - {"name" ["probe0" nil]})) - )))) + {"name" ["probe0" nil]})))))) + ; ; Some experiments with generators for gene fields. diff --git a/test/cavm/sqleval_test.clj b/test/cavm/sqleval_test.clj index 2c5867a..e4ba09c 100644 --- a/test/cavm/sqleval_test.clj +++ b/test/cavm/sqleval_test.clj @@ -55,8 +55,8 @@ (ct/is (= {"a" [] "b" []} (sqleval/evaluate rows store - {:select ["a" "b"] :where [:in "a" [:z :y]]}))) - ))) + {:select ["a" "b"] :where [:in "a" [:z :y]]})))))) + (ct/deftest arr-test (ct/testing "array operations" diff --git a/test/float/ryu_test.clj b/test/float/ryu_test.clj index 006d06c..332c1f3 100644 --- a/test/float/ryu_test.clj +++ b/test/float/ryu_test.clj @@ -33,8 +33,8 @@ (doseq [[v d] combos] (let [libc (libc-float d v) ryu (ryu-float d v)] - (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) - (is (<= (count ryu) (count libc)) {:value v :digits d}))))) + (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) + (is (<= (count ryu) (count libc)) {:value v :digits d}))))) (testing "fractional ones" (let [int-ones (map #(-> (str "0." (apply str (repeat % \0)) \1)) (range 0 20)) digits (range 1 20) @@ -43,8 +43,8 @@ (doseq [[v d] combos] (let [libc (libc-float d v) ryu (ryu-float d v)] - (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) - (is (<= (count ryu) (count libc)) {:value v :digits d}))))) + (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) + (is (<= (count ryu) (count libc)) {:value v :digits d}))))) (testing "nines" (let [int-ones (map #(-> (str "9999" (apply str (repeat % \0)))) (range 0 16)) digits (range 1 20) @@ -53,8 +53,8 @@ (doseq [[v d] combos] (let [libc (libc-float d v) ryu (ryu-float d v)] - (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) - (is (<= (count ryu) (count libc)) {:value v :digits d}))))) + (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) + (is (<= (count ryu) (count libc)) {:value v :digits d}))))) (testing "fractional nines" (let [int-ones (map #(-> (str "0." (apply str (repeat % \0)) "9999")) (range 0 16)) digits (range 1 20) @@ -72,8 +72,8 @@ (doseq [[v d] combos] (let [libc (libc-float d v) ryu (ryu-float d v)] - (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) - (is (<= (count ryu) (count libc)) {:value v :digits d})))))) + (is (= (Float. libc) (Float. ryu)) {:value v :digits d}) + (is (<= (count ryu) (count libc)) {:value v :digits d})))))) (def sign