@haniffalab/cherita-react 1.4.1-dev.2025-10-23.e95b5a90 → 1.4.1-dev.2025-10-23.55fbe6ff
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/README.md +1 -1
- package/dist/cjs/components/controls/Controls.js +4 -4
- package/dist/cjs/components/dotplot/Dotplot.js +8 -8
- package/dist/cjs/components/dotplot/DotplotControls.js +5 -5
- package/dist/cjs/components/full-page/FullPage.js +1 -2
- package/dist/cjs/components/full-page/PlotAlert.js +1 -1
- package/dist/cjs/components/full-page/PlotTypeSelector.js +13 -13
- package/dist/cjs/components/heatmap/Heatmap.js +7 -7
- package/dist/cjs/components/icons/DotPlotIcon.js +1 -1
- package/dist/cjs/components/icons/HeatmapIcon.js +1 -1
- package/dist/cjs/components/icons/MatrixPlotIcon.1.js +1 -1
- package/dist/cjs/components/icons/MatrixPlotIcon.js +1 -1
- package/dist/cjs/components/icons/ScatterplotIcon.1.js +1 -1
- package/dist/cjs/components/icons/ScatterplotIcon.js +1 -1
- package/dist/cjs/components/icons/ViolinPlotIcon.js +1 -1
- package/dist/cjs/components/matrixplot/Matrixplot.js +7 -7
- package/dist/cjs/components/obs-list/ObsItem.js +19 -19
- package/dist/cjs/components/obs-list/ObsList.js +17 -17
- package/dist/cjs/components/obsm-list/ObsmList.js +7 -7
- package/dist/cjs/components/pseudospatial/Pseudospatial.js +16 -16
- package/dist/cjs/components/pseudospatial/PseudospatialToolbar.js +10 -10
- package/dist/cjs/components/scatterplot/Scatterplot.js +16 -16
- package/dist/cjs/components/scatterplot/ScatterplotControls.js +1 -1
- package/dist/cjs/components/scatterplot/SpatialControls.js +9 -9
- package/dist/cjs/components/scatterplot/Toolbox.js +4 -4
- package/dist/cjs/components/search-bar/SearchBar.js +14 -14
- package/dist/cjs/components/search-bar/SearchInfo.js +3 -3
- package/dist/cjs/components/search-bar/SearchResults.js +2 -2
- package/dist/cjs/components/toolbar/Toolbar.js +3 -3
- package/dist/cjs/components/var-list/VarItem.js +15 -15
- package/dist/cjs/components/var-list/VarList.js +5 -5
- package/dist/cjs/components/var-list/VarListToolbar.js +4 -4
- package/dist/cjs/components/var-list/VarSet.js +13 -13
- package/dist/cjs/components/violin/Violin.js +10 -10
- package/dist/cjs/constants/colorscales.js +19 -19
- package/dist/cjs/constants/constants.js +47 -47
- package/dist/cjs/context/DatasetContext.js +3 -3
- package/dist/cjs/context/FilterContext.js +2 -2
- package/dist/cjs/context/SettingsContext.js +57 -57
- package/dist/cjs/helpers/color-helper.js +2 -2
- package/dist/cjs/helpers/zarr-helper.js +3 -3
- package/dist/cjs/utils/Filter.js +1 -1
- package/dist/cjs/utils/Histogram.js +2 -2
- package/dist/cjs/utils/ImageViewer.js +2 -2
- package/dist/cjs/utils/Legend.js +1 -1
- package/dist/cjs/utils/LoadingIndicators.js +1 -1
- package/dist/cjs/utils/Resolver.js +7 -7
- package/dist/cjs/utils/Skeleton.js +1 -1
- package/dist/cjs/utils/StyledTooltip.js +5 -5
- package/dist/cjs/utils/VirtualizedList.js +7 -7
- package/dist/cjs/utils/errors.js +15 -15
- package/dist/cjs/utils/requests.js +5 -5
- package/dist/cjs/utils/search.js +4 -4
- package/dist/cjs/utils/string.js +6 -6
- package/dist/cjs/utils/zarrData.js +5 -5
- package/dist/css/cherita.css +21 -20
- package/dist/css/cherita.css.map +1 -1
- package/dist/esm/components/controls/Controls.js +9 -9
- package/dist/esm/components/dotplot/Dotplot.js +21 -21
- package/dist/esm/components/dotplot/DotplotControls.js +9 -9
- package/dist/esm/components/full-page/FullPage.js +22 -23
- package/dist/esm/components/full-page/PlotAlert.js +5 -5
- package/dist/esm/components/full-page/PlotTypeSelector.js +21 -21
- package/dist/esm/components/heatmap/Heatmap.js +20 -20
- package/dist/esm/components/heatmap/HeatmapControls.js +2 -2
- package/dist/esm/components/icons/DotPlotIcon.js +1 -1
- package/dist/esm/components/icons/HeatmapIcon.js +1 -1
- package/dist/esm/components/icons/MatrixPlotIcon.1.js +1 -1
- package/dist/esm/components/icons/MatrixPlotIcon.js +1 -1
- package/dist/esm/components/icons/ScatterplotIcon.1.js +1 -1
- package/dist/esm/components/icons/ScatterplotIcon.js +1 -1
- package/dist/esm/components/icons/ViolinPlotIcon.js +1 -1
- package/dist/esm/components/matrixplot/Matrixplot.js +20 -20
- package/dist/esm/components/matrixplot/MatrixplotControls.js +2 -2
- package/dist/esm/components/obs-list/ObsItem.js +37 -37
- package/dist/esm/components/obs-list/ObsList.js +34 -34
- package/dist/esm/components/obs-list/ObsToolbar.js +1 -1
- package/dist/esm/components/obsm-list/ObsmList.js +15 -15
- package/dist/esm/components/offcanvas/index.js +6 -6
- package/dist/esm/components/pseudospatial/Pseudospatial.js +31 -31
- package/dist/esm/components/pseudospatial/PseudospatialToolbar.js +17 -17
- package/dist/esm/components/scatterplot/Scatterplot.js +38 -38
- package/dist/esm/components/scatterplot/ScatterplotControls.js +9 -9
- package/dist/esm/components/scatterplot/SpatialControls.js +23 -23
- package/dist/esm/components/scatterplot/Toolbox.js +7 -7
- package/dist/esm/components/search-bar/SearchBar.js +27 -27
- package/dist/esm/components/search-bar/SearchInfo.js +14 -14
- package/dist/esm/components/search-bar/SearchResults.js +10 -10
- package/dist/esm/components/toolbar/Toolbar.js +6 -6
- package/dist/esm/components/var-list/VarItem.js +27 -27
- package/dist/esm/components/var-list/VarList.js +21 -21
- package/dist/esm/components/var-list/VarListToolbar.js +10 -10
- package/dist/esm/components/var-list/VarSet.js +22 -22
- package/dist/esm/components/violin/Violin.js +26 -26
- package/dist/esm/components/violin/ViolinControls.js +2 -2
- package/dist/esm/constants/colorscales.js +19 -19
- package/dist/esm/constants/constants.js +47 -47
- package/dist/esm/context/DatasetContext.js +11 -11
- package/dist/esm/context/FilterContext.js +3 -3
- package/dist/esm/context/SettingsContext.js +61 -61
- package/dist/esm/context/ZarrDataContext.js +3 -3
- package/dist/esm/helpers/color-helper.js +5 -5
- package/dist/esm/helpers/map-helper.js +2 -2
- package/dist/esm/helpers/zarr-helper.js +6 -6
- package/dist/esm/index.js +22 -22
- package/dist/esm/utils/Filter.js +8 -8
- package/dist/esm/utils/Histogram.js +6 -6
- package/dist/esm/utils/ImageViewer.js +4 -4
- package/dist/esm/utils/Legend.js +9 -9
- package/dist/esm/utils/LoadingIndicators.js +2 -2
- package/dist/esm/utils/Resolver.js +13 -13
- package/dist/esm/utils/Skeleton.js +2 -2
- package/dist/esm/utils/StyledTooltip.js +6 -6
- package/dist/esm/utils/VirtualizedList.js +9 -9
- package/dist/esm/utils/errors.js +15 -15
- package/dist/esm/utils/requests.js +8 -8
- package/dist/esm/utils/search.js +7 -7
- package/dist/esm/utils/string.js +7 -7
- package/dist/esm/utils/zarrData.js +13 -13
- package/package.json +11 -7
- package/scss/cherita-bootstrap.scss +2 -2
- package/scss/cherita.scss +24 -17
- package/scss/components/accordions.scss +4 -1
- package/scss/components/layouts.scss +13 -12
- package/scss/components/lists.scss +8 -4
- package/scss/components/plotly.scss +1 -0
|
@@ -3,40 +3,40 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
import { useState } from
|
|
7
|
-
import { PLOT_TYPES } from
|
|
8
|
-
import { StyledTooltip } from
|
|
9
|
-
import DotPlotIcon from
|
|
10
|
-
import HeatmapIcon from
|
|
11
|
-
import MatrixPlotIcon from
|
|
12
|
-
import ScatterplotIcon from
|
|
13
|
-
import ViolinPlotIcon from
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import { PLOT_TYPES } from '../../constants/constants';
|
|
8
|
+
import { StyledTooltip } from '../../utils/StyledTooltip';
|
|
9
|
+
import DotPlotIcon from '../icons/DotPlotIcon';
|
|
10
|
+
import HeatmapIcon from '../icons/HeatmapIcon';
|
|
11
|
+
import MatrixPlotIcon from '../icons/MatrixPlotIcon';
|
|
12
|
+
import ScatterplotIcon from '../icons/ScatterplotIcon';
|
|
13
|
+
import ViolinPlotIcon from '../icons/ViolinPlotIcon';
|
|
14
14
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
const plotTypes = [{
|
|
16
16
|
type: PLOT_TYPES.SCATTERPLOT,
|
|
17
17
|
icon: ScatterplotIcon,
|
|
18
|
-
name:
|
|
19
|
-
description:
|
|
18
|
+
name: 'Scatterplot',
|
|
19
|
+
description: 'Displays cells in 2D based on dimensionality reduction.'
|
|
20
20
|
}, {
|
|
21
21
|
type: PLOT_TYPES.MATRIXPLOT,
|
|
22
22
|
icon: MatrixPlotIcon,
|
|
23
|
-
name:
|
|
24
|
-
description:
|
|
23
|
+
name: 'Matrix Plot',
|
|
24
|
+
description: 'Shows expression values of genes across categories.'
|
|
25
25
|
}, {
|
|
26
26
|
type: PLOT_TYPES.DOTPLOT,
|
|
27
27
|
icon: DotPlotIcon,
|
|
28
|
-
name:
|
|
29
|
-
description:
|
|
28
|
+
name: 'Dot Plot',
|
|
29
|
+
description: 'Shows proportion and expression of genes across groups.'
|
|
30
30
|
}, {
|
|
31
31
|
type: PLOT_TYPES.HEATMAP,
|
|
32
32
|
icon: HeatmapIcon,
|
|
33
|
-
name:
|
|
34
|
-
description:
|
|
33
|
+
name: 'Heatmap',
|
|
34
|
+
description: 'Visualises gene expression or feature activity as a colour-coded matrix.'
|
|
35
35
|
}, {
|
|
36
36
|
type: PLOT_TYPES.VIOLINPLOT,
|
|
37
37
|
icon: ViolinPlotIcon,
|
|
38
|
-
name:
|
|
39
|
-
description:
|
|
38
|
+
name: 'Violin Plot',
|
|
39
|
+
description: 'Displays distribution of gene expression across categories.'
|
|
40
40
|
}];
|
|
41
41
|
export function PlotTypeSelector(_ref) {
|
|
42
42
|
let {
|
|
@@ -61,7 +61,7 @@ export function PlotTypeSelector(_ref) {
|
|
|
61
61
|
} = _ref2;
|
|
62
62
|
const isActive = currentType === type;
|
|
63
63
|
const hovered = hoveredMap[type] || false;
|
|
64
|
-
const colour = isActive ?
|
|
64
|
+
const colour = isActive ? '#005a86' : hovered ? '#0071a7' : '#000';
|
|
65
65
|
return /*#__PURE__*/_jsx(StyledTooltip, {
|
|
66
66
|
title: /*#__PURE__*/_jsxs(_Fragment, {
|
|
67
67
|
children: [/*#__PURE__*/_jsx("strong", {
|
|
@@ -72,7 +72,7 @@ export function PlotTypeSelector(_ref) {
|
|
|
72
72
|
slotProps: {
|
|
73
73
|
popper: {
|
|
74
74
|
modifiers: [{
|
|
75
|
-
name:
|
|
75
|
+
name: 'offset',
|
|
76
76
|
options: {
|
|
77
77
|
offset: [0, -12]
|
|
78
78
|
}
|
|
@@ -83,7 +83,7 @@ export function PlotTypeSelector(_ref) {
|
|
|
83
83
|
onMouseEnter: () => handleMouseEnter(type),
|
|
84
84
|
onMouseLeave: () => handleMouseLeave(type),
|
|
85
85
|
onClick: () => onChange(type),
|
|
86
|
-
className: "plotselector-icon".concat(isActive ?
|
|
86
|
+
className: "plotselector-icon".concat(isActive ? ' active' : ''),
|
|
87
87
|
children: /*#__PURE__*/_jsx(Icon, {
|
|
88
88
|
size: 34,
|
|
89
89
|
colour: colour
|
|
@@ -3,19 +3,19 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from
|
|
7
|
-
import _ from
|
|
8
|
-
import { Button } from
|
|
9
|
-
import Plot from
|
|
10
|
-
import { PLOTLY_MODEBAR_BUTTONS } from
|
|
11
|
-
import { useDataset } from
|
|
12
|
-
import { useFilteredData } from
|
|
13
|
-
import { useSettings } from
|
|
14
|
-
import { LoadingSpinner } from
|
|
15
|
-
import { useDebouncedFetch } from
|
|
16
|
-
import { useSelectedMultiVar, useSelectedObs } from
|
|
17
|
-
import { PlotAlert } from
|
|
18
|
-
import { ControlsPlotlyToolbar, ObsPlotlyToolbar, VarPlotlyToolbar } from
|
|
6
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import _ from 'lodash';
|
|
8
|
+
import { Button } from 'react-bootstrap';
|
|
9
|
+
import Plot from 'react-plotly.js';
|
|
10
|
+
import { PLOTLY_MODEBAR_BUTTONS } from '../../constants/constants';
|
|
11
|
+
import { useDataset } from '../../context/DatasetContext';
|
|
12
|
+
import { useFilteredData } from '../../context/FilterContext';
|
|
13
|
+
import { useSettings } from '../../context/SettingsContext';
|
|
14
|
+
import { LoadingSpinner } from '../../utils/LoadingIndicators';
|
|
15
|
+
import { useDebouncedFetch } from '../../utils/requests';
|
|
16
|
+
import { useSelectedMultiVar, useSelectedObs } from '../../utils/Resolver';
|
|
17
|
+
import { PlotAlert } from '../full-page/PlotAlert';
|
|
18
|
+
import { ControlsPlotlyToolbar, ObsPlotlyToolbar, VarPlotlyToolbar } from '../toolbar/Toolbar';
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export function Heatmap(_ref) {
|
|
21
21
|
let {
|
|
@@ -28,7 +28,7 @@ export function Heatmap(_ref) {
|
|
|
28
28
|
plotType,
|
|
29
29
|
setPlotType
|
|
30
30
|
} = _ref;
|
|
31
|
-
const ENDPOINT =
|
|
31
|
+
const ENDPOINT = 'heatmap';
|
|
32
32
|
const dataset = useDataset();
|
|
33
33
|
const settings = useSettings();
|
|
34
34
|
const {
|
|
@@ -106,8 +106,8 @@ export function Heatmap(_ref) {
|
|
|
106
106
|
layout: layout,
|
|
107
107
|
useResizeHandler: true,
|
|
108
108
|
style: {
|
|
109
|
-
width:
|
|
110
|
-
height:
|
|
109
|
+
width: '100%',
|
|
110
|
+
height: '100%'
|
|
111
111
|
},
|
|
112
112
|
config: {
|
|
113
113
|
displaylogo: false,
|
|
@@ -123,17 +123,17 @@ export function Heatmap(_ref) {
|
|
|
123
123
|
setPlotType: setPlotType,
|
|
124
124
|
children: /*#__PURE__*/_jsxs("p", {
|
|
125
125
|
className: "p-0 m-0",
|
|
126
|
-
children: ["Select one or more",
|
|
126
|
+
children: ["Select one or more", ' ', showVarsBtn ? /*#__PURE__*/_jsx(Button, {
|
|
127
127
|
variant: "link",
|
|
128
128
|
className: "border-0 p-0 align-baseline",
|
|
129
129
|
onClick: setShowVars,
|
|
130
130
|
children: "features"
|
|
131
|
-
}) :
|
|
131
|
+
}) : 'features', ' ', "to display their expression, then choose a", ' ', showObsBtn ? /*#__PURE__*/_jsx(Button, {
|
|
132
132
|
variant: "link",
|
|
133
133
|
className: "border-0 p-0 align-baseline",
|
|
134
134
|
onClick: setShowObs,
|
|
135
135
|
children: "category"
|
|
136
|
-
}) :
|
|
136
|
+
}) : 'category', ' ', "to group observations in the heatmap."]
|
|
137
137
|
})
|
|
138
138
|
});
|
|
139
139
|
} else {
|
|
@@ -142,7 +142,7 @@ export function Heatmap(_ref) {
|
|
|
142
142
|
heading: "Error displaying the heatmap",
|
|
143
143
|
plotType: plotType,
|
|
144
144
|
setPlotType: setPlotType,
|
|
145
|
-
children: serverError.message ||
|
|
145
|
+
children: serverError.message || 'An unexpected error occurred while generating the plot.'
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Form } from
|
|
2
|
-
import { ColorscaleSelect } from
|
|
1
|
+
import { Form } from 'react-bootstrap';
|
|
2
|
+
import { ColorscaleSelect } from '../controls/Controls';
|
|
3
3
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
4
|
export function HeatmapControls() {
|
|
5
5
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
@@ -10,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
export default function DotPlotIcon(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
size = 40,
|
|
13
|
-
colour =
|
|
13
|
+
colour = '#000',
|
|
14
14
|
gap = 20
|
|
15
15
|
} = _ref,
|
|
16
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -10,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
export default function HeatmapIcon(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
size = 40,
|
|
13
|
-
colour =
|
|
13
|
+
colour = '#000',
|
|
14
14
|
gap = 1
|
|
15
15
|
} = _ref,
|
|
16
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -10,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
export default function MatrixPlotIcon(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
size = 40,
|
|
13
|
-
colour =
|
|
13
|
+
colour = '#000',
|
|
14
14
|
gap = 2
|
|
15
15
|
} = _ref,
|
|
16
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -10,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
export default function MatrixPlotIcon(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
size = 40,
|
|
13
|
-
colour =
|
|
13
|
+
colour = '#000',
|
|
14
14
|
gap = 2
|
|
15
15
|
} = _ref,
|
|
16
16
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -10,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
export default function ScatterplotIcon(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
size = 40,
|
|
13
|
-
colour =
|
|
13
|
+
colour = '#000'
|
|
14
14
|
} = _ref,
|
|
15
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
16
|
// Points with cluster assignments
|
|
@@ -10,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
export default function ScatterplotIcon(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
size = 40,
|
|
13
|
-
colour =
|
|
13
|
+
colour = '#000'
|
|
14
14
|
} = _ref,
|
|
15
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
16
|
// Points with cluster assignments
|
|
@@ -10,7 +10,7 @@ function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t =
|
|
|
10
10
|
export default function ViolinPlotIcon(_ref) {
|
|
11
11
|
let {
|
|
12
12
|
size = 40,
|
|
13
|
-
colour =
|
|
13
|
+
colour = '#000'
|
|
14
14
|
} = _ref,
|
|
15
15
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
16
|
return /*#__PURE__*/_jsx("svg", _objectSpread(_objectSpread({
|
|
@@ -3,19 +3,19 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from
|
|
7
|
-
import _ from
|
|
8
|
-
import { Button } from
|
|
9
|
-
import Plot from
|
|
10
|
-
import { PLOTLY_MODEBAR_BUTTONS } from
|
|
11
|
-
import { useDataset } from
|
|
12
|
-
import { useFilteredData } from
|
|
13
|
-
import { useSettings } from
|
|
14
|
-
import { LoadingSpinner } from
|
|
15
|
-
import { useDebouncedFetch } from
|
|
16
|
-
import { useSelectedMultiVar, useSelectedObs } from
|
|
17
|
-
import { PlotAlert } from
|
|
18
|
-
import { ControlsPlotlyToolbar, ObsPlotlyToolbar, VarPlotlyToolbar } from
|
|
6
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import _ from 'lodash';
|
|
8
|
+
import { Button } from 'react-bootstrap';
|
|
9
|
+
import Plot from 'react-plotly.js';
|
|
10
|
+
import { PLOTLY_MODEBAR_BUTTONS } from '../../constants/constants';
|
|
11
|
+
import { useDataset } from '../../context/DatasetContext';
|
|
12
|
+
import { useFilteredData } from '../../context/FilterContext';
|
|
13
|
+
import { useSettings } from '../../context/SettingsContext';
|
|
14
|
+
import { LoadingSpinner } from '../../utils/LoadingIndicators';
|
|
15
|
+
import { useDebouncedFetch } from '../../utils/requests';
|
|
16
|
+
import { useSelectedMultiVar, useSelectedObs } from '../../utils/Resolver';
|
|
17
|
+
import { PlotAlert } from '../full-page/PlotAlert';
|
|
18
|
+
import { ControlsPlotlyToolbar, ObsPlotlyToolbar, VarPlotlyToolbar } from '../toolbar/Toolbar';
|
|
19
19
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
20
|
export function Matrixplot(_ref) {
|
|
21
21
|
let {
|
|
@@ -28,7 +28,7 @@ export function Matrixplot(_ref) {
|
|
|
28
28
|
plotType,
|
|
29
29
|
setPlotType
|
|
30
30
|
} = _ref;
|
|
31
|
-
const ENDPOINT =
|
|
31
|
+
const ENDPOINT = 'matrixplot';
|
|
32
32
|
const dataset = useDataset();
|
|
33
33
|
const settings = useSettings();
|
|
34
34
|
const {
|
|
@@ -107,8 +107,8 @@ export function Matrixplot(_ref) {
|
|
|
107
107
|
layout: layout,
|
|
108
108
|
useResizeHandler: true,
|
|
109
109
|
style: {
|
|
110
|
-
width:
|
|
111
|
-
height:
|
|
110
|
+
width: '100%',
|
|
111
|
+
height: '100%'
|
|
112
112
|
},
|
|
113
113
|
config: {
|
|
114
114
|
displaylogo: false,
|
|
@@ -124,17 +124,17 @@ export function Matrixplot(_ref) {
|
|
|
124
124
|
setPlotType: setPlotType,
|
|
125
125
|
children: /*#__PURE__*/_jsxs("p", {
|
|
126
126
|
className: "p-0 m-0",
|
|
127
|
-
children: ["Select a",
|
|
127
|
+
children: ["Select a", ' ', showObsBtn ? /*#__PURE__*/_jsx(Button, {
|
|
128
128
|
variant: "link",
|
|
129
129
|
className: "border-0 p-0 align-baseline",
|
|
130
130
|
onClick: setShowObs,
|
|
131
131
|
children: "category"
|
|
132
|
-
}) :
|
|
132
|
+
}) : 'category', ' ', "to group observations, then choose one or more", ' ', showVarsBtn ? /*#__PURE__*/_jsx(Button, {
|
|
133
133
|
variant: "link",
|
|
134
134
|
className: "border-0 p-0 align-baseline",
|
|
135
135
|
onClick: setShowVars,
|
|
136
136
|
children: "features"
|
|
137
|
-
}) :
|
|
137
|
+
}) : 'features', ' ', "to display the matrix plot."]
|
|
138
138
|
})
|
|
139
139
|
});
|
|
140
140
|
} else {
|
|
@@ -143,7 +143,7 @@ export function Matrixplot(_ref) {
|
|
|
143
143
|
heading: "Error displaying the matrix plot",
|
|
144
144
|
plotType: plotType,
|
|
145
145
|
setPlotType: setPlotType,
|
|
146
|
-
children: serverError.message ||
|
|
146
|
+
children: serverError.message || 'An unexpected error occurred while generating the plot.'
|
|
147
147
|
});
|
|
148
148
|
}
|
|
149
149
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Form } from
|
|
2
|
-
import { ColorscaleSelect, ScaleSelect } from
|
|
1
|
+
import { Form } from 'react-bootstrap';
|
|
2
|
+
import { ColorscaleSelect, ScaleSelect } from '../controls/Controls';
|
|
3
3
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
4
|
export function MatrixplotControls() {
|
|
5
5
|
return /*#__PURE__*/_jsx(_Fragment, {
|
|
@@ -3,24 +3,24 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
3
3
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
4
4
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
|
-
import { useCallback, useEffect, useMemo, useState } from
|
|
7
|
-
import { Tooltip } from
|
|
8
|
-
import { Gauge, SparkLineChart } from
|
|
9
|
-
import _ from
|
|
10
|
-
import { Badge, Form, ListGroup } from
|
|
11
|
-
import { ObsToolbar } from
|
|
12
|
-
import { COLOR_ENCODINGS, OBS_TYPES } from
|
|
13
|
-
import { useDataset } from
|
|
14
|
-
import { useFilteredData } from
|
|
15
|
-
import { useSettings } from
|
|
16
|
-
import { useColor } from
|
|
17
|
-
import { Histogram } from
|
|
18
|
-
import { LoadingLinear } from
|
|
19
|
-
import { useFetch } from
|
|
20
|
-
import { useSelectedVar } from
|
|
21
|
-
import { formatNumerical, FORMATS } from
|
|
22
|
-
import { VirtualizedList } from
|
|
23
|
-
import { useObsData } from
|
|
6
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
7
|
+
import { Tooltip } from '@mui/material';
|
|
8
|
+
import { Gauge, SparkLineChart } from '@mui/x-charts';
|
|
9
|
+
import _ from 'lodash';
|
|
10
|
+
import { Badge, Form, ListGroup } from 'react-bootstrap';
|
|
11
|
+
import { ObsToolbar } from './ObsToolbar';
|
|
12
|
+
import { COLOR_ENCODINGS, OBS_TYPES } from '../../constants/constants';
|
|
13
|
+
import { useDataset } from '../../context/DatasetContext';
|
|
14
|
+
import { useFilteredData } from '../../context/FilterContext';
|
|
15
|
+
import { useSettings } from '../../context/SettingsContext';
|
|
16
|
+
import { useColor } from '../../helpers/color-helper';
|
|
17
|
+
import { Histogram } from '../../utils/Histogram';
|
|
18
|
+
import { LoadingLinear } from '../../utils/LoadingIndicators';
|
|
19
|
+
import { useFetch } from '../../utils/requests';
|
|
20
|
+
import { useSelectedVar } from '../../utils/Resolver';
|
|
21
|
+
import { formatNumerical, FORMATS } from '../../utils/string';
|
|
22
|
+
import { VirtualizedList } from '../../utils/VirtualizedList';
|
|
23
|
+
import { useObsData } from '../../utils/zarrData';
|
|
24
24
|
|
|
25
25
|
// const N_BINS = 5;
|
|
26
26
|
|
|
@@ -43,13 +43,13 @@ import { useObsData } from "../../utils/zarrData";
|
|
|
43
43
|
// }
|
|
44
44
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
45
45
|
function getContinuousLabel(code, binEdges) {
|
|
46
|
-
return "[ ".concat(formatNumerical(binEdges[code][0]), ", ").concat(formatNumerical(binEdges[code][1], FORMATS.EXPONENTIAL)).concat(code === binEdges.length - 1 ?
|
|
46
|
+
return "[ ".concat(formatNumerical(binEdges[code][0]), ", ").concat(formatNumerical(binEdges[code][1], FORMATS.EXPONENTIAL)).concat(code === binEdges.length - 1 ? ' ]' : ' )');
|
|
47
47
|
}
|
|
48
48
|
const useObsHistogram = (obs, _ref) => {
|
|
49
49
|
let {
|
|
50
50
|
enabled = true
|
|
51
51
|
} = _ref;
|
|
52
|
-
const ENDPOINT =
|
|
52
|
+
const ENDPOINT = 'obs/histograms';
|
|
53
53
|
const dataset = useDataset();
|
|
54
54
|
const settings = useSettings();
|
|
55
55
|
const {
|
|
@@ -59,7 +59,7 @@ const useObsHistogram = (obs, _ref) => {
|
|
|
59
59
|
const selectedVar = useSelectedVar();
|
|
60
60
|
const [params, setParams] = useState({
|
|
61
61
|
url: dataset.url,
|
|
62
|
-
obsCol: _.omit(obs,
|
|
62
|
+
obsCol: _.omit(obs, 'omit'),
|
|
63
63
|
// avoid re-rendering when toggling unselected obs
|
|
64
64
|
varKey: selectedVar !== null && selectedVar !== void 0 && selectedVar.isSet ? {
|
|
65
65
|
name: selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.name,
|
|
@@ -70,7 +70,7 @@ const useObsHistogram = (obs, _ref) => {
|
|
|
70
70
|
useEffect(() => {
|
|
71
71
|
setParams(p => {
|
|
72
72
|
return _objectSpread(_objectSpread({}, p), {}, {
|
|
73
|
-
obsCol: _.omit(obs,
|
|
73
|
+
obsCol: _.omit(obs, 'omit'),
|
|
74
74
|
varKey: selectedVar !== null && selectedVar !== void 0 && selectedVar.isSet ? {
|
|
75
75
|
name: selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.name,
|
|
76
76
|
indices: selectedVar === null || selectedVar === void 0 ? void 0 : selectedVar.vars.map(v => v.index)
|
|
@@ -188,7 +188,7 @@ function CategoricalItem(_ref2) {
|
|
|
188
188
|
className: "pl-1 m-0",
|
|
189
189
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
190
190
|
title: isSliced ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
191
|
-
children: ["Filtered:",
|
|
191
|
+
children: ["Filtered:", ' ', formatNumerical(filteredStats.pct, FORMATS.EXPONENTIAL), "%", /*#__PURE__*/_jsx("br", {}), "Total: ", formatNumerical(stats.pct, FORMATS.EXPONENTIAL), "%"]
|
|
192
192
|
}) : "".concat(formatNumerical(stats.pct, FORMATS.EXPONENTIAL), "%"),
|
|
193
193
|
placement: "left",
|
|
194
194
|
arrow: true,
|
|
@@ -196,8 +196,8 @@ function CategoricalItem(_ref2) {
|
|
|
196
196
|
className: "d-flex align-items-center",
|
|
197
197
|
children: [/*#__PURE__*/_jsxs(Badge, {
|
|
198
198
|
className: "value-count-badge",
|
|
199
|
-
children: [
|
|
200
|
-
children: [formatNumerical(parseInt(filteredStats.value_counts)),
|
|
199
|
+
children: [' ', isSliced && parseInt(filteredStats.value_counts) !== parseInt(stats.value_counts) && /*#__PURE__*/_jsxs(_Fragment, {
|
|
200
|
+
children: [formatNumerical(parseInt(filteredStats.value_counts)), ' ', "out of", ' ']
|
|
201
201
|
}), formatNumerical(parseInt(stats.value_counts), FORMATS.EXPONENTIAL)]
|
|
202
202
|
}), /*#__PURE__*/_jsx("div", {
|
|
203
203
|
className: "value-pct-gauge-container",
|
|
@@ -206,8 +206,8 @@ function CategoricalItem(_ref2) {
|
|
|
206
206
|
className: "pct-gauge filtered-pct-gauge",
|
|
207
207
|
value: filteredStats.pct,
|
|
208
208
|
text: null,
|
|
209
|
-
innerRadius:
|
|
210
|
-
outerRadius:
|
|
209
|
+
innerRadius: '50%',
|
|
210
|
+
outerRadius: '75%',
|
|
211
211
|
margin: {
|
|
212
212
|
top: 0,
|
|
213
213
|
right: 0,
|
|
@@ -218,7 +218,7 @@ function CategoricalItem(_ref2) {
|
|
|
218
218
|
className: "pct-gauge",
|
|
219
219
|
value: stats.pct,
|
|
220
220
|
text: null,
|
|
221
|
-
innerRadius:
|
|
221
|
+
innerRadius: '75%',
|
|
222
222
|
margin: {
|
|
223
223
|
top: 0,
|
|
224
224
|
right: 0,
|
|
@@ -229,7 +229,7 @@ function CategoricalItem(_ref2) {
|
|
|
229
229
|
}) : /*#__PURE__*/_jsx(Gauge, {
|
|
230
230
|
value: stats.pct,
|
|
231
231
|
text: null,
|
|
232
|
-
innerRadius:
|
|
232
|
+
innerRadius: '50%',
|
|
233
233
|
margin: {
|
|
234
234
|
top: 0,
|
|
235
235
|
right: 0,
|
|
@@ -260,7 +260,7 @@ function CategoricalItem(_ref2) {
|
|
|
260
260
|
grayParams: {
|
|
261
261
|
alpha: 1
|
|
262
262
|
},
|
|
263
|
-
colorEncoding:
|
|
263
|
+
colorEncoding: 'obs'
|
|
264
264
|
}, useUnsColors ? {
|
|
265
265
|
colorscale: colors
|
|
266
266
|
} : {})), ")")
|
|
@@ -350,7 +350,7 @@ function ObsContinuousStats(_ref4) {
|
|
|
350
350
|
let {
|
|
351
351
|
obs
|
|
352
352
|
} = _ref4;
|
|
353
|
-
const ENDPOINT =
|
|
353
|
+
const ENDPOINT = 'obs/distribution';
|
|
354
354
|
const dataset = useDataset();
|
|
355
355
|
const params = {
|
|
356
356
|
url: dataset.url,
|
|
@@ -394,7 +394,7 @@ function ObsContinuousStats(_ref4) {
|
|
|
394
394
|
valueFormatter: v => "".concat(formatNumerical(v, FORMATS.EXPONENTIAL)),
|
|
395
395
|
slotProps: {
|
|
396
396
|
popper: {
|
|
397
|
-
className:
|
|
397
|
+
className: 'feature-histogram-tooltip'
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
})
|
|
@@ -405,28 +405,28 @@ function ObsContinuousStats(_ref4) {
|
|
|
405
405
|
className: "d-flex justify-content-between",
|
|
406
406
|
children: [/*#__PURE__*/_jsx("span", {
|
|
407
407
|
children: "Min"
|
|
408
|
-
}),
|
|
408
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
409
409
|
children: formatNumerical(obs.min, FORMATS.EXPONENTIAL)
|
|
410
410
|
})]
|
|
411
411
|
}), /*#__PURE__*/_jsxs("div", {
|
|
412
412
|
className: "d-flex justify-content-between",
|
|
413
413
|
children: [/*#__PURE__*/_jsx("span", {
|
|
414
414
|
children: "Max"
|
|
415
|
-
}),
|
|
415
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
416
416
|
children: formatNumerical(obs.max, FORMATS.EXPONENTIAL)
|
|
417
417
|
})]
|
|
418
418
|
}), /*#__PURE__*/_jsxs("div", {
|
|
419
419
|
className: "d-flex justify-content-between",
|
|
420
420
|
children: [/*#__PURE__*/_jsx("span", {
|
|
421
421
|
children: "Mean"
|
|
422
|
-
}),
|
|
422
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
423
423
|
children: formatNumerical(obs.mean, FORMATS.EXPONENTIAL)
|
|
424
424
|
})]
|
|
425
425
|
}), /*#__PURE__*/_jsxs("div", {
|
|
426
426
|
className: "d-flex justify-content-between",
|
|
427
427
|
children: [/*#__PURE__*/_jsx("span", {
|
|
428
428
|
children: "Median"
|
|
429
|
-
}),
|
|
429
|
+
}), ' ', /*#__PURE__*/_jsx("span", {
|
|
430
430
|
children: formatNumerical(obs.median, FORMATS.EXPONENTIAL)
|
|
431
431
|
})]
|
|
432
432
|
})]
|
|
@@ -456,7 +456,7 @@ export function ContinuousObs(_ref5) {
|
|
|
456
456
|
const filteredObsData = useFilteredObsData(obs);
|
|
457
457
|
const enabledHistograms = useMemo(() => showHistograms && settings.colorEncoding === COLOR_ENCODINGS.VAR, [settings.colorEncoding, showHistograms]);
|
|
458
458
|
const getLabel = useCallback(index => {
|
|
459
|
-
return isNaN(obs.values[index]) ?
|
|
459
|
+
return isNaN(obs.values[index]) ? 'NaN' : getContinuousLabel(obs.codes[obs.values[index]], obs.bins.binEdges);
|
|
460
460
|
}, [obs.bins.binEdges, obs.codes, obs.values]);
|
|
461
461
|
const getDataAtIndex = useCallback(index => {
|
|
462
462
|
var _obsHistograms$fetche2;
|