@sjcrh/proteinpaint-shared 2.186.0 → 2.187.0
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 +1 -1
- package/src/termdb.usecase.js +27 -0
package/package.json
CHANGED
package/src/termdb.usecase.js
CHANGED
|
@@ -179,6 +179,33 @@ export function isUsableTerm(term, _usecase, termdbConfig, ds) {
|
|
|
179
179
|
}
|
|
180
180
|
return uses
|
|
181
181
|
|
|
182
|
+
case "profileForms2": {
|
|
183
|
+
// Picker (forms2.ts makeChartBtnMenu) sets usecase.cohort + usecase.subtype.
|
|
184
|
+
// Reads the per-cohort domains list directly from the dataset config at
|
|
185
|
+
// plotConfigByCohort[cohort].profileForms2.domains — each entry is { id, plotTypes }.
|
|
186
|
+
if (term.isleaf) return uses
|
|
187
|
+
const allowed =
|
|
188
|
+
termdbConfig?.plotConfigByCohort?.[usecase.cohort]?.profileForms2
|
|
189
|
+
?.domains
|
|
190
|
+
if (!allowed) return uses
|
|
191
|
+
const ancestors = term.id.split("__").length
|
|
192
|
+
const subtype = usecase.subtype
|
|
193
|
+
if (ancestors == 3) {
|
|
194
|
+
if (allowed.find((d) => d.id === term.id)?.plotTypes?.includes(subtype))
|
|
195
|
+
uses.add("plot")
|
|
196
|
+
} else if (ancestors < 3) {
|
|
197
|
+
const prefix = term.id + "__"
|
|
198
|
+
if (
|
|
199
|
+
allowed.some(
|
|
200
|
+
(d) => d.id.startsWith(prefix) && d.plotTypes.includes(subtype)
|
|
201
|
+
)
|
|
202
|
+
) {
|
|
203
|
+
uses.add("branch")
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return uses
|
|
207
|
+
}
|
|
208
|
+
|
|
182
209
|
// case 'boxplot':
|
|
183
210
|
// if (term.type == 'float' || term.type == 'integer') uses.add('plot')
|
|
184
211
|
// if (usecase.detail === 'term2' && hasNumericChild(child_types)) uses.add('branch')
|