@milaboratories/miplots4 1.0.145 → 1.0.146
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/dist/heatmap/ChartRenderer.d.ts +1 -1
- package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
- package/dist/heatmap/ChartRenderer.js +110 -109
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.d.ts +1 -0
- package/dist/heatmap/HeatmapSettingsImpl.d.ts.map +1 -1
- package/dist/heatmap/HeatmapSettingsImpl.js +7 -6
- package/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/heatmap/components/Annotations/Annotation.d.ts +2 -2
- package/dist/heatmap/components/Annotations/Annotation.d.ts.map +1 -1
- package/dist/heatmap/components/Annotations/Annotation.js +106 -98
- package/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
- package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.d.ts +23 -0
- package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.d.ts.map +1 -0
- package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.js +99 -0
- package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.js.map +1 -0
- package/dist/heatmap/components/Annotations/AnnotationCellsSvg.d.ts +23 -0
- package/dist/heatmap/components/Annotations/AnnotationCellsSvg.d.ts.map +1 -0
- package/dist/heatmap/components/Annotations/AnnotationCellsSvg.js +57 -0
- package/dist/heatmap/components/Annotations/AnnotationCellsSvg.js.map +1 -0
- package/dist/heatmap/components/Annotations/index.d.ts +2 -2
- package/dist/heatmap/components/Annotations/index.d.ts.map +1 -1
- package/dist/heatmap/components/Annotations/index.js +2 -2
- package/dist/heatmap/components/Annotations/index.js.map +1 -1
- package/dist/heatmap/components/CanvasCells.d.ts +21 -0
- package/dist/heatmap/components/CanvasCells.d.ts.map +1 -0
- package/dist/heatmap/components/CanvasCells.js +85 -0
- package/dist/heatmap/components/CanvasCells.js.map +1 -0
- package/dist/heatmap/components/Chart.d.ts +2 -1
- package/dist/heatmap/components/Chart.d.ts.map +1 -1
- package/dist/heatmap/components/Chart.js +180 -186
- package/dist/heatmap/components/Chart.js.map +1 -1
- package/dist/heatmap/components/ChartsGroup.d.ts +2 -1
- package/dist/heatmap/components/ChartsGroup.d.ts.map +1 -1
- package/dist/heatmap/components/ChartsGroup.js +27 -25
- package/dist/heatmap/components/ChartsGroup.js.map +1 -1
- package/dist/heatmap/components/SvgCells.d.ts +19 -0
- package/dist/heatmap/components/SvgCells.d.ts.map +1 -0
- package/dist/heatmap/components/SvgCells.js +38 -0
- package/dist/heatmap/components/SvgCells.js.map +1 -0
- package/dist/heatmap/components/tooltipUtils.d.ts +10 -0
- package/dist/heatmap/components/tooltipUtils.d.ts.map +1 -0
- package/dist/heatmap/components/tooltipUtils.js +44 -0
- package/dist/heatmap/components/tooltipUtils.js.map +1 -0
- package/dist/heatmap/components/types.d.ts +8 -0
- package/dist/heatmap/components/types.d.ts.map +1 -1
- package/dist/heatmap/constants.d.ts +1 -0
- package/dist/heatmap/constants.d.ts.map +1 -1
- package/dist/heatmap/constants.js +13 -12
- package/dist/heatmap/constants.js.map +1 -1
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +65 -68
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +89 -87
- package/dist/heatmap/index.js.map +1 -1
- package/dist/types/heatmap.d.ts +3 -0
- package/dist/types/heatmap.d.ts.map +1 -1
- package/dist/types/heatmap.js +5 -4
- package/dist/types/heatmap.js.map +1 -1
- package/package.json +1 -1
package/dist/heatmap/getCells.js
CHANGED
|
@@ -1,41 +1,38 @@
|
|
|
1
1
|
import v from "../node_modules/lodash/lodash.js";
|
|
2
|
-
import
|
|
2
|
+
import Z from "../node_modules/d3-array/src/deviation.js";
|
|
3
3
|
import I from "../node_modules/d3-array/src/mean.js";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const o = O(s), l = I(s);
|
|
4
|
+
import O from "../node_modules/d3-array/src/extent.js";
|
|
5
|
+
function k(n) {
|
|
6
|
+
const o = Z(n), l = I(n);
|
|
8
7
|
return o === void 0 || l === void 0 || o === 0 ? (c) => c : (c) => (c - l) / o;
|
|
9
8
|
}
|
|
10
|
-
function
|
|
11
|
-
const o = I(
|
|
9
|
+
function ee(n) {
|
|
10
|
+
const o = I(n), [l, c] = O(n);
|
|
12
11
|
return o === void 0 || l === void 0 || c === void 0 || c === l ? (f) => f : (f) => (f - o) / (c - l);
|
|
13
12
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
13
|
+
function te(n, o) {
|
|
14
|
+
return n === "standardScaling" ? k(o) : n === "meanNormalization" ? ee(o) : (l) => l;
|
|
16
15
|
}
|
|
17
|
-
function B(
|
|
18
|
-
if (!
|
|
16
|
+
function B(n) {
|
|
17
|
+
if (!n.length)
|
|
19
18
|
return [];
|
|
20
19
|
let o = [[]];
|
|
21
|
-
return
|
|
20
|
+
return n.forEach((l) => {
|
|
22
21
|
const c = [];
|
|
23
22
|
l.forEach((f) => {
|
|
24
|
-
c.push(...o.map((
|
|
23
|
+
c.push(...o.map((d) => [...d, f]));
|
|
25
24
|
}), o = c;
|
|
26
25
|
}), o;
|
|
27
26
|
}
|
|
28
|
-
const
|
|
27
|
+
const _ = (n, o, l = {}) => n.sort(
|
|
29
28
|
(c, f) => o === "asc" ? (l[c] ?? c).localeCompare(l[f] ?? f, "en", { numeric: !0 }) : (l[f] ?? f).localeCompare(l[c] ?? c, "en", { numeric: !0 })
|
|
30
29
|
);
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
S > ee && console.error(`Too many cells for graph rendering (${S})`);
|
|
34
|
-
const T = f.length ? f.map((e) => x[e.value] ?? s.getColumnCategories(e.value)) : [["null"]], F = E.length ? E.map((e) => x[e.value] ?? s.getColumnCategories(e.value)) : [["null"]], U = d.length ? d.map((e) => x[e.value] ?? s.getColumnCategories(e.value)) : [["null"]], M = B(T), $ = B(F), j = B(U), _ = M.map((e) => e.join("_")), V = $.map((e) => e.join("_")), b = j.map((e) => e.join("_")), t = {
|
|
30
|
+
function le(n, o, l, c, f, d, b, D, z, X, C, Y, x, A, N) {
|
|
31
|
+
const F = f.length ? f.map((e) => x[e.value] ?? n.getColumnCategories(e.value)) : [["null"]], R = d.length ? d.map((e) => x[e.value] ?? n.getColumnCategories(e.value)) : [["null"]], H = b.length ? b.map((e) => x[e.value] ?? n.getColumnCategories(e.value)) : [["null"]], S = B(F), M = B(R), j = B(H), $ = S.map((e) => e.join("_")), E = M.map((e) => e.join("_")), L = j.map((e) => e.join("_")), t = {
|
|
35
32
|
meta: {
|
|
36
|
-
facetKeys:
|
|
37
|
-
xGroupKeys:
|
|
38
|
-
yGroupKeys:
|
|
33
|
+
facetKeys: $,
|
|
34
|
+
xGroupKeys: E,
|
|
35
|
+
yGroupKeys: L,
|
|
39
36
|
xKeysByGroups: {},
|
|
40
37
|
yKeysByGroups: {},
|
|
41
38
|
xLabels: {},
|
|
@@ -44,17 +41,17 @@ function ie(s, o, l, c, f, E, d, D, N, X, L, A, x, Y, R) {
|
|
|
44
41
|
yGroupLabels: {},
|
|
45
42
|
xDataByKeys: {},
|
|
46
43
|
yDataByKeys: {},
|
|
47
|
-
facetKeyValues:
|
|
48
|
-
xGroupKeyValues:
|
|
49
|
-
yGroupKeyValues:
|
|
44
|
+
facetKeyValues: $.reduce((e, a, u) => (e[a] = S[u], e), {}),
|
|
45
|
+
xGroupKeyValues: E.reduce((e, a, u) => (e[a] = M[u], e), {}),
|
|
46
|
+
yGroupKeyValues: L.reduce((e, a, u) => (e[a] = j[u], e), {}),
|
|
50
47
|
valueExtent: [1 / 0, -1 / 0]
|
|
51
48
|
},
|
|
52
49
|
facets: {}
|
|
53
|
-
}, w = o.valueLabels ?? o.value, q = l.valueLabels ?? l.value,
|
|
54
|
-
for (let e = 0; e <
|
|
55
|
-
const a = f.length ? f.map((
|
|
56
|
-
t.meta.xGroupLabels[u] =
|
|
57
|
-
const i = String(
|
|
50
|
+
}, w = o.valueLabels ?? o.value, q = l.valueLabels ?? l.value, J = D.filter((e) => e.axis === "x").map((e) => e.valueColumn.value), P = D.filter((e) => e.axis === "y").map((e) => e.valueColumn.value), Q = Object.values(z ?? {}).map((e) => e.value), T = Object.values(X ?? {}).map((e) => e.value), U = v.uniq([...J, ...Q, w]), W = v.uniq([...P, ...T, q]);
|
|
51
|
+
for (let e = 0; e < n.rowsCount; e++) {
|
|
52
|
+
const a = f.length ? f.map((s) => n.getColumnValue(s.value, e)).join("_") : "null", u = d.length ? d.map((s) => n.getColumnValue(s.value, e)).join("_") : "null", y = b.length ? b.map((s) => n.getColumnValue(s.value, e)).join("_") : "null", K = d.length ? d.map((s) => n.getColumnValue(s.valueLabels ?? s.value, e)).join(", ") : "", G = b.length ? b.map((s) => n.getColumnValue(s.valueLabels ?? s.value, e)).join(", ") : "";
|
|
53
|
+
t.meta.xGroupLabels[u] = K, t.meta.yGroupLabels[y] = G;
|
|
54
|
+
const i = String(n.getColumnValue(o.value, e)), r = String(n.getColumnValue(l.value, e)), p = n.getColumnValue(c.value, e) ?? Y;
|
|
58
55
|
if (i === "null" || r === "null" || p === null)
|
|
59
56
|
continue;
|
|
60
57
|
if (t.facets[a] || (t.facets[a] = {
|
|
@@ -65,22 +62,22 @@ function ie(s, o, l, c, f, E, d, D, N, X, L, A, x, Y, R) {
|
|
|
65
62
|
cells: {}
|
|
66
63
|
}), t.facets[a].xKeysByGroups[u] || (t.facets[a].xKeysByGroups[u] = []), t.facets[a].yKeysByGroups[y] || (t.facets[a].yKeysByGroups[y] = []), t.facets[a].xKeys.push(i), t.facets[a].yKeys.push(r), t.facets[a].xKeysByGroups[u].push(i), t.facets[a].yKeysByGroups[y].push(r), t.facets[a].cells[i] || (t.facets[a].cells[i] = {}), t.meta.valueExtent[0] = Math.min(p, t.meta.valueExtent[0]), t.meta.valueExtent[1] = Math.max(p, t.meta.valueExtent[1]), t.facets[a].cells[i][r] && t.facets[a].cells[i][r].value !== p)
|
|
67
64
|
throw Error(`More than 1 value for x=${i}, y=${r}`);
|
|
68
|
-
const h =
|
|
65
|
+
const h = n.getColumnValue(w, e);
|
|
69
66
|
if (t.meta.xLabels[i] && String(h) !== t.meta.xLabels[i])
|
|
70
67
|
throw Error(`More than 1 x-label value for x=${i}`);
|
|
71
|
-
const
|
|
72
|
-
if (t.meta.yLabels[r] && String(
|
|
68
|
+
const g = n.getColumnValue(q, e);
|
|
69
|
+
if (t.meta.yLabels[r] && String(g) !== t.meta.yLabels[r])
|
|
73
70
|
throw Error(`More than 1 y-label value for y=${r}`);
|
|
74
|
-
t.meta.xLabels[i] = String(h), t.meta.yLabels[r] = String(
|
|
75
|
-
const m = typeof t.meta.xDataByKeys[
|
|
76
|
-
if (m || (t.meta.xDataByKeys[
|
|
77
|
-
throw Error(`More than 1 value for x = ${i} and column = ${
|
|
78
|
-
|
|
79
|
-
}),
|
|
80
|
-
const m = typeof t.meta.yDataByKeys[
|
|
81
|
-
if (m || (t.meta.yDataByKeys[
|
|
82
|
-
throw Error(`More than 1 value for y = ${r} and column = ${
|
|
83
|
-
|
|
71
|
+
t.meta.xLabels[i] = String(h), t.meta.yLabels[r] = String(g), U.forEach((s) => {
|
|
72
|
+
const m = typeof t.meta.xDataByKeys[s] < "u", V = m && typeof t.meta.xDataByKeys[s][i] < "u";
|
|
73
|
+
if (m || (t.meta.xDataByKeys[s] = {}), V && t.meta.xDataByKeys[s][i] !== n.getColumnValue(s, e))
|
|
74
|
+
throw Error(`More than 1 value for x = ${i} and column = ${s}`);
|
|
75
|
+
V || (t.meta.xDataByKeys[s][i] = n.getColumnValue(s, e));
|
|
76
|
+
}), W.forEach((s) => {
|
|
77
|
+
const m = typeof t.meta.yDataByKeys[s] < "u", V = m && typeof t.meta.yDataByKeys[s][r] < "u";
|
|
78
|
+
if (m || (t.meta.yDataByKeys[s] = {}), V && t.meta.yDataByKeys[s][r] !== n.getColumnValue(s, e))
|
|
79
|
+
throw Error(`More than 1 value for y = ${r} and column = ${s}`);
|
|
80
|
+
V || (t.meta.yDataByKeys[s][r] = n.getColumnValue(s, e));
|
|
84
81
|
}), t.facets[a].cells[i][r] = {
|
|
85
82
|
isCell: !0,
|
|
86
83
|
idx: e,
|
|
@@ -93,55 +90,55 @@ function ie(s, o, l, c, f, E, d, D, N, X, L, A, x, Y, R) {
|
|
|
93
90
|
}
|
|
94
91
|
if (t.meta.facetKeys = t.meta.facetKeys.filter((e) => t.facets[e]), t.meta.facetKeys.forEach((e) => {
|
|
95
92
|
const a = t.facets[e], u = v.uniq(a.xKeys), y = v.uniq(a.yKeys);
|
|
96
|
-
a.xKeys = x[o.value] ? v.intersection(x[o.value], u) : u, a.yKeys = x[l.value] ? v.intersection(x[l.value], y) : y,
|
|
97
|
-
t.facets[e].xKeysByGroups[
|
|
93
|
+
a.xKeys = x[o.value] ? v.intersection(x[o.value], u) : u, a.yKeys = x[l.value] ? v.intersection(x[l.value], y) : y, E.forEach((K) => {
|
|
94
|
+
t.facets[e].xKeysByGroups[K] = v.intersection(
|
|
98
95
|
a.xKeys,
|
|
99
|
-
t.facets[e].xKeysByGroups[
|
|
96
|
+
t.facets[e].xKeysByGroups[K]
|
|
100
97
|
);
|
|
101
|
-
}),
|
|
102
|
-
t.facets[e].yKeysByGroups[
|
|
98
|
+
}), L.forEach((K) => {
|
|
99
|
+
t.facets[e].yKeysByGroups[K] = v.intersection(
|
|
103
100
|
a.yKeys,
|
|
104
|
-
t.facets[e].yKeysByGroups[
|
|
101
|
+
t.facets[e].yKeysByGroups[K]
|
|
105
102
|
);
|
|
106
103
|
});
|
|
107
|
-
}),
|
|
104
|
+
}), C) {
|
|
108
105
|
const e = [1 / 0, -1 / 0];
|
|
109
106
|
t.meta.facetKeys.forEach((a) => {
|
|
110
|
-
const { xKeys: u, yKeys: y, cells:
|
|
111
|
-
var
|
|
112
|
-
return (
|
|
107
|
+
const { xKeys: u, yKeys: y, cells: K } = t.facets[a], G = C.direction === "row" ? u : y, i = C.direction === "row" ? y : u, r = C.direction === "row" ? (p, h) => {
|
|
108
|
+
var g;
|
|
109
|
+
return (g = K[p]) == null ? void 0 : g[h];
|
|
113
110
|
} : (p, h) => {
|
|
114
|
-
var
|
|
115
|
-
return (
|
|
111
|
+
var g;
|
|
112
|
+
return (g = K[h]) == null ? void 0 : g[p];
|
|
116
113
|
};
|
|
117
114
|
i.forEach((p) => {
|
|
118
115
|
const h = [];
|
|
119
|
-
G.forEach((
|
|
120
|
-
var
|
|
121
|
-
const m = (
|
|
116
|
+
G.forEach((s) => {
|
|
117
|
+
var V;
|
|
118
|
+
const m = (V = r(s, p)) == null ? void 0 : V.value;
|
|
122
119
|
m !== void 0 && h.push(m);
|
|
123
120
|
});
|
|
124
|
-
const
|
|
125
|
-
G.forEach((
|
|
126
|
-
const m = r(
|
|
127
|
-
m !== void 0 && (m.normalizedValue =
|
|
121
|
+
const g = te(C.method, h);
|
|
122
|
+
G.forEach((s) => {
|
|
123
|
+
const m = r(s, p);
|
|
124
|
+
m !== void 0 && (m.normalizedValue = g(m.value), e[0] = Math.min(m.normalizedValue, e[0]), e[1] = Math.max(m.normalizedValue, e[1]));
|
|
128
125
|
});
|
|
129
126
|
});
|
|
130
127
|
}), t.meta.valueExtent = e;
|
|
131
128
|
}
|
|
132
|
-
return t.meta.xKeysByGroups =
|
|
133
|
-
const u =
|
|
129
|
+
return t.meta.xKeysByGroups = E.reduce((e, a) => {
|
|
130
|
+
const u = _(v.uniq(
|
|
134
131
|
v.flatten(t.meta.facetKeys.map((y) => t.facets[y].xKeysByGroups[a]))
|
|
135
|
-
),
|
|
132
|
+
), A.sorting, t.meta.xLabels);
|
|
136
133
|
return e[a] = x[o.value] ? v.intersection(x[o.value], u) : u, e;
|
|
137
|
-
}, {}), t.meta.yKeysByGroups =
|
|
138
|
-
const u =
|
|
134
|
+
}, {}), t.meta.yKeysByGroups = L.reduce((e, a) => {
|
|
135
|
+
const u = _(v.uniq(
|
|
139
136
|
v.flatten(t.meta.facetKeys.map((y) => t.facets[y].yKeysByGroups[a]))
|
|
140
|
-
),
|
|
137
|
+
), N.sorting, t.meta.yLabels);
|
|
141
138
|
return e[a] = x[l.value] ? v.intersection(x[l.value], u) : u, e;
|
|
142
139
|
}, {}), t.meta.valueExtent[0] === 1 / 0 && (t.meta.valueExtent[0] = 0), t.meta.valueExtent[1] === -1 / 0 && (t.meta.valueExtent[1] = 0), t;
|
|
143
140
|
}
|
|
144
141
|
export {
|
|
145
|
-
|
|
142
|
+
le as getCells
|
|
146
143
|
};
|
|
147
144
|
//# sourceMappingURL=getCells.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCells.js","sources":["../../src/heatmap/getCells.ts"],"sourcesContent":["import { deviation, extent, mean } from 'd3-array';\nimport lodash from 'lodash';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\n\nconst MAX_RENDERED_CELLS_COUNT = 500000;\nfunction normalizeByStd(values:number[]) {\n const stdValue = deviation(values);\n const meanValue = mean(values);\n\n if (stdValue === undefined || meanValue === undefined || stdValue === 0) {\n return (v:number) => v;\n }\n return (v:number) => (v - meanValue) / stdValue;\n}\nfunction normalizeByMinMax(values:number[]) {\n const meanValue = mean(values);\n const [min, max] = extent(values);\n if (meanValue === undefined || min === undefined || max === undefined || max === min) {\n return (v:number) => v;\n }\n return (v:number) => (v - meanValue) / (max - min);\n}\n\nfunction getNormalizationFn(method:NormalizationMethod, values:number[]) {\n if (method === 'standardScaling') {\n return normalizeByStd(values);\n }\n if (method === 'meanNormalization') {\n return normalizeByMinMax(values);\n }\n return (v:number) => v;\n}\n\nexport type Cell = {\n isCell: true;\n idx: number;\n id: string;\n value: DataValue;\n normalizedValue: DataValue;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData = {\n meta: {\n facetKeys: string[];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // for titles, if facet by more 1 columns title has several values separated by commas\n facetKeyValues: Record<string, string[]>;\n xGroupKeyValues: Record<string, string[]>;\n yGroupKeyValues: Record<string, string[]>;\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n xGroupLabels: Record<string, string>;\n yGroupLabels: Record<string, string>;\n valueExtent: [number, number]; // for color scales\n // data for labels, annotations and dendrograms\n xDataByKeys: Record<string, Record<string, DataValue>>;\n yDataByKeys: Record<string, Record<string, DataValue>>;\n };\n //facet groups\n facets: Record<\n string,\n {\n // axis keys\n xKeys: string[];\n yKeys: string[];\n // axis keys grouped by group keys from meta\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // cells grouped by X, then by Y\n cells: Record<string, Record<string, Cell>>;\n }\n >;\n};\n\n// all combinations with 1 key from each list\nfunction getKeysCombinations(keysLists: string[][]) {\n if (!keysLists.length) {\n return [];\n }\n let result: string[][] = [[]];\n keysLists.forEach(keys => {\n const nextResult: string[][] = [];\n keys.forEach(key => {\n nextResult.push(...result.map(resultItem => [...resultItem, key]));\n });\n result = nextResult;\n });\n return result;\n}\nconst sortByLabels = (arr: string[], direction: 'asc' | 'desc', labels: Record<string, string> = {}) => {\n return arr.sort((a, b) => direction === 'asc'\n ? (labels[a] ?? a).localeCompare((labels[b] ?? b), 'en', { numeric: true })\n : (labels[b] ?? b).localeCompare((labels[a] ?? a), 'en', { numeric: true })\n );\n};\n\nexport function getCells(\n data: DataFrame,\n xColumn: ColumnName,\n yColumn: ColumnName,\n valueColumn: ColumnName,\n facetBy: ColumnName[],\n xGroupBy: ColumnName[],\n yGroupBy: ColumnName[],\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n normalization: HeatmapSettingsImpl['normalization'],\n NAValueAs: HeatmapSettingsImpl['NAValueAs'],\n keysOrder: HeatmapSettingsImpl['keysOrder'],\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n): GroupedCellsData {\n const dataSize = data.columnNames.length ? data.getColumn(data.columnNames[0]).length : 0;\n if (dataSize > MAX_RENDERED_CELLS_COUNT) {\n console.error(`Too many cells for graph rendering (${dataSize})`);\n }\n const facetKeysLists = facetBy.length\n ? facetBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const xGroupKeysLists = xGroupBy.length\n ? xGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const yGroupKeysLists = yGroupBy.length\n ? yGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const facetKeysCombinations = getKeysCombinations(facetKeysLists);\n const xGroupKeysCombinations = getKeysCombinations(xGroupKeysLists);\n const yGroupKeysCombinations = getKeysCombinations(yGroupKeysLists);\n\n const facetKeys = facetKeysCombinations.map(keys => keys.join('_'));\n const xGroupKeys = xGroupKeysCombinations.map(keys => keys.join('_'));\n const yGroupKeys = yGroupKeysCombinations.map(keys => keys.join('_'));\n\n const result: GroupedCellsData = {\n meta: {\n facetKeys,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups: {},\n yKeysByGroups: {},\n xLabels: {},\n yLabels: {},\n xGroupLabels: {},\n yGroupLabels: {},\n xDataByKeys: {},\n yDataByKeys: {},\n facetKeyValues: facetKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = facetKeysCombinations[index];\n return res;\n }, {}),\n xGroupKeyValues: xGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = xGroupKeysCombinations[index];\n return res;\n }, {}),\n yGroupKeyValues: yGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = yGroupKeysCombinations[index];\n return res;\n }, {}),\n valueExtent: [Infinity, -Infinity],\n },\n facets: {},\n };\n\n const xLabelsSource = xColumn.valueLabels ?? xColumn.value;\n const yLabelsSource = yColumn.valueLabels ?? yColumn.value;\n const annotationColumnsX = annotations.filter(item => item.axis === 'x').map(item => item.valueColumn.value);\n const annotationColumnsY = annotations.filter(item => item.axis === 'y').map(item => item.valueColumn.value);\n const dendrogramXColumns = Object.values(dendrogramX ?? {}).map(column => column.value);\n const dendrogramYColumns = Object.values(dendrogramY ?? {}).map(column => column.value);\n const additionalDataColumnsX = lodash.uniq([...annotationColumnsX, ...dendrogramXColumns, xLabelsSource]);\n const additionalDataColumnsY = lodash.uniq([...annotationColumnsY, ...dendrogramYColumns, yLabelsSource]);\n\n for (let i = 0; i < data.rowsCount; i++) {\n const facetKey = facetBy.length ? facetBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const yGroupKey = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupLabel = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n const yGroupLabel = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n result.meta.xGroupLabels[xGroupKey] = xGroupLabel;\n result.meta.yGroupLabels[yGroupKey] = yGroupLabel;\n const x = String(data.getColumnValue(xColumn.value, i));\n const y = String(data.getColumnValue(yColumn.value, i));\n const value = (data.getColumnValue(valueColumn.value, i) ?? NAValueAs) as number | null;\n \n if (x === 'null' || y === 'null' || value === null) {\n continue;\n }\n\n if (!result.facets[facetKey]) {\n result.facets[facetKey] = {\n xKeys: [],\n yKeys: [],\n xKeysByGroups: {},\n yKeysByGroups: {},\n cells: {},\n };\n }\n if (!result.facets[facetKey].xKeysByGroups[xGroupKey]) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = [];\n }\n if (!result.facets[facetKey].yKeysByGroups[yGroupKey]) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = [];\n }\n result.facets[facetKey].xKeys.push(x);\n result.facets[facetKey].yKeys.push(y);\n result.facets[facetKey].xKeysByGroups[xGroupKey].push(x);\n result.facets[facetKey].yKeysByGroups[yGroupKey].push(y);\n\n if (!result.facets[facetKey].cells[x]) {\n result.facets[facetKey].cells[x] = {};\n }\n result.meta.valueExtent[0] = Math.min(value, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value, result.meta.valueExtent[1]);\n if (result.facets[facetKey].cells[x][y] && result.facets[facetKey].cells[x][y].value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const xLabelsSourceValue = data.getColumnValue(xLabelsSource, i);\n if (result.meta.xLabels[x] && String(xLabelsSourceValue) !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n const yLabelsSourceValue = data.getColumnValue(yLabelsSource, i);\n if (result.meta.yLabels[y] && String(yLabelsSourceValue) !== result.meta.yLabels[y]) {\n throw Error(`More than 1 y-label value for y=${y}`);\n }\n result.meta.xLabels[x] = String(xLabelsSourceValue);\n result.meta.yLabels[y] = String(yLabelsSourceValue);\n // data for labels, annotations and dendrograms by X\n additionalDataColumnsX.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.xDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.xDataByKeys[columnKey][x] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.xDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.xDataByKeys[columnKey][x] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for x = ${x} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.xDataByKeys[columnKey][x] = data.getColumnValue(columnKey, i);\n }\n });\n // data for labels, annotations and dendrograms by Y\n additionalDataColumnsY.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.yDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.yDataByKeys[columnKey][y] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.yDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.yDataByKeys[columnKey][y] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for y = ${y} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.yDataByKeys[columnKey][y] = data.getColumnValue(columnKey, i);\n }\n });\n result.facets[facetKey].cells[x][y] = {\n isCell: true,\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value,\n normalizedValue: value,\n };\n }\n\n result.meta.facetKeys = result.meta.facetKeys.filter((key) => result.facets[key]); // filter only used;\n\n // make uniq x, y, x-group and y-group keys\n result.meta.facetKeys.forEach(facetKey => {\n const facet = result.facets[facetKey];\n const uniqueXKeys = lodash.uniq(facet.xKeys);\n const uniqueYKeys = lodash.uniq(facet.yKeys);\n facet.xKeys = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], uniqueXKeys) : uniqueXKeys;\n facet.yKeys = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], uniqueYKeys) : uniqueYKeys;\n xGroupKeys.forEach(xGroupKey => {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = lodash.intersection(\n facet.xKeys,\n result.facets[facetKey].xKeysByGroups[xGroupKey]\n );\n });\n yGroupKeys.forEach(yGroupKey => {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = lodash.intersection(\n facet.yKeys,\n result.facets[facetKey].yKeysByGroups[yGroupKey]\n );\n });\n });\n\n if (normalization) {\n const valueExtent = [Infinity, -Infinity] as [number, number];\n result.meta.facetKeys.forEach(facetKey => {\n const {xKeys, yKeys, cells} = result.facets[facetKey];\n const cellKeys = normalization.direction === 'row' ? xKeys : yKeys;\n const groupKeys = normalization.direction === 'row' ? yKeys : xKeys;\n const cellGetter = normalization.direction === 'row'\n ? (cellKey:string, groupKey:string) => cells[cellKey]?.[groupKey]\n : (cellKey:string, groupKey:string) => cells[groupKey]?.[cellKey];\n groupKeys.forEach((groupKey) => {\n const values:number[] = [];\n cellKeys.forEach((cellKey) => {\n const v = cellGetter(cellKey, groupKey)?.value;\n if (v !== undefined) {\n values.push(v as number);\n }\n });\n const normalize = getNormalizationFn(normalization.method, values);\n cellKeys.forEach((cellKey) => {\n const cell = cellGetter(cellKey, groupKey);\n if (cell !== undefined) {\n cell.normalizedValue = normalize(cell.value as number);\n valueExtent[0] = Math.min(cell.normalizedValue, valueExtent[0]);\n valueExtent[1] = Math.max(cell.normalizedValue, valueExtent[1]);\n }\n });\n });\n });\n result.meta.valueExtent = valueExtent;\n }\n\n // every facet may contain not all of available keys, but for shared axes it is necessary to have all of them\n result.meta.xKeysByGroups = xGroupKeys.reduce((res: Record<string, string[]>, xGroupKey) => {\n const existingXKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].xKeysByGroups[xGroupKey]))\n ), xAxis.sorting, result.meta.xLabels);\n res[xGroupKey] = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], existingXKeys) : existingXKeys;\n return res;\n }, {});\n result.meta.yKeysByGroups = yGroupKeys.reduce((res: Record<string, string[]>, yGroupKey) => {\n const existingYKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].yKeysByGroups[yGroupKey]))\n ), yAxis.sorting, result.meta.yLabels);\n res[yGroupKey] = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], existingYKeys) : existingYKeys;\n return res;\n }, {});\n\n // avoid render errors on empty data\n if (result.meta.valueExtent[0] === Infinity) {\n result.meta.valueExtent[0] = 0;\n }\n if (result.meta.valueExtent[1] === -Infinity) {\n result.meta.valueExtent[1] = 0;\n }\n\n return result;\n}\n"],"names":["MAX_RENDERED_CELLS_COUNT","normalizeByStd","values","stdValue","deviation","meanValue","mean","v","normalizeByMinMax","min","max","extent","getNormalizationFn","method","getKeysCombinations","keysLists","result","keys","nextResult","key","resultItem","sortByLabels","arr","direction","labels","a","b","getCells","data","xColumn","yColumn","valueColumn","facetBy","xGroupBy","yGroupBy","annotations","dendrogramX","dendrogramY","normalization","NAValueAs","keysOrder","xAxis","yAxis","dataSize","facetKeysLists","column","xGroupKeysLists","yGroupKeysLists","facetKeysCombinations","xGroupKeysCombinations","yGroupKeysCombinations","facetKeys","xGroupKeys","yGroupKeys","res","index","xLabelsSource","yLabelsSource","annotationColumnsX","item","annotationColumnsY","dendrogramXColumns","dendrogramYColumns","additionalDataColumnsX","lodash","additionalDataColumnsY","i","facetKey","xGroupKey","yGroupKey","xGroupLabel","yGroupLabel","x","y","value","xLabelsSourceValue","yLabelsSourceValue","columnKey","isAddedColumn","isAddedValue","facet","uniqueXKeys","uniqueYKeys","valueExtent","xKeys","yKeys","cells","cellKeys","groupKeys","cellGetter","cellKey","groupKey","_a","normalize","cell","existingXKeys","existingYKeys"],"mappings":";;;;AAMA,MAAMA,KAA2B;AACjC,SAASC,GAAeC,GAAiB;AACrC,QAAMC,IAAWC,EAAUF,CAAM,GAC3BG,IAAYC,EAAKJ,CAAM;AAE7B,SAAIC,MAAa,UAAaE,MAAc,UAAaF,MAAa,IAC3D,CAACI,MAAaA,IAElB,CAACA,OAAcA,IAAIF,KAAaF;AAC3C;AACA,SAASK,GAAkBN,GAAiB;AACxC,QAAMG,IAAYC,EAAKJ,CAAM,GACvB,CAACO,GAAKC,CAAG,IAAIC,EAAOT,CAAM;AAChC,SAAIG,MAAc,UAAaI,MAAQ,UAAaC,MAAQ,UAAaA,MAAQD,IACtE,CAACF,MAAaA,IAElB,CAACA,OAAcA,IAAIF,MAAcK,IAAMD;AAClD;AAEA,SAASG,GAAmBC,GAA4BX,GAAiB;AACrE,SAAIW,MAAW,oBACJZ,GAAeC,CAAM,IAE5BW,MAAW,sBACJL,GAAkBN,CAAM,IAE5B,CAACK,MAAaA;AACzB;AAiDA,SAASO,EAAo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AAAA,EACX,GAAG,CAAA,CAAE,GAGDtC,EAAO,KAAK,YAAY,CAAC,MAAM,UAC/BA,EAAO,KAAK,YAAY,CAAC,IAAI,IAE7BA,EAAO,KAAK,YAAY,CAAC,MAAM,WAC/BA,EAAO,KAAK,YAAY,CAAC,IAAI,IAG1BA;AACX;"}
|
|
1
|
+
{"version":3,"file":"getCells.js","sources":["../../src/heatmap/getCells.ts"],"sourcesContent":["import { deviation, extent, mean } from 'd3-array';\nimport lodash from 'lodash';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\n\nfunction normalizeByStd(values:number[]) {\n const stdValue = deviation(values);\n const meanValue = mean(values);\n\n if (stdValue === undefined || meanValue === undefined || stdValue === 0) {\n return (v:number) => v;\n }\n return (v:number) => (v - meanValue) / stdValue;\n}\nfunction normalizeByMinMax(values:number[]) {\n const meanValue = mean(values);\n const [min, max] = extent(values);\n if (meanValue === undefined || min === undefined || max === undefined || max === min) {\n return (v:number) => v;\n }\n return (v:number) => (v - meanValue) / (max - min);\n}\n\nfunction getNormalizationFn(method:NormalizationMethod, values:number[]) {\n if (method === 'standardScaling') {\n return normalizeByStd(values);\n }\n if (method === 'meanNormalization') {\n return normalizeByMinMax(values);\n }\n return (v:number) => v;\n}\n\nexport type Cell = {\n isCell: true;\n idx: number;\n id: string;\n value: DataValue;\n normalizedValue: DataValue;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData = {\n meta: {\n facetKeys: string[];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // for titles, if facet by more 1 columns title has several values separated by commas\n facetKeyValues: Record<string, string[]>;\n xGroupKeyValues: Record<string, string[]>;\n yGroupKeyValues: Record<string, string[]>;\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n xGroupLabels: Record<string, string>;\n yGroupLabels: Record<string, string>;\n valueExtent: [number, number]; // for color scales\n // data for labels, annotations and dendrograms\n xDataByKeys: Record<string, Record<string, DataValue>>;\n yDataByKeys: Record<string, Record<string, DataValue>>;\n };\n //facet groups\n facets: Record<\n string,\n {\n // axis keys\n xKeys: string[];\n yKeys: string[];\n // axis keys grouped by group keys from meta\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n // cells grouped by X, then by Y\n cells: Record<string, Record<string, Cell>>;\n }\n >;\n};\n\n// all combinations with 1 key from each list\nfunction getKeysCombinations(keysLists: string[][]) {\n if (!keysLists.length) {\n return [];\n }\n let result: string[][] = [[]];\n keysLists.forEach(keys => {\n const nextResult: string[][] = [];\n keys.forEach(key => {\n nextResult.push(...result.map(resultItem => [...resultItem, key]));\n });\n result = nextResult;\n });\n return result;\n}\nconst sortByLabels = (arr: string[], direction: 'asc' | 'desc', labels: Record<string, string> = {}) => {\n return arr.sort((a, b) => direction === 'asc'\n ? (labels[a] ?? a).localeCompare((labels[b] ?? b), 'en', { numeric: true })\n : (labels[b] ?? b).localeCompare((labels[a] ?? a), 'en', { numeric: true })\n );\n};\n\nexport function getCells(\n data: DataFrame,\n xColumn: ColumnName,\n yColumn: ColumnName,\n valueColumn: ColumnName,\n facetBy: ColumnName[],\n xGroupBy: ColumnName[],\n yGroupBy: ColumnName[],\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n normalization: HeatmapSettingsImpl['normalization'],\n NAValueAs: HeatmapSettingsImpl['NAValueAs'],\n keysOrder: HeatmapSettingsImpl['keysOrder'],\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'],\n): GroupedCellsData {\n const facetKeysLists = facetBy.length\n ? facetBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const xGroupKeysLists = xGroupBy.length\n ? xGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const yGroupKeysLists = yGroupBy.length\n ? yGroupBy.map(column => keysOrder[column.value] ?? data.getColumnCategories(column.value))\n : [['null']];\n const facetKeysCombinations = getKeysCombinations(facetKeysLists);\n const xGroupKeysCombinations = getKeysCombinations(xGroupKeysLists);\n const yGroupKeysCombinations = getKeysCombinations(yGroupKeysLists);\n\n const facetKeys = facetKeysCombinations.map(keys => keys.join('_'));\n const xGroupKeys = xGroupKeysCombinations.map(keys => keys.join('_'));\n const yGroupKeys = yGroupKeysCombinations.map(keys => keys.join('_'));\n\n const result: GroupedCellsData = {\n meta: {\n facetKeys,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups: {},\n yKeysByGroups: {},\n xLabels: {},\n yLabels: {},\n xGroupLabels: {},\n yGroupLabels: {},\n xDataByKeys: {},\n yDataByKeys: {},\n facetKeyValues: facetKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = facetKeysCombinations[index];\n return res;\n }, {}),\n xGroupKeyValues: xGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = xGroupKeysCombinations[index];\n return res;\n }, {}),\n yGroupKeyValues: yGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = yGroupKeysCombinations[index];\n return res;\n }, {}),\n valueExtent: [Infinity, -Infinity],\n },\n facets: {},\n };\n\n const xLabelsSource = xColumn.valueLabels ?? xColumn.value;\n const yLabelsSource = yColumn.valueLabels ?? yColumn.value;\n const annotationColumnsX = annotations.filter(item => item.axis === 'x').map(item => item.valueColumn.value);\n const annotationColumnsY = annotations.filter(item => item.axis === 'y').map(item => item.valueColumn.value);\n const dendrogramXColumns = Object.values(dendrogramX ?? {}).map(column => column.value);\n const dendrogramYColumns = Object.values(dendrogramY ?? {}).map(column => column.value);\n const additionalDataColumnsX = lodash.uniq([...annotationColumnsX, ...dendrogramXColumns, xLabelsSource]);\n const additionalDataColumnsY = lodash.uniq([...annotationColumnsY, ...dendrogramYColumns, yLabelsSource]);\n\n for (let i = 0; i < data.rowsCount; i++) {\n const facetKey = facetBy.length ? facetBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupKey = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const yGroupKey = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.value, i)).join('_') : 'null';\n const xGroupLabel = xGroupBy.length ? xGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n const yGroupLabel = yGroupBy.length ? yGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ') : '';\n result.meta.xGroupLabels[xGroupKey] = xGroupLabel;\n result.meta.yGroupLabels[yGroupKey] = yGroupLabel;\n const x = String(data.getColumnValue(xColumn.value, i));\n const y = String(data.getColumnValue(yColumn.value, i));\n const value = (data.getColumnValue(valueColumn.value, i) ?? NAValueAs) as number | null;\n \n if (x === 'null' || y === 'null' || value === null) {\n continue;\n }\n\n if (!result.facets[facetKey]) {\n result.facets[facetKey] = {\n xKeys: [],\n yKeys: [],\n xKeysByGroups: {},\n yKeysByGroups: {},\n cells: {},\n };\n }\n if (!result.facets[facetKey].xKeysByGroups[xGroupKey]) {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = [];\n }\n if (!result.facets[facetKey].yKeysByGroups[yGroupKey]) {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = [];\n }\n result.facets[facetKey].xKeys.push(x);\n result.facets[facetKey].yKeys.push(y);\n result.facets[facetKey].xKeysByGroups[xGroupKey].push(x);\n result.facets[facetKey].yKeysByGroups[yGroupKey].push(y);\n\n if (!result.facets[facetKey].cells[x]) {\n result.facets[facetKey].cells[x] = {};\n }\n result.meta.valueExtent[0] = Math.min(value, result.meta.valueExtent[0]);\n result.meta.valueExtent[1] = Math.max(value, result.meta.valueExtent[1]);\n if (result.facets[facetKey].cells[x][y] && result.facets[facetKey].cells[x][y].value !== value) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n const xLabelsSourceValue = data.getColumnValue(xLabelsSource, i);\n if (result.meta.xLabels[x] && String(xLabelsSourceValue) !== result.meta.xLabels[x]) {\n throw Error(`More than 1 x-label value for x=${x}`);\n }\n const yLabelsSourceValue = data.getColumnValue(yLabelsSource, i);\n if (result.meta.yLabels[y] && String(yLabelsSourceValue) !== result.meta.yLabels[y]) {\n throw Error(`More than 1 y-label value for y=${y}`);\n }\n result.meta.xLabels[x] = String(xLabelsSourceValue);\n result.meta.yLabels[y] = String(yLabelsSourceValue);\n // data for labels, annotations and dendrograms by X\n additionalDataColumnsX.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.xDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.xDataByKeys[columnKey][x] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.xDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.xDataByKeys[columnKey][x] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for x = ${x} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.xDataByKeys[columnKey][x] = data.getColumnValue(columnKey, i);\n }\n });\n // data for labels, annotations and dendrograms by Y\n additionalDataColumnsY.forEach(columnKey => {\n const isAddedColumn = typeof result.meta.yDataByKeys[columnKey] !== 'undefined';\n const isAddedValue = isAddedColumn && typeof result.meta.yDataByKeys[columnKey][y] !== 'undefined';\n if (!isAddedColumn) {\n result.meta.yDataByKeys[columnKey] = {};\n }\n if (isAddedValue && result.meta.yDataByKeys[columnKey][y] !== data.getColumnValue(columnKey, i)) {\n throw Error(`More than 1 value for y = ${y} and column = ${columnKey}`);\n }\n if (!isAddedValue) {\n result.meta.yDataByKeys[columnKey][y] = data.getColumnValue(columnKey, i);\n }\n });\n result.facets[facetKey].cells[x][y] = {\n isCell: true,\n idx: i,\n id: `${x}_${y}`,\n x,\n y,\n value,\n normalizedValue: value,\n };\n }\n\n result.meta.facetKeys = result.meta.facetKeys.filter((key) => result.facets[key]); // filter only used;\n\n // make uniq x, y, x-group and y-group keys\n result.meta.facetKeys.forEach(facetKey => {\n const facet = result.facets[facetKey];\n const uniqueXKeys = lodash.uniq(facet.xKeys);\n const uniqueYKeys = lodash.uniq(facet.yKeys);\n facet.xKeys = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], uniqueXKeys) : uniqueXKeys;\n facet.yKeys = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], uniqueYKeys) : uniqueYKeys;\n xGroupKeys.forEach(xGroupKey => {\n result.facets[facetKey].xKeysByGroups[xGroupKey] = lodash.intersection(\n facet.xKeys,\n result.facets[facetKey].xKeysByGroups[xGroupKey]\n );\n });\n yGroupKeys.forEach(yGroupKey => {\n result.facets[facetKey].yKeysByGroups[yGroupKey] = lodash.intersection(\n facet.yKeys,\n result.facets[facetKey].yKeysByGroups[yGroupKey]\n );\n });\n });\n\n if (normalization) {\n const valueExtent = [Infinity, -Infinity] as [number, number];\n result.meta.facetKeys.forEach(facetKey => {\n const {xKeys, yKeys, cells} = result.facets[facetKey];\n const cellKeys = normalization.direction === 'row' ? xKeys : yKeys;\n const groupKeys = normalization.direction === 'row' ? yKeys : xKeys;\n const cellGetter = normalization.direction === 'row'\n ? (cellKey:string, groupKey:string) => cells[cellKey]?.[groupKey]\n : (cellKey:string, groupKey:string) => cells[groupKey]?.[cellKey];\n groupKeys.forEach((groupKey) => {\n const values:number[] = [];\n cellKeys.forEach((cellKey) => {\n const v = cellGetter(cellKey, groupKey)?.value;\n if (v !== undefined) {\n values.push(v as number);\n }\n });\n const normalize = getNormalizationFn(normalization.method, values);\n cellKeys.forEach((cellKey) => {\n const cell = cellGetter(cellKey, groupKey);\n if (cell !== undefined) {\n cell.normalizedValue = normalize(cell.value as number);\n valueExtent[0] = Math.min(cell.normalizedValue, valueExtent[0]);\n valueExtent[1] = Math.max(cell.normalizedValue, valueExtent[1]);\n }\n });\n });\n });\n result.meta.valueExtent = valueExtent;\n }\n\n // every facet may contain not all of available keys, but for shared axes it is necessary to have all of them\n result.meta.xKeysByGroups = xGroupKeys.reduce((res: Record<string, string[]>, xGroupKey) => {\n const existingXKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].xKeysByGroups[xGroupKey]))\n ), xAxis.sorting, result.meta.xLabels);\n res[xGroupKey] = keysOrder[xColumn.value] ? lodash.intersection(keysOrder[xColumn.value], existingXKeys) : existingXKeys;\n return res;\n }, {});\n result.meta.yKeysByGroups = yGroupKeys.reduce((res: Record<string, string[]>, yGroupKey) => {\n const existingYKeys = sortByLabels(lodash.uniq(\n lodash.flatten(result.meta.facetKeys.map(facetKey => result.facets[facetKey].yKeysByGroups[yGroupKey]))\n ), yAxis.sorting, result.meta.yLabels);\n res[yGroupKey] = keysOrder[yColumn.value] ? lodash.intersection(keysOrder[yColumn.value], existingYKeys) : existingYKeys;\n return res;\n }, {});\n\n // avoid render errors on empty data\n if (result.meta.valueExtent[0] === Infinity) {\n result.meta.valueExtent[0] = 0;\n }\n if (result.meta.valueExtent[1] === -Infinity) {\n result.meta.valueExtent[1] = 0;\n }\n\n return result;\n}\n"],"names":["normalizeByStd","values","stdValue","deviation","meanValue","mean","v","normalizeByMinMax","min","max","extent","getNormalizationFn","method","getKeysCombinations","keysLists","result","keys","nextResult","key","resultItem","sortByLabels","arr","direction","labels","a","b","getCells","data","xColumn","yColumn","valueColumn","facetBy","xGroupBy","yGroupBy","annotations","dendrogramX","dendrogramY","normalization","NAValueAs","keysOrder","xAxis","yAxis","facetKeysLists","column","xGroupKeysLists","yGroupKeysLists","facetKeysCombinations","xGroupKeysCombinations","yGroupKeysCombinations","facetKeys","xGroupKeys","yGroupKeys","res","index","xLabelsSource","yLabelsSource","annotationColumnsX","item","annotationColumnsY","dendrogramXColumns","dendrogramYColumns","additionalDataColumnsX","lodash","additionalDataColumnsY","i","facetKey","xGroupKey","yGroupKey","xGroupLabel","yGroupLabel","x","y","value","xLabelsSourceValue","yLabelsSourceValue","columnKey","isAddedColumn","isAddedValue","facet","uniqueXKeys","uniqueYKeys","valueExtent","xKeys","yKeys","cells","cellKeys","groupKeys","cellGetter","cellKey","groupKey","_a","normalize","cell","existingXKeys","existingYKeys"],"mappings":";;;;AAMA,SAASA,EAAeC,GAAiB;AACrC,QAAMC,IAAWC,EAAUF,CAAM,GAC3BG,IAAYC,EAAKJ,CAAM;AAE7B,SAAIC,MAAa,UAAaE,MAAc,UAAaF,MAAa,IAC3D,CAACI,MAAaA,IAElB,CAACA,OAAcA,IAAIF,KAAaF;AAC3C;AACA,SAASK,GAAkBN,GAAiB;AACxC,QAAMG,IAAYC,EAAKJ,CAAM,GACvB,CAACO,GAAKC,CAAG,IAAIC,EAAOT,CAAM;AAChC,SAAIG,MAAc,UAAaI,MAAQ,UAAaC,MAAQ,UAAaA,MAAQD,IACtE,CAACF,MAAaA,IAElB,CAACA,OAAcA,IAAIF,MAAcK,IAAMD;AAClD;AAEA,SAASG,GAAmBC,GAA4BX,GAAiB;AACrE,SAAIW,MAAW,oBACJZ,EAAeC,CAAM,IAE5BW,MAAW,sBACJL,GAAkBN,CAAM,IAE5B,CAACK,MAAaA;AACzB;AAiDA,SAASO,EAAoBC,GAAuB;AAChD,MAAI,CAACA,EAAU;AACX,WAAO,CAAA;AAEX,MAAIC,IAAqB,CAAC,EAAE;AAC5B,SAAAD,EAAU,QAAQ,CAAAE,MAAQ;AACtB,UAAMC,IAAyB,CAAA;AAC/B,IAAAD,EAAK,QAAQ,CAAAE,MAAO;AAChB,MAAAD,EAAW,KAAK,GAAGF,EAAO,IAAI,CAAAI,MAAc,CAAC,GAAGA,GAAYD,CAAG,CAAC,CAAC;AAAA,IACrE,CAAC,GACDH,IAASE;AAAA,EACb,CAAC,GACMF;AACX;AACA,MAAMK,IAAe,CAACC,GAAeC,GAA2BC,IAAiC,CAAA,MACtFF,EAAI;AAAA,EAAK,CAACG,GAAGC,MAAM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A6DpG,+BAA+B,CAAC,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS;IAUpE,WAAW;IA8CX,gBAAgB;IAIhB,YAAY;CAkDf"}
|
package/dist/heatmap/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { renderToString as
|
|
5
|
-
import { AbstractChart as
|
|
6
|
-
import { isColumnName as
|
|
7
|
-
import
|
|
8
|
-
import { getCells as
|
|
9
|
-
import { getDendrograms as
|
|
10
|
-
import { HeatmapSettingsImpl as
|
|
11
|
-
|
|
1
|
+
var M = Object.defineProperty;
|
|
2
|
+
var q = (g, d, a) => d in g ? M(g, d, { enumerable: !0, configurable: !0, writable: !0, value: a }) : g[d] = a;
|
|
3
|
+
var A = (g, d, a) => q(g, typeof d != "symbol" ? d + "" : d, a);
|
|
4
|
+
import { renderToString as z } from "../node_modules/react-dom/server.browser.js";
|
|
5
|
+
import { AbstractChart as L } from "../AbstractChart.js";
|
|
6
|
+
import { isColumnName as v } from "../utils/index.js";
|
|
7
|
+
import S from "./ChartRenderer.js";
|
|
8
|
+
import { getCells as K } from "./getCells.js";
|
|
9
|
+
import { getDendrograms as F } from "./getDendrograms.js";
|
|
10
|
+
import { HeatmapSettingsImpl as V } from "./HeatmapSettingsImpl.js";
|
|
11
|
+
import { MAX_SVG_RENDERED_CELLS_COUNT as J } from "./constants.js";
|
|
12
|
+
class na extends L {
|
|
12
13
|
constructor(a, e, t) {
|
|
13
14
|
super(a, e);
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
A(this, "settings");
|
|
16
|
+
A(this, "chartRenderer", new S());
|
|
17
|
+
A(this, "onTooltipHintSwitch", () => {
|
|
17
18
|
});
|
|
18
|
-
|
|
19
|
-
this.settings = new
|
|
19
|
+
A(this, "calculatedData", null);
|
|
20
|
+
this.settings = new V(e), t && (this.onTooltipHintSwitch = t[0]);
|
|
20
21
|
}
|
|
21
22
|
mount(a) {
|
|
22
23
|
try {
|
|
@@ -30,8 +31,8 @@ class ta extends F {
|
|
|
30
31
|
}
|
|
31
32
|
updateSettingsAndData(a, e) {
|
|
32
33
|
try {
|
|
33
|
-
const t = this.settings,
|
|
34
|
-
this.settings = new
|
|
34
|
+
const t = this.settings, o = this.data;
|
|
35
|
+
this.settings = new V(e), this.data = a, this._needUpdateCalculatedDataBySettings(t, this.settings) || this._needUpdateCalculatedDataByData(o, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
|
|
35
36
|
} catch (t) {
|
|
36
37
|
t instanceof Error && (this.chartRenderer.renderError(t.message), console.error(t));
|
|
37
38
|
}
|
|
@@ -40,40 +41,40 @@ class ta extends F {
|
|
|
40
41
|
console.warn("no chart state for heatmap");
|
|
41
42
|
}
|
|
42
43
|
export() {
|
|
43
|
-
return this._updateChart(),
|
|
44
|
+
return this._updateChart(), z(this.chartRenderer.component);
|
|
44
45
|
}
|
|
45
46
|
_needUpdateCalculatedDataBySettings(a, e) {
|
|
46
|
-
var
|
|
47
|
+
var y, i, R, Y, E, O, k, N, T, b, w, U;
|
|
47
48
|
const {
|
|
48
49
|
xColumn: t,
|
|
49
|
-
yColumn:
|
|
50
|
+
yColumn: o,
|
|
50
51
|
valueColumn: l,
|
|
51
52
|
xGroupBy: u,
|
|
52
|
-
yGroupBy:
|
|
53
|
-
facetBy:
|
|
54
|
-
annotations:
|
|
55
|
-
chartSettings:
|
|
56
|
-
facetSettings:
|
|
57
|
-
dendrogramX:
|
|
58
|
-
dendrogramY:
|
|
53
|
+
yGroupBy: c,
|
|
54
|
+
facetBy: D,
|
|
55
|
+
annotations: _,
|
|
56
|
+
chartSettings: C,
|
|
57
|
+
facetSettings: r,
|
|
58
|
+
dendrogramX: h,
|
|
59
|
+
dendrogramY: m,
|
|
59
60
|
normalization: n,
|
|
60
|
-
NAValueAs:
|
|
61
|
-
} = e, x = Object.values(((
|
|
62
|
-
|
|
63
|
-
),
|
|
64
|
-
|
|
65
|
-
),
|
|
66
|
-
function
|
|
67
|
-
return
|
|
61
|
+
NAValueAs: p
|
|
62
|
+
} = e, x = Object.values(((y = a.dendrogramX) == null ? void 0 : y.aes) || {}).filter(
|
|
63
|
+
v
|
|
64
|
+
), B = Object.values((h == null ? void 0 : h.aes) || {}).filter(v), G = Object.values(((i = a.dendrogramY) == null ? void 0 : i.aes) || {}).filter(
|
|
65
|
+
v
|
|
66
|
+
), X = Object.values((m == null ? void 0 : m.aes) || {}).filter(v);
|
|
67
|
+
function s(f, j) {
|
|
68
|
+
return f.length !== j.length || f.some((H, I) => H.value !== j[I].value);
|
|
68
69
|
}
|
|
69
|
-
return a.xColumn.value !== t.value || a.yColumn.value !==
|
|
70
|
-
a.annotations.map((
|
|
71
|
-
|
|
72
|
-
) ||
|
|
70
|
+
return a.xColumn.value !== t.value || a.yColumn.value !== o.value || a.valueColumn.value !== l.value || s(a.xGroupBy, u) || s(a.yGroupBy, c) || s(a.facetBy, D) || s(
|
|
71
|
+
a.annotations.map((f) => f.valueColumn),
|
|
72
|
+
_.map((f) => f.valueColumn)
|
|
73
|
+
) || s(x, B) || s(G, X) || (e.dendrogramX || a.dendrogramX) && (((R = a.dendrogramX) == null ? void 0 : R.distance) !== ((Y = e.dendrogramX) == null ? void 0 : Y.distance) || ((E = a.dendrogramX) == null ? void 0 : E.linkage) !== ((O = e.dendrogramX) == null ? void 0 : O.linkage)) || (e.dendrogramY || a.dendrogramY) && (((k = a.dendrogramY) == null ? void 0 : k.distance) !== ((N = e.dendrogramY) == null ? void 0 : N.distance) || ((T = a.dendrogramY) == null ? void 0 : T.linkage) !== ((b = e.dendrogramY) == null ? void 0 : b.linkage)) || a.chartSettings.valueType !== C.valueType || a.facetSettings.sharedX !== r.sharedX || a.facetSettings.sharedY !== r.sharedY || ((w = a.normalization) == null ? void 0 : w.method) !== (n == null ? void 0 : n.method) || ((U = a.normalization) == null ? void 0 : U.direction) !== (n == null ? void 0 : n.direction) || a.NAValueAs !== p;
|
|
73
74
|
}
|
|
74
75
|
_needUpdateCalculatedDataByData(a, e) {
|
|
75
|
-
const t = Object.keys(a.data),
|
|
76
|
-
return a.id !== e.id || t.length !==
|
|
76
|
+
const t = Object.keys(a.data), o = Object.keys(e.data);
|
|
77
|
+
return a.id !== e.id || t.length !== o.length || t.some((l) => {
|
|
77
78
|
var u;
|
|
78
79
|
return a.data[l].length !== ((u = e.data[l]) == null ? void 0 : u.length);
|
|
79
80
|
});
|
|
@@ -83,95 +84,96 @@ class ta extends F {
|
|
|
83
84
|
xColumn: a,
|
|
84
85
|
yColumn: e,
|
|
85
86
|
valueColumn: t,
|
|
86
|
-
xGroupBy:
|
|
87
|
+
xGroupBy: o,
|
|
87
88
|
yGroupBy: l,
|
|
88
89
|
facetBy: u,
|
|
89
|
-
chartSettings:
|
|
90
|
-
facetSettings:
|
|
91
|
-
annotations:
|
|
92
|
-
dendrogramX:
|
|
93
|
-
dendrogramY:
|
|
94
|
-
normalization:
|
|
95
|
-
NAValueAs:
|
|
90
|
+
chartSettings: c,
|
|
91
|
+
facetSettings: D,
|
|
92
|
+
annotations: _,
|
|
93
|
+
dendrogramX: C,
|
|
94
|
+
dendrogramY: r,
|
|
95
|
+
normalization: h,
|
|
96
|
+
NAValueAs: m,
|
|
96
97
|
keysOrder: n
|
|
97
|
-
} = this.settings,
|
|
98
|
+
} = this.settings, p = K(
|
|
98
99
|
this.data,
|
|
99
100
|
a,
|
|
100
101
|
e,
|
|
101
102
|
t,
|
|
102
103
|
u,
|
|
103
|
-
s,
|
|
104
|
-
l,
|
|
105
|
-
D,
|
|
106
|
-
g,
|
|
107
104
|
o,
|
|
108
|
-
|
|
105
|
+
l,
|
|
106
|
+
_,
|
|
107
|
+
C,
|
|
108
|
+
r,
|
|
109
109
|
h,
|
|
110
|
+
m,
|
|
110
111
|
n,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
), x =
|
|
112
|
+
c.xAxis,
|
|
113
|
+
c.yAxis
|
|
114
|
+
), x = F(p, C, r, D), B = c.valueType === "discrete" ? this.data.getColumnCategories(t.value) : [];
|
|
114
115
|
this.calculatedData = {
|
|
115
|
-
groupedCellsData:
|
|
116
|
+
groupedCellsData: p,
|
|
116
117
|
dendrogramsData: x,
|
|
117
|
-
cellUniqValues:
|
|
118
|
+
cellUniqValues: B
|
|
118
119
|
};
|
|
119
120
|
}
|
|
120
121
|
_updateAesInData() {
|
|
121
122
|
}
|
|
122
123
|
_updateChart() {
|
|
123
|
-
var
|
|
124
|
+
var X, s;
|
|
124
125
|
if (!this.calculatedData)
|
|
125
126
|
return;
|
|
126
127
|
const {
|
|
127
128
|
id: a,
|
|
128
129
|
valueColumn: e,
|
|
129
130
|
chartSettings: t,
|
|
130
|
-
facetSettings:
|
|
131
|
+
facetSettings: o,
|
|
131
132
|
aes: l,
|
|
132
133
|
annotations: u,
|
|
133
|
-
dendrogramX:
|
|
134
|
-
dendrogramY:
|
|
135
|
-
inheritedDendrogramAes:
|
|
136
|
-
normalization:
|
|
137
|
-
keysOrder:
|
|
138
|
-
xColumn:
|
|
139
|
-
yColumn:
|
|
134
|
+
dendrogramX: c,
|
|
135
|
+
dendrogramY: D,
|
|
136
|
+
inheritedDendrogramAes: _,
|
|
137
|
+
normalization: C,
|
|
138
|
+
keysOrder: r,
|
|
139
|
+
xColumn: h,
|
|
140
|
+
yColumn: m,
|
|
140
141
|
xGroupBy: n,
|
|
141
|
-
yGroupBy:
|
|
142
|
+
yGroupBy: p
|
|
142
143
|
} = this.settings, x = {
|
|
143
|
-
x: ((
|
|
144
|
-
y: ((
|
|
145
|
-
xGroup: n.some((
|
|
146
|
-
var
|
|
147
|
-
return ((
|
|
144
|
+
x: ((X = r[h.value]) == null ? void 0 : X.length) > 0,
|
|
145
|
+
y: ((s = r[m.value]) == null ? void 0 : s.length) > 0,
|
|
146
|
+
xGroup: n.some((y) => {
|
|
147
|
+
var i;
|
|
148
|
+
return ((i = r[y.value]) == null ? void 0 : i.length) > 0;
|
|
148
149
|
}),
|
|
149
|
-
yGroup:
|
|
150
|
-
var
|
|
151
|
-
return ((
|
|
150
|
+
yGroup: p.some((y) => {
|
|
151
|
+
var i;
|
|
152
|
+
return ((i = r[y.value]) == null ? void 0 : i.length) > 0;
|
|
152
153
|
})
|
|
153
|
-
};
|
|
154
|
+
}, B = this.data.columnNames.length ? this.data.getColumn(this.data.columnNames[0]).length : 0, G = this.settings.cellsRenderingMode ?? (B > J ? "canvas" : "svg");
|
|
154
155
|
this.chartRenderer.render(
|
|
155
156
|
this.data,
|
|
156
157
|
a,
|
|
157
158
|
t,
|
|
158
|
-
|
|
159
|
+
o,
|
|
159
160
|
l,
|
|
160
161
|
this.calculatedData.groupedCellsData,
|
|
161
162
|
u,
|
|
162
163
|
e,
|
|
163
|
-
|
|
164
|
-
f,
|
|
165
|
-
this.calculatedData.dendrogramsData,
|
|
164
|
+
c,
|
|
166
165
|
D,
|
|
166
|
+
this.calculatedData.dendrogramsData,
|
|
167
|
+
_,
|
|
167
168
|
this.calculatedData.cellUniqValues,
|
|
168
|
-
|
|
169
|
+
C,
|
|
169
170
|
this.onTooltipHintSwitch,
|
|
170
|
-
x
|
|
171
|
+
x,
|
|
172
|
+
G
|
|
171
173
|
);
|
|
172
174
|
}
|
|
173
175
|
}
|
|
174
176
|
export {
|
|
175
|
-
|
|
177
|
+
na as ChartHeatmap
|
|
176
178
|
};
|
|
177
179
|
//# sourceMappingURL=index.js.map
|