@milaboratories/miplots4 1.0.150 → 1.0.152
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/bubble/BubbleSettingsImpl.d.ts +9 -1
- package/dist/bubble/BubbleSettingsImpl.d.ts.map +1 -1
- package/dist/bubble/BubbleSettingsImpl.js +25 -16
- package/dist/bubble/BubbleSettingsImpl.js.map +1 -1
- package/dist/bubble/ChartRenderer.d.ts +15 -5
- package/dist/bubble/ChartRenderer.d.ts.map +1 -1
- package/dist/bubble/ChartRenderer.js +146 -146
- package/dist/bubble/ChartRenderer.js.map +1 -1
- package/dist/bubble/components/Chart.d.ts +5 -5
- package/dist/bubble/components/Chart.d.ts.map +1 -1
- package/dist/bubble/components/Chart.js +46 -46
- package/dist/bubble/components/Chart.js.map +1 -1
- package/dist/bubble/components/ChartsGroup.d.ts +4 -4
- package/dist/bubble/components/ChartsGroup.d.ts.map +1 -1
- package/dist/bubble/components/ChartsGroup.js.map +1 -1
- package/dist/bubble/getCellTooltip.d.ts +2 -2
- package/dist/bubble/getCellTooltip.d.ts.map +1 -1
- package/dist/bubble/getCellTooltip.js +17 -17
- package/dist/bubble/getCellTooltip.js.map +1 -1
- package/dist/bubble/getGroupedCellsData.d.ts +7 -29
- package/dist/bubble/getGroupedCellsData.d.ts.map +1 -1
- package/dist/bubble/getGroupedCellsData.js +49 -83
- package/dist/bubble/getGroupedCellsData.js.map +1 -1
- package/dist/bubble/index.d.ts +2 -2
- package/dist/bubble/index.d.ts.map +1 -1
- package/dist/bubble/index.js +54 -37
- package/dist/bubble/index.js.map +1 -1
- package/dist/bubble/utils/calculateCaptionTails.d.ts +2 -2
- package/dist/bubble/utils/calculateCaptionTails.d.ts.map +1 -1
- package/dist/bubble/utils/calculateCaptionTails.js.map +1 -1
- package/dist/discrete/DiscreteSettingsImpl.d.ts +2 -0
- package/dist/discrete/DiscreteSettingsImpl.d.ts.map +1 -1
- package/dist/discrete/DiscreteSettingsImpl.js +21 -19
- package/dist/discrete/DiscreteSettingsImpl.js.map +1 -1
- package/dist/discrete/layers/stackedBar.d.ts.map +1 -1
- package/dist/discrete/layers/stackedBar.js +55 -30
- package/dist/discrete/layers/stackedBar.js.map +1 -1
- package/dist/heatmap/ChartRenderer.d.ts +7 -7
- package/dist/heatmap/ChartRenderer.d.ts.map +1 -1
- package/dist/heatmap/ChartRenderer.js +2 -2
- package/dist/heatmap/ChartRenderer.js.map +1 -1
- package/dist/heatmap/components/Annotations/Annotation.d.ts +4 -4
- package/dist/heatmap/components/Annotations/Annotation.d.ts.map +1 -1
- package/dist/heatmap/components/Annotations/Annotation.js.map +1 -1
- package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.d.ts +2 -2
- package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.d.ts.map +1 -1
- package/dist/heatmap/components/Annotations/AnnotationCellsCanvas.js.map +1 -1
- package/dist/heatmap/components/Annotations/AnnotationCellsSvg.d.ts +2 -2
- package/dist/heatmap/components/Annotations/AnnotationCellsSvg.d.ts.map +1 -1
- package/dist/heatmap/components/Annotations/AnnotationCellsSvg.js.map +1 -1
- package/dist/heatmap/components/Annotations/index.d.ts +5 -5
- package/dist/heatmap/components/Annotations/index.d.ts.map +1 -1
- package/dist/heatmap/components/Annotations/index.js.map +1 -1
- package/dist/heatmap/components/CanvasCells.d.ts +3 -3
- package/dist/heatmap/components/CanvasCells.d.ts.map +1 -1
- package/dist/heatmap/components/CanvasCells.js +18 -18
- package/dist/heatmap/components/CanvasCells.js.map +1 -1
- package/dist/heatmap/components/Chart.d.ts +6 -6
- package/dist/heatmap/components/Chart.d.ts.map +1 -1
- package/dist/heatmap/components/Chart.js +63 -63
- package/dist/heatmap/components/Chart.js.map +1 -1
- package/dist/heatmap/components/ChartsGroup.d.ts +3 -3
- package/dist/heatmap/components/ChartsGroup.d.ts.map +1 -1
- package/dist/heatmap/components/ChartsGroup.js.map +1 -1
- package/dist/heatmap/components/SvgCells.d.ts +3 -3
- package/dist/heatmap/components/SvgCells.d.ts.map +1 -1
- package/dist/heatmap/components/SvgCells.js +18 -18
- package/dist/heatmap/components/SvgCells.js.map +1 -1
- package/dist/heatmap/components/tooltipUtils.d.ts +5 -5
- package/dist/heatmap/components/tooltipUtils.d.ts.map +1 -1
- package/dist/heatmap/components/tooltipUtils.js +7 -7
- package/dist/heatmap/components/tooltipUtils.js.map +1 -1
- package/dist/heatmap/fillCellsData.d.ts +45 -0
- package/dist/heatmap/fillCellsData.d.ts.map +1 -0
- package/dist/heatmap/fillCellsData.js +244 -0
- package/dist/heatmap/fillCellsData.js.map +1 -0
- package/dist/heatmap/getCells.d.ts +5 -37
- package/dist/heatmap/getCells.d.ts.map +1 -1
- package/dist/heatmap/getCells.js +28 -214
- package/dist/heatmap/getCells.js.map +1 -1
- package/dist/heatmap/getDendrograms.d.ts +2 -2
- package/dist/heatmap/getDendrograms.d.ts.map +1 -1
- package/dist/heatmap/getDendrograms.js +19 -19
- package/dist/heatmap/getDendrograms.js.map +1 -1
- package/dist/heatmap/index.d.ts +2 -2
- package/dist/heatmap/index.d.ts.map +1 -1
- package/dist/heatmap/index.js +7 -7
- package/dist/heatmap/index.js.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.d.ts +2 -2
- package/dist/heatmap/utils/calculateCaptionTails.d.ts.map +1 -1
- package/dist/heatmap/utils/calculateCaptionTails.js.map +1 -1
- package/dist/node_modules/d3-array/src/min.js +11 -5
- package/dist/node_modules/d3-array/src/min.js.map +1 -1
- package/dist/types/bubble.d.ts +92 -0
- package/dist/types/bubble.d.ts.map +1 -1
- package/dist/types/bubble.js +16 -5
- package/dist/types/bubble.js.map +1 -1
- package/dist/types/discrete.d.ts +30 -8
- package/dist/types/discrete.d.ts.map +1 -1
- package/dist/types/discrete.js +16 -14
- package/dist/types/discrete.js.map +1 -1
- package/dist/types/heatmap.d.ts +18 -18
- package/dist/utils/getFacetOrGroupKey.d.ts +2 -0
- package/dist/utils/getFacetOrGroupKey.d.ts.map +1 -0
- package/dist/utils/getFacetOrGroupKey.js +7 -0
- package/dist/utils/getFacetOrGroupKey.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fillCellsData.js","sources":["../../src/heatmap/fillCellsData.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';\nimport { getFacetOrGroupKey } from '../utils/getFacetOrGroupKey';\nimport type { BubbleSettingsImpl } from '../bubble/BubbleSettingsImpl';\n\nexport type Cell<T extends string> = {\n isCell: true;\n idx: number;\n id: string;\n value: Record<T, DataValue>;\n normalizedValue: Record<T, DataValue>;\n x: DataValue;\n y: DataValue;\n};\n\nexport type GroupedCellsData<T extends string> = {\n meta: {\n valueSources: T[]; // dataSource for heatmap, color and size for bubble - main data for every cell\n\n facetKeys: string[];\n xGroupKeys: string[];\n yGroupKeys: string[];\n\n xKeys: string[];\n yKeys: string[];\n xKeysByGroups: Record<string, string[]>;\n yKeysByGroups: Record<string, string[]>;\n\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\n xLabels: Record<string, string>;\n yLabels: Record<string, string>;\n xGroupLabels: Record<string, string>;\n yGroupLabels: Record<string, string>;\n\n valueExtent: Record<T, [number, number]>; // for color/size 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<T>>>;\n }\n >;\n};\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\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};\nfunction applyAggregation<T extends string>(\n result: GroupedCellsData<T>,\n aggregation: HeatmapSettingsImpl['aggregation'],\n additionalDataColumnsX: string[],\n additionalDataColumnsY: string[],\n annotations: HeatmapSettingsImpl['annotations']\n) {\n if (aggregation.x || aggregation.y) {\n const valueExtent: GroupedCellsData<T>['meta']['valueExtent'] = result.meta.valueSources.reduce((r, key) => {\n r[key] = [Infinity, -Infinity] as [number, number];\n return r;\n }, {} as GroupedCellsData<T>['meta']['valueExtent']);\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\n for (const xGroupKey of xNewKeys) {\n for (const yGroupKey of yNewKeys) {\n // collect values for aggregation to arrays\n const valuesBySources: Record<T, number[]> = result.meta.valueSources.reduce((r, v) => {\n r[v] = [];\n return r;\n }, {} as Record<T, number[]>);\n xGroups[xGroupKey].forEach((xKey) => {\n yGroups[yGroupKey].forEach((yKey) => {\n for (const valueSource of result.meta.valueSources) {\n const cellValue = cells[xKey]?.[yKey]?.value?.[valueSource];\n if (cellValue !== undefined) {\n valuesBySources[valueSource].push(cellValue as number);\n }\n }\n delete cells[xKey]?.[yKey];\n });\n });\n // create new cells with aggregated values\n for (const valueSource of result.meta.valueSources) {\n const values = valuesBySources[valueSource];\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 if (!result.facets[facetKey].cells[xGroupKey][yGroupKey]) {\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: result.meta.valueSources.reduce((r, v) => { r[v] = null; return r; }, {} as Record<T, DataValue>),\n normalizedValue: result.meta.valueSources.reduce((r, v) => { r[v] = null; return r; }, {} as Record<T, DataValue>),\n };\n }\n const cell = result.facets[facetKey].cells[xGroupKey][yGroupKey];\n cell.value[valueSource] = value;\n cell.normalizedValue[valueSource] = value;\n\n valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource], valueExtent[valueSource][0]);\n valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource], valueExtent[valueSource][1]);\n }\n }\n }\n }\n // add aggregated values for X annotations\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 // add aggregated values for Y annotations\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 // erase grouping - we aggregated by them and now there is no grouping in the chart;\n // replace axis keys with group keys - now group keys are new axis keys\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}\n\nfunction updateValueExtent<T extends string>(result: GroupedCellsData<T>, cell: Cell<T>) {\n for (const valueSource of result.meta.valueSources) {\n result.meta.valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource] as number, result.meta.valueExtent[valueSource][0]);\n result.meta.valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource] as number, result.meta.valueExtent[valueSource][1]);\n }\n\n}\nfunction applyNormalization<T extends string>(\n result: GroupedCellsData<T>,\n normalizationBySources: Record<T, HeatmapSettingsImpl['normalization']>,\n) {\n if (Object.values(normalizationBySources).length) {\n const valueExtent: GroupedCellsData<T>['meta']['valueExtent'] = result.meta.valueSources.reduce((r, key) => {\n if (normalizationBySources[key]) {\n r[key] = [Infinity, -Infinity] as [number, number];\n }\n return r;\n }, {} as GroupedCellsData<T>['meta']['valueExtent']);\n result.meta.facetKeys.forEach(facetKey => {\n const { xKeys, yKeys, cells } = result.facets[facetKey];\n\n for (const valueSource of result.meta.valueSources) {\n const normalization = normalizationBySources[valueSource];\n if (!normalization) {\n continue;\n }\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?.[valueSource];\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[valueSource] = normalize(cell.value?.[valueSource] as number);\n valueExtent[valueSource][0] = Math.min(cell.normalizedValue?.[valueSource], valueExtent[valueSource][0]);\n valueExtent[valueSource][1] = Math.max(cell.normalizedValue?.[valueSource], valueExtent[valueSource][1]);\n }\n });\n });\n }\n\n });\n result.meta.valueExtent = {...result.meta.valueExtent, valueExtent};\n }\n}\n\nexport function fillCellsData<T extends string>(\n result: GroupedCellsData<T>,\n data: DataFrame,\n xColumn: ColumnName,\n yColumn: ColumnName,\n valueColumns: Record<string, ColumnName>,\n facetBy: ColumnName[],\n xGroupBy: ColumnName[],\n yGroupBy: ColumnName[],\n annotations: HeatmapSettingsImpl['annotations'],\n dendrogramX: HeatmapSettingsImpl['dendrogramX'],\n dendrogramY: HeatmapSettingsImpl['dendrogramY'],\n normalizationBySource: Record<T, HeatmapSettingsImpl['normalization']>, // separated for color and size for example\n NAValueAs: HeatmapSettingsImpl['NAValueAs'],\n keysOrder: HeatmapSettingsImpl['keysOrder'],\n xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'] | BubbleSettingsImpl['chartSettings']['xAxis'],\n yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'] | BubbleSettingsImpl['chartSettings']['yAxis'],\n aggregation: HeatmapSettingsImpl['aggregation'],\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(getFacetOrGroupKey);\n const xGroupKeys = xGroupKeysCombinations.map(getFacetOrGroupKey);\n const yGroupKeys = yGroupKeysCombinations.map(getFacetOrGroupKey);\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 = getFacetOrGroupKey(facetBy.map(column => data.getColumnValue(column.value, i)));\n const xGroupKey = getFacetOrGroupKey(xGroupBy.map(column => data.getColumnValue(column.value, i)));\n const yGroupKey = getFacetOrGroupKey(yGroupBy.map(column => data.getColumnValue(column.value, i)));\n const xGroupLabel = xGroupBy.map(column => data.getColumnValue(column.valueLabels ?? column.value, i)).join(', ');\n const yGroupLabel = 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\n const values = result.meta.valueSources.reduce((r, key) => {\n r[key] = (data.getColumnValue(valueColumns[key].value, i) ?? NAValueAs) as number | null;\n return r;\n }, {} as Record<string, DataValue>);\n\n if (x === 'null' || y === 'null' || Object.values(values).every(v => v === 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\n for (const valueSource of result.meta.valueSources) {\n if (result.facets[facetKey].cells[x][y] && result.facets[facetKey].cells[x][y].value[valueSource] !== values[valueSource]) {\n throw Error(`More than 1 value for x=${x}, y=${y}`);\n }\n }\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: values,\n normalizedValue: values,\n };\n\n updateValueExtent(result, result.facets[facetKey].cells[x][y]);\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, normalizationBySource);\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.xKeys = result.meta.xGroupKeys.reduce((res: string[], xGroupKey: string) => {\n res = res.concat(result.meta.xKeysByGroups[xGroupKey]);\n return res;\n }, []);\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 result.meta.yKeys = result.meta.yGroupKeys.reduce((res: string[], yGroupKey: string) => {\n res = res.concat(result.meta.yKeysByGroups[yGroupKey]);\n return res;\n }, []);\n\n for (const valueSource of result.meta.valueSources) {\n // avoid render errors on empty data\n if (result.meta.valueExtent[valueSource][0] === Infinity) {\n result.meta.valueExtent[valueSource][0] = 0;\n }\n if (result.meta.valueExtent[valueSource][1] === -Infinity) {\n result.meta.valueExtent[valueSource][1] = 0;\n }\n }\n\n return result;\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","applyAggregation","aggregation","additionalDataColumnsX","additionalDataColumnsY","annotations","valueExtent","r","facetKey","xKeys","yKeys","cells","xKeysByGroups","yKeysByGroups","xGroups","xKey","yGroups","yKey","xNewKeys","yNewKeys","xGroupKey","yGroupKey","valuesBySources","valueSource","cellValue","_c","_b","_a","_d","value","cell","columnKey","annotation","updateValueExtent","applyNormalization","normalizationBySources","normalization","cellKeys","groupKeys","cellGetter","cellKey","groupKey","normalize","fillCellsData","data","xColumn","yColumn","valueColumns","facetBy","xGroupBy","yGroupBy","dendrogramX","dendrogramY","normalizationBySource","NAValueAs","keysOrder","xAxis","yAxis","facetKeysLists","column","xGroupKeysLists","yGroupKeysLists","facetKeysCombinations","xGroupKeysCombinations","yGroupKeysCombinations","facetKeys","getFacetOrGroupKey","xGroupKeys","yGroupKeys","index","xLabelsSource","yLabelsSource","annotationColumnsX","item","annotationColumnsY","dendrogramXColumns","dendrogramYColumns","lodash","i","xGroupLabel","yGroupLabel","x","y","xLabelsSourceValue","yLabelsSourceValue","isAddedColumn","isAddedValue","facet","uniqueXKeys","uniqueYKeys","existingXKeys","existingYKeys"],"mappings":";;;;;;;AA+DA,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,GAAkB;AACvE,SAAIW,MAAW,oBACJZ,GAAeC,CAAM,IAE5BW,MAAW,sBACJL,GAAkBN,CAAM,IAE5B,CAACK,MAAcA;AAC1B;AAEA,SAASO,EAAiBD,GAA2BX,GAAkB;AACnE,UAAQW,GAAA;AAAA,IACJ,KAAK,OAAO;AACR,UAAIE,IAAMb,EAAO,CAAC;AAClB,iBAAWK,KAAKL;AACZ,QAAAa,IAAM,KAAK,IAAIA,GAAKR,CAAC;AAEzB,aAAOQ;AAAA,IACX;AAAA,IACA,KAAK,OAAO;AACR,UAAIA,IAAMb,EAAO,CAAC;AAClB,iBAAWK,KAAKL;AACZ,QAAAa,IAAM,KAAK,IAAIA,GAAKR,CAAC;AAEzB,aAAOQ;AAAA,IACX;AAAA,IACA,KAAK,UAAU;AACX,YAAMC,IAAed,EAAO,KAAK,CAACe,GAAGC,MAAMD,IAAIC,CAAC;AAChD,aAAOC,GAAeH,GAAc,GAAG;AAAA,IAC3C;AAAA,IACA,KAAK;AACD,aAAOV,EAAK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CAAC,MAAM,UAC5C/B,EAAO,KAAK,YAAY+B,CAAW,EAAE,CAAC,IAAI,IAE1C/B,EAAO,KAAK,YAAY+B,CAAW,EAAE,CAAC,MAAM,WAC5C/B,EAAO,KAAK,YAAY+B,CAAW,EAAE,CAAC,IAAI;AAIlD,SAAO/B;AACX;"}
|
|
@@ -1,40 +1,8 @@
|
|
|
1
1
|
import { DataFrame } from '../DataFrame';
|
|
2
|
-
import { ColumnName
|
|
2
|
+
import { ColumnName } from '../types';
|
|
3
3
|
import { HeatmapSettingsImpl } from './HeatmapSettingsImpl';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
value: DataValue;
|
|
9
|
-
normalizedValue: DataValue;
|
|
10
|
-
x: DataValue;
|
|
11
|
-
y: DataValue;
|
|
12
|
-
};
|
|
13
|
-
export type GroupedCellsData = {
|
|
14
|
-
meta: {
|
|
15
|
-
facetKeys: string[];
|
|
16
|
-
xGroupKeys: string[];
|
|
17
|
-
yGroupKeys: string[];
|
|
18
|
-
xKeysByGroups: Record<string, string[]>;
|
|
19
|
-
yKeysByGroups: Record<string, string[]>;
|
|
20
|
-
facetKeyValues: Record<string, string[]>;
|
|
21
|
-
xGroupKeyValues: Record<string, string[]>;
|
|
22
|
-
yGroupKeyValues: Record<string, string[]>;
|
|
23
|
-
xLabels: Record<string, string>;
|
|
24
|
-
yLabels: Record<string, string>;
|
|
25
|
-
xGroupLabels: Record<string, string>;
|
|
26
|
-
yGroupLabels: Record<string, string>;
|
|
27
|
-
valueExtent: [number, number];
|
|
28
|
-
xDataByKeys: Record<string, Record<string, DataValue>>;
|
|
29
|
-
yDataByKeys: Record<string, Record<string, DataValue>>;
|
|
30
|
-
};
|
|
31
|
-
facets: Record<string, {
|
|
32
|
-
xKeys: string[];
|
|
33
|
-
yKeys: string[];
|
|
34
|
-
xKeysByGroups: Record<string, string[]>;
|
|
35
|
-
yKeysByGroups: Record<string, string[]>;
|
|
36
|
-
cells: Record<string, Record<string, Cell>>;
|
|
37
|
-
}>;
|
|
38
|
-
};
|
|
39
|
-
export declare function getCells(data: DataFrame, xColumn: ColumnName, yColumn: ColumnName, valueColumn: ColumnName, facetBy: ColumnName[], xGroupBy: ColumnName[], yGroupBy: ColumnName[], annotations: HeatmapSettingsImpl['annotations'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], normalization: HeatmapSettingsImpl['normalization'], NAValueAs: HeatmapSettingsImpl['NAValueAs'], keysOrder: HeatmapSettingsImpl['keysOrder'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'], aggregation: HeatmapSettingsImpl['aggregation']): GroupedCellsData;
|
|
4
|
+
import { Cell, GroupedCellsData } from './fillCellsData';
|
|
5
|
+
export type CellHeatmap = Cell<'dataSource'>;
|
|
6
|
+
export type GroupedCellsHeatmap = GroupedCellsData<'dataSource'>;
|
|
7
|
+
export declare function getCells(data: DataFrame, xColumn: ColumnName, yColumn: ColumnName, valueColumns: Record<string, ColumnName>, facetBy: ColumnName[], xGroupBy: ColumnName[], yGroupBy: ColumnName[], annotations: HeatmapSettingsImpl['annotations'], dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], normalization: HeatmapSettingsImpl['normalization'], NAValueAs: HeatmapSettingsImpl['NAValueAs'], keysOrder: HeatmapSettingsImpl['keysOrder'], xAxis: HeatmapSettingsImpl['chartSettings']['xAxis'], yAxis: HeatmapSettingsImpl['chartSettings']['yAxis'], aggregation: HeatmapSettingsImpl['aggregation']): GroupedCellsHeatmap;
|
|
40
8
|
//# sourceMappingURL=getCells.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCells.d.ts","sourceRoot":"","sources":["../../src/heatmap/getCells.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getCells.d.ts","sourceRoot":"","sources":["../../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
4
|
-
import { quantileSorted as te } from "../node_modules/d3-array/src/quantile.js";
|
|
5
|
-
import ae from "../node_modules/d3-array/src/deviation.js";
|
|
6
|
-
import se from "../node_modules/d3-array/src/extent.js";
|
|
7
|
-
function ne(t) {
|
|
8
|
-
const s = ae(t), n = X(t);
|
|
9
|
-
return s === void 0 || n === void 0 || s === 0 ? (u) => u : (u) => (u - n) / s;
|
|
10
|
-
}
|
|
11
|
-
function oe(t) {
|
|
12
|
-
const s = X(t), [n, u] = se(t);
|
|
13
|
-
return s === void 0 || n === void 0 || u === void 0 || u === n ? (r) => r : (r) => (r - s) / (u - n);
|
|
14
|
-
}
|
|
15
|
-
function le(t, s) {
|
|
16
|
-
return t === "standardScaling" ? ne(s) : t === "meanNormalization" ? oe(s) : (n) => n;
|
|
17
|
-
}
|
|
18
|
-
function N(t, s) {
|
|
19
|
-
switch (t) {
|
|
20
|
-
case "max": {
|
|
21
|
-
let n = s[0];
|
|
22
|
-
for (const u of s)
|
|
23
|
-
n = Math.max(n, u);
|
|
24
|
-
return n;
|
|
25
|
-
}
|
|
26
|
-
case "min": {
|
|
27
|
-
let n = s[0];
|
|
28
|
-
for (const u of s)
|
|
29
|
-
n = Math.min(n, u);
|
|
30
|
-
return n;
|
|
31
|
-
}
|
|
32
|
-
case "median": {
|
|
33
|
-
const n = s.sort((u, r) => u - r);
|
|
34
|
-
return te(n, 0.5);
|
|
35
|
-
}
|
|
36
|
-
case "mean":
|
|
37
|
-
return X(s) ?? s[0];
|
|
38
|
-
default:
|
|
39
|
-
ee(t, `Unknown aggregation function ${t}`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
function P(t) {
|
|
43
|
-
const s = [...new Set(t)].sort();
|
|
44
|
-
return s.length > 3 ? [...s.slice(0, 3), "..."].join(", ") : s.join(", ");
|
|
45
|
-
}
|
|
46
|
-
function A(t) {
|
|
47
|
-
if (!t.length)
|
|
48
|
-
return [];
|
|
49
|
-
let s = [[]];
|
|
50
|
-
return t.forEach((n) => {
|
|
51
|
-
const u = [];
|
|
52
|
-
n.forEach((r) => {
|
|
53
|
-
u.push(...s.map((p) => [...p, r]));
|
|
54
|
-
}), s = u;
|
|
55
|
-
}), s;
|
|
56
|
-
}
|
|
57
|
-
const Q = (t, s, n = {}) => t.sort(
|
|
58
|
-
(u, r) => s === "asc" ? (n[u] ?? u).localeCompare(n[r] ?? r, "en", { numeric: !0 }) : (n[r] ?? r).localeCompare(n[u] ?? u, "en", { numeric: !0 })
|
|
59
|
-
);
|
|
60
|
-
function ue() {
|
|
1
|
+
import { fillCellsData as b } from "./fillCellsData.js";
|
|
2
|
+
function d() {
|
|
61
3
|
return {
|
|
62
4
|
meta: {
|
|
5
|
+
valueSources: ["dataSource"],
|
|
63
6
|
facetKeys: [],
|
|
7
|
+
xKeys: [],
|
|
8
|
+
yKeys: [],
|
|
64
9
|
xGroupKeys: [],
|
|
65
10
|
yGroupKeys: [],
|
|
66
11
|
xKeysByGroups: {},
|
|
@@ -74,165 +19,34 @@ function ue() {
|
|
|
74
19
|
facetKeyValues: {},
|
|
75
20
|
xGroupKeyValues: {},
|
|
76
21
|
yGroupKeyValues: {},
|
|
77
|
-
valueExtent: [1 / 0, -1 / 0]
|
|
22
|
+
valueExtent: { dataSource: [1 / 0, -1 / 0] }
|
|
78
23
|
},
|
|
79
24
|
facets: {}
|
|
80
25
|
};
|
|
81
26
|
}
|
|
82
|
-
function
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
y: i,
|
|
104
|
-
value: v,
|
|
105
|
-
normalizedValue: v
|
|
106
|
-
}, p[0] = Math.min(v, p[0]), p[1] = Math.max(v, p[1]);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
s.x && d.forEach((e) => {
|
|
110
|
-
n.forEach((i) => {
|
|
111
|
-
const b = r.find((x) => x.valueColumn.value === i || x.valueColumn.valueLabels === i);
|
|
112
|
-
if (!b)
|
|
113
|
-
return;
|
|
114
|
-
const v = [];
|
|
115
|
-
c[e].forEach((x) => {
|
|
116
|
-
v.push(t.meta.xDataByKeys[i][x]), delete t.meta.xDataByKeys[i][x];
|
|
117
|
-
});
|
|
118
|
-
const C = b.type === "continuous" ? N(s.method, v) : P(v);
|
|
119
|
-
t.meta.xDataByKeys[i][e] = C;
|
|
120
|
-
});
|
|
121
|
-
}), s.y && (u.forEach((e) => {
|
|
122
|
-
t.meta.yDataByKeys[e] = {};
|
|
123
|
-
}), D.forEach((e) => {
|
|
124
|
-
u.forEach((i) => {
|
|
125
|
-
const b = r.find((x) => x.valueColumn.value === i || x.valueColumn.valueLabels === i);
|
|
126
|
-
if (!b)
|
|
127
|
-
return;
|
|
128
|
-
const v = [];
|
|
129
|
-
V[e].forEach((x) => {
|
|
130
|
-
v.push(t.meta.yDataByKeys[i][x]), delete t.meta.yDataByKeys[i][x];
|
|
131
|
-
});
|
|
132
|
-
const C = b.type === "continuous" ? N(s.method, v) : P(v);
|
|
133
|
-
t.meta.yDataByKeys[i][e] = C;
|
|
134
|
-
});
|
|
135
|
-
})), s.x && (t.facets[y].xKeys = Object.keys(G), t.facets[y].xKeysByGroups = { null: t.facets[y].xKeys }, t.meta.xLabels = t.meta.xGroupLabels, t.meta.xGroupKeys = ["null"], t.meta.xGroupKeyValues = { null: ["null"] }), s.y && (t.facets[y].yKeys = Object.keys(E), t.facets[y].yKeysByGroups = { null: t.facets[y].yKeys }, t.meta.yLabels = t.meta.yGroupLabels, t.meta.yGroupKeys = ["null"], t.meta.yGroupKeyValues = { null: ["null"] });
|
|
136
|
-
}), t.meta.valueExtent = p;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
function re(t, s) {
|
|
140
|
-
if (s) {
|
|
141
|
-
const n = [1 / 0, -1 / 0];
|
|
142
|
-
t.meta.facetKeys.forEach((u) => {
|
|
143
|
-
const { xKeys: r, yKeys: p, cells: y } = t.facets[u], B = s.direction === "row" ? r : p, w = s.direction === "row" ? p : r, g = s.direction === "row" ? (G, E) => {
|
|
144
|
-
var c;
|
|
145
|
-
return (c = y[G]) == null ? void 0 : c[E];
|
|
146
|
-
} : (G, E) => {
|
|
147
|
-
var c;
|
|
148
|
-
return (c = y[E]) == null ? void 0 : c[G];
|
|
149
|
-
};
|
|
150
|
-
w.forEach((G) => {
|
|
151
|
-
const E = [];
|
|
152
|
-
B.forEach((V) => {
|
|
153
|
-
var D;
|
|
154
|
-
const d = (D = g(V, G)) == null ? void 0 : D.value;
|
|
155
|
-
d !== void 0 && E.push(d);
|
|
156
|
-
});
|
|
157
|
-
const c = le(s.method, E);
|
|
158
|
-
B.forEach((V) => {
|
|
159
|
-
const d = g(V, G);
|
|
160
|
-
d !== void 0 && (d.normalizedValue = c(d.value), n[0] = Math.min(d.normalizedValue, n[0]), n[1] = Math.max(d.normalizedValue, n[1]));
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
}), t.meta.valueExtent = n;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
function xe(t, s, n, u, r, p, y, B, w, g, G, E, c, V, d, D) {
|
|
167
|
-
const e = ue(), i = r.length ? r.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], b = p.length ? p.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], v = y.length ? y.map((a) => c[a.value] ?? t.getColumnCategories(a.value)) : [["null"]], C = A(i), x = A(b), $ = A(v), q = C.map((a) => a.join("_")), S = x.map((a) => a.join("_")), z = $.map((a) => a.join("_"));
|
|
168
|
-
e.meta.facetKeys = q, e.meta.xGroupKeys = S, e.meta.yGroupKeys = z, e.meta.facetKeyValues = q.reduce((a, o, f) => (a[o] = C[f], a), {}), e.meta.xGroupKeyValues = S.reduce((a, o, f) => (a[o] = x[f], a), {}), e.meta.yGroupKeyValues = z.reduce((a, o, f) => (a[o] = $[f], a), {});
|
|
169
|
-
const Y = s.valueLabels ?? s.value, F = n.valueLabels ?? n.value, T = B.filter((a) => a.axis === "x").map((a) => a.valueColumn.valueLabels ?? a.valueColumn.value), W = B.filter((a) => a.axis === "y").map((a) => a.valueColumn.valueLabels ?? a.valueColumn.value), Z = Object.values(w ?? {}).map((a) => a.value), O = Object.values(g ?? {}).map((a) => a.value), R = K.uniq([...T, ...Z, Y]), U = K.uniq([...W, ...O, F]);
|
|
170
|
-
for (let a = 0; a < t.rowsCount; a++) {
|
|
171
|
-
const o = r.length ? r.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", f = p.length ? p.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", L = y.length ? y.map((l) => t.getColumnValue(l.value, a)).join("_") : "null", j = p.length ? p.map((l) => t.getColumnValue(l.valueLabels ?? l.value, a)).join(", ") : "", k = y.length ? y.map((l) => t.getColumnValue(l.valueLabels ?? l.value, a)).join(", ") : "";
|
|
172
|
-
e.meta.xGroupLabels[f] = j, e.meta.yGroupLabels[L] = k;
|
|
173
|
-
const m = String(t.getColumnValue(s.value, a)), h = String(t.getColumnValue(n.value, a)), M = t.getColumnValue(u.value, a) ?? E;
|
|
174
|
-
if (m === "null" || h === "null" || M === null)
|
|
175
|
-
continue;
|
|
176
|
-
if (e.facets[o] || (e.facets[o] = {
|
|
177
|
-
xKeys: [],
|
|
178
|
-
yKeys: [],
|
|
179
|
-
xKeysByGroups: {},
|
|
180
|
-
yKeysByGroups: {},
|
|
181
|
-
cells: {}
|
|
182
|
-
}), e.facets[o].xKeysByGroups[f] || (e.facets[o].xKeysByGroups[f] = []), e.facets[o].yKeysByGroups[L] || (e.facets[o].yKeysByGroups[L] = []), e.facets[o].xKeys.push(m), e.facets[o].yKeys.push(h), e.facets[o].xKeysByGroups[f].push(m), e.facets[o].yKeysByGroups[L].push(h), e.facets[o].cells[m] || (e.facets[o].cells[m] = {}), e.meta.valueExtent[0] = Math.min(M, e.meta.valueExtent[0]), e.meta.valueExtent[1] = Math.max(M, e.meta.valueExtent[1]), e.facets[o].cells[m][h] && e.facets[o].cells[m][h].value !== M)
|
|
183
|
-
throw Error(`More than 1 value for x=${m}, y=${h}`);
|
|
184
|
-
const H = t.getColumnValue(Y, a);
|
|
185
|
-
if (e.meta.xLabels[m] && String(H) !== e.meta.xLabels[m])
|
|
186
|
-
throw Error(`More than 1 x-label value for x=${m}`);
|
|
187
|
-
const J = t.getColumnValue(F, a);
|
|
188
|
-
if (e.meta.yLabels[h] && String(J) !== e.meta.yLabels[h])
|
|
189
|
-
throw Error(`More than 1 y-label value for y=${h}`);
|
|
190
|
-
e.meta.xLabels[m] = String(H), e.meta.yLabels[h] = String(J), R.forEach((l) => {
|
|
191
|
-
const I = typeof e.meta.xDataByKeys[l] < "u", _ = I && typeof e.meta.xDataByKeys[l][m] < "u";
|
|
192
|
-
if (I || (e.meta.xDataByKeys[l] = {}), _ && e.meta.xDataByKeys[l][m] !== t.getColumnValue(l, a))
|
|
193
|
-
throw Error(`More than 1 value for x = ${m} and column = ${l}`);
|
|
194
|
-
_ || (e.meta.xDataByKeys[l][m] = t.getColumnValue(l, a));
|
|
195
|
-
}), U.forEach((l) => {
|
|
196
|
-
const I = typeof e.meta.yDataByKeys[l] < "u", _ = I && typeof e.meta.yDataByKeys[l][h] < "u";
|
|
197
|
-
if (I || (e.meta.yDataByKeys[l] = {}), _ && e.meta.yDataByKeys[l][h] !== t.getColumnValue(l, a))
|
|
198
|
-
throw Error(`More than 1 value for y = ${h} and column = ${l}`);
|
|
199
|
-
_ || (e.meta.yDataByKeys[l][h] = t.getColumnValue(l, a));
|
|
200
|
-
}), e.facets[o].cells[m][h] = {
|
|
201
|
-
isCell: !0,
|
|
202
|
-
idx: a,
|
|
203
|
-
id: `${m}_${h}`,
|
|
204
|
-
x: m,
|
|
205
|
-
y: h,
|
|
206
|
-
value: M,
|
|
207
|
-
normalizedValue: M
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
return e.meta.facetKeys = e.meta.facetKeys.filter((a) => e.facets[a]), e.meta.facetKeys.forEach((a) => {
|
|
211
|
-
const o = e.facets[a], f = K.uniq(o.xKeys), L = K.uniq(o.yKeys);
|
|
212
|
-
o.xKeys = c[s.value] ? K.intersection(c[s.value], f) : f, o.yKeys = c[n.value] ? K.intersection(c[n.value], L) : L, S.forEach((j) => {
|
|
213
|
-
e.facets[a].xKeysByGroups[j] = K.intersection(
|
|
214
|
-
o.xKeys,
|
|
215
|
-
e.facets[a].xKeysByGroups[j]
|
|
216
|
-
);
|
|
217
|
-
}), z.forEach((j) => {
|
|
218
|
-
e.facets[a].yKeysByGroups[j] = K.intersection(
|
|
219
|
-
o.yKeys,
|
|
220
|
-
e.facets[a].yKeysByGroups[j]
|
|
221
|
-
);
|
|
222
|
-
});
|
|
223
|
-
}), ie(e, D, R, U, B), re(e, G), e.meta.xKeysByGroups = e.meta.xGroupKeys.reduce((a, o) => {
|
|
224
|
-
const f = Q(K.uniq(
|
|
225
|
-
K.flatten(e.meta.facetKeys.map((L) => e.facets[L].xKeysByGroups[o]))
|
|
226
|
-
), V.sorting, e.meta.xLabels);
|
|
227
|
-
return a[o] = c[s.value] ? K.intersection(c[s.value], f) : f, a;
|
|
228
|
-
}, {}), e.meta.yKeysByGroups = e.meta.yGroupKeys.reduce((a, o) => {
|
|
229
|
-
const f = Q(K.uniq(
|
|
230
|
-
K.flatten(e.meta.facetKeys.map((L) => e.facets[L].yKeysByGroups[o]))
|
|
231
|
-
), d.sorting, e.meta.yLabels);
|
|
232
|
-
return a[o] = c[n.value] ? K.intersection(c[n.value], f) : f, a;
|
|
233
|
-
}, {}), e.meta.valueExtent[0] === 1 / 0 && (e.meta.valueExtent[0] = 0), e.meta.valueExtent[1] === -1 / 0 && (e.meta.valueExtent[1] = 0), e;
|
|
27
|
+
function B(a, y, s, t, u, r, o, l, n, p, K, c, f, x, G, i) {
|
|
28
|
+
const e = d();
|
|
29
|
+
return b(
|
|
30
|
+
e,
|
|
31
|
+
a,
|
|
32
|
+
y,
|
|
33
|
+
s,
|
|
34
|
+
t,
|
|
35
|
+
u,
|
|
36
|
+
r,
|
|
37
|
+
o,
|
|
38
|
+
l,
|
|
39
|
+
n,
|
|
40
|
+
p,
|
|
41
|
+
{ dataSource: K },
|
|
42
|
+
c,
|
|
43
|
+
f,
|
|
44
|
+
x,
|
|
45
|
+
G,
|
|
46
|
+
i
|
|
47
|
+
), e;
|
|
234
48
|
}
|
|
235
49
|
export {
|
|
236
|
-
|
|
50
|
+
B as getCells
|
|
237
51
|
};
|
|
238
52
|
//# sourceMappingURL=getCells.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCells.js","sources":["../../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","x","y","xLabelsSourceValue","yLabelsSourceValue","isA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cY,CAAS,CAAC,CAAC;AAAA,IAAA,GACvG8B,EAAM,SAAS1D,EAAO,KAAK,OAAO;AACrC,WAAAV,EAAIsC,CAAS,IAAI6B,EAAUT,EAAQ,KAAK,IAAI8B,EAAO,aAAarB,EAAUT,EAAQ,KAAK,GAAG2C,CAAa,IAAIA,GACpGrG;AAAA,EACX,GAAG,CAAA,CAAE,GACLU,EAAO,KAAK,gBAAgBA,EAAO,KAAK,WAAW,OAAO,CAACV,GAA+BuC,MAAc;AACpG,UAAM+D,IAAgBvF,EAAayE,EAAO;AAAA,MACtCA,EAAO,QAAQ9E,EAAO,KAAK,UAAU,IAAI,CAAAgB,MAAYhB,EAAO,OAAOgB,CAAQ,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,GAAG2C,CAAa,IAAIA,GACpGtG;AAAA,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;"}
|
|
1
|
+
{"version":3,"file":"getCells.js","sources":["../../src/heatmap/getCells.ts"],"sourcesContent":["import type { DataFrame } from '../DataFrame';\nimport type { ColumnName } from '../types';\nimport type { HeatmapSettingsImpl } from './HeatmapSettingsImpl';\nimport type { Cell, GroupedCellsData } from './fillCellsData';\nimport { fillCellsData } from './fillCellsData';\n\nexport type CellHeatmap = Cell<'dataSource'>\nexport type GroupedCellsHeatmap = GroupedCellsData<'dataSource'>;\n\nfunction createEmptyGroupedCells(): GroupedCellsHeatmap {\n return {\n meta: {\n valueSources: ['dataSource'],\n facetKeys: [],\n xKeys: [],\n yKeys: [],\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: { dataSource: [Infinity, -Infinity] },\n },\n facets: {},\n };\n}\n\nexport function getCells(\n data: DataFrame,\n xColumn: ColumnName,\n yColumn: ColumnName,\n valueColumns: Record<string, 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): GroupedCellsHeatmap {\n const result: GroupedCellsHeatmap = createEmptyGroupedCells();\n fillCellsData(\n result,\n data,\n xColumn, yColumn, valueColumns,\n facetBy, xGroupBy, yGroupBy,\n annotations,\n dendrogramX, dendrogramY,\n {dataSource: normalization},\n NAValueAs,\n keysOrder,\n xAxis,\n yAxis,\n aggregation\n );\n return result;\n}\n"],"names":["createEmptyGroupedCells","getCells","data","xColumn","yColumn","valueColumns","facetBy","xGroupBy","yGroupBy","annotations","dendrogramX","dendrogramY","normalization","NAValueAs","keysOrder","xAxis","yAxis","aggregation","result","fillCellsData"],"mappings":";AASA,SAASA,IAA+C;AACpD,SAAO;AAAA,IACH,MAAM;AAAA,MACF,cAAc,CAAC,YAAY;AAAA,MAC3B,WAAW,CAAA;AAAA,MACX,OAAO,CAAA;AAAA,MACP,OAAO,CAAA;AAAA,MACP,YAAY,CAAA;AAAA,MACZ,YAAY,CAAA;AAAA,MACZ,eAAe,CAAA;AAAA,MACf,eAAe,CAAA;AAAA,MACf,SAAS,CAAA;AAAA,MACT,SAAS,CAAA;AAAA,MACT,cAAc,CAAA;AAAA,MACd,cAAc,CAAA;AAAA,MACd,aAAa,CAAA;AAAA,MACb,aAAa,CAAA;AAAA,MACb,gBAAgB,CAAA;AAAA,MAChB,iBAAiB,CAAA;AAAA,MACjB,iBAAiB,CAAA;AAAA,MACjB,aAAa,EAAE,YAAY,CAAC,OAAU,MAAS,EAAA;AAAA,IAAE;AAAA,IAErD,QAAQ,CAAA;AAAA,EAAC;AAEjB;AAEO,SAASC,EACZC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACAC,GACmB;AACnB,QAAMC,IAA8BlB,EAAA;AACpC,SAAAmB;AAAA,IACID;AAAA,IACAhB;AAAA,IACAC;AAAA,IAASC;AAAA,IAASC;AAAA,IAClBC;AAAA,IAASC;AAAA,IAAUC;AAAA,IACnBC;AAAA,IACAC;AAAA,IAAaC;AAAA,IACb,EAAC,YAAYC,EAAA;AAAA,IACbC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,IACAC;AAAA,EAAA,GAEGC;AACX;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Cluster } from './components/types';
|
|
2
|
-
import {
|
|
2
|
+
import { GroupedCellsHeatmap } from './getCells';
|
|
3
3
|
import { HeatmapSettingsImpl } from './HeatmapSettingsImpl';
|
|
4
4
|
import { HierarchyNode } from 'd3-hierarchy';
|
|
5
5
|
export type DendrogramsData = Record<string, {
|
|
6
6
|
hierarchyByGroupX: Record<string, HierarchyNode<Cluster>>;
|
|
7
7
|
hierarchyByGroupY: Record<string, HierarchyNode<Cluster>>;
|
|
8
8
|
}>;
|
|
9
|
-
export declare function getDendrograms(groupedCellsData:
|
|
9
|
+
export declare function getDendrograms(groupedCellsData: GroupedCellsHeatmap, dendrogramX: HeatmapSettingsImpl['dendrogramX'], dendrogramY: HeatmapSettingsImpl['dendrogramY'], facetSettings: HeatmapSettingsImpl['facetSettings']): DendrogramsData;
|
|
10
10
|
//# sourceMappingURL=getDendrograms.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDendrograms.d.ts","sourceRoot":"","sources":["../../src/heatmap/getDendrograms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"getDendrograms.d.ts","sourceRoot":"","sources":["../../src/heatmap/getDendrograms.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAGlD,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE;IACzC,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1D,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;CAC7D,CAAC,CAAA;AAIF,wBAAgB,cAAc,CAC1B,gBAAgB,EAAE,mBAAmB,EACrC,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAAC,EAC/C,aAAa,EAAE,mBAAmB,CAAC,eAAe,CAAC,GACpD,eAAe,CAwEjB"}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { getClustersApproximate as K } from "./getClusters.js";
|
|
2
2
|
import m from "../node_modules/d3-hierarchy/src/hierarchy/index.js";
|
|
3
|
-
function b(t,
|
|
3
|
+
function b(t, r, p, B) {
|
|
4
4
|
const { facetKeys: G, xGroupKeys: w, yGroupKeys: E } = t.meta, x = {};
|
|
5
|
-
if (
|
|
5
|
+
if (r && B.sharedX)
|
|
6
6
|
throw Error("Dendrogram on X axis is not available with shared by facets X axis");
|
|
7
7
|
return G.forEach((c) => {
|
|
8
8
|
const u = {
|
|
9
9
|
hierarchyByGroupX: {},
|
|
10
10
|
hierarchyByGroupY: {}
|
|
11
11
|
}, o = t.facets[c];
|
|
12
|
-
if (
|
|
13
|
-
const
|
|
12
|
+
if (r) {
|
|
13
|
+
const y = [];
|
|
14
14
|
w.forEach((s) => {
|
|
15
|
-
const
|
|
16
|
-
|
|
15
|
+
const i = o.xKeysByGroups[s], f = o.yKeys, a = K(
|
|
16
|
+
i.map((e) => f.map((l) => {
|
|
17
17
|
var h;
|
|
18
|
-
return ((h = o.cells[e][l]) == null ? void 0 : h.normalizedValue) ??
|
|
18
|
+
return ((h = o.cells[e][l]) == null ? void 0 : h.normalizedValue.dataSource) ?? r.fillNA;
|
|
19
19
|
})),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
),
|
|
23
|
-
t.facets[c].xKeysByGroups[s] =
|
|
24
|
-
}), t.facets[c].xKeys =
|
|
20
|
+
r.distance,
|
|
21
|
+
r.linkage
|
|
22
|
+
), n = a.indexes.map((e) => i[e]);
|
|
23
|
+
t.facets[c].xKeysByGroups[s] = n, y.push(...n), u.hierarchyByGroupX[s] = m(a);
|
|
24
|
+
}), t.facets[c].xKeys = y;
|
|
25
25
|
}
|
|
26
26
|
if (p) {
|
|
27
|
-
const
|
|
27
|
+
const y = [];
|
|
28
28
|
E.forEach((s) => {
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const i = o.yKeysByGroups[s], f = o.xKeys, a = K(
|
|
30
|
+
i.map((e) => f.map((l) => {
|
|
31
31
|
var h;
|
|
32
|
-
return ((h = o.cells[l][e]) == null ? void 0 : h.normalizedValue) ?? p.fillNA;
|
|
32
|
+
return ((h = o.cells[l][e]) == null ? void 0 : h.normalizedValue.dataSource) ?? p.fillNA;
|
|
33
33
|
})),
|
|
34
34
|
p.distance,
|
|
35
35
|
p.linkage
|
|
36
|
-
),
|
|
37
|
-
t.facets[c].yKeysByGroups[s] =
|
|
38
|
-
}), t.facets[c].yKeys =
|
|
36
|
+
), n = a.indexes.map((e) => i[e]);
|
|
37
|
+
t.facets[c].yKeysByGroups[s] = n, y.push(...n), u.hierarchyByGroupY[s] = m(a);
|
|
38
|
+
}), t.facets[c].yKeys = y;
|
|
39
39
|
}
|
|
40
40
|
x[c] = u;
|
|
41
41
|
}), x;
|