@milaboratories/graph-maker 1.1.162 → 1.1.163
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/GraphMaker/constantsCommon.d.ts +6 -0
- package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
- package/dist/GraphMaker/constantsCommon.js +25 -19
- package/dist/GraphMaker/constantsCommon.js.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/Heatmap.vue.d.ts.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/Heatmap.vue.js +122 -91
- package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/Heatmap.vue.js.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.d.ts.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js +105 -77
- package/dist/GraphMaker/forms/LayersForm/Layer/heatmap/HeatmapClustered.vue.js.map +1 -1
- package/dist/GraphMaker/index.vue.d.ts.map +1 -1
- package/dist/GraphMaker/index.vue.js +50 -46
- package/dist/GraphMaker/index.vue.js.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts +5 -0
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js +28 -24
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeHeatmapSettings.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/MiPlots.js +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js +3 -3
- package/dist/node_modules/@milaboratories/miplots4/dist/common/Legend.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js +25 -25
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js +13 -8
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/HeatmapSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/index.js +58 -58
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Chart.js +4 -4
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js +204 -110
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/getCells.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js +81 -78
- package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/index.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/react/index.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/node_modules/react-dom/index.js +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js +14 -9
- package/dist/node_modules/@milaboratories/miplots4/dist/types/heatmap.js.map +1 -1
- package/package.json +2 -2
package/dist/node_modules/@milaboratories/miplots4/dist/heatmap/components/Annotations/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n cellsRenderingMode: 'canvas' | 'svg';\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","cellsRenderingMode","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/components/Annotations/index.tsx"],"sourcesContent":["import type {TooltipsData} from '../../../common/Tooltip';\nimport {Annotation} from './Annotation';\nimport type {\n AnnotationColorScales,\n AnnotationTooltipData,\n ChartDimensionsData,\n ChartScales,\n} from '../types';\nimport {ANNOTATION_WIDTH, ANNOTATIONS_OFFSET} from '../../constants';\nimport type {Cell} from '../../getCells';\nimport type {GroupedCellsData} from '../../getCells';\nimport type {HeatmapSettingsImpl} from '../../HeatmapSettingsImpl';\nimport React from 'react';\n\nfunction showTitle(item: HeatmapSettingsImpl['annotations'][0], chartEdgeSides: ChartDimensionsData['chartEdgeSides']) {\n return item.showTitle && chartEdgeSides.includes(item.titlePosition);\n}\n\ninterface AnnotationProps {\n facetKey: string;\n sideElementBBoxes: ChartDimensionsData['sideElementBBoxes'];\n annotations: HeatmapSettingsImpl['annotations'];\n cellsMeta: GroupedCellsData['meta'];\n annotationColorScales: AnnotationColorScales;\n sharedX: boolean;\n sharedY: boolean;\n chartEdgeSides: ChartDimensionsData['chartEdgeSides'];\n width: number;\n height: number;\n scales: ChartScales;\n stepX: number;\n stepY: number;\n aes: HeatmapSettingsImpl['aes'];\n frame: HeatmapSettingsImpl['chartSettings']['frame'];\n xGroupKeys: string[];\n yGroupKeys: string[];\n xKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['xKeysByGroups'];\n yKeysByGroups: GroupedCellsData['facets'][keyof GroupedCellsData['facets']]['yKeysByGroups'];\n tooltipsData: TooltipsData<Cell|AnnotationTooltipData>;\n cellsRenderingMode: 'canvas' | 'svg';\n}\n\nexport function Annotations({\n facetKey,\n sideElementBBoxes,\n annotations,\n annotationColorScales,\n cellsMeta,\n chartEdgeSides,\n sharedX,\n sharedY,\n width,\n height,\n scales,\n stepX,\n stepY,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n}: AnnotationProps) {\n const usedAnnotations = annotations.filter(item => {\n return (\n chartEdgeSides.includes(item.position) ||\n (!sharedX && ['left', 'right'].includes(item.position)) ||\n (!sharedY && ['top', 'bottom'].includes(item.position))\n );\n });\n const leftAnnotations = usedAnnotations.filter(item => item.position === 'left');\n const rightAnnotations = usedAnnotations.filter(item => item.position === 'right');\n const topAnnotations = usedAnnotations.filter(item => item.position === 'top');\n const bottomAnnotations = usedAnnotations.filter(item => item.position === 'bottom');\n const {xDataByKeys, yDataByKeys} = cellsMeta;\n\n const commonProps = {\n facetKey,\n scales,\n stepX,\n stepY,\n width,\n height,\n aes,\n frame,\n xGroupKeys,\n yGroupKeys,\n xKeysByGroups,\n yKeysByGroups,\n tooltipsData,\n cellsRenderingMode,\n };\n return (\n <g>\n {leftAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.left.annotations.x + idx * ANNOTATION_WIDTH}\n y={sideElementBBoxes.left.annotations.y}\n {...commonProps}\n />\n );\n })}\n {rightAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={yDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.right.annotations.x + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n y={sideElementBBoxes.right.annotations.y}\n {...commonProps}\n />\n );\n })}\n {topAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.top.annotations.x}\n y={sideElementBBoxes.top.annotations.y + idx * ANNOTATION_WIDTH}\n {...commonProps}\n />\n );\n })}\n {bottomAnnotations.map((item, idx) => {\n return (\n <Annotation\n key={item.id}\n annotation={item}\n colorScale={annotationColorScales[item.id]}\n data={xDataByKeys[item.valueColumn.valueLabels ?? item.valueColumn.value]}\n showTitle={showTitle(item, chartEdgeSides)}\n x={sideElementBBoxes.bottom.annotations.x}\n y={sideElementBBoxes.bottom.annotations.y + idx * ANNOTATION_WIDTH + ANNOTATIONS_OFFSET}\n {...commonProps}\n />\n );\n })}\n </g>\n );\n}\n"],"names":["showTitle","item","chartEdgeSides","Annotations","facetKey","sideElementBBoxes","annotations","annotationColorScales","cellsMeta","sharedX","sharedY","width","height","scales","stepX","stepY","aes","frame","xGroupKeys","yGroupKeys","xKeysByGroups","yKeysByGroups","tooltipsData","cellsRenderingMode","usedAnnotations","leftAnnotations","rightAnnotations","topAnnotations","bottomAnnotations","xDataByKeys","yDataByKeys","commonProps","l","idx","jsx","Annotation","ANNOTATION_WIDTH","ANNOTATIONS_OFFSET"],"mappings":";;;AAcA,SAASA,EAAUC,GAA6CC,GAAuD;AACnH,SAAOD,EAAK,aAAaC,EAAe,SAASD,EAAK,aAAa;AACvE;AA0BO,SAASE,EAAY;AAAA,EACxB,UAAAC;AAAAA,EACA,mBAAAC;AAAAA,EACA,aAAAC;AAAAA,EACA,uBAAAC;AAAAA,EACA,WAAAC;AAAAA,EACA,gBAAAN;AAAAA,EACA,SAAAO;AAAAA,EACA,SAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,QAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,KAAAC;AAAAA,EACA,OAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,YAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,eAAAC;AAAAA,EACA,cAAAC;AAAAA,EACA,oBAAAC;AACJ,GAA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AAA,QACxC,GAAGA,EAAkB,OAAO,YAAY,IAAI4B,IAAMG,IAAmBC;AAAAA,QACpE,GAAGN;AAAAA,MAAA;AAAA,MAPC9B,EAAK;AAAA,IAAA,CAUrB;AAAA,EAAA,GACL;AAER;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as t } from "../../node_modules/react/jsx-runtime.js";
|
|
2
2
|
import { Tooltip as E } from "../../common/Tooltip.js";
|
|
3
|
-
import { useDataFrame as
|
|
3
|
+
import { useDataFrame as J } from "../../common/useDataFrame.js";
|
|
4
4
|
import { FONT_SIZE as N, FACET_TITLE_OFFSET as P } from "../constants.js";
|
|
5
5
|
import { Annotations as Q } from "./Annotations/index.js";
|
|
6
6
|
import { Captions as U } from "./Captions/index.js";
|
|
@@ -37,7 +37,7 @@ function fe({
|
|
|
37
37
|
tooltipsData: e,
|
|
38
38
|
cellsRenderingMode: D
|
|
39
39
|
}) {
|
|
40
|
-
const R =
|
|
40
|
+
const R = J(), { xAxis: V, yAxis: W, tooltips: T } = p, { width: G, height: B } = l.inner, { padding: i, chartEdgeSides: _, sideElementBBoxes: n } = l, { xGroupLabels: H, yGroupLabels: I, xLabels: O, yLabels: q } = a, h = s.x.domain(), S = s.y.domain(), b = {
|
|
41
41
|
left: x.left + l.left + i.left,
|
|
42
42
|
right: d.totalWidth - (x.left + l.left + i.left),
|
|
43
43
|
top: x.top + l.top + i.top,
|
|
@@ -160,8 +160,8 @@ function fe({
|
|
|
160
160
|
xGroupLabels: H,
|
|
161
161
|
yGroupLabels: I,
|
|
162
162
|
labelAngles: M,
|
|
163
|
-
xLabels:
|
|
164
|
-
yLabels:
|
|
163
|
+
xLabels: O,
|
|
164
|
+
yLabels: q
|
|
165
165
|
}
|
|
166
166
|
)
|
|
167
167
|
] }),
|
|
@@ -1,38 +1,68 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import h from "../node_modules/lodash/lodash.js";
|
|
2
|
+
import { exhaustive as ee } from "../utils/index.js";
|
|
3
|
+
import N from "../node_modules/d3-array/src/mean.js";
|
|
4
|
+
import { quantileSorted as ae } from "../node_modules/d3-array/src/quantile.js";
|
|
5
|
+
import te from "../node_modules/d3-array/src/deviation.js";
|
|
6
|
+
import ue from "../node_modules/d3-array/src/extent.js";
|
|
7
|
+
function oe(a) {
|
|
8
|
+
const u = te(a), o = N(a);
|
|
9
|
+
return u === void 0 || o === void 0 || u === 0 ? (n) => n : (n) => (n - o) / u;
|
|
8
10
|
}
|
|
9
|
-
function
|
|
10
|
-
const
|
|
11
|
-
return
|
|
11
|
+
function le(a) {
|
|
12
|
+
const u = N(a), [o, n] = ue(a);
|
|
13
|
+
return u === void 0 || o === void 0 || n === void 0 || n === o ? (y) => y : (y) => (y - u) / (n - o);
|
|
12
14
|
}
|
|
13
|
-
function
|
|
14
|
-
return
|
|
15
|
+
function se(a, u) {
|
|
16
|
+
return a === "standardScaling" ? oe(u) : a === "meanNormalization" ? le(u) : (o) => o;
|
|
15
17
|
}
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
+
function k(a, u) {
|
|
19
|
+
switch (a) {
|
|
20
|
+
case "max": {
|
|
21
|
+
let o = u[0];
|
|
22
|
+
for (const n of u)
|
|
23
|
+
o = Math.max(o, n);
|
|
24
|
+
return o;
|
|
25
|
+
}
|
|
26
|
+
case "min": {
|
|
27
|
+
let o = u[0];
|
|
28
|
+
for (const n of u)
|
|
29
|
+
o = Math.min(o, n);
|
|
30
|
+
return o;
|
|
31
|
+
}
|
|
32
|
+
case "median": {
|
|
33
|
+
const o = u.sort((n, y) => n - y);
|
|
34
|
+
return ae(o, 0.5);
|
|
35
|
+
}
|
|
36
|
+
case "mean":
|
|
37
|
+
return N(u) ?? u[0];
|
|
38
|
+
default:
|
|
39
|
+
ee(a, `Unknown aggregation function ${a}`);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function Q(a) {
|
|
43
|
+
const u = [...new Set(a)].sort();
|
|
44
|
+
return u.length > 3 ? [...u.slice(0, 3), "..."].join(", ") : u.join(", ");
|
|
45
|
+
}
|
|
46
|
+
function I(a) {
|
|
47
|
+
if (!a.length)
|
|
18
48
|
return [];
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}),
|
|
25
|
-
}),
|
|
49
|
+
let u = [[]];
|
|
50
|
+
return a.forEach((o) => {
|
|
51
|
+
const n = [];
|
|
52
|
+
o.forEach((y) => {
|
|
53
|
+
n.push(...u.map((v) => [...v, y]));
|
|
54
|
+
}), u = n;
|
|
55
|
+
}), u;
|
|
26
56
|
}
|
|
27
|
-
const
|
|
28
|
-
(
|
|
57
|
+
const R = (a, u, o = {}) => a.sort(
|
|
58
|
+
(n, y) => u === "asc" ? (o[n] ?? n).localeCompare(o[y] ?? y, "en", { numeric: !0 }) : (o[y] ?? y).localeCompare(o[n] ?? n, "en", { numeric: !0 })
|
|
29
59
|
);
|
|
30
|
-
function
|
|
31
|
-
|
|
60
|
+
function ne() {
|
|
61
|
+
return {
|
|
32
62
|
meta: {
|
|
33
|
-
facetKeys:
|
|
34
|
-
xGroupKeys:
|
|
35
|
-
yGroupKeys:
|
|
63
|
+
facetKeys: [],
|
|
64
|
+
xGroupKeys: [],
|
|
65
|
+
yGroupKeys: [],
|
|
36
66
|
xKeysByGroups: {},
|
|
37
67
|
yKeysByGroups: {},
|
|
38
68
|
xLabels: {},
|
|
@@ -41,104 +71,168 @@ function se(l, o, s, m, c, B, E, j, O, k, d, F, K, H, J) {
|
|
|
41
71
|
yGroupLabels: {},
|
|
42
72
|
xDataByKeys: {},
|
|
43
73
|
yDataByKeys: {},
|
|
44
|
-
facetKeyValues:
|
|
45
|
-
xGroupKeyValues:
|
|
46
|
-
yGroupKeyValues:
|
|
74
|
+
facetKeyValues: {},
|
|
75
|
+
xGroupKeyValues: {},
|
|
76
|
+
yGroupKeyValues: {},
|
|
47
77
|
valueExtent: [1 / 0, -1 / 0]
|
|
48
78
|
},
|
|
49
79
|
facets: {}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function re(a, u, o, n, y) {
|
|
83
|
+
if (u.x || u.y) {
|
|
84
|
+
const v = [1 / 0, -1 / 0];
|
|
85
|
+
a.meta.facetKeys.forEach((m) => {
|
|
86
|
+
const { xKeys: L, yKeys: M, cells: V, xKeysByGroups: g, yKeysByGroups: G } = a.facets[m], c = u.x ? g : L.reduce((e, r) => (e[r] = [r], e), {}), b = u.y ? G : M.reduce((e, r) => (e[r] = [r], e), {}), d = Object.keys(c), D = Object.keys(b);
|
|
87
|
+
for (const e of d)
|
|
88
|
+
for (const r of D) {
|
|
89
|
+
const B = [];
|
|
90
|
+
if (c[e].forEach((K) => {
|
|
91
|
+
b[r].forEach((C) => {
|
|
92
|
+
var p, S, _;
|
|
93
|
+
const j = (S = (p = V[K]) == null ? void 0 : p[C]) == null ? void 0 : S.value;
|
|
94
|
+
j !== void 0 && (B.push(j), (_ = V[K]) == null || delete _[C]);
|
|
95
|
+
});
|
|
96
|
+
}), B.length > 0) {
|
|
97
|
+
const K = k(u.method, B);
|
|
98
|
+
a.facets[m].cells[e] || (a.facets[m].cells[e] = {}), a.facets[m].cells[e][r] = {
|
|
99
|
+
isCell: !0,
|
|
100
|
+
idx: 0,
|
|
101
|
+
id: `${e}_${r}`,
|
|
102
|
+
x: e,
|
|
103
|
+
y: r,
|
|
104
|
+
value: K,
|
|
105
|
+
normalizedValue: K
|
|
106
|
+
}, v[0] = Math.min(K, v[0]), v[1] = Math.max(K, v[1]);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
u.x && d.forEach((e) => {
|
|
110
|
+
o.forEach((r) => {
|
|
111
|
+
const B = y.find((p) => p.valueColumn.value === r || p.valueColumn.valueLabels === r);
|
|
112
|
+
if (!B)
|
|
113
|
+
return;
|
|
114
|
+
const K = [];
|
|
115
|
+
c[e].forEach((p) => {
|
|
116
|
+
K.push(a.meta.xDataByKeys[r][p]), delete a.meta.xDataByKeys[r][p];
|
|
117
|
+
});
|
|
118
|
+
const C = B.type === "continuous" ? k(u.method, K) : Q(K);
|
|
119
|
+
a.meta.xDataByKeys[r][e] = C;
|
|
120
|
+
});
|
|
121
|
+
}), u.y && (n.forEach((e) => {
|
|
122
|
+
a.meta.yDataByKeys[e] = {};
|
|
123
|
+
}), D.forEach((e) => {
|
|
124
|
+
n.forEach((r) => {
|
|
125
|
+
const B = y.find((p) => p.valueColumn.value === r || p.valueColumn.valueLabels === r);
|
|
126
|
+
if (!B)
|
|
127
|
+
return;
|
|
128
|
+
const K = [];
|
|
129
|
+
b[e].forEach((p) => {
|
|
130
|
+
K.push(a.meta.yDataByKeys[r][p]), delete a.meta.yDataByKeys[r][p];
|
|
131
|
+
});
|
|
132
|
+
const C = B.type === "continuous" ? k(u.method, K) : Q(K);
|
|
133
|
+
a.meta.yDataByKeys[r][e] = C;
|
|
134
|
+
});
|
|
135
|
+
})), u.x && (a.facets[m].xKeys = Object.keys(g), a.facets[m].xKeysByGroups = { null: a.facets[m].xKeys }, a.meta.xLabels = a.meta.xGroupLabels, a.meta.xGroupKeys = ["null"], a.meta.xGroupKeyValues = { null: ["null"] }), u.y && (a.facets[m].yKeys = Object.keys(G), a.facets[m].yKeysByGroups = { null: a.facets[m].yKeys }, a.meta.yLabels = a.meta.yGroupLabels, a.meta.yGroupKeys = ["null"], a.meta.yGroupKeyValues = { null: ["null"] });
|
|
136
|
+
}), a.meta.valueExtent = v;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function ye(a, u) {
|
|
140
|
+
if (u) {
|
|
141
|
+
const o = [1 / 0, -1 / 0];
|
|
142
|
+
a.meta.facetKeys.forEach((n) => {
|
|
143
|
+
const { xKeys: y, yKeys: v, cells: m } = a.facets[n], L = u.direction === "row" ? y : v, M = u.direction === "row" ? v : y, V = u.direction === "row" ? (g, G) => {
|
|
144
|
+
var c;
|
|
145
|
+
return (c = m[g]) == null ? void 0 : c[G];
|
|
146
|
+
} : (g, G) => {
|
|
147
|
+
var c;
|
|
148
|
+
return (c = m[G]) == null ? void 0 : c[g];
|
|
149
|
+
};
|
|
150
|
+
M.forEach((g) => {
|
|
151
|
+
const G = [];
|
|
152
|
+
L.forEach((b) => {
|
|
153
|
+
var d;
|
|
154
|
+
const D = (d = V(b, g)) == null ? void 0 : d.value;
|
|
155
|
+
D !== void 0 && G.push(D);
|
|
156
|
+
});
|
|
157
|
+
const c = se(u.method, G);
|
|
158
|
+
L.forEach((b) => {
|
|
159
|
+
const d = V(b, g);
|
|
160
|
+
d !== void 0 && (d.normalizedValue = c(d.value), o[0] = Math.min(d.normalizedValue, o[0]), o[1] = Math.max(d.normalizedValue, o[1]));
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
}), a.meta.valueExtent = o;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function pe(a, u, o, n, y, v, m, L, M, V, g, G, c, b, d, D) {
|
|
167
|
+
const e = ne(), r = y.length ? y.map((t) => c[t.value] ?? a.getColumnCategories(t.value)) : [["null"]], B = v.length ? v.map((t) => c[t.value] ?? a.getColumnCategories(t.value)) : [["null"]], K = m.length ? m.map((t) => c[t.value] ?? a.getColumnCategories(t.value)) : [["null"]], C = I(r), p = I(B), S = I(K), _ = C.map((t) => t.join("_")), j = p.map((t) => t.join("_")), O = S.map((t) => t.join("_"));
|
|
168
|
+
e.meta.facetKeys = _, e.meta.xGroupKeys = j, e.meta.yGroupKeys = O, e.meta.facetKeyValues = _.reduce((t, l, f) => (t[l] = C[f], t), {}), e.meta.xGroupKeyValues = j.reduce((t, l, f) => (t[l] = p[f], t), {}), e.meta.yGroupKeyValues = O.reduce((t, l, f) => (t[l] = S[f], t), {});
|
|
169
|
+
const U = u.valueLabels ?? u.value, A = o.valueLabels ?? o.value, T = L.filter((t) => t.axis === "x").map((t) => t.valueColumn.valueLabels ?? t.valueColumn.value), W = L.filter((t) => t.axis === "y").map((t) => t.valueColumn.valueLabels ?? t.valueColumn.value), Y = Object.values(M ?? {}).map((t) => t.value), Z = Object.values(V ?? {}).map((t) => t.value), F = h.uniq([...T, ...Y, U]), H = h.uniq([...W, ...Z, A]);
|
|
170
|
+
for (let t = 0; t < a.rowsCount; t++) {
|
|
171
|
+
const l = y.length ? y.map((s) => a.getColumnValue(s.value, t)).join("_") : "null", f = v.length ? v.map((s) => a.getColumnValue(s.value, t)).join("_") : "null", E = m.length ? m.map((s) => a.getColumnValue(s.value, t)).join("_") : "null", $ = v.length ? v.map((s) => a.getColumnValue(s.valueLabels ?? s.value, t)).join(", ") : "", X = m.length ? m.map((s) => a.getColumnValue(s.valueLabels ?? s.value, t)).join(", ") : "";
|
|
172
|
+
e.meta.xGroupLabels[f] = $, e.meta.yGroupLabels[E] = X;
|
|
173
|
+
const i = String(a.getColumnValue(u.value, t)), x = String(a.getColumnValue(o.value, t)), w = a.getColumnValue(n.value, t) ?? G;
|
|
174
|
+
if (i === "null" || x === "null" || w === null)
|
|
56
175
|
continue;
|
|
57
|
-
if (
|
|
176
|
+
if (e.facets[l] || (e.facets[l] = {
|
|
58
177
|
xKeys: [],
|
|
59
178
|
yKeys: [],
|
|
60
179
|
xKeysByGroups: {},
|
|
61
180
|
yKeysByGroups: {},
|
|
62
181
|
cells: {}
|
|
63
|
-
}),
|
|
64
|
-
throw Error(`More than 1 value for x=${
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
67
|
-
throw Error(`More than 1 x-label value for x=${
|
|
68
|
-
const
|
|
69
|
-
if (
|
|
70
|
-
throw Error(`More than 1 y-label value for y=${
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
throw Error(`More than 1 value for x = ${
|
|
75
|
-
|
|
76
|
-
}),
|
|
77
|
-
const
|
|
78
|
-
if (
|
|
79
|
-
throw Error(`More than 1 value for y = ${
|
|
80
|
-
|
|
81
|
-
}),
|
|
182
|
+
}), e.facets[l].xKeysByGroups[f] || (e.facets[l].xKeysByGroups[f] = []), e.facets[l].yKeysByGroups[E] || (e.facets[l].yKeysByGroups[E] = []), e.facets[l].xKeys.push(i), e.facets[l].yKeys.push(x), e.facets[l].xKeysByGroups[f].push(i), e.facets[l].yKeysByGroups[E].push(x), e.facets[l].cells[i] || (e.facets[l].cells[i] = {}), e.meta.valueExtent[0] = Math.min(w, e.meta.valueExtent[0]), e.meta.valueExtent[1] = Math.max(w, e.meta.valueExtent[1]), e.facets[l].cells[i][x] && e.facets[l].cells[i][x].value !== w)
|
|
183
|
+
throw Error(`More than 1 value for x=${i}, y=${x}`);
|
|
184
|
+
const J = a.getColumnValue(U, t);
|
|
185
|
+
if (e.meta.xLabels[i] && String(J) !== e.meta.xLabels[i])
|
|
186
|
+
throw Error(`More than 1 x-label value for x=${i}`);
|
|
187
|
+
const P = a.getColumnValue(A, t);
|
|
188
|
+
if (e.meta.yLabels[x] && String(P) !== e.meta.yLabels[x])
|
|
189
|
+
throw Error(`More than 1 y-label value for y=${x}`);
|
|
190
|
+
e.meta.xLabels[i] = String(J), e.meta.yLabels[x] = String(P), F.forEach((s) => {
|
|
191
|
+
const q = typeof e.meta.xDataByKeys[s] < "u", z = q && typeof e.meta.xDataByKeys[s][i] < "u";
|
|
192
|
+
if (q || (e.meta.xDataByKeys[s] = {}), z && e.meta.xDataByKeys[s][i] !== a.getColumnValue(s, t))
|
|
193
|
+
throw Error(`More than 1 value for x = ${i} and column = ${s}`);
|
|
194
|
+
z || (e.meta.xDataByKeys[s][i] = a.getColumnValue(s, t));
|
|
195
|
+
}), H.forEach((s) => {
|
|
196
|
+
const q = typeof e.meta.yDataByKeys[s] < "u", z = q && typeof e.meta.yDataByKeys[s][x] < "u";
|
|
197
|
+
if (q || (e.meta.yDataByKeys[s] = {}), z && e.meta.yDataByKeys[s][x] !== a.getColumnValue(s, t))
|
|
198
|
+
throw Error(`More than 1 value for y = ${x} and column = ${s}`);
|
|
199
|
+
z || (e.meta.yDataByKeys[s][x] = a.getColumnValue(s, t));
|
|
200
|
+
}), e.facets[l].cells[i][x] = {
|
|
82
201
|
isCell: !0,
|
|
83
|
-
idx:
|
|
84
|
-
id: `${
|
|
85
|
-
x:
|
|
86
|
-
y,
|
|
87
|
-
value:
|
|
88
|
-
normalizedValue:
|
|
202
|
+
idx: t,
|
|
203
|
+
id: `${i}_${x}`,
|
|
204
|
+
x: i,
|
|
205
|
+
y: x,
|
|
206
|
+
value: w,
|
|
207
|
+
normalizedValue: w
|
|
89
208
|
};
|
|
90
209
|
}
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
210
|
+
return e.meta.facetKeys = e.meta.facetKeys.filter((t) => e.facets[t]), e.meta.facetKeys.forEach((t) => {
|
|
211
|
+
const l = e.facets[t], f = h.uniq(l.xKeys), E = h.uniq(l.yKeys);
|
|
212
|
+
l.xKeys = c[u.value] ? h.intersection(c[u.value], f) : f, l.yKeys = c[o.value] ? h.intersection(c[o.value], E) : E, j.forEach(($) => {
|
|
213
|
+
e.facets[t].xKeysByGroups[$] = h.intersection(
|
|
214
|
+
l.xKeys,
|
|
215
|
+
e.facets[t].xKeysByGroups[$]
|
|
97
216
|
);
|
|
98
|
-
}),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
217
|
+
}), O.forEach(($) => {
|
|
218
|
+
e.facets[t].yKeysByGroups[$] = h.intersection(
|
|
219
|
+
l.yKeys,
|
|
220
|
+
e.facets[t].yKeysByGroups[$]
|
|
102
221
|
);
|
|
103
222
|
});
|
|
104
|
-
}),
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const x = [];
|
|
116
|
-
L.forEach((u) => {
|
|
117
|
-
var f;
|
|
118
|
-
const G = (f = y(u, p)) == null ? void 0 : f.value;
|
|
119
|
-
G !== void 0 && x.push(G);
|
|
120
|
-
});
|
|
121
|
-
const h = ae(d.method, x);
|
|
122
|
-
L.forEach((u) => {
|
|
123
|
-
const f = y(u, p);
|
|
124
|
-
f !== void 0 && (f.normalizedValue = h(f.value), e[0] = Math.min(f.normalizedValue, e[0]), e[1] = Math.max(f.normalizedValue, e[1]));
|
|
125
|
-
});
|
|
126
|
-
});
|
|
127
|
-
}), a.meta.valueExtent = e;
|
|
128
|
-
}
|
|
129
|
-
return a.meta.xKeysByGroups = V.reduce((e, t) => {
|
|
130
|
-
const r = q(v.uniq(
|
|
131
|
-
v.flatten(a.meta.facetKeys.map((i) => a.facets[i].xKeysByGroups[t]))
|
|
132
|
-
), H.sorting, a.meta.xLabels);
|
|
133
|
-
return e[t] = K[o.value] ? v.intersection(K[o.value], r) : r, e;
|
|
134
|
-
}, {}), a.meta.yKeysByGroups = C.reduce((e, t) => {
|
|
135
|
-
const r = q(v.uniq(
|
|
136
|
-
v.flatten(a.meta.facetKeys.map((i) => a.facets[i].yKeysByGroups[t]))
|
|
137
|
-
), J.sorting, a.meta.yLabels);
|
|
138
|
-
return e[t] = K[s.value] ? v.intersection(K[s.value], r) : r, e;
|
|
139
|
-
}, {}), a.meta.valueExtent[0] === 1 / 0 && (a.meta.valueExtent[0] = 0), a.meta.valueExtent[1] === -1 / 0 && (a.meta.valueExtent[1] = 0), a;
|
|
223
|
+
}), re(e, D, F, H, L), ye(e, g), e.meta.xKeysByGroups = e.meta.xGroupKeys.reduce((t, l) => {
|
|
224
|
+
const f = R(h.uniq(
|
|
225
|
+
h.flatten(e.meta.facetKeys.map((E) => e.facets[E].xKeysByGroups[l]))
|
|
226
|
+
), b.sorting, e.meta.xLabels);
|
|
227
|
+
return t[l] = c[u.value] ? h.intersection(c[u.value], f) : f, t;
|
|
228
|
+
}, {}), e.meta.yKeysByGroups = e.meta.yGroupKeys.reduce((t, l) => {
|
|
229
|
+
const f = R(h.uniq(
|
|
230
|
+
h.flatten(e.meta.facetKeys.map((E) => e.facets[E].yKeysByGroups[l]))
|
|
231
|
+
), d.sorting, e.meta.yLabels);
|
|
232
|
+
return t[l] = c[o.value] ? h.intersection(c[o.value], f) : f, t;
|
|
233
|
+
}, {}), e.meta.valueExtent[0] === 1 / 0 && (e.meta.valueExtent[0] = 0), e.meta.valueExtent[1] === -1 / 0 && (e.meta.valueExtent[1] = 0), e;
|
|
140
234
|
}
|
|
141
235
|
export {
|
|
142
|
-
|
|
236
|
+
pe as getCells
|
|
143
237
|
};
|
|
144
238
|
//# sourceMappingURL=getCells.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCells.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/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","s","x","y","value","xLabelsSourceValue","yLabelsSourceValue","columnKey","isAddedColumn","isAddedValue","r","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,CA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ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"getCells.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/getCells.ts"],"sourcesContent":["import { deviation, extent, mean, quantileSorted } from 'd3-array';\nimport lodash from 'lodash';\nimport type { DataFrame } from '../DataFrame';\nimport type { AggregationMethod, ColumnName, DataValue, NormalizationMethod } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { exhaustive } from '../utils';\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\nfunction aggregateNumeric(method: AggregationMethod, values: number[]) {\n switch (method) {\n case 'max': {\n let res = values[0];\n for (const v of values) {\n res = Math.max(res, v);\n }\n return res;\n }\n case 'min': {\n let res = values[0];\n for (const v of values) {\n res = Math.min(res, v);\n }\n return res;\n }\n case 'median': {\n const valuesSorted = values.sort((a, b) => a - b);\n return quantileSorted(valuesSorted, 0.5) as number;\n }\n case 'mean': {\n return mean(values) ?? values[0];\n }\n default: exhaustive(method, `Unknown aggregation function ${method}`);\n }\n}\nfunction aggregateString(values: string[]) {\n const list = [...new Set(values)].sort();\n if (list.length > 3) {\n return [...list.slice(0, 3), '...'].join(', ');\n }\n return list.join(', ');\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\nfunction createEmptyGroupedCells(): GroupedCellsData {\n return {\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: {},\n xGroupKeyValues: {},\n yGroupKeyValues: {},\n valueExtent: [Infinity, -Infinity],\n },\n facets: {},\n };\n}\n\nfunction applyAggregation(\n result: GroupedCellsData,\n aggregation: HeatmapSettingsImpl['aggregation'],\n additionalDataColumnsX: string[],\n additionalDataColumnsY: string[],\n annotations: HeatmapSettingsImpl['annotations']\n) {\n if (aggregation.x || aggregation.y) {\n const valueExtent = [Infinity, -Infinity] as [number, number];\n result.meta.facetKeys.forEach(facetKey => {\n const { xKeys, yKeys, cells, xKeysByGroups, yKeysByGroups } = result.facets[facetKey];\n const xGroups = aggregation.x ? xKeysByGroups : xKeys.reduce((res, xKey) => { res[xKey] = [xKey]; return res; }, {} as Record<string, string[]>);\n const yGroups = aggregation.y ? yKeysByGroups : yKeys.reduce((res, yKey) => { res[yKey] = [yKey]; return res; }, {} as Record<string, string[]>);\n const xNewKeys = Object.keys(xGroups);\n const yNewKeys = Object.keys(yGroups);\n for (const xGroupKey of xNewKeys) {\n for (const yGroupKey of yNewKeys) {\n const values: number[] = [];\n xGroups[xGroupKey].forEach((xKey) => {\n yGroups[yGroupKey].forEach((yKey) => {\n const cellValue = cells[xKey]?.[yKey]?.value;\n if (cellValue !== undefined) {\n values.push(cellValue as number);\n delete cells[xKey]?.[yKey];\n }\n });\n });\n if (values.length > 0) {\n const value = aggregateNumeric(aggregation.method, values);\n if (!result.facets[facetKey].cells[xGroupKey]) {\n result.facets[facetKey].cells[xGroupKey] = {};\n }\n result.facets[facetKey].cells[xGroupKey][yGroupKey] = {\n isCell: true,\n idx: 0,\n id: `${xGroupKey}_${yGroupKey}`,\n x: xGroupKey,\n y: yGroupKey,\n value,\n normalizedValue: value,\n };\n valueExtent[0] = Math.min(value, valueExtent[0]);\n valueExtent[1] = Math.max(value, valueExtent[1]);\n }\n }\n }\n if (aggregation.x) {\n xNewKeys.forEach(xGroupKey => {\n additionalDataColumnsX.forEach(columnKey => {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n return;\n }\n const values: DataValue[] = [];\n xGroups[xGroupKey].forEach((xKey) => {\n values.push(result.meta.xDataByKeys[columnKey][xKey]);\n delete result.meta.xDataByKeys[columnKey][xKey];\n });\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.xDataByKeys[columnKey][xGroupKey] = value;\n });\n });\n }\n if (aggregation.y) {\n additionalDataColumnsY.forEach(columnKey => {\n result.meta.yDataByKeys[columnKey] = {};\n });\n yNewKeys.forEach(yGroupKey => {\n additionalDataColumnsY.forEach(columnKey => {\n const annotation = annotations.find((v) => v.valueColumn.value === columnKey || v.valueColumn.valueLabels === columnKey);\n if (!annotation) {\n return;\n }\n const values: DataValue[] = [];\n yGroups[yGroupKey].forEach((yKey) => {\n values.push(result.meta.yDataByKeys[columnKey][yKey]);\n delete result.meta.yDataByKeys[columnKey][yKey];\n });\n const value = annotation.type === 'continuous' ? aggregateNumeric(aggregation.method, values as number[]) : aggregateString(values as string[]);\n result.meta.yDataByKeys[columnKey][yGroupKey] = value;\n });\n });\n }\n if (aggregation.x) {\n result.facets[facetKey].xKeys = Object.keys(xKeysByGroups);\n result.facets[facetKey].xKeysByGroups = { 'null': result.facets[facetKey].xKeys };\n result.meta.xLabels = result.meta.xGroupLabels;\n result.meta.xGroupKeys = ['null'];\n result.meta.xGroupKeyValues = { null: ['null'] };\n }\n if (aggregation.y) {\n result.facets[facetKey].yKeys = Object.keys(yKeysByGroups);\n result.facets[facetKey].yKeysByGroups = { 'null': result.facets[facetKey].yKeys };\n result.meta.yLabels = result.meta.yGroupLabels;\n result.meta.yGroupKeys = ['null'];\n result.meta.yGroupKeyValues = { null: ['null'] };\n }\n });\n result.meta.valueExtent = valueExtent;\n }\n}\nfunction applyNormalization(result: GroupedCellsData, normalization: HeatmapSettingsImpl['normalization']) {\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\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 aggregation: HeatmapSettingsImpl['aggregation'],\n): GroupedCellsData {\n const result: GroupedCellsData = createEmptyGroupedCells();\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 result.meta.facetKeys = facetKeys;\n result.meta.xGroupKeys = xGroupKeys;\n result.meta.yGroupKeys = yGroupKeys;\n result.meta.facetKeyValues = facetKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = facetKeysCombinations[index];\n return res;\n }, {});\n result.meta.xGroupKeyValues = xGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = xGroupKeysCombinations[index];\n return res;\n }, {});\n result.meta.yGroupKeyValues = yGroupKeys.reduce((res: Record<string, string[]>, key, index) => {\n res[key] = yGroupKeysCombinations[index];\n return res;\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.valueLabels ?? item.valueColumn.value);\n const annotationColumnsY = annotations.filter(item => item.axis === 'y').map(item => item.valueColumn.valueLabels ?? 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 applyAggregation(result, aggregation, additionalDataColumnsX, additionalDataColumnsY, annotations);\n applyNormalization(result, normalization);\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 = result.meta.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 = result.meta.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","aggregateNumeric","res","valuesSorted","a","b","quantileSorted","exhaustive","aggregateString","list","getKeysCombinations","keysLists","result","keys","nextResult","key","resultItem","sortByLabels","arr","direction","labels","createEmptyGroupedCells","applyAggregation","aggregation","additionalDataColumnsX","additionalDataColumnsY","annotations","valueExtent","facetKey","xKeys","yKeys","cells","xKeysByGroups","yKeysByGroups","xGroups","xKey","yGroups","yKey","xNewKeys","yNewKeys","xGroupKey","yGroupKey","cellValue","_b","_a","_c","value","columnKey","annotation","applyNormalization","normalization","cellKeys","groupKeys","cellGetter","cellKey","groupKey","normalize","cell","getCells","data","xColumn","yColumn","valueColumn","facetBy","xGroupBy","yGroupBy","dendrogramX","dendrogramY","NAValueAs","keysOrder","xAxis","yAxis","facetKeysLists","column","xGroupKeysLists","yGroupKeysLists","facetKeysCombinations","xGroupKeysCombinations","yGroupKeysCombinations","facetKeys","xGroupKeys","yGroupKeys","index","xLabelsSource","yLabelsSource","annotationColumnsX","item","annotationColumnsY","dendrogramXColumns","dendrogramYColumns","lodash","i","xGroupLabel","yGroupLabel","l","x","y","xLabelsSourceValue","yLabelsSourceValue","isAddedColumn","isAddedValue","facet","uniqueXKeys","uniqueYKeys","existingXKeys","existingYKeys"],"mappings":";;;;;;AAOA,SAASA,GAAeC,GAAkB;AACtC,QAAMC,IAAWC,GAAUF,CAAM,GAC3BG,IAAYC,EAAKJ,CAAM;AAE7B,SAAIC,MAAa,UAAaE,MAAc,UAAaF,MAAa,IAC3D,CAACI,MAAcA,IAEnB,CAACA,OAAeA,IAAIF,KAAaF;AAC5C;AACA,SAASK,GAAkBN,GAAkB;AACzC,QAAMG,IAAYC,EAAKJ,CAAM,GACvB,CAACO,GAAKC,CAAG,IAAIC,GAAOT,CAAM;AAChC,SAAIG,MAAc,UAAaI,MAAQ,UAAaC,MAAQ,UAAa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