forked from intermine/im-tables-3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
views.cljs
193 lines (178 loc) · 8.09 KB
/
views.cljs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
(ns im-tables.views
(:require [re-frame.core :as re-frame]
[im-tables.views.core :as main-view]
[reagent.core :as r]
[clojure.string :as string]
[reagent.dom.server :as server]
[oops.core :refer [ocall]]))
(def humanmine-config
{:service {:root "https://www.humanmine.org/humanmine"}
:query {:from "Gene"
:select ["symbol"
"secondaryIdentifier"
"dataSets.description"
"primaryIdentifier"
"organism.name"
"dataSets.name"]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "humanmine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
(def flymine-config
{:service {:root "https://www.flymine.org/flymine"}
:query {:from "Gene"
:select ["symbol"
"secondaryIdentifier"
"primaryIdentifier"]
:where [{:path "Gene"
:op "LOOKUP"
:value "eve"}]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "flymine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
(def yeastmine-config
{:service {:root "https://yeastmine.yeastgenome.org/yeastmine"}
:query {:from "Protein"
:select ["symbol"
"secondaryIdentifier"
"primaryIdentifier"]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "yeastmine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
(def testmine-config
{:service {:root "localhost:8080/intermine-demo"}
:query {:from "Employee"
:select ["name"
"department.name"]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "testmine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
(def biotestmine-config
{:service {:root "http://localhost:8080/biotestmine"}
:query {:from "Gene"
:select ["symbol"
"secondaryIdentifier"
"dataSets.description"
"primaryIdentifier"
"organism.name"
"dataSets.name"]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "biotestmine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
(def covidmine-config
{:service {:root "https://test.intermine.org/covidmine"}
:query {:from "Cases"
:select ["date"
"totalConfirmed"
"totalDeaths"
"newConfirmed"
"newDeaths"
"geoLocation.country"
"geoLocation.state"]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "covidmine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
;; Query with subclass constraint
(def subclass-config
{:service {:root "https://www.flymine.org/flymine"}
:query {:from "Gene"
:select ["Gene.secondaryIdentifier",
"Gene.symbol",
"Gene.primaryIdentifier",
"Gene.organism.name",
"Gene.interactions.participant2.alleles.primaryIdentifier",
"Gene.interactions.participant2.alleles.symbol",
"Gene.interactions.participant2.alleles.alleleClass",
"Gene.interactions.participant2.alleles.organism.name"]
:where [{:path "Gene"
:op "LOOKUP"
:value "eve"}
{:path "Gene.interactions.participant2"
:type "Gene"}]}
:settings {:pagination {:limit 10}
:compact true
:links {:vocab {:mine "flymine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
(def pickitems-config
{:service {:root "https://www.flymine.org/flymine"}
:query {:from "Gene"
:select ["symbol",
"secondaryIdentifier",
"goAnnotation.ontologyTerm.identifier",
"goAnnotation.ontologyTerm.name",
"goAnnotation.evidence.code.code",
"goAnnotation.ontologyTerm.namespace",
"goAnnotation.qualifier"]
:where [{:path "Gene"
:op "LOOKUP"
:value "Notch"}]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "flymine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
;; This query has a very wide column, making it great for testing overflow.
(def flymine-wide-config
{:service {:root "https://www.flymine.org/flymine"}
:query {:from "Gene"
:select ["primaryIdentifier"
"symbol"
"regulatoryRegions.primaryIdentifier"
"regulatoryRegions.chromosome.primaryIdentifier"
"regulatoryRegions.sequenceOntologyTerm.name"
"regulatoryRegions.chromosomeLocation.end"
"regulatoryRegions.chromosomeLocation.start"
"regulatoryRegions.dataSets.dataSource.name"
"regulatoryRegions.sequence.residues"]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "flymine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
(def pagination-bug
{:service {:root "https://www.humanmine.org/humanmine"}
:query {:from "Gene"
:select ["Gene.overlappingFeatures.primaryIdentifier",
"Gene.overlappingFeatures.length",
"Gene.overlappingFeatures.organism.name"]
:where [{:path "Gene.id"
:op "="
:value "1016209"}]}
:settings {:pagination {:limit 10}
:links {:vocab {:mine "humanmine"}
:url (fn [{:keys [mine class objectId] :as _vocab}]
(string/join "/" [nil mine "report" class objectId]))}}})
; This function is used for testing purposes.
; When using im-tables in real life, you could call the view like so:
; [im-tables.views.core/main {:location ... :service ... :query ...}]
; Increase this range to produce N number of tables on the same page
; (useful for stress testing)
(def number-of-tables 1)
(defn reboot-tables-fn []
(dotimes [n number-of-tables]
(re-frame/dispatch-sync [:im-tables/load [:test :location n] subclass-config])))
(defn main-panel []
(let [show? (r/atom true)]
(fn []
[:div.container-fluid
[:div.container
[:div.panel.panel-info
[:div.panel-heading (str "Global Test Controls for " number-of-tables " tables")]
[:div.panel-body
[:div.btn-toolbar
[:div.btn-group
[:button.btn.btn-default {:on-click reboot-tables-fn}
"Reboot Tables"]]
[:div.btn-group
[:button.btn.btn-default {:on-click (fn [] (swap! show? not))}
(if @show? "Unmount Tables" "Mount Tables")]]]]]]
(when @show?
(into [:div {:style {:max-width "100vw"
:background-color "white"
:border "1px solid #ccc"}}]
(->> (range 0 number-of-tables)
(map (fn [n] [main-view/main [:test :location n]])))))])))