@sjcrh/proteinpaint-shared 2.180.0 → 2.180.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/src/bulk.cnv.js +30 -30
- package/src/bulk.del.js +48 -48
- package/src/bulk.itd.js +48 -48
- package/src/bulk.js +31 -31
- package/src/bulk.snv.js +109 -72
- package/src/bulk.sv.js +78 -78
- package/src/bulk.svjson.js +33 -31
- package/src/bulk.trunc.js +53 -47
- package/src/clustering.js +27 -27
- package/src/common.js +665 -558
- package/src/compute.percentile.js +3 -1
- package/src/fetch-helpers.js +67 -42
- package/src/fileSize.js +4 -4
- package/src/filter.js +207 -179
- package/src/hash.js +8 -5
- package/src/helpers.js +17 -9
- package/src/index.js +24 -24
- package/src/mds3tk.js +14 -12
- package/src/roundValue.js +5 -4
- package/src/termdb.bins.js +151 -84
- package/src/termdb.initbinconfig.js +46 -18
- package/src/termdb.usecase.js +125 -116
- package/src/terms.js +281 -266
- package/src/tree.js +4 -4
- package/src/vcf.ann.js +9 -9
- package/src/vcf.csq.js +8 -8
- package/src/vcf.info.js +3 -3
- package/src/vcf.js +99 -74
- package/src/vcf.type.js +8 -2
package/src/termdb.usecase.js
CHANGED
|
@@ -1,29 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
TermTypes,
|
|
3
|
+
isNumericTerm,
|
|
4
|
+
SINGLECELL_CELLTYPE,
|
|
5
|
+
SINGLECELL_GENE_EXPRESSION,
|
|
6
|
+
} from "./terms.js"
|
|
2
7
|
|
|
3
8
|
export const graphableTypes = new Set([
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
"categorical",
|
|
10
|
+
"integer",
|
|
11
|
+
"float",
|
|
12
|
+
"condition",
|
|
13
|
+
"survival",
|
|
14
|
+
"snplst",
|
|
15
|
+
"snplocus",
|
|
16
|
+
"geneVariant",
|
|
17
|
+
"samplelst",
|
|
18
|
+
"geneExpression",
|
|
19
|
+
"dtcnv",
|
|
20
|
+
"dtsnvindel",
|
|
21
|
+
"dtfusion",
|
|
22
|
+
"dtsv",
|
|
23
|
+
"date",
|
|
19
24
|
TermTypes.SSGSEA,
|
|
20
25
|
TermTypes.DNA_METHYLATION,
|
|
21
26
|
TermTypes.METABOLITE_INTENSITY,
|
|
22
|
-
TermTypes.
|
|
27
|
+
TermTypes.PROTEOME_ABUNDANCE,
|
|
23
28
|
SINGLECELL_GENE_EXPRESSION,
|
|
24
29
|
SINGLECELL_CELLTYPE,
|
|
25
30
|
TermTypes.SNP,
|
|
26
|
-
TermTypes.TERM_COLLECTION
|
|
31
|
+
TermTypes.TERM_COLLECTION,
|
|
27
32
|
])
|
|
28
33
|
|
|
29
34
|
/*
|
|
@@ -68,7 +73,7 @@ export function isUsableTerm(term, _usecase, termdbConfig, ds) {
|
|
|
68
73
|
const usecase = _usecase || {}
|
|
69
74
|
|
|
70
75
|
// may apply dataset specific override filter for a use case
|
|
71
|
-
if (typeof ds?.usecase?.[usecase.target] ==
|
|
76
|
+
if (typeof ds?.usecase?.[usecase.target] == "function") {
|
|
72
77
|
return ds.usecase[usecase.target](term, usecase)
|
|
73
78
|
}
|
|
74
79
|
|
|
@@ -79,41 +84,41 @@ export function isUsableTerm(term, _usecase, termdbConfig, ds) {
|
|
|
79
84
|
const child_types = term.child_types || []
|
|
80
85
|
// default handling
|
|
81
86
|
switch (usecase.target) {
|
|
82
|
-
case
|
|
83
|
-
case
|
|
84
|
-
case
|
|
85
|
-
case
|
|
86
|
-
if (term.type && term.type !==
|
|
87
|
-
if (hasAllowedChildTypes(child_types, [
|
|
87
|
+
case "barchart":
|
|
88
|
+
case "violin":
|
|
89
|
+
case "boxplot":
|
|
90
|
+
case "summary":
|
|
91
|
+
if (term.type && term.type !== "survival") uses.add("plot")
|
|
92
|
+
if (hasAllowedChildTypes(child_types, ["survival"])) uses.add("branch")
|
|
88
93
|
return uses
|
|
89
94
|
|
|
90
|
-
case
|
|
91
|
-
if (usecase.detail ===
|
|
92
|
-
if (term.type && term.type !==
|
|
93
|
-
if (hasAllowedChildTypes(child_types, [
|
|
95
|
+
case "summaryInput":
|
|
96
|
+
if (usecase.detail === "term2" || usecase.detail == "term0") {
|
|
97
|
+
if (term.type && term.type !== "survival") uses.add("plot")
|
|
98
|
+
if (hasAllowedChildTypes(child_types, ["survival"])) uses.add("branch")
|
|
94
99
|
return uses
|
|
95
100
|
} else {
|
|
96
|
-
if (graphableTypes.has(term.type)) uses.add(
|
|
97
|
-
if (!term.isleaf) uses.add(
|
|
101
|
+
if (graphableTypes.has(term.type)) uses.add("plot")
|
|
102
|
+
if (!term.isleaf) uses.add("branch")
|
|
98
103
|
return uses
|
|
99
104
|
}
|
|
100
105
|
|
|
101
|
-
case
|
|
102
|
-
if (term.type) uses.add(
|
|
103
|
-
if (!term.isleaf) uses.add(
|
|
106
|
+
case "matrix":
|
|
107
|
+
if (term.type) uses.add("plot")
|
|
108
|
+
if (!term.isleaf) uses.add("branch")
|
|
104
109
|
return uses
|
|
105
110
|
|
|
106
|
-
case
|
|
107
|
-
if (usecase.detail ==
|
|
108
|
-
if (child_types.length > 1) uses.add(
|
|
111
|
+
case "table":
|
|
112
|
+
if (usecase.detail == "term") uses.add("plot")
|
|
113
|
+
if (child_types.length > 1) uses.add("branch")
|
|
109
114
|
return uses
|
|
110
115
|
|
|
111
|
-
case
|
|
112
|
-
if (usecase.detail ==
|
|
116
|
+
case "sampleScatter":
|
|
117
|
+
if (usecase.detail == "numeric") {
|
|
113
118
|
if (isNumericTerm(term)) {
|
|
114
|
-
uses.add(
|
|
119
|
+
uses.add("plot")
|
|
115
120
|
}
|
|
116
|
-
if (hasNumericChild(child_types)) uses.add(
|
|
121
|
+
if (hasNumericChild(child_types)) uses.add("branch")
|
|
117
122
|
}
|
|
118
123
|
// Commenting out for now. May need later for another single
|
|
119
124
|
// cell term. Revisit logic at that time.
|
|
@@ -125,49 +130,38 @@ export function isUsableTerm(term, _usecase, termdbConfig, ds) {
|
|
|
125
130
|
// }
|
|
126
131
|
// }
|
|
127
132
|
else {
|
|
128
|
-
if (graphableTypes.has(term.type)) uses.add(
|
|
129
|
-
if (!term.isleaf) uses.add(
|
|
133
|
+
if (graphableTypes.has(term.type)) uses.add("plot")
|
|
134
|
+
if (!term.isleaf) uses.add("branch")
|
|
130
135
|
}
|
|
131
136
|
return uses
|
|
132
|
-
case
|
|
133
|
-
if (usecase.detail ==
|
|
134
|
-
if (term.type ==
|
|
135
|
-
uses.add(
|
|
137
|
+
case "runChart2":
|
|
138
|
+
if (usecase.detail == "date" || usecase.detail == "xtw") {
|
|
139
|
+
if (term.type == "date") {
|
|
140
|
+
uses.add("plot")
|
|
136
141
|
}
|
|
137
|
-
if (child_types.includes(
|
|
138
|
-
} else if (usecase.detail ==
|
|
139
|
-
if (isNumericTerm(term) && term.type !=
|
|
140
|
-
uses.add(
|
|
142
|
+
if (child_types.includes("date")) uses.add("branch")
|
|
143
|
+
} else if (usecase.detail == "numeric") {
|
|
144
|
+
if (isNumericTerm(term) && term.type != "date") {
|
|
145
|
+
uses.add("plot")
|
|
141
146
|
}
|
|
142
|
-
if (hasNumericChild(child_types)) uses.add(
|
|
147
|
+
if (hasNumericChild(child_types)) uses.add("branch")
|
|
143
148
|
} else {
|
|
144
|
-
if (graphableTypes.has(term.type)) uses.add(
|
|
145
|
-
if (!term.isleaf) uses.add(
|
|
146
|
-
}
|
|
147
|
-
return uses
|
|
148
|
-
case 'numericDictTermCluster':
|
|
149
|
-
if (!usecase.detail?.exclude?.includes(term.id)) {
|
|
150
|
-
if (isNumericTerm(term)) {
|
|
151
|
-
uses.add('plot')
|
|
152
|
-
}
|
|
153
|
-
if (hasNumericChild(child_types)) {
|
|
154
|
-
uses.add('branch')
|
|
155
|
-
}
|
|
149
|
+
if (graphableTypes.has(term.type)) uses.add("plot")
|
|
150
|
+
if (!term.isleaf) uses.add("branch")
|
|
156
151
|
}
|
|
157
152
|
return uses
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (usecase.detail?.
|
|
161
|
-
if (usecase.detail?.branchIds?.includes(term.id)) uses.add('branch')
|
|
153
|
+
case "termCollections":
|
|
154
|
+
if (usecase.detail?.termIds?.includes(term.id)) uses.add("plot")
|
|
155
|
+
if (usecase.detail?.branchIds?.includes(term.id)) uses.add("branch")
|
|
162
156
|
return uses
|
|
163
157
|
|
|
164
|
-
case
|
|
158
|
+
case "profileForms":
|
|
165
159
|
if (!term.isleaf) {
|
|
166
|
-
const ancestors = term.id.split(
|
|
160
|
+
const ancestors = term.id.split("__").length //depends on using the __ naming convension!
|
|
167
161
|
if (ancestors == 3) {
|
|
168
162
|
// 3rd level term is a domain, we show the templates associated to this domain
|
|
169
|
-
uses.add(
|
|
170
|
-
} else if (ancestors < 3) uses.add(
|
|
163
|
+
uses.add("plot")
|
|
164
|
+
} else if (ancestors < 3) uses.add("branch")
|
|
171
165
|
}
|
|
172
166
|
return uses
|
|
173
167
|
|
|
@@ -176,87 +170,102 @@ export function isUsableTerm(term, _usecase, termdbConfig, ds) {
|
|
|
176
170
|
// if (usecase.detail === 'term2' && hasNumericChild(child_types)) uses.add('branch')
|
|
177
171
|
// return uses
|
|
178
172
|
|
|
179
|
-
case
|
|
180
|
-
if (usecase.detail ==
|
|
181
|
-
if (term.type ==
|
|
182
|
-
if (child_types.includes(
|
|
173
|
+
case "cuminc":
|
|
174
|
+
if (usecase.detail == "term") {
|
|
175
|
+
if (term.type == "condition") uses.add("plot")
|
|
176
|
+
if (child_types.includes("condition")) uses.add("branch")
|
|
183
177
|
return uses
|
|
184
178
|
}
|
|
185
|
-
if (usecase.detail ===
|
|
186
|
-
if (term.type && term.type !=
|
|
187
|
-
|
|
179
|
+
if (usecase.detail === "term2" || usecase.detail == "term0") {
|
|
180
|
+
if (term.type && term.type != "condition" && term.type != "survival")
|
|
181
|
+
uses.add("plot")
|
|
182
|
+
if (hasAllowedChildTypes(child_types, ["condition", "survival"]))
|
|
183
|
+
uses.add("branch")
|
|
188
184
|
return uses
|
|
189
185
|
}
|
|
190
186
|
return uses
|
|
191
187
|
|
|
192
|
-
case
|
|
193
|
-
if (usecase.detail ==
|
|
194
|
-
if (term.type ==
|
|
195
|
-
if (child_types.includes(
|
|
188
|
+
case "survival":
|
|
189
|
+
if (usecase.detail == "term") {
|
|
190
|
+
if (term.type == "survival") uses.add("plot")
|
|
191
|
+
if (child_types.includes("survival")) uses.add("branch")
|
|
196
192
|
return uses
|
|
197
193
|
}
|
|
198
|
-
if (usecase.detail ===
|
|
199
|
-
if (term.type && term.type !=
|
|
200
|
-
if (hasAllowedChildTypes(child_types, [
|
|
194
|
+
if (usecase.detail === "term2" || usecase.detail == "term0") {
|
|
195
|
+
if (term.type && term.type != "survival") uses.add("plot")
|
|
196
|
+
if (hasAllowedChildTypes(child_types, ["survival"])) uses.add("branch")
|
|
201
197
|
return uses
|
|
202
198
|
}
|
|
203
199
|
return uses
|
|
204
200
|
|
|
205
|
-
case
|
|
206
|
-
if (usecase.detail ==
|
|
207
|
-
if (usecase.regressionType ==
|
|
208
|
-
if (term.type ==
|
|
209
|
-
if (hasNumericChild(child_types)) uses.add(
|
|
201
|
+
case "regression":
|
|
202
|
+
if (usecase.detail == "outcome") {
|
|
203
|
+
if (usecase.regressionType == "linear") {
|
|
204
|
+
if (term.type == "float" || term.type == "integer") uses.add("plot")
|
|
205
|
+
if (hasNumericChild(child_types)) uses.add("branch")
|
|
210
206
|
return uses
|
|
211
207
|
}
|
|
212
|
-
if (usecase.regressionType ==
|
|
213
|
-
if (term.type && term.type !=
|
|
214
|
-
if (hasAllowedChildTypes(child_types, [
|
|
208
|
+
if (usecase.regressionType == "logistic") {
|
|
209
|
+
if (term.type && term.type != "survival") uses.add("plot")
|
|
210
|
+
if (hasAllowedChildTypes(child_types, ["survival"]))
|
|
211
|
+
uses.add("branch")
|
|
215
212
|
return uses
|
|
216
|
-
} else if (usecase.regressionType ==
|
|
217
|
-
if (term.type ==
|
|
218
|
-
|
|
213
|
+
} else if (usecase.regressionType == "cox") {
|
|
214
|
+
if (term.type == "condition" || term.type == "survival")
|
|
215
|
+
uses.add("plot")
|
|
216
|
+
if (
|
|
217
|
+
child_types.includes("condition") ||
|
|
218
|
+
child_types.includes("survival")
|
|
219
|
+
)
|
|
220
|
+
uses.add("branch")
|
|
219
221
|
return uses
|
|
220
222
|
}
|
|
221
223
|
}
|
|
222
224
|
|
|
223
|
-
if (usecase.detail ==
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
|
|
225
|
+
if (usecase.detail == "independent") {
|
|
226
|
+
if (
|
|
227
|
+
term.type == "float" ||
|
|
228
|
+
term.type == "integer" ||
|
|
229
|
+
term.type == "categorical" ||
|
|
230
|
+
term.type == "samplelst"
|
|
231
|
+
)
|
|
232
|
+
uses.add("plot")
|
|
233
|
+
if (hasChildTypes(child_types, ["categorical", "float", "integer"]))
|
|
234
|
+
uses.add("branch")
|
|
227
235
|
return uses
|
|
228
236
|
}
|
|
229
237
|
return uses
|
|
230
238
|
|
|
231
|
-
case
|
|
239
|
+
case "filter": {
|
|
232
240
|
// apply "exlst" to other targets as needed
|
|
233
241
|
const exlst = termdbConfig?.excludedTermtypeByTarget?.filter
|
|
234
242
|
if (exlst) {
|
|
235
|
-
if (graphableTypes.has(term.type) && !exlst.includes(term.type))
|
|
236
|
-
|
|
243
|
+
if (graphableTypes.has(term.type) && !exlst.includes(term.type))
|
|
244
|
+
uses.add("plot")
|
|
245
|
+
if (child_types.find((t) => !exlst.includes(t))) uses.add("branch") // there's a non-excluded child type, allow branch to show
|
|
237
246
|
return uses
|
|
238
247
|
}
|
|
239
248
|
// no specific rule for filter. use default rules
|
|
240
|
-
if (graphableTypes.has(term.type)) uses.add(
|
|
241
|
-
if (!term.isleaf) uses.add(
|
|
249
|
+
if (graphableTypes.has(term.type)) uses.add("plot")
|
|
250
|
+
if (!term.isleaf) uses.add("branch")
|
|
242
251
|
return uses
|
|
243
252
|
}
|
|
244
253
|
|
|
245
|
-
case
|
|
246
|
-
if (usecase.detail ==
|
|
254
|
+
case "correlationVolcano":
|
|
255
|
+
if (usecase.detail == "numeric") {
|
|
247
256
|
if (isNumericTerm(term)) {
|
|
248
|
-
uses.add(
|
|
257
|
+
uses.add("plot")
|
|
249
258
|
}
|
|
250
|
-
if (hasNumericChild(child_types)) uses.add(
|
|
259
|
+
if (hasNumericChild(child_types)) uses.add("branch")
|
|
251
260
|
} else {
|
|
252
|
-
if (graphableTypes.has(term.type)) uses.add(
|
|
253
|
-
if (!term.isleaf) uses.add(
|
|
261
|
+
if (graphableTypes.has(term.type)) uses.add("plot")
|
|
262
|
+
if (!term.isleaf) uses.add("branch")
|
|
254
263
|
}
|
|
255
264
|
return uses
|
|
256
265
|
|
|
257
266
|
default:
|
|
258
|
-
if (graphableTypes.has(term.type)) uses.add(
|
|
259
|
-
if (!term.isleaf) uses.add(
|
|
267
|
+
if (graphableTypes.has(term.type)) uses.add("plot")
|
|
268
|
+
if (!term.isleaf) uses.add("branch")
|
|
260
269
|
return uses
|
|
261
270
|
}
|
|
262
271
|
}
|
|
@@ -272,14 +281,14 @@ function hasAllowedChildTypes(child_types, excluded_types) {
|
|
|
272
281
|
// no excluded types
|
|
273
282
|
return true
|
|
274
283
|
}
|
|
275
|
-
if (child_types.some(type => !excluded_types.includes(type))) {
|
|
284
|
+
if (child_types.some((type) => !excluded_types.includes(type))) {
|
|
276
285
|
// at least one child type is not excluded
|
|
277
286
|
return true
|
|
278
287
|
}
|
|
279
288
|
}
|
|
280
289
|
|
|
281
290
|
function hasNumericChild(child_types) {
|
|
282
|
-
return child_types.includes(
|
|
291
|
+
return child_types.includes("float") || child_types.includes("integer")
|
|
283
292
|
}
|
|
284
293
|
|
|
285
294
|
function hasChildTypes(child_types, expected_types) {
|