Skip to content

Instantly share code, notes, and snippets.

View harishtella's full-sized avatar

Harish Tella harishtella

View GitHub Profile
@harishtella
harishtella / with-overlay-text.vg.json
Last active October 10, 2019 21:15
Vega-lite: comparing heatmap and table-bubble-plot
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {"url": "data/cars.json"},
"transform": [
{
"aggregate": [{"op": "count", "as": "num_cars"}],
"groupby": ["Origin", "Cylinders"]
}
],
"resolve": {
@harishtella
harishtella / box-plot.vg.json
Last active October 11, 2019 22:49
Vega-lite: comparing box-plot and strip-plot
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"height": {"step": 30},
"width": 300,
"description": "Shows the relationship between horsepower and the numbver of cylinders using tick marks.",
"data": {"url": "data/cars.json"},
"mark": {
"type": "boxplot",
"extent": "min-max"
},
; you can just take the first two ?b's because they come into
; bufferop sorted
(defbufferop top-2 [tuples]
(take 2 tuples))
; let cascalog do the sorting (grouped by ?a) for you
(??<- [?a ?b-out]
(data ?a ?b)
;; 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)))
;; actually makes the call to c/first-n to create the limited sorted
;; sample
(defn top-n-seq [sample-name n]
(let [fields ["?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)))
(defn top-n-seq [sample-name n]
(let [aa-seq-fields ["?aa" "?v" "?j" "?sn" "?nc" "?c" "?nf" "?rf" "?cdr3"]
sample-name-seqs (<- aa-seq-fields
(aa-seqs :>> aa-seq-fields)
(= ?sn sample-name))]
(<- aa-seq-fields ((c/first-n sample-name-seqs n :sort ["?nc"] :reverse true)
:>> aa-seq-fields))))
(let [aa-seq-fields ["?aa" "?v" "?j" "?sn" "?nc" "?c" "?nf" "?rf" "?cdr3"]]
(?<- (stdout) aa-seq-fields