@haniffalab/cherita-react 2.0.0 → 2.1.0
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/cjs/components/dotplot/Dotplot.js +4 -5
- package/dist/cjs/components/dotplot/DotplotControls.js +7 -3
- package/dist/cjs/components/heatmap/Heatmap.js +4 -5
- package/dist/cjs/components/icons/HeatmapIcon.js +2 -2
- package/dist/cjs/components/matrixplot/Matrixplot.js +4 -5
- package/dist/cjs/components/obs-list/ObsItem.js +7 -7
- package/dist/cjs/components/offcanvas/OffCanvas.js +7 -4
- package/dist/cjs/components/plot/PlotTypeSelector.js +49 -10
- package/dist/cjs/components/pseudospatial/Pseudospatial.js +8 -5
- package/dist/cjs/components/scatterplot/Scatterplot.js +134 -136
- package/dist/cjs/components/scatterplot/ScatterplotLayer.js +144 -0
- package/dist/cjs/components/scatterplot/SpatialControls.js +7 -4
- package/dist/cjs/components/scatterplot/Toolbox.js +8 -4
- package/dist/cjs/components/search-bar/SearchBar.js +51 -29
- package/dist/cjs/components/search-bar/SearchInfo.js +2 -2
- package/dist/cjs/components/search-bar/SearchResults.js +9 -6
- package/dist/cjs/components/toolbar/Toolbar.js +10 -65
- package/dist/cjs/components/var-list/VarItem.js +4 -6
- package/dist/cjs/components/var-list/VarList.js +17 -9
- package/dist/cjs/components/var-list/VarListToolbar.js +1 -1
- package/dist/cjs/components/var-list/VarSet.js +7 -5
- package/dist/cjs/components/violin/Violin.js +6 -7
- package/dist/cjs/constants/constants.js +6 -3
- package/dist/cjs/context/DatasetContext.js +11 -2
- package/dist/cjs/context/SettingsContext.js +27 -2
- package/dist/cjs/helpers/color-helper.js +17 -12
- package/dist/cjs/index.js +0 -7
- package/dist/cjs/utils/Legend.js +6 -5
- package/dist/cjs/utils/requests.js +2 -2
- package/dist/cjs/views/ObservationFeature/StandardView.js +1 -1
- package/dist/cjs/views/PerturbationMap/ObsExplorer.js +11 -9
- package/dist/cjs/views/PerturbationMap/StandardView.js +2 -1
- package/dist/cjs/workers/scatterplotData.js +16 -0
- package/dist/esm/components/dotplot/Dotplot.js +5 -6
- package/dist/esm/components/dotplot/DotplotControls.js +6 -3
- package/dist/esm/components/heatmap/Heatmap.js +5 -6
- package/dist/esm/components/icons/HeatmapIcon.js +2 -2
- package/dist/esm/components/matrixplot/Matrixplot.js +5 -6
- package/dist/esm/components/obs-list/ObsItem.js +7 -7
- package/dist/esm/components/offcanvas/OffCanvas.js +7 -4
- package/dist/esm/components/plot/PlotTypeSelector.js +49 -10
- package/dist/esm/components/pseudospatial/Pseudospatial.js +8 -5
- package/dist/esm/components/scatterplot/Scatterplot.js +132 -134
- package/dist/esm/components/scatterplot/ScatterplotLayer.js +137 -0
- package/dist/esm/components/scatterplot/SpatialControls.js +7 -4
- package/dist/esm/components/scatterplot/Toolbox.js +8 -4
- package/dist/esm/components/search-bar/SearchBar.js +52 -30
- package/dist/esm/components/search-bar/SearchInfo.js +2 -2
- package/dist/esm/components/search-bar/SearchResults.js +9 -6
- package/dist/esm/components/toolbar/Toolbar.js +9 -63
- package/dist/esm/components/var-list/VarItem.js +4 -6
- package/dist/esm/components/var-list/VarList.js +17 -9
- package/dist/esm/components/var-list/VarListToolbar.js +1 -1
- package/dist/esm/components/var-list/VarSet.js +7 -5
- package/dist/esm/components/violin/Violin.js +7 -8
- package/dist/esm/constants/constants.js +5 -2
- package/dist/esm/context/DatasetContext.js +11 -2
- package/dist/esm/context/SettingsContext.js +27 -2
- package/dist/esm/helpers/color-helper.js +17 -12
- package/dist/esm/index.js +0 -1
- package/dist/esm/utils/Legend.js +6 -5
- package/dist/esm/utils/requests.js +2 -2
- package/dist/esm/views/ObservationFeature/StandardView.js +1 -1
- package/dist/esm/views/PerturbationMap/ObsExplorer.js +11 -9
- package/dist/esm/views/PerturbationMap/StandardView.js +2 -1
- package/dist/esm/workers/scatterplotData.js +10 -0
- package/package.json +6 -3
|
@@ -30,7 +30,6 @@ function Dotplot(_ref) {
|
|
|
30
30
|
setShowCategories,
|
|
31
31
|
setShowSearch,
|
|
32
32
|
setShowControls,
|
|
33
|
-
plotType,
|
|
34
33
|
setPlotType,
|
|
35
34
|
isFullscreen = false
|
|
36
35
|
} = _ref;
|
|
@@ -160,7 +159,7 @@ function Dotplot(_ref) {
|
|
|
160
159
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlotAlert.PlotAlert, {
|
|
161
160
|
variant: "info",
|
|
162
161
|
heading: "Set up your dotplot",
|
|
163
|
-
plotType:
|
|
162
|
+
plotType: _constants.PLOT_TYPES.DOTPLOT,
|
|
164
163
|
setPlotType: setPlotType,
|
|
165
164
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
166
165
|
className: "p-0 m-0",
|
|
@@ -168,8 +167,8 @@ function Dotplot(_ref) {
|
|
|
168
167
|
variant: "link",
|
|
169
168
|
className: "border-0 p-0 align-baseline",
|
|
170
169
|
onClick: setShowSearch,
|
|
171
|
-
children:
|
|
172
|
-
}) :
|
|
170
|
+
children: dataset.varLabel.plural
|
|
171
|
+
}) : dataset.varLabel.plural, ' ', "to display their ", dataset.valueLabel, " across groups, then choose a", ' ', showCategoriesBtn ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
173
172
|
variant: "link",
|
|
174
173
|
className: "border-0 p-0 align-baseline",
|
|
175
174
|
onClick: setShowCategories,
|
|
@@ -181,7 +180,7 @@ function Dotplot(_ref) {
|
|
|
181
180
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlotAlert.PlotAlert, {
|
|
182
181
|
variant: "danger",
|
|
183
182
|
heading: "Error displaying the dotplot",
|
|
184
|
-
plotType:
|
|
183
|
+
plotType: _constants.PLOT_TYPES.DOTPLOT,
|
|
185
184
|
setPlotType: setPlotType,
|
|
186
185
|
children: serverError.message || 'An unexpected error occurred while generating the plot.'
|
|
187
186
|
});
|
|
@@ -5,10 +5,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.DotplotControls = DotplotControls;
|
|
7
7
|
var _react = require("react");
|
|
8
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
8
9
|
var _reactBootstrap = require("react-bootstrap");
|
|
10
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
9
11
|
var _SettingsContext = require("../../context/SettingsContext");
|
|
10
12
|
var _Controls = require("../controls/Controls");
|
|
11
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
16
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
14
17
|
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; }
|
|
@@ -17,6 +20,7 @@ function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e =
|
|
|
17
20
|
function DotplotControls() {
|
|
18
21
|
const settings = (0, _SettingsContext.useSettings)();
|
|
19
22
|
const dispatch = (0, _SettingsContext.useSettingsDispatch)();
|
|
23
|
+
const dataset = (0, _DatasetContext.useDataset)();
|
|
20
24
|
const [controls, setControls] = (0, _react.useState)({
|
|
21
25
|
expressionCutoff: settings.controls.expressionCutoff,
|
|
22
26
|
colorAxis: {
|
|
@@ -97,8 +101,8 @@ function DotplotControls() {
|
|
|
97
101
|
plot: "dotplot"
|
|
98
102
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Form.Group, {
|
|
99
103
|
className: "mb-2",
|
|
100
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
101
|
-
children: "
|
|
104
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.Form.Label, {
|
|
105
|
+
children: [_lodash.default.capitalize(dataset.valueLabel), " Cutoff"]
|
|
102
106
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactBootstrap.InputGroup, {
|
|
103
107
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Control, {
|
|
104
108
|
size: "sm",
|
|
@@ -125,7 +129,7 @@ function DotplotControls() {
|
|
|
125
129
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Form.Check, {
|
|
126
130
|
type: "switch",
|
|
127
131
|
id: "meanOnlyExpressed",
|
|
128
|
-
label: "Average only above cutoff",
|
|
132
|
+
label: "Average only above ".concat(dataset.valueLabel, " cutoff"),
|
|
129
133
|
checked: settings.controls.meanOnlyExpressed,
|
|
130
134
|
onChange: () => {
|
|
131
135
|
dispatch({
|
|
@@ -30,7 +30,6 @@ function Heatmap(_ref) {
|
|
|
30
30
|
setShowCategories,
|
|
31
31
|
setShowSearch,
|
|
32
32
|
setShowControls,
|
|
33
|
-
plotType,
|
|
34
33
|
setPlotType,
|
|
35
34
|
isFullscreen = false
|
|
36
35
|
} = _ref;
|
|
@@ -134,7 +133,7 @@ function Heatmap(_ref) {
|
|
|
134
133
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlotAlert.PlotAlert, {
|
|
135
134
|
variant: "info",
|
|
136
135
|
heading: "Set up your heatmap",
|
|
137
|
-
plotType:
|
|
136
|
+
plotType: _constants.PLOT_TYPES.HEATMAP,
|
|
138
137
|
setPlotType: setPlotType,
|
|
139
138
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
140
139
|
className: "p-0 m-0",
|
|
@@ -142,8 +141,8 @@ function Heatmap(_ref) {
|
|
|
142
141
|
variant: "link",
|
|
143
142
|
className: "border-0 p-0 align-baseline",
|
|
144
143
|
onClick: setShowSearch,
|
|
145
|
-
children:
|
|
146
|
-
}) :
|
|
144
|
+
children: dataset.varLabel.plural
|
|
145
|
+
}) : dataset.varLabel.plural, ' ', "to display their ", dataset.valueLabel, ", then choose a", ' ', showCategoriesBtn ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.Button, {
|
|
147
146
|
variant: "link",
|
|
148
147
|
className: "border-0 p-0 align-baseline",
|
|
149
148
|
onClick: setShowCategories,
|
|
@@ -155,7 +154,7 @@ function Heatmap(_ref) {
|
|
|
155
154
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlotAlert.PlotAlert, {
|
|
156
155
|
variant: "danger",
|
|
157
156
|
heading: "Error displaying the heatmap",
|
|
158
|
-
plotType:
|
|
157
|
+
plotType: _constants.PLOT_TYPES.HEATMAP,
|
|
159
158
|
setPlotType: setPlotType,
|
|
160
159
|
children: serverError.message || 'An unexpected error occurred while generating the plot.'
|
|
161
160
|
});
|
|
@@ -20,8 +20,8 @@ function HeatmapIcon(_ref) {
|
|
|
20
20
|
gap = 1
|
|
21
21
|
} = _ref,
|
|
22
22
|
props = _objectWithoutProperties(_ref, _excluded);
|
|
23
|
-
const rows = 6; //
|
|
24
|
-
const cols = 8; //
|
|
23
|
+
const rows = 6; // features
|
|
24
|
+
const cols = 8; // observations
|
|
25
25
|
|
|
26
26
|
// Example expression pattern for visual clusters
|
|
27
27
|
const expressionLevels = [[1, 0.8, 0.2, 0.2, 0.5, 0.9, 1, 0.7], [0.9, 0.7, 0.1, 0.2, 0.4, 0.8, 0.9, 0.6], [0.1, 0.2, 0.8, 0.9, 0.7, 0.2, 0.1, 0.3], [0.2, 0.3, 0.9, 1, 0.8, 0.3, 0.2, 0.4], [0.5, 0.6, 0.2, 0.1, 0.9, 0.7, 0.6, 0.8], [0.6, 0.7, 0.3, 0.2, 0.8, 0.6, 0.7, 0.9]];
|
|
@@ -30,7 +30,6 @@ function Matrixplot(_ref) {
|
|
|
30
30
|
setShowCategories,
|
|
31
31
|
setShowSearch,
|
|
32
32
|
setShowControls,
|
|
33
|
-
plotType,
|
|
34
33
|
setPlotType,
|
|
35
34
|
isFullscreen = false
|
|
36
35
|
} = _ref;
|
|
@@ -135,7 +134,7 @@ function Matrixplot(_ref) {
|
|
|
135
134
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlotAlert.PlotAlert, {
|
|
136
135
|
variant: "info",
|
|
137
136
|
heading: "Set up your matrix plot",
|
|
138
|
-
plotType:
|
|
137
|
+
plotType: _constants.PLOT_TYPES.MATRIXPLOT,
|
|
139
138
|
setPlotType: setPlotType,
|
|
140
139
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
141
140
|
className: "p-0 m-0",
|
|
@@ -148,15 +147,15 @@ function Matrixplot(_ref) {
|
|
|
148
147
|
variant: "link",
|
|
149
148
|
className: "border-0 p-0 align-baseline",
|
|
150
149
|
onClick: setShowSearch,
|
|
151
|
-
children:
|
|
152
|
-
}) :
|
|
150
|
+
children: dataset.varLabel.plural
|
|
151
|
+
}) : dataset.varLabel.plural, ' ', "to display the matrix plot."]
|
|
153
152
|
})
|
|
154
153
|
});
|
|
155
154
|
} else {
|
|
156
155
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_PlotAlert.PlotAlert, {
|
|
157
156
|
variant: "danger",
|
|
158
157
|
heading: "Error displaying the matrix plot",
|
|
159
|
-
plotType:
|
|
158
|
+
plotType: _constants.PLOT_TYPES.MATRIXPLOT,
|
|
160
159
|
setPlotType: setPlotType,
|
|
161
160
|
children: serverError.message || 'An unexpected error occurred while generating the plot.'
|
|
162
161
|
});
|
|
@@ -163,7 +163,10 @@ function CategoricalItem(_ref2) {
|
|
|
163
163
|
} = (0, _DatasetContext.useDataset)();
|
|
164
164
|
const {
|
|
165
165
|
getColor
|
|
166
|
-
} = (0, _colorHelper.useColor)(
|
|
166
|
+
} = (0, _colorHelper.useColor)({
|
|
167
|
+
isCategorical: true,
|
|
168
|
+
colorscale: useUnsColors ? colors : null
|
|
169
|
+
});
|
|
167
170
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
168
171
|
className: "virtualized-list-wrapper ps-1",
|
|
169
172
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactBootstrap.ListGroup.Item, {
|
|
@@ -258,17 +261,14 @@ function CategoricalItem(_ref2) {
|
|
|
258
261
|
y: "0",
|
|
259
262
|
width: "10",
|
|
260
263
|
height: "10",
|
|
261
|
-
fill: "rgb(".concat(getColor(
|
|
262
|
-
value: (code - min) / (max - min),
|
|
263
|
-
categorical: true,
|
|
264
|
+
fill: "rgb(".concat(getColor({
|
|
265
|
+
value: (code - min) / Math.max(max - min, 1e-6),
|
|
264
266
|
grayOut: isOmitted,
|
|
265
267
|
grayParams: {
|
|
266
268
|
alpha: 1
|
|
267
269
|
},
|
|
268
270
|
colorEncoding: 'obs'
|
|
269
|
-
},
|
|
270
|
-
colorscale: colors
|
|
271
|
-
} : {})), ")")
|
|
271
|
+
}), ")")
|
|
272
272
|
})
|
|
273
273
|
})
|
|
274
274
|
}) : null]
|
|
@@ -10,6 +10,7 @@ exports.OffcanvasObsm = OffcanvasObsm;
|
|
|
10
10
|
exports.OffcanvasVars = OffcanvasVars;
|
|
11
11
|
var _Offcanvas = _interopRequireDefault(require("react-bootstrap/Offcanvas"));
|
|
12
12
|
var _constants = require("../../constants/constants");
|
|
13
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
13
14
|
var _ObsExplorer = require("../../views/PerturbationMap/ObsExplorer");
|
|
14
15
|
var _ObsList = require("../obs-list/ObsList");
|
|
15
16
|
var _ObsmList = require("../obsm-list/ObsmList");
|
|
@@ -72,14 +73,15 @@ function OffcanvasVars(_ref3) {
|
|
|
72
73
|
handleClose,
|
|
73
74
|
mode = _constants.SELECTION_MODES.MULTIPLE
|
|
74
75
|
} = _ref3;
|
|
76
|
+
const dataset = (0, _DatasetContext.useDataset)();
|
|
75
77
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Offcanvas.default, {
|
|
76
78
|
show: show,
|
|
77
79
|
onHide: handleClose,
|
|
78
80
|
className: "offcanvas-vars",
|
|
79
81
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default.Header, {
|
|
80
82
|
closeButton: true,
|
|
81
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
82
|
-
children: "
|
|
83
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Offcanvas.default.Title, {
|
|
84
|
+
children: ["Search for ", dataset.varLabel.plural]
|
|
83
85
|
})
|
|
84
86
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default.Body, {
|
|
85
87
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -122,13 +124,14 @@ function OffcanvasObsExplorer(_ref5) {
|
|
|
122
124
|
handleClose
|
|
123
125
|
} = _ref5,
|
|
124
126
|
props = _objectWithoutProperties(_ref5, _excluded3);
|
|
127
|
+
const dataset = (0, _DatasetContext.useDataset)();
|
|
125
128
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Offcanvas.default, {
|
|
126
129
|
show: show,
|
|
127
130
|
onHide: handleClose,
|
|
128
131
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default.Header, {
|
|
129
132
|
closeButton: true,
|
|
130
|
-
children: /*#__PURE__*/(0, _jsxRuntime.
|
|
131
|
-
children: "
|
|
133
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Offcanvas.default.Title, {
|
|
134
|
+
children: ["Search for ", dataset.obsLabel.plural]
|
|
132
135
|
})
|
|
133
136
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Offcanvas.default.Body, {
|
|
134
137
|
className: "p-1",
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.PlotTypeSelector = PlotTypeSelector;
|
|
7
7
|
var _react = require("react");
|
|
8
8
|
var _constants = require("../../constants/constants");
|
|
9
|
+
var _DatasetContext = require("../../context/DatasetContext");
|
|
9
10
|
var _StyledTooltip = require("../../utils/StyledTooltip");
|
|
10
11
|
var _DotPlotIcon = _interopRequireDefault(require("../icons/DotPlotIcon"));
|
|
11
12
|
var _HeatmapIcon = _interopRequireDefault(require("../icons/HeatmapIcon"));
|
|
@@ -23,33 +24,67 @@ const plotTypes = [{
|
|
|
23
24
|
type: _constants.PLOT_TYPES.SCATTERPLOT,
|
|
24
25
|
icon: _ScatterplotIcon.default,
|
|
25
26
|
name: 'Scatterplot',
|
|
26
|
-
description:
|
|
27
|
+
description: _ref => {
|
|
28
|
+
let {
|
|
29
|
+
obsLabel
|
|
30
|
+
} = _ref;
|
|
31
|
+
return "Displays ".concat(obsLabel.plural, " in 2D based on dimensionality reduction.");
|
|
32
|
+
}
|
|
27
33
|
}, {
|
|
28
34
|
type: _constants.PLOT_TYPES.MATRIXPLOT,
|
|
29
35
|
icon: _MatrixPlotIcon.default,
|
|
30
36
|
name: 'Matrix Plot',
|
|
31
|
-
description:
|
|
37
|
+
description: _ref2 => {
|
|
38
|
+
let {
|
|
39
|
+
varLabel,
|
|
40
|
+
valueLabel
|
|
41
|
+
} = _ref2;
|
|
42
|
+
return "Shows ".concat(valueLabel, " values of ").concat(varLabel.plural, " across categories.");
|
|
43
|
+
}
|
|
32
44
|
}, {
|
|
33
45
|
type: _constants.PLOT_TYPES.DOTPLOT,
|
|
34
46
|
icon: _DotPlotIcon.default,
|
|
35
47
|
name: 'Dot Plot',
|
|
36
|
-
description:
|
|
48
|
+
description: _ref3 => {
|
|
49
|
+
let {
|
|
50
|
+
varLabel,
|
|
51
|
+
valueLabel
|
|
52
|
+
} = _ref3;
|
|
53
|
+
return "Shows proportion and ".concat(valueLabel, " of ").concat(varLabel.plural, " across groups.");
|
|
54
|
+
}
|
|
37
55
|
}, {
|
|
38
56
|
type: _constants.PLOT_TYPES.HEATMAP,
|
|
39
57
|
icon: _HeatmapIcon.default,
|
|
40
58
|
name: 'Heatmap',
|
|
41
|
-
description:
|
|
59
|
+
description: _ref4 => {
|
|
60
|
+
let {
|
|
61
|
+
varLabel,
|
|
62
|
+
valueLabel
|
|
63
|
+
} = _ref4;
|
|
64
|
+
return "Visualises ".concat(valueLabel, " of ").concat(varLabel.plural, " as a colour-coded matrix.");
|
|
65
|
+
}
|
|
42
66
|
}, {
|
|
43
67
|
type: _constants.PLOT_TYPES.VIOLINPLOT,
|
|
44
68
|
icon: _ViolinPlotIcon.default,
|
|
45
69
|
name: 'Violin Plot',
|
|
46
|
-
description:
|
|
70
|
+
description: _ref5 => {
|
|
71
|
+
let {
|
|
72
|
+
obsLabel,
|
|
73
|
+
valueLabel
|
|
74
|
+
} = _ref5;
|
|
75
|
+
return "Displays distribution of ".concat(valueLabel, " across ").concat(obsLabel.plural, ".");
|
|
76
|
+
}
|
|
47
77
|
}];
|
|
48
|
-
function PlotTypeSelector(
|
|
78
|
+
function PlotTypeSelector(_ref6) {
|
|
49
79
|
let {
|
|
50
80
|
currentType,
|
|
51
81
|
onChange
|
|
52
|
-
} =
|
|
82
|
+
} = _ref6;
|
|
83
|
+
const {
|
|
84
|
+
obsLabel,
|
|
85
|
+
varLabel,
|
|
86
|
+
valueLabel
|
|
87
|
+
} = (0, _DatasetContext.useDataset)();
|
|
53
88
|
const [hoveredMap, setHoveredMap] = (0, _react.useState)({});
|
|
54
89
|
const handleMouseEnter = type => setHoveredMap(prev => _objectSpread(_objectSpread({}, prev), {}, {
|
|
55
90
|
[type]: true
|
|
@@ -59,13 +94,13 @@ function PlotTypeSelector(_ref) {
|
|
|
59
94
|
}));
|
|
60
95
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
61
96
|
className: "d-flex gap-2 justify-content-between",
|
|
62
|
-
children: plotTypes.map(
|
|
97
|
+
children: plotTypes.map(_ref7 => {
|
|
63
98
|
let {
|
|
64
99
|
type,
|
|
65
100
|
icon: Icon,
|
|
66
101
|
name,
|
|
67
102
|
description
|
|
68
|
-
} =
|
|
103
|
+
} = _ref7;
|
|
69
104
|
const isActive = currentType === type;
|
|
70
105
|
const hovered = hoveredMap[type] || false;
|
|
71
106
|
const colour = isActive ? '#005a86' : hovered ? '#0071a7' : '#000';
|
|
@@ -73,7 +108,11 @@ function PlotTypeSelector(_ref) {
|
|
|
73
108
|
title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
74
109
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("strong", {
|
|
75
110
|
children: name
|
|
76
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), description
|
|
111
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("br", {}), description({
|
|
112
|
+
obsLabel,
|
|
113
|
+
varLabel,
|
|
114
|
+
valueLabel
|
|
115
|
+
})]
|
|
77
116
|
}),
|
|
78
117
|
placement: "bottom",
|
|
79
118
|
slotProps: {
|
|
@@ -93,7 +93,8 @@ function Pseudospatial(_ref) {
|
|
|
93
93
|
setPlotType
|
|
94
94
|
} = _ref;
|
|
95
95
|
const {
|
|
96
|
-
imageUrl
|
|
96
|
+
imageUrl,
|
|
97
|
+
valueLabel
|
|
97
98
|
} = (0, _DatasetContext.useDataset)();
|
|
98
99
|
const settings = (0, _SettingsContext.useSettings)();
|
|
99
100
|
const dispatch = (0, _SettingsContext.useSettingsDispatch)();
|
|
@@ -101,7 +102,9 @@ function Pseudospatial(_ref) {
|
|
|
101
102
|
const [layout, setLayout] = (0, _react.useState)({});
|
|
102
103
|
const {
|
|
103
104
|
getColor
|
|
104
|
-
} = (0, _colorHelper.useColor)(
|
|
105
|
+
} = (0, _colorHelper.useColor)({
|
|
106
|
+
isCategorical: false
|
|
107
|
+
});
|
|
105
108
|
const colorscale = (0, _react.useRef)(settings.controls.colorScale);
|
|
106
109
|
const {
|
|
107
110
|
valueMin,
|
|
@@ -137,7 +140,7 @@ function Pseudospatial(_ref) {
|
|
|
137
140
|
return trace;
|
|
138
141
|
}
|
|
139
142
|
const color = (0, _colorHelper.rgbToHex)(getColor({
|
|
140
|
-
value: (v - min) / (max - min)
|
|
143
|
+
value: (v - min) / Math.max(max - min, 1e-6)
|
|
141
144
|
}));
|
|
142
145
|
return _objectSpread(_objectSpread({}, trace), {}, {
|
|
143
146
|
fillcolor: color,
|
|
@@ -180,7 +183,7 @@ function Pseudospatial(_ref) {
|
|
|
180
183
|
return trace;
|
|
181
184
|
}
|
|
182
185
|
const color = (0, _colorHelper.rgbToHex)(getColor({
|
|
183
|
-
value: (v - min) / (max - min)
|
|
186
|
+
value: (v - min) / Math.max(max - min, 1e-6)
|
|
184
187
|
}));
|
|
185
188
|
return _objectSpread(_objectSpread({}, trace), {}, {
|
|
186
189
|
fillcolor: color,
|
|
@@ -279,7 +282,7 @@ function Pseudospatial(_ref) {
|
|
|
279
282
|
}), hasSelections && showLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Legend.Legend, {
|
|
280
283
|
min: layout === null || layout === void 0 || (_layout$coloraxis5 = layout.coloraxis) === null || _layout$coloraxis5 === void 0 ? void 0 : _layout$coloraxis5.cmin,
|
|
281
284
|
max: layout === null || layout === void 0 || (_layout$coloraxis6 = layout.coloraxis) === null || _layout$coloraxis6 === void 0 ? void 0 : _layout$coloraxis6.cmax,
|
|
282
|
-
addText: plotType === _constants.PSEUDOSPATIAL_PLOT_TYPES.GENE ?
|
|
285
|
+
addText: plotType === _constants.PSEUDOSPATIAL_PLOT_TYPES.GENE ? " - Mean ".concat(valueLabel) : plotType === _constants.PSEUDOSPATIAL_PLOT_TYPES.CATEGORICAL ? ' - %' : plotType === _constants.PSEUDOSPATIAL_PLOT_TYPES.CONTINUOUS ? ' - Mean value' : ''
|
|
283
286
|
})]
|
|
284
287
|
})
|
|
285
288
|
});
|