This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-05-20
Channels
- # aleph (11)
- # announcements (3)
- # babashka (35)
- # babashka-sci-dev (28)
- # beginners (29)
- # calva (51)
- # cider (33)
- # clj-kondo (26)
- # clj-on-windows (1)
- # clojure (40)
- # clojure-austin (1)
- # clojure-europe (47)
- # clojure-nl (9)
- # clojure-norway (7)
- # clojure-uk (5)
- # clojurescript (69)
- # conjure (30)
- # cursive (7)
- # data-science (9)
- # datomic (2)
- # etaoin (10)
- # events (2)
- # fulcro (1)
- # graalvm (1)
- # gratitude (6)
- # helix (16)
- # honeysql (20)
- # hyperfiddle (14)
- # inf-clojure (2)
- # jobs (1)
- # jobs-discuss (12)
- # kaocha (9)
- # leiningen (2)
- # lsp (4)
- # malli (8)
- # music (9)
- # off-topic (12)
- # pathom (10)
- # portal (14)
- # practicalli (15)
- # re-frame (27)
- # reitit (7)
- # remote-jobs (4)
- # sci (37)
- # shadow-cljs (16)
- # sql (8)
- # tools-deps (6)
- # vim (6)
- # xtdb (21)
Can you show me an example of subsetting with ds/tc?
;; setup
(def d '({:sample "H3K27me3_IMR90_Cell_Line_0",
:file "EpigenomeAtlas/Current-Release/experiment-sample/Histone_H3K27me3/IMR90_Cell_Line/UCSD.IMR90.H3K27me3.LL223.bed.gz"}
{:sample "H3K27me3_IMR90_Cell_Line_1",
:file "EpigenomeAtlas/Current-Release/experiment-sample/Histone_H3K27me3/IMR90_Cell_Line/UCSD.IMR90.H3K27me3.SK05.bed.gz"}
{:sample "H3K27me3_ES-WA7_Cell_Line_0",
:file "EpigenomeAtlas/Current-Release/experiment-sample/Histone_H3K27me3/ES-WA7_Cell_Line/BI.ES-WA7.H3K27me3.Solexa-12609.bed.gz"}))
(def ss (ds/->dataset d))
I'd like to get all values from the file
column that matches sample
"H3K27me3_IMR90_Cell_Line_1"
.In pandas I'd do
ss[ss["sample"] == "H3K27me3_IMR90_Cell_Line_1"].file.iloc[0]
There is a select-rows, but it uses indexes:
(ds/select-rows ss (map #(= "H3K27me3_IMR90_Cell_Line_1" %) (ss "sample")))
;; bool not a number
(def c
(-> (ds/filter-column ss "sample" #(= "H3K27me3_IMR90_Cell_Line_0" %))
(ds/select-columns ["file"])))
(-> c vals first first)
;; "EpigenomeAtlas/Current-Release/experiment-sample/Histone_H3K27me3/IMR90_Cell_Line/UCSD.IMR90.H3K27me3.LL223.bed.gz"
Doesn't feel like the most pity solution.(tc/select-rows ss (comp #{"H3K27me3_IMR90_Cell_Line_0"} #(get % "sample")))
worked.
It would have been easier if the columns were keywords.
Right. Above can be rewritten as:
(tc/select-rows ss #(= "H3K27me3_IMR90_Cell_Line_0" (% "sample")))
🙏 1
Good news nerds! GitHub finally accepts LaTeX in their Markdown! https://github.blog/changelog/2022-05-19-render-mathematical-expressions-in-markdown/
2
🙏 1
🥳 2
👍 1