Skip to content

Instantly share code, notes, and snippets.

@michaelbarton
Forked from swannodette/split_file.clj
Created July 22, 2011 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelbarton/1100479 to your computer and use it in GitHub Desktop.
Save michaelbarton/1100479 to your computer and use it in GitHub Desktop.
(use '[clojure.java.io :only [reader]])
(use '[clojure.string :only [split]])
(def read-keys [:id :status :pos-contig :pos-position :pos-strand :neg-contig :neg-position :neg-strand])
(defn split-line [x]
(split x #"\t"))
(defn create-read [x]
(with-meta
(zipmap read-keys (split-line x))
{:type ::read}))
(println
(take 3
(map create-read
(rest ; Ignore the header line
(line-seq
(reader "data/read_status.tab"))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment