Skip to content

Instantly share code, notes, and snippets.

@swannodette
Forked from michaelbarton/split_file.clj
Created July 22, 2011 20:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save swannodette/1100291 to your computer and use it in GitHub Desktop.
Save swannodette/1100291 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