Created
November 26, 2011 07:48
-
-
Save harishtella/1395256 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; instead of having to call this function all the time | |
(defn top-n-seq [sample-name n] | |
(let [fields ["?id" "?aa" "?v" "?j" "?name" "?nc"] | |
sample-name-seqs (<- fields | |
(tcr-seqs :>> fields) | |
(= ?name sample-name))] | |
(c/first-n sample-name-seqs n :sort ["?nc"] :reverse true))) | |
;; I can pre-sort tcr-seqs, grouping-by ?name, adding a ranking, and saving it to a seqfile | |
(def tcr-seqs-sorted (hfs-seqfile "/somewhere")) | |
(defbufferop add-rank | |
[tuples] | |
(map #(conj (vec %1) %2) tuples (iterate inc 1))) | |
(?<- tcr-seqs-sorted [?id-out ?name ?nc-out ?rank] | |
(tcr-sequences ?id ?aa ?v ?j ?name ?nc) | |
(:sort :< ?nc) | |
(:reverse true) | |
(add-rank :< ?id ?nc :> ?id-out ?nc-out ?rank)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment