@milaboratories/graph-maker 1.1.162 → 1.1.164
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 +7 -0
- package/dist/GraphMaker/constantsCommon.d.ts.map +1 -1
- package/dist/GraphMaker/constantsCommon.js +26 -19
- package/dist/GraphMaker/constantsCommon.js.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/Line.vue.d.ts.map +1 -1
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/Line.vue.js +63 -52
- package/dist/GraphMaker/forms/LayersForm/Layer/discrete/Line.vue.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/composeDiscreteSettings.d.ts +1 -0
- package/dist/GraphMaker/utils/createChartSettingsForRender/composeDiscreteSettings.d.ts.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/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.d.ts.map +1 -1
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.js +11 -10
- package/dist/GraphMaker/utils/createChartSettingsForRender/getLayersDataFromForms.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/discrete/DiscreteSettingsImpl.js +24 -24
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/index.js +13 -13
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.js +31 -40
- package/dist/node_modules/@milaboratories/miplots4/dist/discrete/layers/lines.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/discrete.js +11 -10
- package/dist/node_modules/@milaboratories/miplots4/dist/types/discrete.js.map +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
|
@@ -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,CAAA;AAC/BD,IAAAA,EAAK,QAAQ,CAAAE,MAAO;AAChBD,MAAAA,EAAW,KAAK,GAAGF,EAAO,IAAI,CAAAI,MAAc,C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AAAA,MACL,CAAC;AAAA,IACL,CAAC,GACDpE,EAAO,KAAK,cAAcoE;AAAAA,EAC9B;AAGA,SAAApE,EAAO,KAAK,gBAAgBmC,EAAW,OAAO,CAACE,GAA+Bc,MAAc;AACxF,UAAM6B,IAAgB3E,EAAa0C,EAAO;AAAA,MACtCA,EAAO,QAAQ/C,EAAO,KAAK,UAAU,IAAI,CAAAkD,MAAYlD,EAAO,OAAOkD,CAAQ,EAAE,cAAcC,CAAS,CAAC,CAAC;AAAA,IAAA,GACvG1B,EAAM,SAASzB,EAAO,KAAK,OAAO;AACrC,WAAAqC,EAAIc,CAAS,IAAI3B,EAAUX,EAAQ,KAAK,IAAIkC,EAAO,aAAavB,EAAUX,EAAQ,KAAK,GAAGmE,CAAa,IAAIA,GACpG3C;AAAAA,EACX,GAAG,CAAA,CAAE,GACLrC,EAAO,KAAK,gBAAgBoC,EAAW,OAAO,CAACC,GAA+Be,MAAc;AACxF,UAAM6B,IAAgB5E,EAAa0C,EAAO;AAAA,MACtCA,EAAO,QAAQ/C,EAAO,KAAK,UAAU,IAAI,CAAAkD,MAAYlD,EAAO,OAAOkD,CAAQ,EAAE,cAAcE,CAAS,CAAC,CAAC;AAAA,IAAA,GACvG1B,EAAM,SAAS1B,EAAO,KAAK,OAAO;AACrC,WAAAqC,EAAIe,CAAS,IAAI5B,EAAUV,EAAQ,KAAK,IAAIiC,EAAO,aAAavB,EAAUV,EAAQ,KAAK,GAAGmE,CAAa,IAAIA,GACpG5C;AAAAA,EACX,GAAG,CAAA,CAAE,GAGDrC,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;","x_google_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,UAAaA,MAAQD,IACtE,CAACF,MAAcA,IAEnB,CAACA,OAAeA,IAAIF,MAAcK,IAAMD;AACnD;AAEA,SAASG,GAAmBC,GAA6BX,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,EAAE,cAAca,CAAS,CAAC,CAAC;AAAA,IAAA,GACvG8B,EAAM,SAAS3D,EAAO,KAAK,OAAO;AACrC,WAAAV,EAAIuC,CAAS,IAAI4B,EAAUR,EAAQ,KAAK,IAAI6B,EAAO,aAAarB,EAAUR,EAAQ,KAAK,GAAG4C,CAAa,IAAIA,GACpGvG;AAAAA,EACX,GAAG,CAAA,CAAE,GAGDU,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;","x_google_ignoreList":[0]}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { renderToString as
|
|
2
|
-
import { AbstractChart as
|
|
3
|
-
import { isColumnName as
|
|
4
|
-
import
|
|
5
|
-
import { getCells as
|
|
1
|
+
import { renderToString as F } from "../node_modules/react-dom/server.browser.js";
|
|
2
|
+
import { AbstractChart as L } from "../AbstractChart.js";
|
|
3
|
+
import { isColumnName as A } from "../utils/index.js";
|
|
4
|
+
import $ from "./ChartRenderer.js";
|
|
5
|
+
import { getCells as K } from "./getCells.js";
|
|
6
6
|
import { getDendrograms as M } from "./getDendrograms.js";
|
|
7
|
-
import { HeatmapSettingsImpl as
|
|
8
|
-
import { MAX_SVG_RENDERED_CELLS_COUNT as
|
|
9
|
-
var
|
|
10
|
-
class
|
|
7
|
+
import { HeatmapSettingsImpl as k } from "./HeatmapSettingsImpl.js";
|
|
8
|
+
import { MAX_SVG_RENDERED_CELLS_COUNT as P } from "./constants.js";
|
|
9
|
+
var W = Object.defineProperty, J = (g, t, e) => t in g ? W(g, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : g[t] = e, X = (g, t, e) => J(g, typeof t != "symbol" ? t + "" : t, e);
|
|
10
|
+
class lt extends L {
|
|
11
11
|
constructor(t, e, a) {
|
|
12
|
-
super(t, e),
|
|
13
|
-
}),
|
|
12
|
+
super(t, e), X(this, "settings"), X(this, "chartRenderer", new $()), X(this, "onTooltipHintSwitch", () => {
|
|
13
|
+
}), X(this, "calculatedData", null), this.settings = new k(e), a && (this.onTooltipHintSwitch = a[0]);
|
|
14
14
|
}
|
|
15
15
|
mount(t) {
|
|
16
16
|
try {
|
|
@@ -25,7 +25,7 @@ class at extends H {
|
|
|
25
25
|
updateSettingsAndData(t, e) {
|
|
26
26
|
try {
|
|
27
27
|
const a = this.settings, r = this.data;
|
|
28
|
-
this.settings = new
|
|
28
|
+
this.settings = new k(e), this.data = t, this._needUpdateCalculatedDataBySettings(a, this.settings) || this._needUpdateCalculatedDataByData(r, this.data) ? this._updateData() : this._updateAesInData(), this._updateChart();
|
|
29
29
|
} catch (a) {
|
|
30
30
|
a instanceof Error && (this.chartRenderer.renderError(a.message), console.error(a));
|
|
31
31
|
}
|
|
@@ -34,36 +34,37 @@ class at extends H {
|
|
|
34
34
|
console.warn("no chart state for heatmap");
|
|
35
35
|
}
|
|
36
36
|
export() {
|
|
37
|
-
return this._updateChart(),
|
|
37
|
+
return this._updateChart(), F(this.chartRenderer.component);
|
|
38
38
|
}
|
|
39
39
|
_needUpdateCalculatedDataBySettings(t, e) {
|
|
40
|
-
var a, r, n, o,
|
|
40
|
+
var a, r, n, o, i, m, c, d, s, v, l, p, y, u, C;
|
|
41
41
|
const {
|
|
42
|
-
xColumn:
|
|
43
|
-
yColumn:
|
|
44
|
-
valueColumn:
|
|
45
|
-
xGroupBy:
|
|
46
|
-
yGroupBy:
|
|
47
|
-
facetBy:
|
|
48
|
-
annotations:
|
|
49
|
-
chartSettings:
|
|
50
|
-
facetSettings:
|
|
51
|
-
dendrogramX:
|
|
52
|
-
dendrogramY:
|
|
53
|
-
normalization:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
42
|
+
xColumn: S,
|
|
43
|
+
yColumn: b,
|
|
44
|
+
valueColumn: G,
|
|
45
|
+
xGroupBy: _,
|
|
46
|
+
yGroupBy: h,
|
|
47
|
+
facetBy: w,
|
|
48
|
+
annotations: N,
|
|
49
|
+
chartSettings: T,
|
|
50
|
+
facetSettings: Y,
|
|
51
|
+
dendrogramX: E,
|
|
52
|
+
dendrogramY: O,
|
|
53
|
+
normalization: B,
|
|
54
|
+
aggregation: D,
|
|
55
|
+
NAValueAs: j
|
|
56
|
+
} = e, U = Object.values(((a = t.dendrogramX) == null ? void 0 : a.aes) || {}).filter(
|
|
57
|
+
A
|
|
58
|
+
), V = Object.values((E == null ? void 0 : E.aes) || {}).filter(A), H = Object.values(((r = t.dendrogramY) == null ? void 0 : r.aes) || {}).filter(
|
|
59
|
+
A
|
|
60
|
+
), z = Object.values((O == null ? void 0 : O.aes) || {}).filter(A);
|
|
61
|
+
function f(x, R) {
|
|
62
|
+
return x.length !== R.length || x.some((I, q) => I.value !== R[q].value);
|
|
62
63
|
}
|
|
63
|
-
return t.xColumn.value !==
|
|
64
|
-
t.annotations.map((
|
|
65
|
-
|
|
66
|
-
) ||
|
|
64
|
+
return t.xColumn.value !== S.value || t.yColumn.value !== b.value || t.valueColumn.value !== G.value || f(t.xGroupBy, _) || f(t.yGroupBy, h) || f(t.facetBy, w) || f(
|
|
65
|
+
t.annotations.map((x) => x.valueColumn),
|
|
66
|
+
N.map((x) => x.valueColumn)
|
|
67
|
+
) || f(U, V) || f(H, z) || (e.dendrogramX || t.dendrogramX) && (((n = t.dendrogramX) == null ? void 0 : n.distance) !== ((o = e.dendrogramX) == null ? void 0 : o.distance) || ((i = t.dendrogramX) == null ? void 0 : i.linkage) !== ((m = e.dendrogramX) == null ? void 0 : m.linkage)) || (e.dendrogramY || t.dendrogramY) && (((c = t.dendrogramY) == null ? void 0 : c.distance) !== ((d = e.dendrogramY) == null ? void 0 : d.distance) || ((s = t.dendrogramY) == null ? void 0 : s.linkage) !== ((v = e.dendrogramY) == null ? void 0 : v.linkage)) || t.chartSettings.valueType !== T.valueType || t.facetSettings.sharedX !== Y.sharedX || t.facetSettings.sharedY !== Y.sharedY || ((l = t.normalization) == null ? void 0 : l.method) !== (B == null ? void 0 : B.method) || ((p = t.normalization) == null ? void 0 : p.direction) !== (B == null ? void 0 : B.direction) || t.NAValueAs !== j || ((y = t.aggregation) == null ? void 0 : y.method) !== (D == null ? void 0 : D.method) || ((u = t.aggregation) == null ? void 0 : u.x) !== (D == null ? void 0 : D.x) || ((C = t.aggregation) == null ? void 0 : C.y) !== (D == null ? void 0 : D.y);
|
|
67
68
|
}
|
|
68
69
|
_needUpdateCalculatedDataByData(t, e) {
|
|
69
70
|
const a = Object.keys(t.data), r = Object.keys(e.data);
|
|
@@ -80,15 +81,16 @@ class at extends H {
|
|
|
80
81
|
xGroupBy: r,
|
|
81
82
|
yGroupBy: n,
|
|
82
83
|
facetBy: o,
|
|
83
|
-
chartSettings:
|
|
84
|
+
chartSettings: i,
|
|
84
85
|
facetSettings: m,
|
|
85
86
|
annotations: c,
|
|
86
|
-
dendrogramX:
|
|
87
|
-
dendrogramY:
|
|
88
|
-
normalization:
|
|
87
|
+
dendrogramX: d,
|
|
88
|
+
dendrogramY: s,
|
|
89
|
+
normalization: v,
|
|
89
90
|
NAValueAs: l,
|
|
90
|
-
keysOrder:
|
|
91
|
-
|
|
91
|
+
keysOrder: p,
|
|
92
|
+
aggregation: y
|
|
93
|
+
} = this.settings, u = K(
|
|
92
94
|
this.data,
|
|
93
95
|
t,
|
|
94
96
|
e,
|
|
@@ -97,18 +99,19 @@ class at extends H {
|
|
|
97
99
|
r,
|
|
98
100
|
n,
|
|
99
101
|
c,
|
|
100
|
-
i,
|
|
101
102
|
d,
|
|
102
|
-
|
|
103
|
-
l,
|
|
103
|
+
s,
|
|
104
104
|
v,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
105
|
+
l,
|
|
106
|
+
p,
|
|
107
|
+
i.xAxis,
|
|
108
|
+
i.yAxis,
|
|
109
|
+
y
|
|
110
|
+
), C = M(u, d, s, m), S = i.valueType === "discrete" ? this.data.getColumnCategories(a.value) : [];
|
|
108
111
|
this.calculatedData = {
|
|
109
|
-
groupedCellsData:
|
|
110
|
-
dendrogramsData:
|
|
111
|
-
cellUniqValues:
|
|
112
|
+
groupedCellsData: u,
|
|
113
|
+
dendrogramsData: C,
|
|
114
|
+
cellUniqValues: S
|
|
112
115
|
};
|
|
113
116
|
}
|
|
114
117
|
_updateAesInData() {
|
|
@@ -122,51 +125,51 @@ class at extends H {
|
|
|
122
125
|
valueColumn: r,
|
|
123
126
|
chartSettings: n,
|
|
124
127
|
facetSettings: o,
|
|
125
|
-
aes:
|
|
128
|
+
aes: i,
|
|
126
129
|
annotations: m,
|
|
127
130
|
dendrogramX: c,
|
|
128
|
-
dendrogramY:
|
|
129
|
-
inheritedDendrogramAes:
|
|
130
|
-
normalization:
|
|
131
|
+
dendrogramY: d,
|
|
132
|
+
inheritedDendrogramAes: s,
|
|
133
|
+
normalization: v,
|
|
131
134
|
keysOrder: l,
|
|
132
|
-
xColumn:
|
|
133
|
-
yColumn:
|
|
134
|
-
xGroupBy:
|
|
135
|
-
yGroupBy:
|
|
136
|
-
} = this.settings,
|
|
137
|
-
x: ((t = l[
|
|
138
|
-
y: ((e = l[
|
|
139
|
-
xGroup:
|
|
140
|
-
var
|
|
141
|
-
return ((
|
|
135
|
+
xColumn: p,
|
|
136
|
+
yColumn: y,
|
|
137
|
+
xGroupBy: u,
|
|
138
|
+
yGroupBy: C
|
|
139
|
+
} = this.settings, S = {
|
|
140
|
+
x: ((t = l[p.value]) == null ? void 0 : t.length) > 0,
|
|
141
|
+
y: ((e = l[y.value]) == null ? void 0 : e.length) > 0,
|
|
142
|
+
xGroup: u.some((_) => {
|
|
143
|
+
var h;
|
|
144
|
+
return ((h = l[_.value]) == null ? void 0 : h.length) > 0;
|
|
142
145
|
}),
|
|
143
|
-
yGroup:
|
|
144
|
-
var
|
|
145
|
-
return ((
|
|
146
|
+
yGroup: C.some((_) => {
|
|
147
|
+
var h;
|
|
148
|
+
return ((h = l[_.value]) == null ? void 0 : h.length) > 0;
|
|
146
149
|
})
|
|
147
|
-
},
|
|
150
|
+
}, b = this.data.columnNames.length ? this.data.getColumn(this.data.columnNames[0]).length : 0, G = this.settings.cellsRenderingMode ?? (b > P ? "canvas" : "svg");
|
|
148
151
|
this.chartRenderer.render(
|
|
149
152
|
this.data,
|
|
150
153
|
a,
|
|
151
154
|
n,
|
|
152
155
|
o,
|
|
153
|
-
|
|
156
|
+
i,
|
|
154
157
|
this.calculatedData.groupedCellsData,
|
|
155
158
|
m,
|
|
156
159
|
r,
|
|
157
160
|
c,
|
|
158
|
-
i,
|
|
159
|
-
this.calculatedData.dendrogramsData,
|
|
160
161
|
d,
|
|
162
|
+
this.calculatedData.dendrogramsData,
|
|
163
|
+
s,
|
|
161
164
|
this.calculatedData.cellUniqValues,
|
|
162
|
-
|
|
165
|
+
v,
|
|
163
166
|
this.onTooltipHintSwitch,
|
|
164
|
-
|
|
165
|
-
|
|
167
|
+
S,
|
|
168
|
+
G
|
|
166
169
|
);
|
|
167
170
|
}
|
|
168
171
|
}
|
|
169
172
|
export {
|
|
170
|
-
|
|
173
|
+
lt as ChartHeatmap
|
|
171
174
|
};
|
|
172
175
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/index.ts"],"sourcesContent":["import { renderToString } from 'react-dom/server';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, HeatmapEventHandlers, HeatmapSettings } from '../types';\nimport { isColumnName } from '../utils';\nimport ChartRenderer from './ChartRenderer';\nimport type { GroupedCellsData } from './getCells';\nimport { getCells } from './getCells';\nimport type { DendrogramsData } from './getDendrograms';\nimport { getDendrograms } from './getDendrograms';\nimport { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { MAX_SVG_RENDERED_CELLS_COUNT } from './constants';\n\nexport class ChartHeatmap extends AbstractChart {\n settings: HeatmapSettingsImpl;\n chartRenderer = new ChartRenderer();\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n groupedCellsData: GroupedCellsData;\n dendrogramsData: DendrogramsData;\n cellUniqValues: DataValue[];\n } | null = null;\n\n constructor(data: DataFrame, settings: HeatmapSettings, eventHandlers?:HeatmapEventHandlers) {\n super(data, settings);\n\n this.settings = new HeatmapSettingsImpl(settings);\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: HeatmapSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new HeatmapSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for heatmap');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: HeatmapSettingsImpl, settings: HeatmapSettingsImpl) {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n annotations,\n chartSettings,\n facetSettings,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n } = settings;\n\n const prevDendrogramXColumns: ColumnName[] = Object.values(prevSettings.dendrogramX?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramXColumns: ColumnName[] = Object.values(dendrogramX?.aes || {}).filter(isColumnName);\n const prevDendrogramYColumns: ColumnName[] = Object.values(prevSettings.dendrogramY?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramYColumns: ColumnName[] = Object.values(dendrogramY?.aes || {}).filter(isColumnName);\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.xColumn.value !== xColumn.value ||\n prevSettings.yColumn.value !== yColumn.value ||\n prevSettings.valueColumn.value !== valueColumn.value ||\n compareColumnGroups(prevSettings.xGroupBy, xGroupBy) ||\n compareColumnGroups(prevSettings.yGroupBy, yGroupBy) ||\n compareColumnGroups(prevSettings.facetBy, facetBy) ||\n compareColumnGroups(\n prevSettings.annotations.map(a => a.valueColumn),\n annotations.map(a => a.valueColumn)\n ) ||\n compareColumnGroups(prevDendrogramXColumns, currentDendrogramXColumns) ||\n compareColumnGroups(prevDendrogramYColumns, currentDendrogramYColumns) ||\n ((settings.dendrogramX || prevSettings.dendrogramX) &&\n (prevSettings.dendrogramX?.distance !== settings.dendrogramX?.distance ||\n prevSettings.dendrogramX?.linkage !== settings.dendrogramX?.linkage)) ||\n ((settings.dendrogramY || prevSettings.dendrogramY) &&\n (prevSettings.dendrogramY?.distance !== settings.dendrogramY?.distance ||\n prevSettings.dendrogramY?.linkage !== settings.dendrogramY?.linkage)) ||\n prevSettings.chartSettings.valueType !== chartSettings.valueType ||\n prevSettings.facetSettings.sharedX !== facetSettings.sharedX ||\n prevSettings.facetSettings.sharedY !== facetSettings.sharedY ||\n prevSettings.normalization?.method !== normalization?.method ||\n prevSettings.normalization?.direction !== normalization?.direction ||\n prevSettings.NAValueAs !== NAValueAs\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n chartSettings,\n facetSettings,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder\n } = this.settings;\n\n const groupedCellsData = getCells(\n this.data,\n xColumn,\n yColumn,\n valueColumn,\n facetBy,\n xGroupBy,\n yGroupBy,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder,\n chartSettings.xAxis,\n chartSettings.yAxis,\n );\n const dendrogramsData = getDendrograms(groupedCellsData, dendrogramX, dendrogramY, facetSettings);\n const cellUniqValues =\n chartSettings.valueType === 'discrete' ? this.data.getColumnCategories(valueColumn.value) : [];\n\n this.calculatedData = {\n groupedCellsData,\n dendrogramsData,\n cellUniqValues,\n };\n }\n\n _updateAesInData() {\n return;\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n id,\n valueColumn,\n chartSettings,\n facetSettings,\n aes,\n annotations,\n dendrogramX,\n dendrogramY,\n inheritedDendrogramAes,\n normalization,\n keysOrder,\n xColumn,\n yColumn,\n xGroupBy,\n yGroupBy,\n } = this.settings;\n const customOrder = {\n x: keysOrder[xColumn.value]?.length > 0,\n y: keysOrder[yColumn.value]?.length > 0,\n xGroup: xGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n yGroup: yGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n };\n const dataSize = this.data.columnNames.length ? this.data.getColumn(this.data.columnNames[0]).length : 0;\n const cellsRenderingMode = this.settings.cellsRenderingMode ?? (dataSize > MAX_SVG_RENDERED_CELLS_COUNT ? 'canvas' : 'svg');\n \n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n facetSettings,\n aes,\n this.calculatedData.groupedCellsData,\n annotations,\n valueColumn,\n dendrogramX,\n dendrogramY,\n this.calculatedData.dendrogramsData,\n inheritedDendrogramAes,\n this.calculatedData.cellUniqValues,\n normalization,\n this.onTooltipHintSwitch,\n customOrder,\n cellsRenderingMode\n );\n }\n}\n"],"names":["ChartHeatmap","AbstractChart","data","settings","eventHandlers","__publicField","ChartRenderer","HeatmapSettingsImpl","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","xColumn","yColumn","valueColumn","xGroupBy","yGroupBy","facetBy","annotations","chartSettings","facetSettings","dendrogramX","dendrogramY","normalization","NAValueAs","prevDendrogramXColumns","_a","isColumnName","currentDendrogramXColumns","prevDendrogramYColumns","_b","currentDendrogramYColumns","compareColumnGroups","columns1","columns2","column","idx","a","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","prevData","prevKeys","keys","l","key","keysOrder","groupedCellsData","getCells","dendrogramsData","getDendrograms","cellUniqValues","id","aes","inheritedDendrogramAes","customOrder","v","dataSize","cellsRenderingMode","MAX_SVG_RENDERED_CELLS_COUNT"],"mappings":";;;;;;;;;AAaO,MAAMA,WAAqBC,EAAc;AAAA,EAW5C,YAAYC,GAAiBC,GAA2BC,GAAqC;AACzF,UAAMF,GAAMC,CAAQ,GAXxBE,EAAA,MAAA,UAAA,GACAA,EAAA,MAAA,iBAAgB,IAAIC,EAAAA,CAAA,GAEpBD,EAAA,6BAA2C,MAAA;AAAA,IAAA,CAAA,GAC3CA,EAAA,MAAA,kBAIW,IAAA,GAKP,KAAK,WAAW,IAAIE,EAAoBJ,CAAQ,GAC5CC,MACA,KAAK,sBAAsBA,EAAc,CAAC;AAAA,EAElD;AAAA,EAEA,MAAMI,GAAmB;AACrB,QAAI;AACA,WAAK,cAAc,KAAKA,CAAI,GAC5B,KAAK,eACL,KAAK,aAAA,GACL,KAAK,WAAW;AAAA,IACpB,SAASC,GAAK;AACV,WAAK,WAAW,IACZA,aAAe,UACf,KAAK,cAAc,YAAYA,EAAI,OAAiB,GACpD,QAAQ,MAAMA,CAA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BAAuBD,IAAWE,IAA+B,WAAW;AAErH,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACLP;AAAAA,MACAxC;AAAAA,MACAC;AAAAA,MACAwC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB1C;AAAAA,MACAJ;AAAAA,MACAO;AAAAA,MACAC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBuC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpBtC;AAAAA,MACA,KAAK;AAAA,MACLuC;AAAAA,MACAG;AAAAA,IAAA;AAAA,EAER;AACJ;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../node_modules/@milaboratories/miplots4/src/heatmap/index.ts"],"sourcesContent":["import { renderToString } from 'react-dom/server';\nimport { AbstractChart } from '../AbstractChart';\nimport type { DataFrame } from '../DataFrame';\nimport type { ColumnName, DataValue, HeatmapEventHandlers, HeatmapSettings } from '../types';\nimport { isColumnName } from '../utils';\nimport ChartRenderer from './ChartRenderer';\nimport type { GroupedCellsData } from './getCells';\nimport { getCells } from './getCells';\nimport type { DendrogramsData } from './getDendrograms';\nimport { getDendrograms } from './getDendrograms';\nimport { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport { MAX_SVG_RENDERED_CELLS_COUNT } from './constants';\n\nexport class ChartHeatmap extends AbstractChart {\n settings: HeatmapSettingsImpl;\n chartRenderer = new ChartRenderer();\n\n onTooltipHintSwitch: (v:boolean) => void = () => undefined;\n calculatedData: {\n groupedCellsData: GroupedCellsData;\n dendrogramsData: DendrogramsData;\n cellUniqValues: DataValue[];\n } | null = null;\n\n constructor(data: DataFrame, settings: HeatmapSettings, eventHandlers?:HeatmapEventHandlers) {\n super(data, settings);\n\n this.settings = new HeatmapSettingsImpl(settings);\n if (eventHandlers) {\n this.onTooltipHintSwitch = eventHandlers[0];\n }\n }\n\n mount(node: HTMLElement) {\n try {\n this.chartRenderer.init(node);\n this._updateData();\n this._updateChart();\n this.hasError = false;\n } catch (err) {\n this.hasError = true;\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n unmount() {\n this.chartRenderer.clear();\n }\n\n updateSettingsAndData(data: DataFrame, settings: HeatmapSettings) {\n try {\n const previousSettings = this.settings;\n const previousData = this.data;\n this.settings = new HeatmapSettingsImpl(settings);\n this.data = data;\n if (\n this._needUpdateCalculatedDataBySettings(previousSettings, this.settings) ||\n this._needUpdateCalculatedDataByData(previousData, this.data)\n ) {\n this._updateData();\n } else {\n this._updateAesInData();\n }\n this._updateChart();\n } catch (err) {\n if (err instanceof Error) {\n this.chartRenderer.renderError(err.message as string);\n console.error(err);\n }\n }\n }\n\n updateChartState(_field: string, _value: unknown) {\n console.warn('no chart state for heatmap');\n }\n\n export(): string {\n this._updateChart();\n return renderToString(this.chartRenderer.component);\n }\n\n _needUpdateCalculatedDataBySettings(prevSettings: HeatmapSettingsImpl, settings: HeatmapSettingsImpl) {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n annotations,\n chartSettings,\n facetSettings,\n dendrogramX,\n dendrogramY,\n normalization,\n aggregation,\n NAValueAs,\n } = settings;\n\n const prevDendrogramXColumns: ColumnName[] = Object.values(prevSettings.dendrogramX?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramXColumns: ColumnName[] = Object.values(dendrogramX?.aes || {}).filter(isColumnName);\n const prevDendrogramYColumns: ColumnName[] = Object.values(prevSettings.dendrogramY?.aes || {}).filter(\n isColumnName\n );\n const currentDendrogramYColumns: ColumnName[] = Object.values(dendrogramY?.aes || {}).filter(isColumnName);\n\n function compareColumnGroups(columns1: ColumnName[], columns2: ColumnName[]) {\n return (\n columns1.length !== columns2.length ||\n columns1.some((column, idx) => column.value !== columns2[idx].value)\n );\n }\n\n return (\n prevSettings.xColumn.value !== xColumn.value ||\n prevSettings.yColumn.value !== yColumn.value ||\n prevSettings.valueColumn.value !== valueColumn.value ||\n compareColumnGroups(prevSettings.xGroupBy, xGroupBy) ||\n compareColumnGroups(prevSettings.yGroupBy, yGroupBy) ||\n compareColumnGroups(prevSettings.facetBy, facetBy) ||\n compareColumnGroups(\n prevSettings.annotations.map(a => a.valueColumn),\n annotations.map(a => a.valueColumn)\n ) ||\n compareColumnGroups(prevDendrogramXColumns, currentDendrogramXColumns) ||\n compareColumnGroups(prevDendrogramYColumns, currentDendrogramYColumns) ||\n ((settings.dendrogramX || prevSettings.dendrogramX) &&\n (prevSettings.dendrogramX?.distance !== settings.dendrogramX?.distance ||\n prevSettings.dendrogramX?.linkage !== settings.dendrogramX?.linkage)) ||\n ((settings.dendrogramY || prevSettings.dendrogramY) &&\n (prevSettings.dendrogramY?.distance !== settings.dendrogramY?.distance ||\n prevSettings.dendrogramY?.linkage !== settings.dendrogramY?.linkage)) ||\n prevSettings.chartSettings.valueType !== chartSettings.valueType ||\n prevSettings.facetSettings.sharedX !== facetSettings.sharedX ||\n prevSettings.facetSettings.sharedY !== facetSettings.sharedY ||\n prevSettings.normalization?.method !== normalization?.method ||\n prevSettings.normalization?.direction !== normalization?.direction ||\n prevSettings.NAValueAs !== NAValueAs ||\n prevSettings.aggregation?.method !== aggregation?.method ||\n prevSettings.aggregation?.x !== aggregation?.x ||\n prevSettings.aggregation?.y !== aggregation?.y\n );\n }\n\n _needUpdateCalculatedDataByData(prevData: DataFrame, data: DataFrame) {\n const prevKeys = Object.keys(prevData.data);\n const keys = Object.keys(data.data);\n return (\n prevData.id !== data.id ||\n prevKeys.length !== keys.length ||\n prevKeys.some(key => prevData.data[key].length !== data.data[key]?.length)\n );\n }\n\n _updateData() {\n const {\n xColumn,\n yColumn,\n valueColumn,\n xGroupBy,\n yGroupBy,\n facetBy,\n chartSettings,\n facetSettings,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder,\n aggregation\n } = this.settings;\n\n const groupedCellsData = getCells(\n this.data,\n xColumn,\n yColumn,\n valueColumn,\n facetBy,\n xGroupBy,\n yGroupBy,\n annotations,\n dendrogramX,\n dendrogramY,\n normalization,\n NAValueAs,\n keysOrder,\n chartSettings.xAxis,\n chartSettings.yAxis,\n aggregation\n );\n const dendrogramsData = getDendrograms(groupedCellsData, dendrogramX, dendrogramY, facetSettings);\n const cellUniqValues =\n chartSettings.valueType === 'discrete' ? this.data.getColumnCategories(valueColumn.value) : [];\n\n this.calculatedData = {\n groupedCellsData,\n dendrogramsData,\n cellUniqValues,\n };\n }\n\n _updateAesInData() {\n return;\n }\n\n _updateChart() {\n if (!this.calculatedData) {\n return;\n }\n const {\n id,\n valueColumn,\n chartSettings,\n facetSettings,\n aes,\n annotations,\n dendrogramX,\n dendrogramY,\n inheritedDendrogramAes,\n normalization,\n keysOrder,\n xColumn,\n yColumn,\n xGroupBy,\n yGroupBy,\n } = this.settings;\n const customOrder = {\n x: keysOrder[xColumn.value]?.length > 0,\n y: keysOrder[yColumn.value]?.length > 0,\n xGroup: xGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n yGroup: yGroupBy.some((v) => keysOrder[v.value]?.length > 0),\n };\n const dataSize = this.data.columnNames.length ? this.data.getColumn(this.data.columnNames[0]).length : 0;\n const cellsRenderingMode = this.settings.cellsRenderingMode ?? (dataSize > MAX_SVG_RENDERED_CELLS_COUNT ? 'canvas' : 'svg');\n \n this.chartRenderer.render(\n this.data,\n id,\n chartSettings,\n facetSettings,\n aes,\n this.calculatedData.groupedCellsData,\n annotations,\n valueColumn,\n dendrogramX,\n dendrogramY,\n this.calculatedData.dendrogramsData,\n inheritedDendrogramAes,\n this.calculatedData.cellUniqValues,\n normalization,\n this.onTooltipHintSwitch,\n customOrder,\n cellsRenderingMode\n );\n }\n}\n"],"names":["ChartHeatmap","AbstractChart","data","settings","eventHandlers","__publicField","ChartRenderer","HeatmapSettingsImpl","node","err","previousSettings","previousData","_field","_value","renderToString","prevSettings","xColumn","yColumn","valueColumn","xGroupBy","yGroupBy","facetBy","annotations","chartSettings","facetSettings","dendrogramX","dendrogramY","normalization","aggregation","NAValueAs","prevDendrogramXColumns","_a","isColumnName","currentDendrogramXColumns","prevDendrogramYColumns","_b","currentDendrogramYColumns","compareColumnGroups","columns1","columns2","column","idx","a","_c","_d","_e","_f","_g","_h","_i","_j","_k","_l","_m","_n","_o","prevData","prevKeys","keys","u","key","keysOrder","groupedCellsData","getCells","dendrogramsData","getDendrograms","cellUniqValues","id","aes","inheritedDendrogramAes","customOrder","v","dataSize","cellsRenderingMode","MAX_SVG_RENDERED_CELLS_COUNT"],"mappings":";;;;;;;;;AAaO,MAAMA,WAAqBC,EAAc;AAAA,EAW5C,YAAYC,GAAiBC,GAA2BC,GAAqC;AACzF,UAAMF,GAAMC,CAAQ,GAXxBE,EAAA,MAAA,UAAA,GACAA,EAAA,MAAA,iBAAgB,IAAIC,EAAAA,CAAA,GAEpBD,EAAA,6BAA2C,MAAA;AAAA,IAAA,CAAA,GAC3CA,EAAA,MAAA,kBAIW,IAAA,GAKP,KAAK,WAAW,IAAIE,EAAoBJ,CAAQ,GAC5CC,MACA,KAAK,sBAAsBA,EAAc,CAAC;AAAA,EAElD;AAAA,EAEA,MAAMI,GAAmB;AACrB,QAAI;AACA,WAAK,cAAc,KAAKA,CAAI,GAC5B,KAAK,eACL,KAAK,aAAA,GACL,KAAK,WAAW;AAAA,IACpB,SAASC,GAAK;AACV,WAAK,WAAW,IACZA,aAAe,UACf,KAAK,cAAc,YAAYA,EAAI,OAAiB,GACpD,QAAQ,MAAMA,CAAG;AAAA,IAEzB;AAAA,EACJ;AAAA,EAEA,UAAU;AACN,SAAK,cAAc,MAAA;AAAA,EACvB;AAAA,EAEA,sBAAsBP,GAAiBC,GAA2B;AAC9D,QAAI;AACA,YAAMO,IAAmB,KAAK,UACxBC,IAAe,KAAK;AAC1B,WAAK,WAAW,IAAIJ,EAAoBJ,CAAQ,GAChD,KAAK,OAAOD,GAER,KAAK,oCAAoCQ,GAAkB,KAAK,QAAQ,KACxE,KAAK,gCAAgCC,GAAc,KAAK,IAAI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IAAWE,IAA+B,WAAW;AAErH,SAAK,cAAc;AAAA,MACf,KAAK;AAAA,MACLP;AAAAA,MACA5C;AAAAA,MACAC;AAAAA,MACA4C;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB9C;AAAAA,MACAJ;AAAAA,MACAO;AAAAA,MACAC;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB2C;AAAAA,MACA,KAAK,eAAe;AAAA,MACpB1C;AAAAA,MACA,KAAK;AAAA,MACL2C;AAAAA,MACAG;AAAAA,IAAA;AAAA,EAER;AACJ;","x_google_ignoreList":[0]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import o from "../node_modules/zod/lib/index.js";
|
|
2
|
-
import { LineShapeSchema as t, PointShapeSchema as e, ColumnNameSchema as i, DataValueSchema as a, AxisSettingsContinuousSchema as
|
|
2
|
+
import { LineShapeSchema as t, PointShapeSchema as e, ColumnNameSchema as i, DataValueSchema as a, AxisSettingsContinuousSchema as m, AxisSettingsDiscreteSchema as s, TitlePositionSchema as l, AesRecordSchema as p, FrameTypeSchema as b, LegendPositionSchema as u } from "./common.js";
|
|
3
3
|
const n = o.object({ type: o.enum(["primaryGrouping", "secondaryGrouping"]) }), c = o.object({
|
|
4
4
|
type: o.literal("box"),
|
|
5
5
|
stat: o.optional(
|
|
@@ -61,6 +61,7 @@ const n = o.object({ type: o.enum(["primaryGrouping", "secondaryGrouping"]) }),
|
|
|
61
61
|
}), j = ["mean", "median"], y = ["sd", "se", "ci"], r = o.enum(j), g = o.enum(y), S = o.object({
|
|
62
62
|
type: o.literal("line"),
|
|
63
63
|
pointsValues: r,
|
|
64
|
+
emptyGroupValue: o.optional(o.number()),
|
|
64
65
|
aes: o.optional(
|
|
65
66
|
o.object({
|
|
66
67
|
showOutliers: o.optional(o.boolean()),
|
|
@@ -180,17 +181,17 @@ const n = o.object({ type: o.enum(["primaryGrouping", "secondaryGrouping"]) }),
|
|
|
180
181
|
areaOpacity: o.optional(o.number().min(0).max(1))
|
|
181
182
|
})
|
|
182
183
|
)
|
|
183
|
-
}),
|
|
184
|
+
}), G = ["ttest", "anova", "wilcoxon", "kruskalWallis"], A = [
|
|
184
185
|
"BenjaminiHochberg",
|
|
185
186
|
"BenjaminiYekutieli",
|
|
186
187
|
"Bonferroni",
|
|
187
188
|
"Hochberg",
|
|
188
189
|
"Holm",
|
|
189
190
|
"Hommel"
|
|
190
|
-
],
|
|
191
|
+
], B = o.enum(G), v = o.enum(A), D = o.object({ one: o.number(), two: o.number(), three: o.number() }), L = o.object({
|
|
191
192
|
type: o.literal("stat"),
|
|
192
193
|
statType: o.enum(["overall", "referenceGroup", "pairwise"]),
|
|
193
|
-
testMethod:
|
|
194
|
+
testMethod: B,
|
|
194
195
|
paired: o.optional(o.boolean()),
|
|
195
196
|
ns: o.optional(o.boolean()),
|
|
196
197
|
format: o.optional(o.enum(["significance", "pValue"])),
|
|
@@ -211,7 +212,7 @@ const n = o.object({ type: o.enum(["primaryGrouping", "secondaryGrouping"]) }),
|
|
|
211
212
|
k,
|
|
212
213
|
O,
|
|
213
214
|
L
|
|
214
|
-
]), N = ["horizontal", "vertical"],
|
|
215
|
+
]), N = ["horizontal", "vertical"], V = o.enum(N), T = o.object({
|
|
215
216
|
type: o.literal("discrete"),
|
|
216
217
|
title: o.object({
|
|
217
218
|
name: o.string(),
|
|
@@ -247,8 +248,8 @@ const n = o.object({ type: o.enum(["primaryGrouping", "secondaryGrouping"]) }),
|
|
|
247
248
|
logo: o.optional(o.object({ show: o.boolean() }))
|
|
248
249
|
})
|
|
249
250
|
),
|
|
250
|
-
frame: o.optional(o.object({ type: o.optional(
|
|
251
|
-
orientation: o.optional(
|
|
251
|
+
frame: o.optional(o.object({ type: o.optional(b) })),
|
|
252
|
+
orientation: o.optional(V),
|
|
252
253
|
keyColumn: o.optional(i),
|
|
253
254
|
primaryGrouping: o.optional(
|
|
254
255
|
o.object({
|
|
@@ -277,11 +278,11 @@ const n = o.object({ type: o.enum(["primaryGrouping", "secondaryGrouping"]) }),
|
|
|
277
278
|
titlePosition: o.optional(l)
|
|
278
279
|
})
|
|
279
280
|
),
|
|
280
|
-
xAxis: o.optional(
|
|
281
|
-
yAxis: o.optional(
|
|
281
|
+
xAxis: o.optional(s),
|
|
282
|
+
yAxis: o.optional(m),
|
|
282
283
|
layers: o.array(P)
|
|
283
284
|
});
|
|
284
285
|
export {
|
|
285
|
-
|
|
286
|
+
T as DiscreteSettingsSchema
|
|
286
287
|
};
|
|
287
288
|
//# sourceMappingURL=discrete.js.map
|