 
 (def sample-proteins
   (reduce into 
-          (map read-fasta (take 3 prefixed-files)))) 
+          (map read-fasta (take 4 prefixed-files)))) 
 
 (time (def trial (dbscan sample-proteins protein-metric 100 4)))
 
 
 (comment
+
+(def memoized-dbscan
+  "If true, calls to the metric passed to dbscan will be memoized"
+  true)
+
+(def partition-size
+  "Approximate subdivision size for clojure.core.reducers/fold"
+  8)
+
+(def region-query
+  "Select region-query-s (serial) or region-query-p (parallel)"
+  region-query-p)
+
+
 
 (read-fasta "resources/simple.fasta")
 

  "Parallel region query; returns all pts at least eps similar to pt."
  [pt pts metric eps]
  (letfn [(is-local? [x] (>= (metric pt x) eps))]
    (r/fold 5 (r/monoid into vector) conj (r/filter is-local? pts))))



(defn expand-cluster

(defn dbscan
  "Run dbscan"
  [pts metric eps min-pts]
  (let [mem-metric (if memoized-dbscan
                     (memoize-metric metric)
                      metric)]

    (loop [points pts
           visited #{}
           clusters #{}]
      (let [pt (first points)]
        (cond
          (empty? points)
            clusters
          (visited pt) 
            (recur (rest points)
                   (conj visited pt)
                   clusters)
          :else
            (let [{new-cluster :core, new-visited :visited}
                  (expand-cluster pt pts mem-metric eps min-pts visited)]
              (recur (rest points)
                     new-visited
                     (conj clusters new-cluster))))))))

(defn parse-float
  "Parse string s as float"
