@sjcrh/proteinpaint-shared 2.149.0 → 2.152.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.bins.js +6 -3
- package/src/terms.js +1 -2
package/package.json
CHANGED
package/src/termdb.bins.js
CHANGED
|
@@ -267,7 +267,7 @@ export function get_bin_label(bin, binconfig, valueConversion) {
|
|
|
267
267
|
/*
|
|
268
268
|
Generate a numeric bin label given a bin configuration and an optional term valueConversion object
|
|
269
269
|
*/
|
|
270
|
-
if (
|
|
270
|
+
if (bin.label) return bin.label
|
|
271
271
|
|
|
272
272
|
const bc = binconfig
|
|
273
273
|
if (!bc.binLabelFormatter) bc.binLabelFormatter = getNumDecimalsFormatter(bc)
|
|
@@ -359,10 +359,13 @@ export function get_bin_label(bin, binconfig, valueConversion) {
|
|
|
359
359
|
export function get_bin_range_equation(bin, binconfig) {
|
|
360
360
|
const x = '<span style="font-family:Times;font-style:italic;">x</span>'
|
|
361
361
|
let range_eq
|
|
362
|
-
|
|
362
|
+
// should always use computed (not user-customized) bin label to determine bin range text
|
|
363
|
+
const copy = structuredClone(bin)
|
|
364
|
+
copy.label = '' // mutate only the copy, and not the original bin argument
|
|
365
|
+
const bin_label = get_bin_label(copy, binconfig)
|
|
363
366
|
if (bin.startunbounded || bin.stopunbounded) {
|
|
364
367
|
// first or last bins, e.g. x ≤ 14 and x > 16
|
|
365
|
-
range_eq = x + '
|
|
368
|
+
range_eq = x + ' ' + bin_label
|
|
366
369
|
} else if (bin.startinclusive) {
|
|
367
370
|
// bins with startinclusive, e.g. 14 ≤ x < 16
|
|
368
371
|
range_eq = bin_label.replace('to <', '≤ ' + x + ' <')
|
package/src/terms.js
CHANGED
|
@@ -181,8 +181,7 @@ export function getSampleType(term, ds) {
|
|
|
181
181
|
if (term.type == 'samplelst') {
|
|
182
182
|
const key = Object.keys(term.values)[0]
|
|
183
183
|
const sampleId = term.values[key].list[0]?.sampleId
|
|
184
|
-
|
|
185
|
-
if (sampleId) return ds.sampleId2Type.get(Number(sampleId))
|
|
184
|
+
if (sampleId) return ds.sampleId2Type.get(Number(sampleId) || sampleId)
|
|
186
185
|
else return DEFAULT_SAMPLE_TYPE
|
|
187
186
|
}
|
|
188
187
|
// samplelst or non dict terms
|