@vitessce/dev 2.0.0-beta.2 → 2.0.1
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/{deflate.fd6a2bf5.mjs → deflate.199a1acc.mjs} +1 -1
- package/dist/{index.879a4eb2.mjs → index.00c6d36a.mjs} +1560 -1539
- package/dist/index.mjs +1 -1
- package/dist/index.umd.js +1553 -1532
- package/dist/{jpeg.da6a1ce7.mjs → jpeg.21d1374d.mjs} +1 -1
- package/dist/{lerc.f650c15f.mjs → lerc.c99fbca0.mjs} +1 -1
- package/dist/{lzw.a7b59c9a.mjs → lzw.e9257ec2.mjs} +1 -1
- package/dist/{packbits.948b00a6.mjs → packbits.ab2ecbac.mjs} +1 -1
- package/dist/{raw.f81790cb.mjs → raw.741ddabe.mjs} +1 -1
- package/dist/{webimage.a23de56d.mjs → webimage.0fa273e8.mjs} +1 -1
- package/package.json +5 -5
|
@@ -529,6 +529,18 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
529
529
|
CoordinationType$2.FEATURE_SELECTION
|
|
530
530
|
]
|
|
531
531
|
};
|
|
532
|
+
const note = "This file is regenerated by push-demo.sh.";
|
|
533
|
+
const version$6 = "2.0.1";
|
|
534
|
+
const branch = "release-v2.0.1";
|
|
535
|
+
const date$3 = "2022-11-30";
|
|
536
|
+
const hash$1 = "0327a9c6";
|
|
537
|
+
const META_VERSION = {
|
|
538
|
+
note,
|
|
539
|
+
version: version$6,
|
|
540
|
+
branch,
|
|
541
|
+
date: date$3,
|
|
542
|
+
hash: hash$1
|
|
543
|
+
};
|
|
532
544
|
const ViewType$1 = {
|
|
533
545
|
GENES: [
|
|
534
546
|
"genes",
|
|
@@ -10107,7 +10119,11 @@ const globalColors = {
|
|
|
10107
10119
|
grayLight: "#D3D3D3",
|
|
10108
10120
|
grayMid: "#808080",
|
|
10109
10121
|
grayDark: "#555555",
|
|
10110
|
-
black: "#000000"
|
|
10122
|
+
black: "#000000",
|
|
10123
|
+
grayDarkL5: "rgb(98, 98, 98)",
|
|
10124
|
+
grayDarkD15: "rgb(47, 47, 47)",
|
|
10125
|
+
grayMidL10: "rgb(154, 154, 154)",
|
|
10126
|
+
grayLightL10: "rgb(237, 237, 237)"
|
|
10111
10127
|
};
|
|
10112
10128
|
const muiTheme = {
|
|
10113
10129
|
dark: createTheme({
|
|
@@ -10121,6 +10137,9 @@ const muiTheme = {
|
|
|
10121
10137
|
primaryBackgroundDim: "#333333",
|
|
10122
10138
|
primaryBackgroundLight: "#757575",
|
|
10123
10139
|
primaryForeground: "#D3D3D3",
|
|
10140
|
+
primaryForegroundL5: "rgb(224, 224, 224)",
|
|
10141
|
+
primaryForegroundL10: "rgb(237, 237, 237)",
|
|
10142
|
+
primaryForegroundD15: "rgb(173, 173, 173)",
|
|
10124
10143
|
primaryForegroundDim: "#000000",
|
|
10125
10144
|
primaryForegroundActive: "#9bb7d6",
|
|
10126
10145
|
secondaryBackground: "#000000",
|
|
@@ -10147,6 +10166,9 @@ const muiTheme = {
|
|
|
10147
10166
|
primaryBackgroundDim: "#8A8A8A",
|
|
10148
10167
|
primaryBackgroundLight: "#e0e0e0",
|
|
10149
10168
|
primaryForeground: "#333333",
|
|
10169
|
+
primaryForegroundL5: "rgb(64, 64, 64)",
|
|
10170
|
+
primaryForegroundL10: "rgb(77, 77, 77)",
|
|
10171
|
+
primaryForegroundD15: "rgb(13, 13, 13)",
|
|
10150
10172
|
primaryForegroundDim: "#808080",
|
|
10151
10173
|
primaryForegroundActive: "#0074D9",
|
|
10152
10174
|
secondaryBackground: "#F1F1F1",
|
|
@@ -10419,13 +10441,10 @@ const createViewConfigStore = () => create$c((set3) => ({
|
|
|
10419
10441
|
};
|
|
10420
10442
|
}),
|
|
10421
10443
|
changeLayout: (newComponentProps) => set3((state) => {
|
|
10422
|
-
const newLayout = state.viewConfig.layout.slice()
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
...newProps
|
|
10427
|
-
};
|
|
10428
|
-
});
|
|
10444
|
+
const newLayout = state.viewConfig.layout.slice().map((componentProps) => ({
|
|
10445
|
+
...componentProps,
|
|
10446
|
+
...newComponentProps[componentProps.uid]
|
|
10447
|
+
}));
|
|
10429
10448
|
return {
|
|
10430
10449
|
viewConfig: {
|
|
10431
10450
|
...state.viewConfig,
|
|
@@ -15165,7 +15184,6 @@ function WidthProvideRGL(ComposedComponent) {
|
|
|
15165
15184
|
module2.exports.Responsive.utils = responsiveUtils;
|
|
15166
15185
|
module2.exports.WidthProvider = WidthProvider.default;
|
|
15167
15186
|
})(reactGridLayoutWithLodash);
|
|
15168
|
-
const COMPONENT_ID_PREFIX = "i";
|
|
15169
15187
|
function sum$7(a2) {
|
|
15170
15188
|
return a2.reduce((x2, y2) => x2 + y2, 0);
|
|
15171
15189
|
}
|
|
@@ -15252,12 +15270,11 @@ function VitessceGridLayout(props2) {
|
|
|
15252
15270
|
const [lastValidGridLayouts, setLastValidGridLayouts] = useState(gridLayouts);
|
|
15253
15271
|
const onValidLayoutChange = (newLayout) => {
|
|
15254
15272
|
if (newLayout.length === Object.entries(gridComponents).length) {
|
|
15255
|
-
const newComponentProps =
|
|
15273
|
+
const newComponentProps = {};
|
|
15256
15274
|
newLayout.forEach((nextC) => {
|
|
15257
15275
|
const id2 = nextC.i;
|
|
15258
15276
|
const prevC = gridComponents[id2];
|
|
15259
15277
|
if (prevC) {
|
|
15260
|
-
const i2 = parseInt(id2.substring(id2.indexOf(COMPONENT_ID_PREFIX) + 1), 10);
|
|
15261
15278
|
const nextProps = {
|
|
15262
15279
|
x: nextC.x,
|
|
15263
15280
|
y: nextC.y,
|
|
@@ -15271,11 +15288,11 @@ function VitessceGridLayout(props2) {
|
|
|
15271
15288
|
h: prevC.h
|
|
15272
15289
|
};
|
|
15273
15290
|
if (!isEqual_1(nextProps, prevProps)) {
|
|
15274
|
-
newComponentProps
|
|
15291
|
+
newComponentProps[id2] = nextProps;
|
|
15275
15292
|
}
|
|
15276
15293
|
}
|
|
15277
15294
|
});
|
|
15278
|
-
if (newComponentProps.length > 0) {
|
|
15295
|
+
if (Object.keys(newComponentProps).length > 0) {
|
|
15279
15296
|
onLayoutChangeProp(newComponentProps);
|
|
15280
15297
|
}
|
|
15281
15298
|
}
|
|
@@ -27715,7 +27732,10 @@ function VitessceGrid(props2) {
|
|
|
27715
27732
|
const removeComponent = useRemoveComponent();
|
|
27716
27733
|
const changeLayout = useChangeLayout();
|
|
27717
27734
|
const layout2 = useLayout();
|
|
27718
|
-
const changeLayoutPostMount = useCallback(() =>
|
|
27735
|
+
const changeLayoutPostMount = useCallback((newComponentProps) => {
|
|
27736
|
+
if (componentWidth > 0) {
|
|
27737
|
+
changeLayout(newComponentProps);
|
|
27738
|
+
}
|
|
27719
27739
|
}, [changeLayout, componentWidth]);
|
|
27720
27740
|
useEffect(() => {
|
|
27721
27741
|
if (config3) {
|
|
@@ -49837,12 +49857,11 @@ function upgradeAndValidate(oldConfig, onConfigUpgrade = null) {
|
|
|
49837
49857
|
} while (upgradeFunction);
|
|
49838
49858
|
return [nextConfig, true];
|
|
49839
49859
|
}
|
|
49840
|
-
const packageJson$1 = { version: "unk" };
|
|
49841
49860
|
const generateClassName = createGenerateClassName({
|
|
49842
49861
|
disableGlobal: true
|
|
49843
49862
|
});
|
|
49844
49863
|
function logConfig(config3, name2) {
|
|
49845
|
-
console.groupCollapsed(`\u{1F684} Vitessce (${
|
|
49864
|
+
console.groupCollapsed(`\u{1F684} Vitessce (${META_VERSION.version}) ${name2}`);
|
|
49846
49865
|
console.info(`data:,${JSON.stringify(config3)}`);
|
|
49847
49866
|
console.info(JSON.stringify(config3, null, 2));
|
|
49848
49867
|
console.groupEnd();
|
|
@@ -64026,7 +64045,7 @@ var reactJsxDevRuntime_development = {};
|
|
|
64026
64045
|
module2.exports = reactJsxDevRuntime_development;
|
|
64027
64046
|
}
|
|
64028
64047
|
})(jsxDevRuntime);
|
|
64029
|
-
var _jsxFileName$1 = "/
|
|
64048
|
+
var _jsxFileName$1 = "/home/runner/work/vitessce/vitessce/node_modules/.pnpm/rc-tree@2.1.0_biqbaboplfbrettd7655fr4n2y/node_modules/rc-tree/es/util.js";
|
|
64030
64049
|
var DRAG_SIDE_RANGE = 0.25;
|
|
64031
64050
|
var DRAG_MIN_GAP = 2;
|
|
64032
64051
|
var onlyTreeNodeWarned = false;
|
|
@@ -71778,7 +71797,7 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
71778
71797
|
cursor: "pointer",
|
|
71779
71798
|
border: "0",
|
|
71780
71799
|
backgroundColor: "transparent",
|
|
71781
|
-
color: theme.palette.
|
|
71800
|
+
color: theme.palette.grayDarkL5,
|
|
71782
71801
|
"&[disabled]": {
|
|
71783
71802
|
pointerEvents: "none",
|
|
71784
71803
|
"& svg": {
|
|
@@ -71792,8 +71811,8 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
71792
71811
|
marginTop: "1px"
|
|
71793
71812
|
},
|
|
71794
71813
|
"&:hover,:hover path": {
|
|
71795
|
-
color: theme.palette.
|
|
71796
|
-
fill: theme.palette.
|
|
71814
|
+
color: theme.palette.grayDarkD15,
|
|
71815
|
+
fill: theme.palette.grayDarkD15
|
|
71797
71816
|
}
|
|
71798
71817
|
}
|
|
71799
71818
|
},
|
|
@@ -71812,7 +71831,7 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
71812
71831
|
border: "1px solid transparent"
|
|
71813
71832
|
},
|
|
71814
71833
|
"@global .level-0-treenode > .rc-tree-switcher i svg path": {
|
|
71815
|
-
fill: theme.palette.
|
|
71834
|
+
fill: theme.palette.primaryForegroundL5
|
|
71816
71835
|
},
|
|
71817
71836
|
"@global .rc-tree-focused:not(.rc-tree-active-focused)": {
|
|
71818
71837
|
borderColor: "cyan"
|
|
@@ -71973,7 +71992,7 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
71973
71992
|
plusButton: {
|
|
71974
71993
|
border: "0",
|
|
71975
71994
|
backgroundColor: "transparent",
|
|
71976
|
-
color: theme.palette.
|
|
71995
|
+
color: theme.palette.primaryForegroundL5,
|
|
71977
71996
|
padding: "0",
|
|
71978
71997
|
fontSize: "18px",
|
|
71979
71998
|
marginBottom: "2rem",
|
|
@@ -71988,12 +72007,12 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
71988
72007
|
width: `${nodeHeight}px`,
|
|
71989
72008
|
top: "5.5px",
|
|
71990
72009
|
"&:hover": {
|
|
71991
|
-
fill: theme.palette.
|
|
72010
|
+
fill: theme.palette.grayMidL10
|
|
71992
72011
|
}
|
|
71993
72012
|
},
|
|
71994
72013
|
nodeSizeLabel: {
|
|
71995
72014
|
fontSize: "12px",
|
|
71996
|
-
color: theme.palette.
|
|
72015
|
+
color: theme.palette.primaryForegroundD15
|
|
71997
72016
|
},
|
|
71998
72017
|
levelButtonsContainer: {
|
|
71999
72018
|
height: "20px",
|
|
@@ -72009,8 +72028,8 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
72009
72028
|
height: "12px",
|
|
72010
72029
|
padding: "5px",
|
|
72011
72030
|
backgroundClip: "content-box",
|
|
72012
|
-
border: `2px solid ${theme.palette.
|
|
72013
|
-
backgroundColor: theme.palette.
|
|
72031
|
+
border: `2px solid ${theme.palette.primaryForegroundL10}`,
|
|
72032
|
+
backgroundColor: theme.palette.primaryForegroundL10,
|
|
72014
72033
|
borderRadius: "6px",
|
|
72015
72034
|
position: "relative",
|
|
72016
72035
|
top: "3px",
|
|
@@ -72030,7 +72049,7 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
72030
72049
|
height: `${nodeHeight - 8}px`,
|
|
72031
72050
|
lineHeight: `${nodeHeight - 8}px`,
|
|
72032
72051
|
border: "1px solid transparent",
|
|
72033
|
-
color: theme.palette.
|
|
72052
|
+
color: theme.palette.primaryForegroundL5,
|
|
72034
72053
|
background: "transparent",
|
|
72035
72054
|
backgroundColor: "transparent",
|
|
72036
72055
|
verticalAlign: "top",
|
|
@@ -72073,8 +72092,8 @@ const useStyles$9 = makeStyles((theme) => ({
|
|
|
72073
72092
|
margin: 0,
|
|
72074
72093
|
padding: 0,
|
|
72075
72094
|
"&:hover": {
|
|
72076
|
-
backgroundColor: theme.palette.
|
|
72077
|
-
border: `1px solid ${theme.palette.
|
|
72095
|
+
backgroundColor: theme.palette.grayDarkL5,
|
|
72096
|
+
border: `1px solid ${theme.palette.grayDarkL5}`
|
|
72078
72097
|
}
|
|
72079
72098
|
},
|
|
72080
72099
|
"@global .vitessce-tooltip .ant-tooltip-content .ant-tooltip-inner": {
|
|
@@ -72224,7 +72243,7 @@ const useHelpTooltipStyles = makeStyles((theme) => ({
|
|
|
72224
72243
|
backgroundColor: "transparent",
|
|
72225
72244
|
borderRadius: "2px",
|
|
72226
72245
|
"&:hover": {
|
|
72227
|
-
backgroundColor: theme.palette.
|
|
72246
|
+
backgroundColor: theme.palette.grayLightL10
|
|
72228
72247
|
}
|
|
72229
72248
|
},
|
|
72230
72249
|
"& li:not(:last-child)": {
|
|
@@ -72281,7 +72300,7 @@ HelpTooltip.defaultProps = {
|
|
|
72281
72300
|
mouseLeaveDelay: 0,
|
|
72282
72301
|
destroyTooltipOnHide: true
|
|
72283
72302
|
};
|
|
72284
|
-
var _jsxFileName = "/
|
|
72303
|
+
var _jsxFileName = "/home/runner/work/vitessce/vitessce/node_modules/.pnpm/react-color-with-lodash@2.19.5_react@18.2.0/node_modules/react-color-with-lodash/dist/index.mjs";
|
|
72285
72304
|
var __defProp2 = Object.defineProperty;
|
|
72286
72305
|
var __defNormalProp2 = (obj, key2, value2) => key2 in obj ? __defProp2(obj, key2, {
|
|
72287
72306
|
enumerable: true,
|
|
@@ -180628,16 +180647,16 @@ async function getDecoder(fileDirectory) {
|
|
|
180628
180647
|
const Decoder = await importFn();
|
|
180629
180648
|
return new Decoder(fileDirectory);
|
|
180630
180649
|
}
|
|
180631
|
-
addDecoder([void 0, 1], () => import("./raw.
|
|
180632
|
-
addDecoder(5, () => import("./lzw.
|
|
180650
|
+
addDecoder([void 0, 1], () => import("./raw.741ddabe.mjs").then((m2) => m2.default));
|
|
180651
|
+
addDecoder(5, () => import("./lzw.e9257ec2.mjs").then((m2) => m2.default));
|
|
180633
180652
|
addDecoder(6, () => {
|
|
180634
180653
|
throw new Error("old style JPEG compression is not supported.");
|
|
180635
180654
|
});
|
|
180636
|
-
addDecoder(7, () => import("./jpeg.
|
|
180637
|
-
addDecoder([8, 32946], () => import("./deflate.
|
|
180638
|
-
addDecoder(32773, () => import("./packbits.
|
|
180639
|
-
addDecoder(34887, () => import("./lerc.
|
|
180640
|
-
addDecoder(50001, () => import("./webimage.
|
|
180655
|
+
addDecoder(7, () => import("./jpeg.21d1374d.mjs").then((m2) => m2.default));
|
|
180656
|
+
addDecoder([8, 32946], () => import("./deflate.199a1acc.mjs").then((m2) => m2.default));
|
|
180657
|
+
addDecoder(32773, () => import("./packbits.ab2ecbac.mjs").then((m2) => m2.default));
|
|
180658
|
+
addDecoder(34887, () => import("./lerc.c99fbca0.mjs").then((m2) => m2.default));
|
|
180659
|
+
addDecoder(50001, () => import("./webimage.0fa273e8.mjs").then((m2) => m2.default));
|
|
180641
180660
|
function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
|
|
180642
180661
|
return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
|
|
180643
180662
|
}
|
|
@@ -193641,390 +193660,1541 @@ class BitmaskLayer extends XRLayer {
|
|
|
193641
193660
|
}
|
|
193642
193661
|
BitmaskLayer.layerName = "BitmaskLayer";
|
|
193643
193662
|
BitmaskLayer.defaultProps = defaultProps;
|
|
193644
|
-
|
|
193645
|
-
|
|
193646
|
-
|
|
193647
|
-
|
|
193648
|
-
|
|
193649
|
-
|
|
193650
|
-
|
|
193651
|
-
|
|
193652
|
-
|
|
193653
|
-
|
|
193654
|
-
|
|
193655
|
-
|
|
193656
|
-
|
|
193657
|
-
|
|
193663
|
+
const useStyles$8 = makeStyles(() => ({
|
|
193664
|
+
tool: {
|
|
193665
|
+
position: "absolute",
|
|
193666
|
+
display: "inline",
|
|
193667
|
+
zIndex: "1000",
|
|
193668
|
+
opacity: ".65",
|
|
193669
|
+
color: "black",
|
|
193670
|
+
"&:hover": {
|
|
193671
|
+
opacity: ".90"
|
|
193672
|
+
}
|
|
193673
|
+
},
|
|
193674
|
+
iconButton: {
|
|
193675
|
+
padding: "0",
|
|
193676
|
+
height: "2em",
|
|
193677
|
+
width: "2em",
|
|
193678
|
+
backgroundColor: "white",
|
|
193679
|
+
display: "inline-block",
|
|
193680
|
+
fontWeight: "400",
|
|
193681
|
+
textAlign: "center",
|
|
193682
|
+
verticalAlign: "middle",
|
|
193683
|
+
cursor: "pointer",
|
|
193684
|
+
userSelect: "none",
|
|
193685
|
+
border: "1px solid #6c757d",
|
|
193686
|
+
fontSize: "1rem",
|
|
193687
|
+
lineHeight: "1.5",
|
|
193688
|
+
borderRadius: "0.25rem",
|
|
193689
|
+
transition: "color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
|
|
193690
|
+
color: "#6c757d",
|
|
193691
|
+
marginRight: "0.5rem",
|
|
193692
|
+
"& > svg": {
|
|
193693
|
+
verticalAlign: "middle"
|
|
193694
|
+
}
|
|
193695
|
+
},
|
|
193696
|
+
iconButtonActive: {
|
|
193697
|
+
color: "#fff",
|
|
193698
|
+
backgroundColor: "#6c757d",
|
|
193699
|
+
borderColor: "#6c757d",
|
|
193700
|
+
boxShadow: "0 0 0 0.2rem rgba(108, 117, 125, 0.5)"
|
|
193701
|
+
}
|
|
193702
|
+
}));
|
|
193703
|
+
function IconButton2(props2) {
|
|
193704
|
+
const { alt, onClick, isActive: isActive2, children: children3 } = props2;
|
|
193705
|
+
const classes = useStyles$8();
|
|
193706
|
+
return jsx("button", { className: clsx(classes.iconButton, { [classes.iconButtonActive]: isActive2 }), onClick, type: "button", title: alt, children: children3 });
|
|
193707
|
+
}
|
|
193708
|
+
function ToolMenu(props2) {
|
|
193709
|
+
const { setActiveTool, activeTool, visibleTools = { pan: true, selectRectangle: true, selectLasso: true } } = props2;
|
|
193710
|
+
const classes = useStyles$8();
|
|
193711
|
+
return jsxs("div", { className: classes.tool, children: [visibleTools.pan && jsx(IconButton2, { alt: "pointer tool", onClick: () => setActiveTool(null), isActive: activeTool === null, children: jsx(SvgNearMe, {}) }), visibleTools.selectRectangle ? jsx(IconButton2, { alt: "select rectangle", onClick: () => setActiveTool(distEs6$2.SELECTION_TYPE.RECTANGLE), isActive: activeTool === distEs6$2.SELECTION_TYPE.RECTANGLE, children: jsx(SvgSelectionRectangle, {}) }) : null, visibleTools.selectLasso ? jsx(IconButton2, { alt: "select lasso", onClick: () => setActiveTool(distEs6$2.SELECTION_TYPE.POLYGON), isActive: activeTool === distEs6$2.SELECTION_TYPE.POLYGON, children: jsx(SvgSelectionLasso, {}) }) : null] });
|
|
193712
|
+
}
|
|
193713
|
+
const getCursorWithTool = () => "crosshair";
|
|
193714
|
+
const getCursor = (interactionState) => interactionState.isDragging ? "grabbing" : "default";
|
|
193715
|
+
function getOnHoverCallback(obsIndex, setObsHighlight, setComponentHover) {
|
|
193716
|
+
return (info2) => {
|
|
193717
|
+
if (setComponentHover) {
|
|
193718
|
+
setComponentHover();
|
|
193719
|
+
}
|
|
193720
|
+
if (info2.index) {
|
|
193721
|
+
const obsId = obsIndex[info2.index];
|
|
193722
|
+
if (setObsHighlight) {
|
|
193723
|
+
setObsHighlight(obsId);
|
|
193724
|
+
}
|
|
193725
|
+
} else if (setObsHighlight) {
|
|
193726
|
+
setObsHighlight(null);
|
|
193727
|
+
}
|
|
193728
|
+
};
|
|
193729
|
+
}
|
|
193730
|
+
class AbstractSpatialOrScatterplot extends PureComponent {
|
|
193731
|
+
constructor(props2) {
|
|
193732
|
+
super(props2);
|
|
193733
|
+
this.state = {
|
|
193734
|
+
gl: null,
|
|
193735
|
+
tool: null
|
|
193736
|
+
};
|
|
193737
|
+
this.viewport = null;
|
|
193738
|
+
this.onViewStateChange = this.onViewStateChange.bind(this);
|
|
193739
|
+
this.onInitializeViewInfo = this.onInitializeViewInfo.bind(this);
|
|
193740
|
+
this.onWebGLInitialized = this.onWebGLInitialized.bind(this);
|
|
193741
|
+
this.onToolChange = this.onToolChange.bind(this);
|
|
193742
|
+
this.onHover = this.onHover.bind(this);
|
|
193743
|
+
}
|
|
193744
|
+
onViewStateChange({ viewState: nextViewState }) {
|
|
193745
|
+
const { setViewState, viewState, layers, spatialAxisFixed } = this.props;
|
|
193746
|
+
const use3d = layers == null ? void 0 : layers.some((l2) => l2.use3d);
|
|
193747
|
+
setViewState({
|
|
193748
|
+
...nextViewState,
|
|
193749
|
+
target: spatialAxisFixed && use3d ? viewState.target : nextViewState.target
|
|
193750
|
+
});
|
|
193751
|
+
}
|
|
193752
|
+
onInitializeViewInfo({ viewport }) {
|
|
193753
|
+
this.viewport = viewport;
|
|
193754
|
+
}
|
|
193755
|
+
onWebGLInitialized(gl) {
|
|
193756
|
+
this.setState({ gl });
|
|
193757
|
+
}
|
|
193758
|
+
onToolChange(tool) {
|
|
193759
|
+
const { onToolChange: onToolChangeProp } = this.props;
|
|
193760
|
+
this.setState({ tool });
|
|
193761
|
+
if (onToolChangeProp) {
|
|
193762
|
+
onToolChangeProp(tool);
|
|
193763
|
+
}
|
|
193764
|
+
}
|
|
193765
|
+
getLayers() {
|
|
193766
|
+
return [];
|
|
193767
|
+
}
|
|
193768
|
+
onHover(info2) {
|
|
193769
|
+
const { coordinate, sourceLayer: layer, tile } = info2;
|
|
193770
|
+
const { setCellHighlight, cellHighlight, setComponentHover, layers } = this.props;
|
|
193771
|
+
const hasBitmask = (layers || []).some((l2) => l2.type === "bitmask");
|
|
193772
|
+
if (!setCellHighlight || !tile) {
|
|
193773
|
+
return null;
|
|
193774
|
+
}
|
|
193775
|
+
if (!layer || !coordinate) {
|
|
193776
|
+
if (cellHighlight && hasBitmask) {
|
|
193777
|
+
setCellHighlight(null);
|
|
193778
|
+
}
|
|
193779
|
+
return null;
|
|
193780
|
+
}
|
|
193781
|
+
const { content: content2, bbox: bbox2, z } = tile;
|
|
193782
|
+
if (!content2) {
|
|
193783
|
+
if (cellHighlight && hasBitmask) {
|
|
193784
|
+
setCellHighlight(null);
|
|
193785
|
+
}
|
|
193786
|
+
return null;
|
|
193787
|
+
}
|
|
193788
|
+
const { data: data2, width: width2, height: height2 } = content2;
|
|
193789
|
+
const { left: left2, right: right2, top: top2, bottom: bottom2 } = bbox2;
|
|
193790
|
+
const bounds2 = [
|
|
193791
|
+
left2,
|
|
193792
|
+
data2.height < layer.tileSize ? height2 : bottom2,
|
|
193793
|
+
data2.width < layer.tileSize ? width2 : right2,
|
|
193794
|
+
top2
|
|
193795
|
+
];
|
|
193796
|
+
if (!data2) {
|
|
193797
|
+
if (cellHighlight && hasBitmask) {
|
|
193798
|
+
setCellHighlight(null);
|
|
193799
|
+
}
|
|
193800
|
+
return null;
|
|
193801
|
+
}
|
|
193802
|
+
if (layer.id.includes("bitmask")) {
|
|
193803
|
+
const layerZoomScale = Math.max(1, 2 ** Math.round(-z));
|
|
193804
|
+
const dataCoords = [
|
|
193805
|
+
Math.floor((coordinate[0] - bounds2[0]) / layerZoomScale),
|
|
193806
|
+
Math.floor((coordinate[1] - bounds2[3]) / layerZoomScale)
|
|
193807
|
+
];
|
|
193808
|
+
const coords = dataCoords[1] * width2 + dataCoords[0];
|
|
193809
|
+
const hoverData = data2.map((d) => d[coords]);
|
|
193810
|
+
const cellId = hoverData.find((i2) => i2 > 0);
|
|
193811
|
+
if (cellId !== Number(cellHighlight)) {
|
|
193812
|
+
if (setComponentHover) {
|
|
193813
|
+
setComponentHover();
|
|
193814
|
+
}
|
|
193815
|
+
setCellHighlight(cellId ? String(cellId) : null);
|
|
193816
|
+
}
|
|
193817
|
+
}
|
|
193818
|
+
}
|
|
193819
|
+
viewInfoDidUpdate(obsIndex, obsLocations, makeGetObsCoords) {
|
|
193820
|
+
const { updateViewInfo, uuid } = this.props;
|
|
193821
|
+
const { viewport } = this;
|
|
193822
|
+
if (updateViewInfo && viewport) {
|
|
193823
|
+
updateViewInfo({
|
|
193824
|
+
uuid,
|
|
193825
|
+
project: (obsId) => {
|
|
193826
|
+
try {
|
|
193827
|
+
if (obsIndex && obsLocations) {
|
|
193828
|
+
const getObsCoords = makeGetObsCoords(obsLocations);
|
|
193829
|
+
const obsIdx = obsIndex.indexOf(obsId);
|
|
193830
|
+
const obsCoord = getObsCoords(obsIdx);
|
|
193831
|
+
return viewport.project(obsCoord);
|
|
193658
193832
|
}
|
|
193833
|
+
return [null, null];
|
|
193834
|
+
} catch (e3) {
|
|
193835
|
+
return [null, null];
|
|
193659
193836
|
}
|
|
193660
193837
|
}
|
|
193661
|
-
|
|
193662
|
-
}, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
193663
|
-
return _extends2.apply(this, arguments);
|
|
193838
|
+
});
|
|
193664
193839
|
}
|
|
193665
|
-
module2.exports = _extends2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
193666
|
-
})(_extends$1);
|
|
193667
|
-
return _extends$1.exports;
|
|
193668
|
-
}
|
|
193669
|
-
var _extendsExports = require_extends();
|
|
193670
|
-
var DEFAULT_CONFIG = {
|
|
193671
|
-
epsilon: 1e-12,
|
|
193672
|
-
matrix: "Matrix",
|
|
193673
|
-
number: "number",
|
|
193674
|
-
precision: 64,
|
|
193675
|
-
predictable: false,
|
|
193676
|
-
randomSeed: null
|
|
193677
|
-
};
|
|
193678
|
-
function isNumber$2(x2) {
|
|
193679
|
-
return typeof x2 === "number";
|
|
193680
|
-
}
|
|
193681
|
-
function isBigNumber(x2) {
|
|
193682
|
-
if (!x2 || typeof x2 !== "object" || typeof x2.constructor !== "function") {
|
|
193683
|
-
return false;
|
|
193684
193840
|
}
|
|
193685
|
-
|
|
193686
|
-
return true;
|
|
193841
|
+
componentDidUpdate() {
|
|
193687
193842
|
}
|
|
193688
|
-
|
|
193689
|
-
return
|
|
193843
|
+
use3d() {
|
|
193844
|
+
return false;
|
|
193845
|
+
}
|
|
193846
|
+
render() {
|
|
193847
|
+
var _a3, _b2, _c, _d;
|
|
193848
|
+
const { deckRef, viewState, uuid, hideTools } = this.props;
|
|
193849
|
+
const { gl, tool } = this.state;
|
|
193850
|
+
const layers = this.getLayers();
|
|
193851
|
+
const use3d = this.use3d();
|
|
193852
|
+
const showCellSelectionTools = this.obsSegmentationsData !== null;
|
|
193853
|
+
const showPanTool = layers.length > 0;
|
|
193854
|
+
const useDevicePixels = !use3d && (((_b2 = (_a3 = this.obsSegmentationsData) == null ? void 0 : _a3.shape) == null ? void 0 : _b2[0]) < 1e5 || ((_d = (_c = this.obsLocationsData) == null ? void 0 : _c.shape) == null ? void 0 : _d[1]) < 1e5);
|
|
193855
|
+
return jsxs(Fragment, { children: [jsx(ToolMenu, { activeTool: tool, setActiveTool: this.onToolChange, visibleTools: {
|
|
193856
|
+
pan: showPanTool && !hideTools,
|
|
193857
|
+
selectRectangle: showCellSelectionTools && !hideTools,
|
|
193858
|
+
selectLasso: showCellSelectionTools && !hideTools
|
|
193859
|
+
} }), jsx(DeckGL$1, { id: `deckgl-overlay-${uuid}`, ref: deckRef, views: [
|
|
193860
|
+
use3d ? new OrbitView({ id: "orbit", controller: true, orbitAxis: "Y" }) : new OrthographicView({
|
|
193861
|
+
id: "ortho"
|
|
193862
|
+
})
|
|
193863
|
+
], layers: gl && viewState.target.slice(0, 2).every((i2) => typeof i2 === "number") ? layers : [], glOptions: DEFAULT_GL_OPTIONS, onWebGLInitialized: this.onWebGLInitialized, onViewStateChange: this.onViewStateChange, viewState, useDevicePixels, controller: tool ? { dragPan: false } : true, getCursor: tool ? getCursorWithTool : getCursor, onHover: this.onHover, children: this.onInitializeViewInfo })] });
|
|
193690
193864
|
}
|
|
193691
|
-
return false;
|
|
193692
|
-
}
|
|
193693
|
-
function isComplex(x2) {
|
|
193694
|
-
return x2 && typeof x2 === "object" && Object.getPrototypeOf(x2).isComplex === true || false;
|
|
193695
|
-
}
|
|
193696
|
-
function isFraction(x2) {
|
|
193697
|
-
return x2 && typeof x2 === "object" && Object.getPrototypeOf(x2).isFraction === true || false;
|
|
193698
|
-
}
|
|
193699
|
-
function isUnit(x2) {
|
|
193700
|
-
return x2 && x2.constructor.prototype.isUnit === true || false;
|
|
193701
|
-
}
|
|
193702
|
-
function isString$1(x2) {
|
|
193703
|
-
return typeof x2 === "string";
|
|
193704
|
-
}
|
|
193705
|
-
var isArray$1 = Array.isArray;
|
|
193706
|
-
function isMatrix(x2) {
|
|
193707
|
-
return x2 && x2.constructor.prototype.isMatrix === true || false;
|
|
193708
|
-
}
|
|
193709
|
-
function isCollection(x2) {
|
|
193710
|
-
return Array.isArray(x2) || isMatrix(x2);
|
|
193711
|
-
}
|
|
193712
|
-
function isDenseMatrix(x2) {
|
|
193713
|
-
return x2 && x2.isDenseMatrix && x2.constructor.prototype.isMatrix === true || false;
|
|
193714
|
-
}
|
|
193715
|
-
function isSparseMatrix(x2) {
|
|
193716
|
-
return x2 && x2.isSparseMatrix && x2.constructor.prototype.isMatrix === true || false;
|
|
193717
|
-
}
|
|
193718
|
-
function isRange(x2) {
|
|
193719
|
-
return x2 && x2.constructor.prototype.isRange === true || false;
|
|
193720
|
-
}
|
|
193721
|
-
function isIndex(x2) {
|
|
193722
|
-
return x2 && x2.constructor.prototype.isIndex === true || false;
|
|
193723
|
-
}
|
|
193724
|
-
function isBoolean$3(x2) {
|
|
193725
|
-
return typeof x2 === "boolean";
|
|
193726
|
-
}
|
|
193727
|
-
function isResultSet(x2) {
|
|
193728
|
-
return x2 && x2.constructor.prototype.isResultSet === true || false;
|
|
193729
|
-
}
|
|
193730
|
-
function isHelp(x2) {
|
|
193731
|
-
return x2 && x2.constructor.prototype.isHelp === true || false;
|
|
193732
|
-
}
|
|
193733
|
-
function isFunction$2(x2) {
|
|
193734
|
-
return typeof x2 === "function";
|
|
193735
|
-
}
|
|
193736
|
-
function isDate$2(x2) {
|
|
193737
|
-
return x2 instanceof Date;
|
|
193738
|
-
}
|
|
193739
|
-
function isRegExp$1(x2) {
|
|
193740
|
-
return x2 instanceof RegExp;
|
|
193741
|
-
}
|
|
193742
|
-
function isObject$1(x2) {
|
|
193743
|
-
return !!(x2 && typeof x2 === "object" && x2.constructor === Object && !isComplex(x2) && !isFraction(x2));
|
|
193744
|
-
}
|
|
193745
|
-
function isNull(x2) {
|
|
193746
|
-
return x2 === null;
|
|
193747
|
-
}
|
|
193748
|
-
function isUndefined(x2) {
|
|
193749
|
-
return x2 === void 0;
|
|
193750
|
-
}
|
|
193751
|
-
function isAccessorNode(x2) {
|
|
193752
|
-
return x2 && x2.isAccessorNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193753
|
-
}
|
|
193754
|
-
function isArrayNode(x2) {
|
|
193755
|
-
return x2 && x2.isArrayNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193756
|
-
}
|
|
193757
|
-
function isAssignmentNode(x2) {
|
|
193758
|
-
return x2 && x2.isAssignmentNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193759
|
-
}
|
|
193760
|
-
function isBlockNode(x2) {
|
|
193761
|
-
return x2 && x2.isBlockNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193762
|
-
}
|
|
193763
|
-
function isConditionalNode(x2) {
|
|
193764
|
-
return x2 && x2.isConditionalNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193765
|
-
}
|
|
193766
|
-
function isConstantNode(x2) {
|
|
193767
|
-
return x2 && x2.isConstantNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193768
|
-
}
|
|
193769
|
-
function isFunctionAssignmentNode(x2) {
|
|
193770
|
-
return x2 && x2.isFunctionAssignmentNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193771
|
-
}
|
|
193772
|
-
function isFunctionNode(x2) {
|
|
193773
|
-
return x2 && x2.isFunctionNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193774
|
-
}
|
|
193775
|
-
function isIndexNode(x2) {
|
|
193776
|
-
return x2 && x2.isIndexNode === true && x2.constructor.prototype.isNode === true || false;
|
|
193777
193865
|
}
|
|
193778
|
-
function
|
|
193779
|
-
|
|
193866
|
+
function createQuadTree(obsEmbedding, getCellCoords) {
|
|
193867
|
+
if (!obsEmbedding) {
|
|
193868
|
+
return null;
|
|
193869
|
+
}
|
|
193870
|
+
const tree2 = quadtree$1().x((i2) => getCellCoords(i2)[0]).y((i2) => getCellCoords(i2)[1]).addAll(range_1(obsEmbedding.shape[1]));
|
|
193871
|
+
return tree2;
|
|
193780
193872
|
}
|
|
193781
|
-
function
|
|
193782
|
-
return
|
|
193873
|
+
function constant$5(v) {
|
|
193874
|
+
return () => v;
|
|
193783
193875
|
}
|
|
193784
|
-
function
|
|
193785
|
-
return
|
|
193876
|
+
function jiggle$1(v) {
|
|
193877
|
+
return v + (Math.random() - 0.5) * 1e-6;
|
|
193786
193878
|
}
|
|
193787
|
-
function
|
|
193788
|
-
|
|
193879
|
+
function forceCollideRects() {
|
|
193880
|
+
let nodes;
|
|
193881
|
+
let masses;
|
|
193882
|
+
let strength = 1;
|
|
193883
|
+
let iterations2 = 1;
|
|
193884
|
+
let sizes;
|
|
193885
|
+
let size2 = constant$5([0, 0]);
|
|
193886
|
+
function xCenter(d) {
|
|
193887
|
+
return d.x + d.vx + sizes[d.index][0] / 2;
|
|
193888
|
+
}
|
|
193889
|
+
function yCenter(d) {
|
|
193890
|
+
return d.y + d.vy + sizes[d.index][1] / 2;
|
|
193891
|
+
}
|
|
193892
|
+
function prepare2(quad2) {
|
|
193893
|
+
if (quad2.data) {
|
|
193894
|
+
quad2.size = sizes[quad2.data.index];
|
|
193895
|
+
} else {
|
|
193896
|
+
quad2.size = [0, 0];
|
|
193897
|
+
for (let i2 = 0; i2 < 4; i2++) {
|
|
193898
|
+
if (quad2[i2] && quad2[i2].size) {
|
|
193899
|
+
quad2.size[0] = Math.max(quad2.size[0], quad2[i2].size[0]);
|
|
193900
|
+
quad2.size[1] = Math.max(quad2.size[1], quad2[i2].size[1]);
|
|
193901
|
+
}
|
|
193902
|
+
}
|
|
193903
|
+
}
|
|
193904
|
+
}
|
|
193905
|
+
function force2() {
|
|
193906
|
+
let node;
|
|
193907
|
+
let nodeSize;
|
|
193908
|
+
let nodeMass;
|
|
193909
|
+
let xi;
|
|
193910
|
+
let yi;
|
|
193911
|
+
const tree2 = quadtree$1(nodes, xCenter, yCenter).visitAfter(prepare2);
|
|
193912
|
+
function apply2(quad2, x02, y02, x12, y12) {
|
|
193913
|
+
const { data: data2 } = quad2;
|
|
193914
|
+
const xSize = (nodeSize[0] + quad2.size[0]) / 2;
|
|
193915
|
+
const ySize = (nodeSize[1] + quad2.size[1]) / 2;
|
|
193916
|
+
if (data2 && data2.index > node.index) {
|
|
193917
|
+
let x2 = jiggle$1(xi - xCenter(data2));
|
|
193918
|
+
let y2 = jiggle$1(yi - yCenter(data2));
|
|
193919
|
+
const xd = Math.abs(x2) - xSize;
|
|
193920
|
+
const yd = Math.abs(y2) - ySize;
|
|
193921
|
+
if (xd < 0 && yd < 0) {
|
|
193922
|
+
const l2 = Math.sqrt(x2 * x2 + y2 * y2);
|
|
193923
|
+
const m2 = masses[data2.index] / (nodeMass + masses[data2.index]);
|
|
193924
|
+
if (Math.abs(xd) < Math.abs(yd)) {
|
|
193925
|
+
node.vx -= (x2 *= xd / l2 * strength) * m2;
|
|
193926
|
+
data2.vx += x2 * (1 - m2);
|
|
193927
|
+
} else {
|
|
193928
|
+
node.vy -= (y2 *= yd / l2 * strength) * m2;
|
|
193929
|
+
data2.vy += y2 * (1 - m2);
|
|
193930
|
+
}
|
|
193931
|
+
}
|
|
193932
|
+
return x02 > xi + xSize || x12 < xi - xSize || y02 > yi + ySize || y12 < yi - ySize;
|
|
193933
|
+
}
|
|
193934
|
+
return false;
|
|
193935
|
+
}
|
|
193936
|
+
function iterate2() {
|
|
193937
|
+
for (let j = 0; j < nodes.length; j++) {
|
|
193938
|
+
node = nodes[j];
|
|
193939
|
+
nodeSize = sizes[j];
|
|
193940
|
+
nodeMass = masses[j];
|
|
193941
|
+
xi = xCenter(node);
|
|
193942
|
+
yi = yCenter(node);
|
|
193943
|
+
tree2.visit(apply2);
|
|
193944
|
+
}
|
|
193945
|
+
}
|
|
193946
|
+
for (let i2 = 0; i2 < iterations2; i2++) {
|
|
193947
|
+
iterate2();
|
|
193948
|
+
}
|
|
193949
|
+
}
|
|
193950
|
+
force2.initialize = (v) => {
|
|
193951
|
+
nodes = v;
|
|
193952
|
+
sizes = nodes.map(size2);
|
|
193953
|
+
masses = sizes.map((d) => d[0] + d[1]);
|
|
193954
|
+
};
|
|
193955
|
+
force2.iterations = (...v) => {
|
|
193956
|
+
if (v.length) {
|
|
193957
|
+
iterations2 = +v[0];
|
|
193958
|
+
return force2;
|
|
193959
|
+
}
|
|
193960
|
+
return iterations2;
|
|
193961
|
+
};
|
|
193962
|
+
force2.strength = (...v) => {
|
|
193963
|
+
if (v.length) {
|
|
193964
|
+
strength = +v[0];
|
|
193965
|
+
return force2;
|
|
193966
|
+
}
|
|
193967
|
+
return strength;
|
|
193968
|
+
};
|
|
193969
|
+
force2.size = (...v) => {
|
|
193970
|
+
if (v.length) {
|
|
193971
|
+
size2 = typeof v[0] === "function" ? v[0] : constant$5(v[0]);
|
|
193972
|
+
return force2;
|
|
193973
|
+
}
|
|
193974
|
+
return size2;
|
|
193975
|
+
};
|
|
193976
|
+
return force2;
|
|
193789
193977
|
}
|
|
193790
|
-
function
|
|
193791
|
-
|
|
193978
|
+
function baseClamp$1(number2, lower, upper) {
|
|
193979
|
+
if (number2 === number2) {
|
|
193980
|
+
if (upper !== void 0) {
|
|
193981
|
+
number2 = number2 <= upper ? number2 : upper;
|
|
193982
|
+
}
|
|
193983
|
+
if (lower !== void 0) {
|
|
193984
|
+
number2 = number2 >= lower ? number2 : lower;
|
|
193985
|
+
}
|
|
193986
|
+
}
|
|
193987
|
+
return number2;
|
|
193792
193988
|
}
|
|
193793
|
-
|
|
193794
|
-
|
|
193989
|
+
var _baseClamp = baseClamp$1;
|
|
193990
|
+
var baseClamp = _baseClamp, toNumber$1 = toNumber_1$1;
|
|
193991
|
+
function clamp$2(number2, lower, upper) {
|
|
193992
|
+
if (upper === void 0) {
|
|
193993
|
+
upper = lower;
|
|
193994
|
+
lower = void 0;
|
|
193995
|
+
}
|
|
193996
|
+
if (upper !== void 0) {
|
|
193997
|
+
upper = toNumber$1(upper);
|
|
193998
|
+
upper = upper === upper ? upper : 0;
|
|
193999
|
+
}
|
|
194000
|
+
if (lower !== void 0) {
|
|
194001
|
+
lower = toNumber$1(lower);
|
|
194002
|
+
lower = lower === lower ? lower : 0;
|
|
194003
|
+
}
|
|
194004
|
+
return baseClamp(toNumber$1(number2), lower, upper);
|
|
193795
194005
|
}
|
|
193796
|
-
|
|
193797
|
-
|
|
194006
|
+
var clamp_1 = clamp$2;
|
|
194007
|
+
function getPointSizeDevicePixels(devicePixelRatio2, zoom2, xRange, yRange, width2, height2) {
|
|
194008
|
+
const pointSize = 5e-4;
|
|
194009
|
+
const pointScreenSizeMax = 10;
|
|
194010
|
+
const pointScreenSizeMin = 1 / devicePixelRatio2;
|
|
194011
|
+
const scaleFactor = 2 ** zoom2;
|
|
194012
|
+
const xAxisRange = 2 / (xRange * scaleFactor / width2);
|
|
194013
|
+
const yAxisRange = 2 / (yRange * scaleFactor / height2);
|
|
194014
|
+
const diagonalScreenSize = Math.sqrt(width2 ** 2 + height2 ** 2);
|
|
194015
|
+
const diagonalAxisRange = Math.sqrt(xAxisRange ** 2 + yAxisRange ** 2);
|
|
194016
|
+
const diagonalFraction = pointSize / diagonalAxisRange;
|
|
194017
|
+
const deviceSize = diagonalFraction * diagonalScreenSize;
|
|
194018
|
+
const pointSizeDevicePixels = clamp_1(deviceSize, pointScreenSizeMin, pointScreenSizeMax);
|
|
194019
|
+
return pointSizeDevicePixels;
|
|
193798
194020
|
}
|
|
193799
|
-
function
|
|
193800
|
-
|
|
193801
|
-
|
|
193802
|
-
|
|
193803
|
-
|
|
193804
|
-
|
|
193805
|
-
|
|
193806
|
-
|
|
193807
|
-
|
|
193808
|
-
|
|
193809
|
-
|
|
193810
|
-
|
|
193811
|
-
|
|
193812
|
-
|
|
193813
|
-
|
|
193814
|
-
|
|
193815
|
-
return "Fraction";
|
|
193816
|
-
if (isMatrix(x2))
|
|
193817
|
-
return "Matrix";
|
|
193818
|
-
if (isUnit(x2))
|
|
193819
|
-
return "Unit";
|
|
193820
|
-
if (isIndex(x2))
|
|
193821
|
-
return "Index";
|
|
193822
|
-
if (isRange(x2))
|
|
193823
|
-
return "Range";
|
|
193824
|
-
if (isResultSet(x2))
|
|
193825
|
-
return "ResultSet";
|
|
193826
|
-
if (isNode(x2))
|
|
193827
|
-
return x2.type;
|
|
193828
|
-
if (isChain(x2))
|
|
193829
|
-
return "Chain";
|
|
193830
|
-
if (isHelp(x2))
|
|
193831
|
-
return "Help";
|
|
193832
|
-
return "Object";
|
|
194021
|
+
function getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, avgFillDensity) {
|
|
194022
|
+
const N2 = numCells;
|
|
194023
|
+
const [minX, minY, maxX, maxY2] = new OrthographicView({ zoom: zoom2 }).makeViewport({
|
|
194024
|
+
height: height2,
|
|
194025
|
+
width: width2,
|
|
194026
|
+
viewState: { zoom: zoom2, target: [0, 0, 0] }
|
|
194027
|
+
}).getBounds();
|
|
194028
|
+
const X3 = maxY2 - minY;
|
|
194029
|
+
const Y3 = maxX - minX;
|
|
194030
|
+
const X02 = xRange;
|
|
194031
|
+
const Y02 = yRange;
|
|
194032
|
+
const W = width2;
|
|
194033
|
+
const H = height2;
|
|
194034
|
+
let rho = avgFillDensity;
|
|
194035
|
+
if (!rho) {
|
|
194036
|
+
rho = Math.min(1, 1 / 10 ** (Math.log10(N2) - 3));
|
|
193833
194037
|
}
|
|
193834
|
-
|
|
193835
|
-
|
|
193836
|
-
return
|
|
194038
|
+
const alpha2 = rho * W * H / N2 * (Y02 / Y3) * (X02 / X3);
|
|
194039
|
+
const pointOpacity = clamp_1(alpha2, 1.01 / 255, 1);
|
|
194040
|
+
return pointOpacity;
|
|
193837
194041
|
}
|
|
193838
|
-
|
|
193839
|
-
|
|
193840
|
-
|
|
193841
|
-
|
|
193842
|
-
|
|
193843
|
-
|
|
193844
|
-
|
|
194042
|
+
const CELLS_LAYER_ID$1 = "scatterplot";
|
|
194043
|
+
const LABEL_FONT_FAMILY = "-apple-system, 'Helvetica Neue', Arial, sans-serif";
|
|
194044
|
+
const NUM_FORCE_SIMULATION_TICKS = 100;
|
|
194045
|
+
const LABEL_UPDATE_ZOOM_DELTA = 0.25;
|
|
194046
|
+
const makeDefaultGetCellColors$1 = (cellColors, obsIndex, theme) => (object2, { index: index2 }) => {
|
|
194047
|
+
const [r3, g2, b2, a2] = cellColors && obsIndex && cellColors.get(obsIndex[index2]) || getDefaultColor(theme);
|
|
194048
|
+
return [r3, g2, b2, 255 * (a2 || 1)];
|
|
194049
|
+
};
|
|
194050
|
+
const makeDefaultGetObsCoords$1 = (obsEmbedding) => (i2) => [
|
|
194051
|
+
obsEmbedding.data[0][i2],
|
|
194052
|
+
obsEmbedding.data[1][i2],
|
|
194053
|
+
0
|
|
194054
|
+
];
|
|
194055
|
+
const makeFlippedGetObsCoords = (obsEmbedding) => (i2) => [
|
|
194056
|
+
obsEmbedding.data[0][i2],
|
|
194057
|
+
-obsEmbedding.data[1][i2],
|
|
194058
|
+
0
|
|
194059
|
+
];
|
|
194060
|
+
const getPosition = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
194061
|
+
target2[0] = data2.src.obsEmbedding.data[0][index2];
|
|
194062
|
+
target2[1] = -data2.src.obsEmbedding.data[1][index2];
|
|
194063
|
+
target2[2] = 0;
|
|
194064
|
+
return target2;
|
|
194065
|
+
};
|
|
194066
|
+
class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
194067
|
+
constructor(props2) {
|
|
194068
|
+
super(props2);
|
|
194069
|
+
this.cellsQuadTree = null;
|
|
194070
|
+
this.cellsLayer = null;
|
|
194071
|
+
this.cellsData = null;
|
|
194072
|
+
this.cellSetsForceSimulation = forceCollideRects();
|
|
194073
|
+
this.cellSetsLabelPrevZoom = null;
|
|
194074
|
+
this.cellSetsLayers = [];
|
|
194075
|
+
this.onUpdateCellsData();
|
|
194076
|
+
this.onUpdateCellsLayer();
|
|
194077
|
+
this.onUpdateCellSetsLayers();
|
|
193845
194078
|
}
|
|
193846
|
-
|
|
193847
|
-
|
|
193848
|
-
|
|
194079
|
+
createCellsLayer() {
|
|
194080
|
+
const {
|
|
194081
|
+
obsEmbeddingIndex: obsIndex,
|
|
194082
|
+
theme,
|
|
194083
|
+
cellRadius = 1,
|
|
194084
|
+
cellOpacity = 1,
|
|
194085
|
+
cellSelection,
|
|
194086
|
+
setCellHighlight,
|
|
194087
|
+
setComponentHover,
|
|
194088
|
+
getCellIsSelected,
|
|
194089
|
+
cellColors,
|
|
194090
|
+
getCellColor = makeDefaultGetCellColors$1(cellColors, obsIndex, theme),
|
|
194091
|
+
getExpressionValue,
|
|
194092
|
+
onCellClick,
|
|
194093
|
+
geneExpressionColormap,
|
|
194094
|
+
geneExpressionColormapRange = [0, 1],
|
|
194095
|
+
cellColorEncoding
|
|
194096
|
+
} = this.props;
|
|
194097
|
+
return new ScatterplotLayer({
|
|
194098
|
+
id: CELLS_LAYER_ID$1,
|
|
194099
|
+
data: this.cellsData,
|
|
194100
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
194101
|
+
visible: true,
|
|
194102
|
+
pickable: true,
|
|
194103
|
+
autoHighlight: true,
|
|
194104
|
+
filled: true,
|
|
194105
|
+
stroked: true,
|
|
194106
|
+
backgroundColor: theme === "dark" ? [0, 0, 0] : [241, 241, 241],
|
|
194107
|
+
getCellIsSelected,
|
|
194108
|
+
opacity: cellOpacity,
|
|
194109
|
+
radiusScale: cellRadius,
|
|
194110
|
+
radiusMinPixels: 1,
|
|
194111
|
+
radiusMaxPixels: 30,
|
|
194112
|
+
radiusUnits: "pixels",
|
|
194113
|
+
lineWidthUnits: "pixels",
|
|
194114
|
+
getPosition,
|
|
194115
|
+
getFillColor: getCellColor,
|
|
194116
|
+
getLineColor: getCellColor,
|
|
194117
|
+
getRadius: 1,
|
|
194118
|
+
getExpressionValue,
|
|
194119
|
+
getLineWidth: 0,
|
|
194120
|
+
extensions: [
|
|
194121
|
+
new ScaledExpressionExtension(),
|
|
194122
|
+
new SelectionExtension({ instanced: true })
|
|
194123
|
+
],
|
|
194124
|
+
colorScaleLo: geneExpressionColormapRange[0],
|
|
194125
|
+
colorScaleHi: geneExpressionColormapRange[1],
|
|
194126
|
+
isExpressionMode: cellColorEncoding === "geneSelection",
|
|
194127
|
+
colormap: geneExpressionColormap,
|
|
194128
|
+
onClick: (info2) => {
|
|
194129
|
+
if (onCellClick) {
|
|
194130
|
+
onCellClick(info2);
|
|
194131
|
+
}
|
|
194132
|
+
},
|
|
194133
|
+
onHover: getOnHoverCallback(obsIndex, setCellHighlight, setComponentHover),
|
|
194134
|
+
updateTriggers: {
|
|
194135
|
+
getExpressionValue,
|
|
194136
|
+
getFillColor: [cellColorEncoding, cellSelection, cellColors],
|
|
194137
|
+
getLineColor: [cellColorEncoding, cellSelection, cellColors],
|
|
194138
|
+
getCellIsSelected
|
|
194139
|
+
}
|
|
193849
194140
|
});
|
|
193850
194141
|
}
|
|
193851
|
-
|
|
193852
|
-
|
|
193853
|
-
|
|
193854
|
-
|
|
193855
|
-
|
|
193856
|
-
|
|
193857
|
-
|
|
193858
|
-
|
|
193859
|
-
|
|
193860
|
-
|
|
193861
|
-
|
|
193862
|
-
|
|
193863
|
-
|
|
194142
|
+
createCellSetsLayers() {
|
|
194143
|
+
const { theme, cellSetPolygons, viewState, cellSetPolygonsVisible, cellSetLabelsVisible, cellSetLabelSize } = this.props;
|
|
194144
|
+
const result = [];
|
|
194145
|
+
if (cellSetPolygonsVisible) {
|
|
194146
|
+
result.push(new PolygonLayer({
|
|
194147
|
+
id: "cell-sets-polygon-layer",
|
|
194148
|
+
data: cellSetPolygons,
|
|
194149
|
+
stroked: true,
|
|
194150
|
+
filled: false,
|
|
194151
|
+
wireframe: true,
|
|
194152
|
+
lineWidthMaxPixels: 1,
|
|
194153
|
+
getPolygon: (d) => d.hull,
|
|
194154
|
+
getLineColor: (d) => d.color,
|
|
194155
|
+
getLineWidth: 1
|
|
194156
|
+
}));
|
|
193864
194157
|
}
|
|
193865
|
-
|
|
193866
|
-
|
|
193867
|
-
|
|
193868
|
-
|
|
193869
|
-
|
|
193870
|
-
|
|
193871
|
-
|
|
194158
|
+
if (cellSetLabelsVisible) {
|
|
194159
|
+
const { zoom: zoom2 } = viewState;
|
|
194160
|
+
const nodes = cellSetPolygons.map((p) => ({
|
|
194161
|
+
x: p.centroid[0],
|
|
194162
|
+
y: p.centroid[1],
|
|
194163
|
+
label: p.name
|
|
194164
|
+
}));
|
|
194165
|
+
const collisionForce = this.cellSetsForceSimulation.size((d) => [
|
|
194166
|
+
cellSetLabelSize * 1 / 2 ** zoom2 * 4 * d.label.length,
|
|
194167
|
+
cellSetLabelSize * 1 / 2 ** zoom2 * 1.5
|
|
194168
|
+
]);
|
|
194169
|
+
forceSimulation$1().nodes(nodes).force("collision", collisionForce).tick(NUM_FORCE_SIMULATION_TICKS);
|
|
194170
|
+
result.push(new TextLayer({
|
|
194171
|
+
id: "cell-sets-text-layer",
|
|
194172
|
+
data: nodes,
|
|
194173
|
+
getPosition: (d) => [d.x, d.y],
|
|
194174
|
+
getText: (d) => d.label,
|
|
194175
|
+
getColor: theme === "dark" ? [255, 255, 255] : [0, 0, 0],
|
|
194176
|
+
getSize: cellSetLabelSize,
|
|
194177
|
+
getAngle: 0,
|
|
194178
|
+
getTextAnchor: "middle",
|
|
194179
|
+
getAlignmentBaseline: "center",
|
|
194180
|
+
fontFamily: LABEL_FONT_FAMILY,
|
|
194181
|
+
fontWeight: "normal"
|
|
194182
|
+
}));
|
|
193872
194183
|
}
|
|
194184
|
+
return result;
|
|
193873
194185
|
}
|
|
193874
|
-
|
|
193875
|
-
}
|
|
193876
|
-
|
|
193877
|
-
|
|
193878
|
-
|
|
193879
|
-
|
|
193880
|
-
|
|
194186
|
+
createSelectionLayers() {
|
|
194187
|
+
const { obsEmbeddingIndex: obsIndex, obsEmbedding, viewState, setCellSelection } = this.props;
|
|
194188
|
+
const { tool } = this.state;
|
|
194189
|
+
const { cellsQuadTree } = this;
|
|
194190
|
+
const flipYTooltip = true;
|
|
194191
|
+
const getCellCoords = makeDefaultGetObsCoords$1(obsEmbedding);
|
|
194192
|
+
return getSelectionLayers(tool, viewState.zoom, CELLS_LAYER_ID$1, getCellCoords, obsIndex, setCellSelection, cellsQuadTree, flipYTooltip);
|
|
194193
|
+
}
|
|
194194
|
+
getLayers() {
|
|
194195
|
+
const { cellsLayer, cellSetsLayers } = this;
|
|
194196
|
+
return [
|
|
194197
|
+
cellsLayer,
|
|
194198
|
+
...cellSetsLayers,
|
|
194199
|
+
...this.createSelectionLayers()
|
|
194200
|
+
];
|
|
194201
|
+
}
|
|
194202
|
+
onUpdateCellsData() {
|
|
194203
|
+
const { obsEmbedding } = this.props;
|
|
194204
|
+
if (obsEmbedding) {
|
|
194205
|
+
const getCellCoords = makeDefaultGetObsCoords$1(obsEmbedding);
|
|
194206
|
+
this.cellsQuadTree = createQuadTree(obsEmbedding, getCellCoords);
|
|
194207
|
+
this.cellsData = {
|
|
194208
|
+
src: {
|
|
194209
|
+
obsEmbedding
|
|
194210
|
+
},
|
|
194211
|
+
length: obsEmbedding.shape[1]
|
|
194212
|
+
};
|
|
193881
194213
|
}
|
|
193882
|
-
|
|
193883
|
-
|
|
194214
|
+
}
|
|
194215
|
+
onUpdateCellsLayer() {
|
|
194216
|
+
const { obsEmbeddingIndex, obsEmbedding } = this.props;
|
|
194217
|
+
if (obsEmbeddingIndex && obsEmbedding) {
|
|
194218
|
+
this.cellsLayer = this.createCellsLayer();
|
|
194219
|
+
} else {
|
|
194220
|
+
this.cellsLayer = null;
|
|
193884
194221
|
}
|
|
193885
|
-
|
|
193886
|
-
|
|
193887
|
-
|
|
194222
|
+
}
|
|
194223
|
+
onUpdateCellSetsLayers(onlyViewStateChange) {
|
|
194224
|
+
if (onlyViewStateChange) {
|
|
194225
|
+
const { viewState, cellSetLabelsVisible } = this.props;
|
|
194226
|
+
const { zoom: zoom2 } = viewState;
|
|
194227
|
+
const { cellSetsLabelPrevZoom } = this;
|
|
194228
|
+
if (cellSetLabelsVisible && (cellSetsLabelPrevZoom === null || Math.abs(cellSetsLabelPrevZoom - zoom2) > LABEL_UPDATE_ZOOM_DELTA)) {
|
|
194229
|
+
this.cellSetsLayers = this.createCellSetsLayers();
|
|
194230
|
+
this.cellSetsLabelPrevZoom = zoom2;
|
|
193888
194231
|
}
|
|
194232
|
+
} else {
|
|
194233
|
+
this.cellSetsLayers = this.createCellSetsLayers();
|
|
193889
194234
|
}
|
|
193890
|
-
|
|
193891
|
-
|
|
193892
|
-
|
|
193893
|
-
|
|
193894
|
-
|
|
193895
|
-
|
|
194235
|
+
}
|
|
194236
|
+
viewInfoDidUpdate() {
|
|
194237
|
+
const { obsEmbeddingIndex, obsEmbedding } = this.props;
|
|
194238
|
+
super.viewInfoDidUpdate(obsEmbeddingIndex, obsEmbedding, makeFlippedGetObsCoords);
|
|
194239
|
+
}
|
|
194240
|
+
componentDidUpdate(prevProps) {
|
|
194241
|
+
this.viewInfoDidUpdate();
|
|
194242
|
+
const shallowDiff = (propName) => prevProps[propName] !== this.props[propName];
|
|
194243
|
+
let forceUpdate = false;
|
|
194244
|
+
if (["obsEmbedding"].some(shallowDiff)) {
|
|
194245
|
+
this.onUpdateCellsData();
|
|
194246
|
+
forceUpdate = true;
|
|
193896
194247
|
}
|
|
193897
|
-
|
|
193898
|
-
|
|
193899
|
-
|
|
193900
|
-
|
|
194248
|
+
if ([
|
|
194249
|
+
"obsEmbeddingIndex",
|
|
194250
|
+
"obsEmbedding",
|
|
194251
|
+
"cellFilter",
|
|
194252
|
+
"cellSelection",
|
|
194253
|
+
"cellColors",
|
|
194254
|
+
"cellRadius",
|
|
194255
|
+
"cellOpacity",
|
|
194256
|
+
"cellRadiusMode",
|
|
194257
|
+
"geneExpressionColormap",
|
|
194258
|
+
"geneExpressionColormapRange",
|
|
194259
|
+
"geneSelection",
|
|
194260
|
+
"cellColorEncoding"
|
|
194261
|
+
].some(shallowDiff)) {
|
|
194262
|
+
this.onUpdateCellsLayer();
|
|
194263
|
+
forceUpdate = true;
|
|
193901
194264
|
}
|
|
193902
|
-
|
|
193903
|
-
|
|
193904
|
-
|
|
193905
|
-
|
|
194265
|
+
if ([
|
|
194266
|
+
"cellSetPolygons",
|
|
194267
|
+
"cellSetPolygonsVisible",
|
|
194268
|
+
"cellSetLabelsVisible",
|
|
194269
|
+
"cellSetLabelSize"
|
|
194270
|
+
].some(shallowDiff)) {
|
|
194271
|
+
this.onUpdateCellSetsLayers(false);
|
|
194272
|
+
forceUpdate = true;
|
|
194273
|
+
}
|
|
194274
|
+
if (shallowDiff("viewState")) {
|
|
194275
|
+
this.onUpdateCellSetsLayers(true);
|
|
194276
|
+
forceUpdate = true;
|
|
194277
|
+
}
|
|
194278
|
+
if (forceUpdate) {
|
|
194279
|
+
this.forceUpdate();
|
|
193906
194280
|
}
|
|
193907
|
-
return true;
|
|
193908
|
-
} else {
|
|
193909
|
-
return a2 === b2;
|
|
193910
194281
|
}
|
|
193911
194282
|
}
|
|
193912
|
-
|
|
193913
|
-
|
|
194283
|
+
const ScatterplotWrapper = forwardRef((props2, deckRef) => jsx(Scatterplot, { ...props2, deckRef }));
|
|
194284
|
+
function ScatterplotOptions(props2) {
|
|
194285
|
+
const { children: children3, observationsLabel, cellRadius, setCellRadius, cellRadiusMode, setCellRadiusMode, cellOpacity, setCellOpacity, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange } = props2;
|
|
194286
|
+
const observationsLabelNice = capitalize$2(observationsLabel);
|
|
194287
|
+
const classes = useStyles$b();
|
|
194288
|
+
function handleCellRadiusModeChange(event2) {
|
|
194289
|
+
setCellRadiusMode(event2.target.value);
|
|
194290
|
+
}
|
|
194291
|
+
function handleCellOpacityModeChange(event2) {
|
|
194292
|
+
setCellOpacityMode(event2.target.value);
|
|
194293
|
+
}
|
|
194294
|
+
function handleRadiusChange(event2, value2) {
|
|
194295
|
+
setCellRadius(value2);
|
|
194296
|
+
}
|
|
194297
|
+
function handleOpacityChange(event2, value2) {
|
|
194298
|
+
setCellOpacity(value2);
|
|
194299
|
+
}
|
|
194300
|
+
function handleLabelVisibilityChange(event2) {
|
|
194301
|
+
setCellSetLabelsVisible(event2.target.checked);
|
|
194302
|
+
}
|
|
194303
|
+
function handleLabelSizeChange(event2, value2) {
|
|
194304
|
+
setCellSetLabelSize(value2);
|
|
194305
|
+
}
|
|
194306
|
+
function handlePolygonVisibilityChange(event2) {
|
|
194307
|
+
setCellSetPolygonsVisible(event2.target.checked);
|
|
194308
|
+
}
|
|
194309
|
+
function handleGeneExpressionColormapChange(event2) {
|
|
194310
|
+
setGeneExpressionColormap(event2.target.value);
|
|
194311
|
+
}
|
|
194312
|
+
function handleColormapRangeChange(event2, value2) {
|
|
194313
|
+
setGeneExpressionColormapRange(value2);
|
|
194314
|
+
}
|
|
194315
|
+
const handleColormapRangeChangeDebounced = useCallback(debounce_1$1(handleColormapRangeChange, 5, { trailing: true }), [handleColormapRangeChange]);
|
|
194316
|
+
return jsxs(OptionsContainer, { children: [children3, jsx(CellColorEncodingOption, { observationsLabel, cellColorEncoding, setCellColorEncoding }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Set Labels Visible"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Checkbox$1, { className: classes.checkbox, checked: cellSetLabelsVisible, onChange: handleLabelVisibilityChange, name: "scatterplot-option-cell-set-labels", color: "default" }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Set Label Size"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { disabled: !cellSetLabelsVisible, classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: cellSetLabelSize, onChange: handleLabelSizeChange, "aria-labelledby": "cell-set-label-size-slider", valueLabelDisplay: "auto", step: 1, min: 8, max: 36 }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Set Polygons Visible"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Checkbox$1, { className: classes.checkbox, checked: cellSetPolygonsVisible, onChange: handlePolygonVisibilityChange, name: "scatterplot-option-cell-set-polygons", color: "default" }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, htmlFor: "cell-radius-mode-select", children: [observationsLabelNice, " Radius Mode"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsxs(OptionSelect, { className: classes.select, value: cellRadiusMode, onChange: handleCellRadiusModeChange, inputProps: {
|
|
194317
|
+
id: "cell-radius-mode-select"
|
|
194318
|
+
}, children: [jsx("option", { value: "auto", children: "Auto" }), jsx("option", { value: "manual", children: "Manual" })] }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Radius"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { disabled: cellRadiusMode !== "manual", classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: cellRadius, onChange: handleRadiusChange, "aria-labelledby": "cell-radius-slider", valueLabelDisplay: "auto", step: 0.01, min: 0.01, max: 10 }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, htmlFor: "cell-opacity-mode-select", children: [observationsLabelNice, " Opacity Mode"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsxs(OptionSelect, { className: classes.select, value: cellOpacityMode, onChange: handleCellOpacityModeChange, inputProps: {
|
|
194319
|
+
id: "cell-opacity-mode-select"
|
|
194320
|
+
}, children: [jsx("option", { value: "auto", children: "Auto" }), jsx("option", { value: "manual", children: "Manual" })] }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Opacity"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { disabled: cellOpacityMode !== "manual", classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: cellOpacity, onChange: handleOpacityChange, "aria-labelledby": "cell-opacity-slider", valueLabelDisplay: "auto", step: 0.05, min: 0, max: 1 }) })] }), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, htmlFor: "gene-expression-colormap-select", children: "Gene Expression Colormap" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(OptionSelect, { className: classes.select, value: geneExpressionColormap, onChange: handleGeneExpressionColormapChange, inputProps: {
|
|
194321
|
+
id: "gene-expression-colormap-select"
|
|
194322
|
+
}, children: GLSL_COLORMAPS.map((cmap) => jsx("option", { value: cmap, children: cmap }, cmap)) }) })] }), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: "Gene Expression Colormap Range" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: geneExpressionColormapRange, onChange: handleColormapRangeChangeDebounced, "aria-labelledby": "gene-expression-colormap-range-slider", valueLabelDisplay: "auto", step: 5e-3, min: 0, max: 1 }) })] })] });
|
|
193914
194323
|
}
|
|
193915
|
-
|
|
193916
|
-
|
|
193917
|
-
|
|
193918
|
-
|
|
193919
|
-
|
|
193920
|
-
|
|
193921
|
-
|
|
194324
|
+
const styles34 = makeStyles(() => ({
|
|
194325
|
+
tooltipAnchor: {
|
|
194326
|
+
position: "relative",
|
|
194327
|
+
width: "0px",
|
|
194328
|
+
height: "0px",
|
|
194329
|
+
pointerEvents: "none",
|
|
194330
|
+
userSelect: "none"
|
|
194331
|
+
},
|
|
194332
|
+
tooltipContent: {
|
|
194333
|
+
opacity: 0.9,
|
|
194334
|
+
padding: "5px",
|
|
194335
|
+
pointerEvents: "none",
|
|
194336
|
+
"& table > tbody > tr > th, & table > tbody > tr > td": {
|
|
194337
|
+
fontSize: "80%",
|
|
194338
|
+
opacity: 0.8,
|
|
194339
|
+
outline: 0,
|
|
194340
|
+
padding: "0 2px"
|
|
194341
|
+
},
|
|
194342
|
+
"& table": {
|
|
194343
|
+
borderCollapse: "collapse"
|
|
193922
194344
|
}
|
|
193923
194345
|
}
|
|
193924
|
-
|
|
194346
|
+
}));
|
|
194347
|
+
function Tooltip2(props2) {
|
|
194348
|
+
const { x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props2;
|
|
194349
|
+
const ref2 = useRef();
|
|
194350
|
+
const classes = styles34();
|
|
194351
|
+
const [placementX, setPlacementX] = useState("start");
|
|
194352
|
+
const [placementY, setPlacementY] = useState("bottom");
|
|
194353
|
+
const getTooltipContainer = useVitessceContainer(ref2);
|
|
194354
|
+
useEffect(() => {
|
|
194355
|
+
if (ref2 && ref2.current) {
|
|
194356
|
+
const flipX = x2 > parentWidth / 2;
|
|
194357
|
+
const flipY = y2 > parentHeight / 2;
|
|
194358
|
+
setPlacementX(flipX ? "end" : "start");
|
|
194359
|
+
setPlacementY(flipY ? "top" : "bottom");
|
|
194360
|
+
ref2.current.style.left = `${x2 + (flipX ? -20 : 5)}px`;
|
|
194361
|
+
ref2.current.style.top = `${y2 + (flipY ? -20 : 5)}px`;
|
|
194362
|
+
}
|
|
194363
|
+
}, [x2, y2, parentWidth, parentHeight]);
|
|
194364
|
+
return jsx("div", { ref: ref2, className: classes.tooltipAnchor, children: ref2 && ref2.current ? jsx(Popper$1, { open: true, anchorEl: ref2.current, container: getTooltipContainer, transition: true, placement: `${placementY}-${placementX}`, children: jsx(Paper$1, { elevation: 4, className: classes.tooltipContent, children: children3 }) }) : null });
|
|
193925
194365
|
}
|
|
193926
|
-
|
|
193927
|
-
|
|
193928
|
-
|
|
193929
|
-
|
|
193930
|
-
throw new Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");
|
|
194366
|
+
function Tooltip2D(props2) {
|
|
194367
|
+
const { parentUuid, sourceUuid, x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props2;
|
|
194368
|
+
if (x2 < 0 || x2 > parentWidth || y2 < 0 || y2 > parentHeight) {
|
|
194369
|
+
return null;
|
|
193931
194370
|
}
|
|
193932
|
-
|
|
193933
|
-
|
|
193934
|
-
|
|
193935
|
-
|
|
193936
|
-
|
|
193937
|
-
}
|
|
193938
|
-
|
|
193939
|
-
(
|
|
193940
|
-
|
|
193941
|
-
{
|
|
193942
|
-
|
|
193943
|
-
}
|
|
193944
|
-
})
|
|
193945
|
-
|
|
193946
|
-
|
|
193947
|
-
|
|
193948
|
-
|
|
193949
|
-
|
|
193950
|
-
|
|
193951
|
-
|
|
193952
|
-
|
|
193953
|
-
|
|
193954
|
-
|
|
193955
|
-
|
|
193956
|
-
|
|
193957
|
-
|
|
193958
|
-
|
|
193959
|
-
|
|
193960
|
-
|
|
193961
|
-
|
|
193962
|
-
|
|
193963
|
-
|
|
193964
|
-
|
|
193965
|
-
|
|
193966
|
-
|
|
193967
|
-
|
|
193968
|
-
|
|
193969
|
-
|
|
193970
|
-
|
|
193971
|
-
|
|
193972
|
-
|
|
193973
|
-
|
|
193974
|
-
|
|
193975
|
-
|
|
193976
|
-
|
|
193977
|
-
|
|
193978
|
-
|
|
193979
|
-
|
|
193980
|
-
|
|
193981
|
-
|
|
193982
|
-
|
|
193983
|
-
|
|
193984
|
-
|
|
193985
|
-
|
|
193986
|
-
|
|
193987
|
-
|
|
193988
|
-
|
|
193989
|
-
|
|
193990
|
-
|
|
193991
|
-
|
|
193992
|
-
|
|
193993
|
-
|
|
193994
|
-
|
|
193995
|
-
|
|
193996
|
-
|
|
193997
|
-
|
|
193998
|
-
|
|
193999
|
-
|
|
194000
|
-
|
|
194001
|
-
|
|
194002
|
-
|
|
194003
|
-
|
|
194004
|
-
|
|
194005
|
-
|
|
194006
|
-
|
|
194007
|
-
|
|
194008
|
-
|
|
194009
|
-
|
|
194010
|
-
|
|
194011
|
-
|
|
194012
|
-
|
|
194013
|
-
|
|
194014
|
-
|
|
194015
|
-
|
|
194016
|
-
|
|
194017
|
-
|
|
194018
|
-
|
|
194019
|
-
|
|
194020
|
-
|
|
194021
|
-
|
|
194022
|
-
|
|
194023
|
-
|
|
194024
|
-
|
|
194025
|
-
|
|
194026
|
-
|
|
194027
|
-
|
|
194371
|
+
const isTooltipVisible = parentUuid === sourceUuid;
|
|
194372
|
+
const crosshairWidth = 1;
|
|
194373
|
+
return jsx(Fragment, { children: isTooltipVisible ? jsx(Tooltip2, { x: x2, y: y2, parentWidth, parentHeight, children: children3 }) : jsxs(Fragment, { children: [x2 !== null ? jsx("div", { className: "cell-emphasis-crosshair", style: {
|
|
194374
|
+
left: `${x2 - crosshairWidth / 2}px`,
|
|
194375
|
+
top: 0,
|
|
194376
|
+
width: `${crosshairWidth}px`,
|
|
194377
|
+
height: `${parentHeight}px`
|
|
194378
|
+
} }) : null, y2 !== null ? jsx("div", { className: "cell-emphasis-crosshair", style: {
|
|
194379
|
+
left: 0,
|
|
194380
|
+
top: `${y2 - crosshairWidth / 2}px`,
|
|
194381
|
+
width: `${parentWidth}px`,
|
|
194382
|
+
height: `${crosshairWidth}px`
|
|
194383
|
+
} }) : null] }) });
|
|
194384
|
+
}
|
|
194385
|
+
function TooltipContent(props2) {
|
|
194386
|
+
const { info: info2 } = props2;
|
|
194387
|
+
return jsx("table", { children: jsx("tbody", { children: Object.entries(info2).map(([key2, value2]) => jsxs("tr", { children: [jsx("th", { children: key2 }), jsx("td", { children: value2 })] }, key2)) }) });
|
|
194388
|
+
}
|
|
194389
|
+
function ScatterplotTooltipSubscriber(props2) {
|
|
194390
|
+
const { parentUuid, obsHighlight, width: width2, height: height2, getObsInfo } = props2;
|
|
194391
|
+
const sourceUuid = useComponentHover();
|
|
194392
|
+
const viewInfo = useComponentViewInfo(parentUuid);
|
|
194393
|
+
const [cellInfo, x2, y2] = obsHighlight && getObsInfo ? [
|
|
194394
|
+
getObsInfo(obsHighlight),
|
|
194395
|
+
...viewInfo && viewInfo.project ? viewInfo.project(obsHighlight) : [null, null]
|
|
194396
|
+
] : [null, null, null];
|
|
194397
|
+
return cellInfo ? jsx(Tooltip2D, { x: x2, y: y2, parentUuid, sourceUuid, parentWidth: width2, parentHeight: height2, children: jsx(TooltipContent, { info: cellInfo }) }) : null;
|
|
194398
|
+
}
|
|
194399
|
+
function EmptyMessage(props2) {
|
|
194400
|
+
const { visible, message } = props2;
|
|
194401
|
+
return visible ? jsx("div", { children: message }) : null;
|
|
194402
|
+
}
|
|
194403
|
+
function EmbeddingScatterplotSubscriber(props2) {
|
|
194404
|
+
const {
|
|
194405
|
+
uuid,
|
|
194406
|
+
coordinationScopes,
|
|
194407
|
+
removeGridComponent,
|
|
194408
|
+
theme,
|
|
194409
|
+
disableTooltip = false,
|
|
194410
|
+
observationsLabelOverride,
|
|
194411
|
+
title: titleOverride,
|
|
194412
|
+
averageFillDensity
|
|
194413
|
+
} = props2;
|
|
194414
|
+
const loaders = useLoaders();
|
|
194415
|
+
const setComponentHover = useSetComponentHover();
|
|
194416
|
+
const setComponentViewInfo = useSetComponentViewInfo(uuid);
|
|
194417
|
+
const [{ dataset, obsType, featureType, featureValueType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT], coordinationScopes);
|
|
194418
|
+
const observationsLabel = observationsLabelOverride || obsType;
|
|
194419
|
+
const [urls2, addUrl2] = useUrls(loaders, dataset);
|
|
194420
|
+
const [width2, height2, deckRef] = useDeckCanvasSize();
|
|
194421
|
+
const title2 = titleOverride || `Scatterplot (${mapping})`;
|
|
194422
|
+
const [obsLabelsTypes, obsLabelsData] = useMultiObsLabels(coordinationScopes, obsType, loaders, dataset, addUrl2);
|
|
194423
|
+
const [{ obsIndex: obsEmbeddingIndex, obsEmbedding }, obsEmbeddingStatus] = useObsEmbeddingData(loaders, dataset, addUrl2, true, {}, {}, { obsType, embeddingType: mapping });
|
|
194424
|
+
const cellsCount = (obsEmbeddingIndex == null ? void 0 : obsEmbeddingIndex.length) || 0;
|
|
194425
|
+
const [{ obsSets: cellSets, obsSetsMembership }, obsSetsStatus] = useObsSetsData(loaders, dataset, addUrl2, false, { setObsSetSelection: setCellSetSelection, setObsSetColor: setCellSetColor }, { obsSetSelection: cellSetSelection, obsSetColor: cellSetColor }, { obsType });
|
|
194426
|
+
const [expressionData, loadedFeatureSelection, featureSelectionStatus] = useFeatureSelection(loaders, dataset, false, geneSelection, { obsType, featureType, featureValueType });
|
|
194427
|
+
const [{ obsIndex: matrixObsIndex }, matrixIndicesStatus] = useObsFeatureMatrixIndices(loaders, dataset, addUrl2, false, { obsType, featureType, featureValueType });
|
|
194428
|
+
const isReady = useReady([
|
|
194429
|
+
obsEmbeddingStatus,
|
|
194430
|
+
obsSetsStatus,
|
|
194431
|
+
featureSelectionStatus,
|
|
194432
|
+
matrixIndicesStatus
|
|
194433
|
+
]);
|
|
194434
|
+
const [dynamicCellRadius, setDynamicCellRadius] = useState(cellRadiusFixed);
|
|
194435
|
+
const [dynamicCellOpacity, setDynamicCellOpacity] = useState(cellOpacityFixed);
|
|
194436
|
+
const mergedCellSets = useMemo(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
|
|
194437
|
+
const setCellSelectionProp = useCallback((v) => {
|
|
194438
|
+
setObsSelection(v, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding);
|
|
194439
|
+
}, [
|
|
194440
|
+
additionalCellSets,
|
|
194441
|
+
cellSetColor,
|
|
194442
|
+
setCellColorEncoding,
|
|
194443
|
+
setAdditionalCellSets,
|
|
194444
|
+
setCellSetColor,
|
|
194445
|
+
setCellSetSelection
|
|
194446
|
+
]);
|
|
194447
|
+
const cellColors = useMemo(() => getCellColors({
|
|
194448
|
+
cellColorEncoding,
|
|
194449
|
+
expressionData: expressionData && expressionData[0],
|
|
194450
|
+
geneSelection,
|
|
194451
|
+
cellSets: mergedCellSets,
|
|
194452
|
+
cellSetSelection,
|
|
194453
|
+
cellSetColor,
|
|
194454
|
+
obsIndex: matrixObsIndex,
|
|
194455
|
+
theme
|
|
194456
|
+
}), [
|
|
194457
|
+
cellColorEncoding,
|
|
194458
|
+
geneSelection,
|
|
194459
|
+
mergedCellSets,
|
|
194460
|
+
theme,
|
|
194461
|
+
cellSetSelection,
|
|
194462
|
+
cellSetColor,
|
|
194463
|
+
expressionData,
|
|
194464
|
+
matrixObsIndex
|
|
194465
|
+
]);
|
|
194466
|
+
const [cellSetPolygonCache, setCellSetPolygonCache] = useState([]);
|
|
194467
|
+
const cacheHas2 = (cache2, key2) => cache2.findIndex((el2) => isEqual_1(el2[0], key2)) !== -1;
|
|
194468
|
+
const cacheGet = (cache2, key2) => {
|
|
194469
|
+
var _a3;
|
|
194470
|
+
return (_a3 = cache2.find((el2) => isEqual_1(el2[0], key2))) == null ? void 0 : _a3[1];
|
|
194471
|
+
};
|
|
194472
|
+
const cellSetPolygons = useMemo(() => {
|
|
194473
|
+
var _a3;
|
|
194474
|
+
if ((cellSetLabelsVisible || cellSetPolygonsVisible) && !cacheHas2(cellSetPolygonCache, cellSetSelection) && ((_a3 = mergedCellSets == null ? void 0 : mergedCellSets.tree) == null ? void 0 : _a3.length) && obsEmbedding && obsEmbeddingIndex && (cellSetColor == null ? void 0 : cellSetColor.length)) {
|
|
194475
|
+
const newCellSetPolygons = getCellSetPolygons({
|
|
194476
|
+
obsIndex: obsEmbeddingIndex,
|
|
194477
|
+
obsEmbedding,
|
|
194478
|
+
cellSets: mergedCellSets,
|
|
194479
|
+
cellSetSelection,
|
|
194480
|
+
cellSetColor,
|
|
194481
|
+
theme
|
|
194482
|
+
});
|
|
194483
|
+
setCellSetPolygonCache((cache2) => [...cache2, [cellSetSelection, newCellSetPolygons]]);
|
|
194484
|
+
return newCellSetPolygons;
|
|
194485
|
+
}
|
|
194486
|
+
return cacheGet(cellSetPolygonCache, cellSetSelection) || [];
|
|
194487
|
+
}, [
|
|
194488
|
+
cellSetPolygonsVisible,
|
|
194489
|
+
cellSetPolygonCache,
|
|
194490
|
+
cellSetLabelsVisible,
|
|
194491
|
+
theme,
|
|
194492
|
+
obsEmbeddingIndex,
|
|
194493
|
+
obsEmbedding,
|
|
194494
|
+
mergedCellSets,
|
|
194495
|
+
cellSetSelection,
|
|
194496
|
+
cellSetColor
|
|
194497
|
+
]);
|
|
194498
|
+
const cellSelection = useMemo(() => Array.from(cellColors.keys()), [cellColors]);
|
|
194499
|
+
const [xRange, yRange, xExtent, yExtent, numCells] = useMemo(() => {
|
|
194500
|
+
if (obsEmbedding && obsEmbedding.data && obsEmbedding.shape) {
|
|
194501
|
+
const cellCount = obsEmbedding.shape[1];
|
|
194502
|
+
const xE = extent$2(obsEmbedding.data[0]);
|
|
194503
|
+
const yE = extent$2(obsEmbedding.data[1]);
|
|
194504
|
+
const xR = xE[1] - xE[0];
|
|
194505
|
+
const yR = yE[1] - yE[0];
|
|
194506
|
+
return [xR, yR, xE, yE, cellCount];
|
|
194507
|
+
}
|
|
194508
|
+
return [null, null, null, null, null];
|
|
194509
|
+
}, [obsEmbedding]);
|
|
194510
|
+
useEffect(() => {
|
|
194511
|
+
if (xRange && yRange) {
|
|
194512
|
+
const pointSizeDevicePixels = getPointSizeDevicePixels(window.devicePixelRatio, zoom2, xRange, yRange, width2, height2);
|
|
194513
|
+
setDynamicCellRadius(pointSizeDevicePixels);
|
|
194514
|
+
const nextCellOpacityScale = getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, averageFillDensity);
|
|
194515
|
+
setDynamicCellOpacity(nextCellOpacityScale);
|
|
194516
|
+
if (typeof targetX2 !== "number" || typeof targetY2 !== "number") {
|
|
194517
|
+
const newTargetX = xExtent[0] + xRange / 2;
|
|
194518
|
+
const newTargetY = yExtent[0] + yRange / 2;
|
|
194519
|
+
const newZoom = Math.log2(Math.min(width2 / xRange, height2 / yRange));
|
|
194520
|
+
setTargetX(newTargetX);
|
|
194521
|
+
setTargetY(-newTargetY);
|
|
194522
|
+
setZoom(newZoom);
|
|
194523
|
+
}
|
|
194524
|
+
}
|
|
194525
|
+
}, [
|
|
194526
|
+
xRange,
|
|
194527
|
+
yRange,
|
|
194528
|
+
xExtent,
|
|
194529
|
+
yExtent,
|
|
194530
|
+
numCells,
|
|
194531
|
+
width2,
|
|
194532
|
+
height2,
|
|
194533
|
+
zoom2,
|
|
194534
|
+
averageFillDensity
|
|
194535
|
+
]);
|
|
194536
|
+
const getObsInfo = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership);
|
|
194537
|
+
const cellSelectionSet = useMemo(() => new Set(cellSelection), [cellSelection]);
|
|
194538
|
+
const getCellIsSelected = useCallback((object2, { index: index2 }) => (cellSelectionSet || /* @__PURE__ */ new Set([])).has(obsEmbeddingIndex[index2]) ? 1 : 0, [cellSelectionSet, obsEmbeddingIndex]);
|
|
194539
|
+
const cellRadius = cellRadiusMode === "manual" ? cellRadiusFixed : dynamicCellRadius;
|
|
194540
|
+
const cellOpacity = cellOpacityMode === "manual" ? cellOpacityFixed : dynamicCellOpacity;
|
|
194541
|
+
const getExpressionValue = useExpressionValueGetter({
|
|
194542
|
+
instanceObsIndex: obsEmbeddingIndex,
|
|
194543
|
+
matrixObsIndex,
|
|
194544
|
+
expressionData
|
|
194545
|
+
});
|
|
194546
|
+
return jsxs(TitleInfo, { title: title2, info: `${commaNumber(cellsCount)} ${plur(observationsLabel, cellsCount)}`, removeGridComponent, urls: urls2, theme, isReady, options: jsx(ScatterplotOptions, { observationsLabel, cellRadius: cellRadiusFixed, setCellRadius: setCellRadiusFixed, cellRadiusMode, setCellRadiusMode, cellOpacity: cellOpacityFixed, setCellOpacity: setCellOpacityFixed, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange }), children: [jsx(ScatterplotWrapper, { ref: deckRef, uuid, theme, viewState: { zoom: zoom2, target: [targetX2, targetY2, targetZ] }, setViewState: ({ zoom: newZoom, target: target2 }) => {
|
|
194547
|
+
setZoom(newZoom);
|
|
194548
|
+
setTargetX(target2[0]);
|
|
194549
|
+
setTargetY(target2[1]);
|
|
194550
|
+
setTargetZ(target2[2] || 0);
|
|
194551
|
+
}, obsEmbeddingIndex, obsEmbedding, cellFilter, cellSelection, cellHighlight, cellColors, cellSetPolygons, cellSetLabelSize, cellSetLabelsVisible, cellSetPolygonsVisible, setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight, cellRadius, cellOpacity, cellColorEncoding, geneExpressionColormap, geneExpressionColormapRange, setComponentHover: () => {
|
|
194552
|
+
setComponentHover(uuid);
|
|
194553
|
+
}, updateViewInfo: setComponentViewInfo, getExpressionValue, getCellIsSelected }), !disableTooltip && jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo })] });
|
|
194554
|
+
}
|
|
194555
|
+
function register$c() {
|
|
194556
|
+
registerPluginViewType(ViewType$2.SCATTERPLOT, EmbeddingScatterplotSubscriber, COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT]);
|
|
194557
|
+
}
|
|
194558
|
+
function GatingScatterplotOptions(props2) {
|
|
194559
|
+
const { featureType, gatingFeatureSelectionX, setGatingFeatureSelectionX, gatingFeatureSelectionY, setGatingFeatureSelectionY, gatingFeatureValueTransform, setGatingFeatureValueTransform, gatingFeatureValueTransformCoefficient, setGatingFeatureValueTransformCoefficient, geneSelectOptions, transformOptions } = props2;
|
|
194560
|
+
const classes = useStyles$b();
|
|
194561
|
+
const handleGeneSelectChange = (event2) => {
|
|
194562
|
+
const { options } = event2.target;
|
|
194563
|
+
const newValues = [];
|
|
194564
|
+
for (let i2 = 0, l2 = options.length; i2 < l2; i2 += 1) {
|
|
194565
|
+
if (options[i2].selected) {
|
|
194566
|
+
newValues.push(options[i2].value);
|
|
194567
|
+
}
|
|
194568
|
+
}
|
|
194569
|
+
if (newValues.length === 1 && gatingFeatureSelectionX && !gatingFeatureSelectionY && newValues[0] !== gatingFeatureSelectionX) {
|
|
194570
|
+
setGatingFeatureSelectionY(newValues[0]);
|
|
194571
|
+
} else if (newValues.length <= 2) {
|
|
194572
|
+
setGatingFeatureSelectionX(newValues[0]);
|
|
194573
|
+
setGatingFeatureSelectionY(newValues[1]);
|
|
194574
|
+
}
|
|
194575
|
+
};
|
|
194576
|
+
const handleTransformChange = (event2) => {
|
|
194577
|
+
setGatingFeatureValueTransform(event2.target.value === "" ? null : event2.target.value);
|
|
194578
|
+
};
|
|
194579
|
+
const handleTransformCoefficientChange = (event2) => {
|
|
194580
|
+
const { value: value2 } = event2.target;
|
|
194581
|
+
if (!value2) {
|
|
194582
|
+
setGatingFeatureValueTransformCoefficient(value2);
|
|
194583
|
+
} else {
|
|
194584
|
+
const newCoefficient = Number(value2);
|
|
194585
|
+
if (!Number.isNaN(newCoefficient) && newCoefficient >= 0) {
|
|
194586
|
+
setGatingFeatureValueTransformCoefficient(value2);
|
|
194587
|
+
}
|
|
194588
|
+
}
|
|
194589
|
+
};
|
|
194590
|
+
return jsxs(Fragment, { children: [jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: capitalize$2(plur(featureType, geneSelectOptions == null ? void 0 : geneSelectOptions.length)) }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(OptionSelect, { multiple: true, className: classes.select, value: [gatingFeatureSelectionX, gatingFeatureSelectionY].filter((v) => v), onChange: handleGeneSelectChange, inputProps: {
|
|
194591
|
+
id: "scatterplot-gene-select"
|
|
194592
|
+
}, children: geneSelectOptions.map((name2) => jsx("option", { value: name2, children: name2 }, name2)) }, "gating-gene-select") })] }, "gene-option-row"), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: "Transform" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(OptionSelect, { className: classes.select, value: gatingFeatureValueTransform === null ? "" : gatingFeatureValueTransform, onChange: handleTransformChange, inputProps: {
|
|
194593
|
+
id: "scatterplot-transform-select"
|
|
194594
|
+
}, children: transformOptions.map((opt) => jsx("option", { value: opt.value === null ? "" : opt.value, children: opt.name }, opt.name)) }, "gating-transform-select") })] }, "transform-option-row"), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: "Transform Coefficient" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(TextField$1, { label: "Number", type: "number", onChange: handleTransformCoefficientChange, value: gatingFeatureValueTransformCoefficient, InputLabelProps: {
|
|
194595
|
+
shrink: true
|
|
194596
|
+
} }) })] }, "transform-coefficient-option-row")] });
|
|
194597
|
+
}
|
|
194598
|
+
function GatingSubscriber(props2) {
|
|
194599
|
+
const {
|
|
194600
|
+
uuid,
|
|
194601
|
+
coordinationScopes,
|
|
194602
|
+
removeGridComponent,
|
|
194603
|
+
theme,
|
|
194604
|
+
disableTooltip = false,
|
|
194605
|
+
title: titleOverride,
|
|
194606
|
+
averageFillDensity
|
|
194607
|
+
} = props2;
|
|
194608
|
+
const loaders = useLoaders();
|
|
194609
|
+
const setComponentHover = useSetComponentHover();
|
|
194610
|
+
const setComponentViewInfo = useSetComponentViewInfo(uuid);
|
|
194611
|
+
const [{ dataset, obsType, featureType, featureValueType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, obsFilter: cellFilter, obsHighlight: cellHighlight, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, featureSelection: gatingFeatureSelectionColor, featureValueTransform, featureValueTransformCoefficient, gatingFeatureSelectionX, gatingFeatureSelectionY }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setFeatureValueTransform, setFeatureValueTransformCoefficient, setGatingFeatureSelectionX, setGatingFeatureSelectionY }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.GATING], coordinationScopes);
|
|
194612
|
+
const [urls2, addUrl2] = useUrls(loaders, dataset);
|
|
194613
|
+
const [width2, height2, deckRef] = useDeckCanvasSize();
|
|
194614
|
+
const title2 = useMemo(() => {
|
|
194615
|
+
if (titleOverride) {
|
|
194616
|
+
return titleOverride;
|
|
194617
|
+
}
|
|
194618
|
+
if (!(gatingFeatureSelectionX && gatingFeatureSelectionY)) {
|
|
194619
|
+
return "Gating";
|
|
194620
|
+
}
|
|
194621
|
+
return `Gating (${gatingFeatureSelectionX} vs ${gatingFeatureSelectionY})`;
|
|
194622
|
+
}, [titleOverride, gatingFeatureSelectionX, gatingFeatureSelectionY]);
|
|
194623
|
+
const featureSelectionX = useMemo(() => gatingFeatureSelectionX ? [gatingFeatureSelectionX] : null, [gatingFeatureSelectionX]);
|
|
194624
|
+
const featureSelectionY = useMemo(() => gatingFeatureSelectionY ? [gatingFeatureSelectionY] : null, [gatingFeatureSelectionY]);
|
|
194625
|
+
const [{ obsSets: cellSets }, obsSetsStatus] = useObsSetsData(loaders, dataset, addUrl2, false, { setObsSetSelection: setCellSetSelection, setObsSetColor: setCellSetColor }, { obsSetSelection: cellSetSelection, obsSetColor: cellSetColor }, { obsType });
|
|
194626
|
+
const [expressionDataColor, loadedColor, featureSelectionColorStatus] = useFeatureSelection(loaders, dataset, false, gatingFeatureSelectionColor, { obsType, featureType, featureValueType });
|
|
194627
|
+
const [expressionDataX, loadedX, featureSelectionXStatus] = useFeatureSelection(loaders, dataset, false, featureSelectionX, { obsType, featureType, featureValueType });
|
|
194628
|
+
const [expressionDataY, loadedY, featureSelectionYStatus] = useFeatureSelection(loaders, dataset, false, featureSelectionY, { obsType, featureType, featureValueType });
|
|
194629
|
+
const [{ obsIndex, featureIndex }, matrixIndicesStatus] = useObsFeatureMatrixIndices(loaders, dataset, addUrl2, false, { obsType, featureType, featureValueType });
|
|
194630
|
+
const cellsCount = (obsIndex == null ? void 0 : obsIndex.length) || 0;
|
|
194631
|
+
const isReady = useReady([
|
|
194632
|
+
obsSetsStatus,
|
|
194633
|
+
featureSelectionColorStatus,
|
|
194634
|
+
featureSelectionXStatus,
|
|
194635
|
+
featureSelectionYStatus,
|
|
194636
|
+
matrixIndicesStatus
|
|
194637
|
+
]);
|
|
194638
|
+
const obsXY = useMemo(() => {
|
|
194639
|
+
if (!(cellsCount && (expressionDataX == null ? void 0 : expressionDataX[0]) && (expressionDataY == null ? void 0 : expressionDataY[0]) && featureSelectionX && featureSelectionY)) {
|
|
194640
|
+
return null;
|
|
194641
|
+
}
|
|
194642
|
+
let coefficient = 1;
|
|
194643
|
+
const parsedTransformCoefficient = Number(featureValueTransformCoefficient);
|
|
194644
|
+
if (!Number.isNaN(parsedTransformCoefficient) && parsedTransformCoefficient > 0) {
|
|
194645
|
+
coefficient = parsedTransformCoefficient;
|
|
194646
|
+
}
|
|
194647
|
+
const transformFunction = getValueTransformFunction(featureValueTransform, coefficient);
|
|
194648
|
+
const obsX = new Float32Array(cellsCount);
|
|
194649
|
+
const obsY = new Float32Array(cellsCount);
|
|
194650
|
+
for (let i2 = 0; i2 < cellsCount; i2 += 1) {
|
|
194651
|
+
obsX[i2] = transformFunction(expressionDataX[0][i2]);
|
|
194652
|
+
obsY[i2] = transformFunction(expressionDataY[0][i2]);
|
|
194653
|
+
}
|
|
194654
|
+
return {
|
|
194655
|
+
data: [obsX, obsY],
|
|
194656
|
+
shape: [2, cellsCount]
|
|
194657
|
+
};
|
|
194658
|
+
}, [
|
|
194659
|
+
cellsCount,
|
|
194660
|
+
expressionDataX,
|
|
194661
|
+
expressionDataY,
|
|
194662
|
+
featureValueTransform,
|
|
194663
|
+
featureValueTransformCoefficient,
|
|
194664
|
+
featureSelectionX,
|
|
194665
|
+
featureSelectionY
|
|
194666
|
+
]);
|
|
194667
|
+
const [dynamicCellRadius, setDynamicCellRadius] = useState(cellRadiusFixed);
|
|
194668
|
+
const [dynamicCellOpacity, setDynamicCellOpacity] = useState(cellOpacityFixed);
|
|
194669
|
+
const mergedCellSets = useMemo(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
|
|
194670
|
+
const setCellSelectionProp = useCallback((v) => {
|
|
194671
|
+
setObsSelection(v, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding);
|
|
194672
|
+
}, [
|
|
194673
|
+
additionalCellSets,
|
|
194674
|
+
cellSetColor,
|
|
194675
|
+
setCellColorEncoding,
|
|
194676
|
+
setAdditionalCellSets,
|
|
194677
|
+
setCellSetColor,
|
|
194678
|
+
setCellSetSelection
|
|
194679
|
+
]);
|
|
194680
|
+
const cellColors = useMemo(() => getCellColors({
|
|
194681
|
+
cellColorEncoding,
|
|
194682
|
+
expressionData: expressionDataColor && expressionDataColor[0],
|
|
194683
|
+
geneSelection: gatingFeatureSelectionColor,
|
|
194684
|
+
cellSets: mergedCellSets,
|
|
194685
|
+
cellSetSelection,
|
|
194686
|
+
cellSetColor,
|
|
194687
|
+
obsIndex,
|
|
194688
|
+
theme
|
|
194689
|
+
}), [
|
|
194690
|
+
cellColorEncoding,
|
|
194691
|
+
gatingFeatureSelectionColor,
|
|
194692
|
+
mergedCellSets,
|
|
194693
|
+
theme,
|
|
194694
|
+
cellSetSelection,
|
|
194695
|
+
cellSetColor,
|
|
194696
|
+
expressionDataColor,
|
|
194697
|
+
obsIndex
|
|
194698
|
+
]);
|
|
194699
|
+
const [cellSetPolygonCache, setCellSetPolygonCache] = useState([]);
|
|
194700
|
+
const cacheHas2 = (cache2, key2) => cache2.findIndex((el2) => isEqual_1(el2[0], key2)) !== -1;
|
|
194701
|
+
const cacheGet = (cache2, key2) => {
|
|
194702
|
+
var _a3;
|
|
194703
|
+
return (_a3 = cache2.find((el2) => isEqual_1(el2[0], key2))) == null ? void 0 : _a3[1];
|
|
194704
|
+
};
|
|
194705
|
+
const cellSetPolygons = useMemo(() => {
|
|
194706
|
+
var _a3;
|
|
194707
|
+
if ((cellSetLabelsVisible || cellSetPolygonsVisible) && !cacheHas2(cellSetPolygonCache, cellSetSelection) && ((_a3 = mergedCellSets == null ? void 0 : mergedCellSets.tree) == null ? void 0 : _a3.length) && obsXY && obsIndex && (cellSetColor == null ? void 0 : cellSetColor.length)) {
|
|
194708
|
+
const newCellSetPolygons = getCellSetPolygons({
|
|
194709
|
+
obsIndex,
|
|
194710
|
+
obsEmbedding: obsXY,
|
|
194711
|
+
cellSets: mergedCellSets,
|
|
194712
|
+
cellSetSelection,
|
|
194713
|
+
cellSetColor,
|
|
194714
|
+
theme
|
|
194715
|
+
});
|
|
194716
|
+
setCellSetPolygonCache((cache2) => [...cache2, [cellSetSelection, newCellSetPolygons]]);
|
|
194717
|
+
return newCellSetPolygons;
|
|
194718
|
+
}
|
|
194719
|
+
return cacheGet(cellSetPolygonCache, cellSetSelection) || [];
|
|
194720
|
+
}, [
|
|
194721
|
+
cellSetPolygonsVisible,
|
|
194722
|
+
cellSetPolygonCache,
|
|
194723
|
+
cellSetLabelsVisible,
|
|
194724
|
+
theme,
|
|
194725
|
+
obsIndex,
|
|
194726
|
+
obsXY,
|
|
194727
|
+
mergedCellSets,
|
|
194728
|
+
cellSetSelection,
|
|
194729
|
+
cellSetColor
|
|
194730
|
+
]);
|
|
194731
|
+
const cellSelection = useMemo(() => Array.from(cellColors.keys()), [cellColors]);
|
|
194732
|
+
const [xRange, yRange, xExtent, yExtent, numCells] = useMemo(() => {
|
|
194733
|
+
if (obsXY && obsXY.data && obsXY.shape) {
|
|
194734
|
+
const cellCount = obsXY.shape[1];
|
|
194735
|
+
const xE = extent$2(obsXY.data[0]);
|
|
194736
|
+
const yE = extent$2(obsXY.data[1]);
|
|
194737
|
+
const xR = xE[1] - xE[0];
|
|
194738
|
+
const yR = yE[1] - yE[0];
|
|
194739
|
+
return [xR, yR, xE, yE, cellCount];
|
|
194740
|
+
}
|
|
194741
|
+
return [null, null, null, null, null];
|
|
194742
|
+
}, [obsXY]);
|
|
194743
|
+
useEffect(() => {
|
|
194744
|
+
if (xRange && yRange) {
|
|
194745
|
+
const pointSizeDevicePixels = getPointSizeDevicePixels(window.devicePixelRatio, zoom2, xRange, yRange, width2, height2);
|
|
194746
|
+
setDynamicCellRadius(pointSizeDevicePixels);
|
|
194747
|
+
const nextCellOpacityScale = getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, averageFillDensity);
|
|
194748
|
+
setDynamicCellOpacity(nextCellOpacityScale);
|
|
194749
|
+
if (typeof targetX2 !== "number" || typeof targetY2 !== "number") {
|
|
194750
|
+
const newTargetX = xExtent[0] + xRange / 2;
|
|
194751
|
+
const newTargetY = yExtent[0] + yRange / 2;
|
|
194752
|
+
const newZoom = Math.log2(Math.min(width2 / xRange, height2 / yRange));
|
|
194753
|
+
setTargetX(newTargetX);
|
|
194754
|
+
setTargetY(-newTargetY);
|
|
194755
|
+
setZoom(newZoom);
|
|
194756
|
+
}
|
|
194757
|
+
}
|
|
194758
|
+
}, [
|
|
194759
|
+
xRange,
|
|
194760
|
+
yRange,
|
|
194761
|
+
xExtent,
|
|
194762
|
+
yExtent,
|
|
194763
|
+
numCells,
|
|
194764
|
+
width2,
|
|
194765
|
+
height2,
|
|
194766
|
+
zoom2,
|
|
194767
|
+
averageFillDensity
|
|
194768
|
+
]);
|
|
194769
|
+
const cellSelectionSet = useMemo(() => new Set(cellSelection), [cellSelection]);
|
|
194770
|
+
const getCellIsSelected = useCallback((object2, { index: index2 }) => (cellSelectionSet || /* @__PURE__ */ new Set([])).has(obsIndex[index2]) ? 1 : 0, [cellSelectionSet, obsIndex]);
|
|
194771
|
+
const cellRadius = cellRadiusMode === "manual" ? cellRadiusFixed : dynamicCellRadius;
|
|
194772
|
+
const cellOpacity = cellOpacityMode === "manual" ? cellOpacityFixed : dynamicCellOpacity;
|
|
194773
|
+
const getExpressionValue = useExpressionValueGetter({
|
|
194774
|
+
instanceObsIndex: obsIndex,
|
|
194775
|
+
matrixObsIndex: obsIndex,
|
|
194776
|
+
expressionData: expressionDataColor
|
|
194777
|
+
});
|
|
194778
|
+
const getObsInfo = useCallback((obsId) => {
|
|
194779
|
+
var _a3;
|
|
194780
|
+
const selectedTransformName = (_a3 = VALUE_TRANSFORM_OPTIONS.find((o2) => o2.value === featureValueTransform)) == null ? void 0 : _a3.name;
|
|
194781
|
+
const genePrefix = featureValueTransform ? `${selectedTransformName} ` : "";
|
|
194782
|
+
const obsIdx = obsIndex == null ? void 0 : obsIndex.indexOf(obsId);
|
|
194783
|
+
const obsInfo = { [`${capitalize$2(obsType)} ID`]: obsId };
|
|
194784
|
+
if (gatingFeatureSelectionX && gatingFeatureSelectionY) {
|
|
194785
|
+
obsInfo[genePrefix + gatingFeatureSelectionX] = obsXY.data[0][obsIdx];
|
|
194786
|
+
obsInfo[genePrefix + gatingFeatureSelectionY] = obsXY.data[1][obsIdx];
|
|
194787
|
+
}
|
|
194788
|
+
return obsInfo;
|
|
194789
|
+
}, [
|
|
194790
|
+
obsXY,
|
|
194791
|
+
obsIndex,
|
|
194792
|
+
featureValueTransform,
|
|
194793
|
+
gatingFeatureSelectionX,
|
|
194794
|
+
gatingFeatureSelectionY,
|
|
194795
|
+
obsType
|
|
194796
|
+
]);
|
|
194797
|
+
return jsxs(TitleInfo, { title: title2, info: `${commaNumber(cellsCount)} ${plur(obsType, cellsCount)}`, removeGridComponent, urls: urls2, theme, isReady, options: jsx(ScatterplotOptions, { observationsLabel: obsType, cellRadius: cellRadiusFixed, setCellRadius: setCellRadiusFixed, cellRadiusMode, setCellRadiusMode, cellOpacity: cellOpacityFixed, setCellOpacity: setCellOpacityFixed, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange, children: jsx(GatingScatterplotOptions, { featureType, gatingFeatureSelectionX, setGatingFeatureSelectionX, gatingFeatureSelectionY, setGatingFeatureSelectionY, gatingFeatureValueTransform: featureValueTransform, setGatingFeatureValueTransform: (newValue) => {
|
|
194798
|
+
setFeatureValueTransform(newValue);
|
|
194799
|
+
setTargetX(null);
|
|
194800
|
+
setTargetY(null);
|
|
194801
|
+
setZoom(null);
|
|
194802
|
+
}, gatingFeatureValueTransformCoefficient: featureValueTransformCoefficient, setGatingFeatureValueTransformCoefficient: setFeatureValueTransformCoefficient, geneSelectOptions: featureIndex, transformOptions: VALUE_TRANSFORM_OPTIONS }) }), children: [jsx(EmptyMessage, { visible: !(gatingFeatureSelectionX && gatingFeatureSelectionY), message: `Select two ${plur(featureType, 2)} in the plot settings.` }), jsx(ScatterplotWrapper, { ref: deckRef, uuid, theme, hideTools: !(gatingFeatureSelectionX && gatingFeatureSelectionY), viewState: { zoom: zoom2, target: [targetX2, targetY2, targetZ] }, setViewState: ({ zoom: newZoom, target: target2 }) => {
|
|
194803
|
+
setZoom(newZoom);
|
|
194804
|
+
setTargetX(target2[0]);
|
|
194805
|
+
setTargetY(target2[1]);
|
|
194806
|
+
setTargetZ(target2[2] || 0);
|
|
194807
|
+
}, obsEmbeddingIndex: obsIndex, obsEmbedding: obsXY, cellFilter, cellSelection, cellHighlight, cellColors, cellSetPolygons, cellSetLabelSize, cellSetLabelsVisible, cellSetPolygonsVisible, setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight, cellRadius, cellOpacity, cellColorEncoding, geneExpressionColormap, geneExpressionColormapRange, setComponentHover: () => {
|
|
194808
|
+
setComponentHover(uuid);
|
|
194809
|
+
}, updateViewInfo: setComponentViewInfo, getExpressionValue, getCellIsSelected }), !disableTooltip && jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo })] });
|
|
194810
|
+
}
|
|
194811
|
+
function register$b() {
|
|
194812
|
+
registerPluginViewType(ViewType$2.GATING, GatingSubscriber, COMPONENT_COORDINATION_TYPES[ViewType$2.GATING]);
|
|
194813
|
+
}
|
|
194814
|
+
var _extends$1 = { exports: {} };
|
|
194815
|
+
var hasRequired_extends;
|
|
194816
|
+
function require_extends() {
|
|
194817
|
+
if (hasRequired_extends)
|
|
194818
|
+
return _extends$1.exports;
|
|
194819
|
+
hasRequired_extends = 1;
|
|
194820
|
+
(function(module2) {
|
|
194821
|
+
function _extends2() {
|
|
194822
|
+
module2.exports = _extends2 = Object.assign ? Object.assign.bind() : function(target2) {
|
|
194823
|
+
for (var i2 = 1; i2 < arguments.length; i2++) {
|
|
194824
|
+
var source2 = arguments[i2];
|
|
194825
|
+
for (var key2 in source2) {
|
|
194826
|
+
if (Object.prototype.hasOwnProperty.call(source2, key2)) {
|
|
194827
|
+
target2[key2] = source2[key2];
|
|
194828
|
+
}
|
|
194829
|
+
}
|
|
194830
|
+
}
|
|
194831
|
+
return target2;
|
|
194832
|
+
}, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
194833
|
+
return _extends2.apply(this, arguments);
|
|
194834
|
+
}
|
|
194835
|
+
module2.exports = _extends2, module2.exports.__esModule = true, module2.exports["default"] = module2.exports;
|
|
194836
|
+
})(_extends$1);
|
|
194837
|
+
return _extends$1.exports;
|
|
194838
|
+
}
|
|
194839
|
+
var _extendsExports = require_extends();
|
|
194840
|
+
var DEFAULT_CONFIG = {
|
|
194841
|
+
epsilon: 1e-12,
|
|
194842
|
+
matrix: "Matrix",
|
|
194843
|
+
number: "number",
|
|
194844
|
+
precision: 64,
|
|
194845
|
+
predictable: false,
|
|
194846
|
+
randomSeed: null
|
|
194847
|
+
};
|
|
194848
|
+
function isNumber$2(x2) {
|
|
194849
|
+
return typeof x2 === "number";
|
|
194850
|
+
}
|
|
194851
|
+
function isBigNumber(x2) {
|
|
194852
|
+
if (!x2 || typeof x2 !== "object" || typeof x2.constructor !== "function") {
|
|
194853
|
+
return false;
|
|
194854
|
+
}
|
|
194855
|
+
if (x2.isBigNumber === true && typeof x2.constructor.prototype === "object" && x2.constructor.prototype.isBigNumber === true) {
|
|
194856
|
+
return true;
|
|
194857
|
+
}
|
|
194858
|
+
if (typeof x2.constructor.isDecimal === "function" && x2.constructor.isDecimal(x2) === true) {
|
|
194859
|
+
return true;
|
|
194860
|
+
}
|
|
194861
|
+
return false;
|
|
194862
|
+
}
|
|
194863
|
+
function isComplex(x2) {
|
|
194864
|
+
return x2 && typeof x2 === "object" && Object.getPrototypeOf(x2).isComplex === true || false;
|
|
194865
|
+
}
|
|
194866
|
+
function isFraction(x2) {
|
|
194867
|
+
return x2 && typeof x2 === "object" && Object.getPrototypeOf(x2).isFraction === true || false;
|
|
194868
|
+
}
|
|
194869
|
+
function isUnit(x2) {
|
|
194870
|
+
return x2 && x2.constructor.prototype.isUnit === true || false;
|
|
194871
|
+
}
|
|
194872
|
+
function isString$1(x2) {
|
|
194873
|
+
return typeof x2 === "string";
|
|
194874
|
+
}
|
|
194875
|
+
var isArray$1 = Array.isArray;
|
|
194876
|
+
function isMatrix(x2) {
|
|
194877
|
+
return x2 && x2.constructor.prototype.isMatrix === true || false;
|
|
194878
|
+
}
|
|
194879
|
+
function isCollection(x2) {
|
|
194880
|
+
return Array.isArray(x2) || isMatrix(x2);
|
|
194881
|
+
}
|
|
194882
|
+
function isDenseMatrix(x2) {
|
|
194883
|
+
return x2 && x2.isDenseMatrix && x2.constructor.prototype.isMatrix === true || false;
|
|
194884
|
+
}
|
|
194885
|
+
function isSparseMatrix(x2) {
|
|
194886
|
+
return x2 && x2.isSparseMatrix && x2.constructor.prototype.isMatrix === true || false;
|
|
194887
|
+
}
|
|
194888
|
+
function isRange(x2) {
|
|
194889
|
+
return x2 && x2.constructor.prototype.isRange === true || false;
|
|
194890
|
+
}
|
|
194891
|
+
function isIndex(x2) {
|
|
194892
|
+
return x2 && x2.constructor.prototype.isIndex === true || false;
|
|
194893
|
+
}
|
|
194894
|
+
function isBoolean$3(x2) {
|
|
194895
|
+
return typeof x2 === "boolean";
|
|
194896
|
+
}
|
|
194897
|
+
function isResultSet(x2) {
|
|
194898
|
+
return x2 && x2.constructor.prototype.isResultSet === true || false;
|
|
194899
|
+
}
|
|
194900
|
+
function isHelp(x2) {
|
|
194901
|
+
return x2 && x2.constructor.prototype.isHelp === true || false;
|
|
194902
|
+
}
|
|
194903
|
+
function isFunction$2(x2) {
|
|
194904
|
+
return typeof x2 === "function";
|
|
194905
|
+
}
|
|
194906
|
+
function isDate$2(x2) {
|
|
194907
|
+
return x2 instanceof Date;
|
|
194908
|
+
}
|
|
194909
|
+
function isRegExp$1(x2) {
|
|
194910
|
+
return x2 instanceof RegExp;
|
|
194911
|
+
}
|
|
194912
|
+
function isObject$1(x2) {
|
|
194913
|
+
return !!(x2 && typeof x2 === "object" && x2.constructor === Object && !isComplex(x2) && !isFraction(x2));
|
|
194914
|
+
}
|
|
194915
|
+
function isNull(x2) {
|
|
194916
|
+
return x2 === null;
|
|
194917
|
+
}
|
|
194918
|
+
function isUndefined(x2) {
|
|
194919
|
+
return x2 === void 0;
|
|
194920
|
+
}
|
|
194921
|
+
function isAccessorNode(x2) {
|
|
194922
|
+
return x2 && x2.isAccessorNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194923
|
+
}
|
|
194924
|
+
function isArrayNode(x2) {
|
|
194925
|
+
return x2 && x2.isArrayNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194926
|
+
}
|
|
194927
|
+
function isAssignmentNode(x2) {
|
|
194928
|
+
return x2 && x2.isAssignmentNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194929
|
+
}
|
|
194930
|
+
function isBlockNode(x2) {
|
|
194931
|
+
return x2 && x2.isBlockNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194932
|
+
}
|
|
194933
|
+
function isConditionalNode(x2) {
|
|
194934
|
+
return x2 && x2.isConditionalNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194935
|
+
}
|
|
194936
|
+
function isConstantNode(x2) {
|
|
194937
|
+
return x2 && x2.isConstantNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194938
|
+
}
|
|
194939
|
+
function isFunctionAssignmentNode(x2) {
|
|
194940
|
+
return x2 && x2.isFunctionAssignmentNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194941
|
+
}
|
|
194942
|
+
function isFunctionNode(x2) {
|
|
194943
|
+
return x2 && x2.isFunctionNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194944
|
+
}
|
|
194945
|
+
function isIndexNode(x2) {
|
|
194946
|
+
return x2 && x2.isIndexNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194947
|
+
}
|
|
194948
|
+
function isNode(x2) {
|
|
194949
|
+
return x2 && x2.isNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194950
|
+
}
|
|
194951
|
+
function isObjectNode(x2) {
|
|
194952
|
+
return x2 && x2.isObjectNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194953
|
+
}
|
|
194954
|
+
function isOperatorNode(x2) {
|
|
194955
|
+
return x2 && x2.isOperatorNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194956
|
+
}
|
|
194957
|
+
function isParenthesisNode(x2) {
|
|
194958
|
+
return x2 && x2.isParenthesisNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194959
|
+
}
|
|
194960
|
+
function isRangeNode(x2) {
|
|
194961
|
+
return x2 && x2.isRangeNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194962
|
+
}
|
|
194963
|
+
function isSymbolNode(x2) {
|
|
194964
|
+
return x2 && x2.isSymbolNode === true && x2.constructor.prototype.isNode === true || false;
|
|
194965
|
+
}
|
|
194966
|
+
function isChain(x2) {
|
|
194967
|
+
return x2 && x2.constructor.prototype.isChain === true || false;
|
|
194968
|
+
}
|
|
194969
|
+
function typeOf(x2) {
|
|
194970
|
+
var t4 = typeof x2;
|
|
194971
|
+
if (t4 === "object") {
|
|
194972
|
+
if (x2 === null)
|
|
194973
|
+
return "null";
|
|
194974
|
+
if (Array.isArray(x2))
|
|
194975
|
+
return "Array";
|
|
194976
|
+
if (x2 instanceof Date)
|
|
194977
|
+
return "Date";
|
|
194978
|
+
if (x2 instanceof RegExp)
|
|
194979
|
+
return "RegExp";
|
|
194980
|
+
if (isBigNumber(x2))
|
|
194981
|
+
return "BigNumber";
|
|
194982
|
+
if (isComplex(x2))
|
|
194983
|
+
return "Complex";
|
|
194984
|
+
if (isFraction(x2))
|
|
194985
|
+
return "Fraction";
|
|
194986
|
+
if (isMatrix(x2))
|
|
194987
|
+
return "Matrix";
|
|
194988
|
+
if (isUnit(x2))
|
|
194989
|
+
return "Unit";
|
|
194990
|
+
if (isIndex(x2))
|
|
194991
|
+
return "Index";
|
|
194992
|
+
if (isRange(x2))
|
|
194993
|
+
return "Range";
|
|
194994
|
+
if (isResultSet(x2))
|
|
194995
|
+
return "ResultSet";
|
|
194996
|
+
if (isNode(x2))
|
|
194997
|
+
return x2.type;
|
|
194998
|
+
if (isChain(x2))
|
|
194999
|
+
return "Chain";
|
|
195000
|
+
if (isHelp(x2))
|
|
195001
|
+
return "Help";
|
|
195002
|
+
return "Object";
|
|
195003
|
+
}
|
|
195004
|
+
if (t4 === "function")
|
|
195005
|
+
return "Function";
|
|
195006
|
+
return t4;
|
|
195007
|
+
}
|
|
195008
|
+
function clone$2(x2) {
|
|
195009
|
+
var type3 = typeof x2;
|
|
195010
|
+
if (type3 === "number" || type3 === "string" || type3 === "boolean" || x2 === null || x2 === void 0) {
|
|
195011
|
+
return x2;
|
|
195012
|
+
}
|
|
195013
|
+
if (typeof x2.clone === "function") {
|
|
195014
|
+
return x2.clone();
|
|
195015
|
+
}
|
|
195016
|
+
if (Array.isArray(x2)) {
|
|
195017
|
+
return x2.map(function(value2) {
|
|
195018
|
+
return clone$2(value2);
|
|
195019
|
+
});
|
|
195020
|
+
}
|
|
195021
|
+
if (x2 instanceof Date)
|
|
195022
|
+
return new Date(x2.valueOf());
|
|
195023
|
+
if (isBigNumber(x2))
|
|
195024
|
+
return x2;
|
|
195025
|
+
if (x2 instanceof RegExp)
|
|
195026
|
+
throw new TypeError("Cannot clone " + x2);
|
|
195027
|
+
return mapObject(x2, clone$2);
|
|
195028
|
+
}
|
|
195029
|
+
function mapObject(object2, callback) {
|
|
195030
|
+
var clone3 = {};
|
|
195031
|
+
for (var key2 in object2) {
|
|
195032
|
+
if (hasOwnProperty$2(object2, key2)) {
|
|
195033
|
+
clone3[key2] = callback(object2[key2]);
|
|
195034
|
+
}
|
|
195035
|
+
}
|
|
195036
|
+
return clone3;
|
|
195037
|
+
}
|
|
195038
|
+
function extend$2(a2, b2) {
|
|
195039
|
+
for (var prop in b2) {
|
|
195040
|
+
if (hasOwnProperty$2(b2, prop)) {
|
|
195041
|
+
a2[prop] = b2[prop];
|
|
195042
|
+
}
|
|
195043
|
+
}
|
|
195044
|
+
return a2;
|
|
195045
|
+
}
|
|
195046
|
+
function deepStrictEqual(a2, b2) {
|
|
195047
|
+
var prop, i2, len2;
|
|
195048
|
+
if (Array.isArray(a2)) {
|
|
195049
|
+
if (!Array.isArray(b2)) {
|
|
195050
|
+
return false;
|
|
195051
|
+
}
|
|
195052
|
+
if (a2.length !== b2.length) {
|
|
195053
|
+
return false;
|
|
195054
|
+
}
|
|
195055
|
+
for (i2 = 0, len2 = a2.length; i2 < len2; i2++) {
|
|
195056
|
+
if (!deepStrictEqual(a2[i2], b2[i2])) {
|
|
195057
|
+
return false;
|
|
195058
|
+
}
|
|
195059
|
+
}
|
|
195060
|
+
return true;
|
|
195061
|
+
} else if (typeof a2 === "function") {
|
|
195062
|
+
return a2 === b2;
|
|
195063
|
+
} else if (a2 instanceof Object) {
|
|
195064
|
+
if (Array.isArray(b2) || !(b2 instanceof Object)) {
|
|
195065
|
+
return false;
|
|
195066
|
+
}
|
|
195067
|
+
for (prop in a2) {
|
|
195068
|
+
if (!(prop in b2) || !deepStrictEqual(a2[prop], b2[prop])) {
|
|
195069
|
+
return false;
|
|
195070
|
+
}
|
|
195071
|
+
}
|
|
195072
|
+
for (prop in b2) {
|
|
195073
|
+
if (!(prop in a2)) {
|
|
195074
|
+
return false;
|
|
195075
|
+
}
|
|
195076
|
+
}
|
|
195077
|
+
return true;
|
|
195078
|
+
} else {
|
|
195079
|
+
return a2 === b2;
|
|
195080
|
+
}
|
|
195081
|
+
}
|
|
195082
|
+
function hasOwnProperty$2(object2, property2) {
|
|
195083
|
+
return object2 && Object.hasOwnProperty.call(object2, property2);
|
|
195084
|
+
}
|
|
195085
|
+
function pickShallow(object2, properties2) {
|
|
195086
|
+
var copy2 = {};
|
|
195087
|
+
for (var i2 = 0; i2 < properties2.length; i2++) {
|
|
195088
|
+
var key2 = properties2[i2];
|
|
195089
|
+
var value2 = object2[key2];
|
|
195090
|
+
if (value2 !== void 0) {
|
|
195091
|
+
copy2[key2] = value2;
|
|
195092
|
+
}
|
|
195093
|
+
}
|
|
195094
|
+
return copy2;
|
|
195095
|
+
}
|
|
195096
|
+
var MATRIX_OPTIONS = ["Matrix", "Array"];
|
|
195097
|
+
var NUMBER_OPTIONS = ["number", "BigNumber", "Fraction"];
|
|
195098
|
+
var config$1 = function config(options) {
|
|
195099
|
+
if (options) {
|
|
195100
|
+
throw new Error("The global config is readonly. \nPlease create a mathjs instance if you want to change the default configuration. \nExample:\n\n import { create, all } from 'mathjs';\n const mathjs = create(all);\n mathjs.config({ number: 'BigNumber' });\n");
|
|
195101
|
+
}
|
|
195102
|
+
return Object.freeze(DEFAULT_CONFIG);
|
|
195103
|
+
};
|
|
195104
|
+
_extendsExports(config$1, DEFAULT_CONFIG, {
|
|
195105
|
+
MATRIX_OPTIONS,
|
|
195106
|
+
NUMBER_OPTIONS
|
|
195107
|
+
});
|
|
195108
|
+
var typedFunction$1 = { exports: {} };
|
|
195109
|
+
(function(module2, exports) {
|
|
195110
|
+
(function(root2, factory2) {
|
|
195111
|
+
{
|
|
195112
|
+
module2.exports = factory2();
|
|
195113
|
+
}
|
|
195114
|
+
})(commonjsGlobal$1, function() {
|
|
195115
|
+
function ok() {
|
|
195116
|
+
return true;
|
|
195117
|
+
}
|
|
195118
|
+
function notOk() {
|
|
195119
|
+
return false;
|
|
195120
|
+
}
|
|
195121
|
+
function undef() {
|
|
195122
|
+
return void 0;
|
|
195123
|
+
}
|
|
195124
|
+
function create6() {
|
|
195125
|
+
var _types = [
|
|
195126
|
+
{ name: "number", test: function(x2) {
|
|
195127
|
+
return typeof x2 === "number";
|
|
195128
|
+
} },
|
|
195129
|
+
{ name: "string", test: function(x2) {
|
|
195130
|
+
return typeof x2 === "string";
|
|
195131
|
+
} },
|
|
195132
|
+
{ name: "boolean", test: function(x2) {
|
|
195133
|
+
return typeof x2 === "boolean";
|
|
195134
|
+
} },
|
|
195135
|
+
{ name: "Function", test: function(x2) {
|
|
195136
|
+
return typeof x2 === "function";
|
|
195137
|
+
} },
|
|
195138
|
+
{ name: "Array", test: Array.isArray },
|
|
195139
|
+
{ name: "Date", test: function(x2) {
|
|
195140
|
+
return x2 instanceof Date;
|
|
195141
|
+
} },
|
|
195142
|
+
{ name: "RegExp", test: function(x2) {
|
|
195143
|
+
return x2 instanceof RegExp;
|
|
195144
|
+
} },
|
|
195145
|
+
{ name: "Object", test: function(x2) {
|
|
195146
|
+
return typeof x2 === "object" && x2 !== null && x2.constructor === Object;
|
|
195147
|
+
} },
|
|
195148
|
+
{ name: "null", test: function(x2) {
|
|
195149
|
+
return x2 === null;
|
|
195150
|
+
} },
|
|
195151
|
+
{ name: "undefined", test: function(x2) {
|
|
195152
|
+
return x2 === void 0;
|
|
195153
|
+
} }
|
|
195154
|
+
];
|
|
195155
|
+
var anyType = {
|
|
195156
|
+
name: "any",
|
|
195157
|
+
test: ok
|
|
195158
|
+
};
|
|
195159
|
+
var _ignore = [];
|
|
195160
|
+
var _conversions = [];
|
|
195161
|
+
var typed2 = {
|
|
195162
|
+
types: _types,
|
|
195163
|
+
conversions: _conversions,
|
|
195164
|
+
ignore: _ignore
|
|
195165
|
+
};
|
|
195166
|
+
function findTypeByName(typeName) {
|
|
195167
|
+
var entry2 = findInArray2(typed2.types, function(entry3) {
|
|
195168
|
+
return entry3.name === typeName;
|
|
195169
|
+
});
|
|
195170
|
+
if (entry2) {
|
|
195171
|
+
return entry2;
|
|
195172
|
+
}
|
|
195173
|
+
if (typeName === "any") {
|
|
195174
|
+
return anyType;
|
|
195175
|
+
}
|
|
195176
|
+
var hint2 = findInArray2(typed2.types, function(entry3) {
|
|
195177
|
+
return entry3.name.toLowerCase() === typeName.toLowerCase();
|
|
195178
|
+
});
|
|
195179
|
+
throw new TypeError('Unknown type "' + typeName + '"' + (hint2 ? '. Did you mean "' + hint2.name + '"?' : ""));
|
|
195180
|
+
}
|
|
195181
|
+
function findTypeIndex(type3) {
|
|
195182
|
+
if (type3 === anyType) {
|
|
195183
|
+
return 999;
|
|
195184
|
+
}
|
|
195185
|
+
return typed2.types.indexOf(type3);
|
|
195186
|
+
}
|
|
195187
|
+
function findTypeName(value2) {
|
|
195188
|
+
var entry2 = findInArray2(typed2.types, function(entry3) {
|
|
195189
|
+
return entry3.test(value2);
|
|
195190
|
+
});
|
|
195191
|
+
if (entry2) {
|
|
195192
|
+
return entry2.name;
|
|
195193
|
+
}
|
|
195194
|
+
throw new TypeError("Value has unknown type. Value: " + value2);
|
|
195195
|
+
}
|
|
195196
|
+
function find2(fn, signature) {
|
|
195197
|
+
if (!fn.signatures) {
|
|
194028
195198
|
throw new TypeError("Function is no typed-function");
|
|
194029
195199
|
}
|
|
194030
195200
|
var arr;
|
|
@@ -197808,7 +198978,7 @@ function cbrt(x2) {
|
|
|
197808
198978
|
function ceil$2(x2) {
|
|
197809
198979
|
return finalise(x2 = new this(x2), x2.e + 1, 2);
|
|
197810
198980
|
}
|
|
197811
|
-
function clamp$
|
|
198981
|
+
function clamp$1(x2, min2, max2) {
|
|
197812
198982
|
return new this(x2).clamp(min2, max2);
|
|
197813
198983
|
}
|
|
197814
198984
|
function config2(obj) {
|
|
@@ -197977,7 +199147,7 @@ function clone$1(obj) {
|
|
|
197977
199147
|
Decimal2.atan2 = atan2$2;
|
|
197978
199148
|
Decimal2.cbrt = cbrt;
|
|
197979
199149
|
Decimal2.ceil = ceil$2;
|
|
197980
|
-
Decimal2.clamp = clamp$
|
|
199150
|
+
Decimal2.clamp = clamp$1;
|
|
197981
199151
|
Decimal2.cos = cos$3;
|
|
197982
199152
|
Decimal2.cosh = cosh$1;
|
|
197983
199153
|
Decimal2.div = div;
|
|
@@ -208394,1157 +209564,6 @@ async function initializeRasterLayersAndChannels(rasterLayers, rasterRenderLayer
|
|
|
208394
209564
|
const autoImageLayerDefs = await Promise.all(autoImageLayerDefPromises);
|
|
208395
209565
|
return [autoImageLayerDefs, nextImageLoaders, nextImageMetaAndLayers];
|
|
208396
209566
|
}
|
|
208397
|
-
const useStyles$8 = makeStyles(() => ({
|
|
208398
|
-
tool: {
|
|
208399
|
-
position: "absolute",
|
|
208400
|
-
display: "inline",
|
|
208401
|
-
zIndex: "1000",
|
|
208402
|
-
opacity: ".65",
|
|
208403
|
-
color: "black",
|
|
208404
|
-
"&:hover": {
|
|
208405
|
-
opacity: ".90"
|
|
208406
|
-
}
|
|
208407
|
-
},
|
|
208408
|
-
iconButton: {
|
|
208409
|
-
padding: "0",
|
|
208410
|
-
height: "2em",
|
|
208411
|
-
width: "2em",
|
|
208412
|
-
backgroundColor: "white",
|
|
208413
|
-
display: "inline-block",
|
|
208414
|
-
fontWeight: "400",
|
|
208415
|
-
textAlign: "center",
|
|
208416
|
-
verticalAlign: "middle",
|
|
208417
|
-
cursor: "pointer",
|
|
208418
|
-
userSelect: "none",
|
|
208419
|
-
border: "1px solid #6c757d",
|
|
208420
|
-
fontSize: "1rem",
|
|
208421
|
-
lineHeight: "1.5",
|
|
208422
|
-
borderRadius: "0.25rem",
|
|
208423
|
-
transition: "color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out",
|
|
208424
|
-
color: "#6c757d",
|
|
208425
|
-
marginRight: "0.5rem",
|
|
208426
|
-
"& > svg": {
|
|
208427
|
-
verticalAlign: "middle"
|
|
208428
|
-
}
|
|
208429
|
-
},
|
|
208430
|
-
iconButtonActive: {
|
|
208431
|
-
color: "#fff",
|
|
208432
|
-
backgroundColor: "#6c757d",
|
|
208433
|
-
borderColor: "#6c757d",
|
|
208434
|
-
boxShadow: "0 0 0 0.2rem rgba(108, 117, 125, 0.5)"
|
|
208435
|
-
}
|
|
208436
|
-
}));
|
|
208437
|
-
function IconButton2(props2) {
|
|
208438
|
-
const { alt, onClick, isActive: isActive2, children: children3 } = props2;
|
|
208439
|
-
const classes = useStyles$8();
|
|
208440
|
-
return jsx("button", { className: clsx(classes.iconButton, { [classes.iconButtonActive]: isActive2 }), onClick, type: "button", title: alt, children: children3 });
|
|
208441
|
-
}
|
|
208442
|
-
function ToolMenu(props2) {
|
|
208443
|
-
const { setActiveTool, activeTool, visibleTools = { pan: true, selectRectangle: true, selectLasso: true } } = props2;
|
|
208444
|
-
const classes = useStyles$8();
|
|
208445
|
-
return jsxs("div", { className: classes.tool, children: [visibleTools.pan && jsx(IconButton2, { alt: "pointer tool", onClick: () => setActiveTool(null), isActive: activeTool === null, children: jsx(SvgNearMe, {}) }), visibleTools.selectRectangle ? jsx(IconButton2, { alt: "select rectangle", onClick: () => setActiveTool(distEs6$2.SELECTION_TYPE.RECTANGLE), isActive: activeTool === distEs6$2.SELECTION_TYPE.RECTANGLE, children: jsx(SvgSelectionRectangle, {}) }) : null, visibleTools.selectLasso ? jsx(IconButton2, { alt: "select lasso", onClick: () => setActiveTool(distEs6$2.SELECTION_TYPE.POLYGON), isActive: activeTool === distEs6$2.SELECTION_TYPE.POLYGON, children: jsx(SvgSelectionLasso, {}) }) : null] });
|
|
208446
|
-
}
|
|
208447
|
-
const getCursorWithTool = () => "crosshair";
|
|
208448
|
-
const getCursor = (interactionState) => interactionState.isDragging ? "grabbing" : "default";
|
|
208449
|
-
function getOnHoverCallback(obsIndex, setObsHighlight, setComponentHover) {
|
|
208450
|
-
return (info2) => {
|
|
208451
|
-
if (setComponentHover) {
|
|
208452
|
-
setComponentHover();
|
|
208453
|
-
}
|
|
208454
|
-
if (info2.index) {
|
|
208455
|
-
const obsId = obsIndex[info2.index];
|
|
208456
|
-
if (setObsHighlight) {
|
|
208457
|
-
setObsHighlight(obsId);
|
|
208458
|
-
}
|
|
208459
|
-
} else if (setObsHighlight) {
|
|
208460
|
-
setObsHighlight(null);
|
|
208461
|
-
}
|
|
208462
|
-
};
|
|
208463
|
-
}
|
|
208464
|
-
class AbstractSpatialOrScatterplot extends PureComponent {
|
|
208465
|
-
constructor(props2) {
|
|
208466
|
-
super(props2);
|
|
208467
|
-
this.state = {
|
|
208468
|
-
gl: null,
|
|
208469
|
-
tool: null
|
|
208470
|
-
};
|
|
208471
|
-
this.viewport = null;
|
|
208472
|
-
this.onViewStateChange = this.onViewStateChange.bind(this);
|
|
208473
|
-
this.onInitializeViewInfo = this.onInitializeViewInfo.bind(this);
|
|
208474
|
-
this.onWebGLInitialized = this.onWebGLInitialized.bind(this);
|
|
208475
|
-
this.onToolChange = this.onToolChange.bind(this);
|
|
208476
|
-
this.onHover = this.onHover.bind(this);
|
|
208477
|
-
}
|
|
208478
|
-
onViewStateChange({ viewState: nextViewState }) {
|
|
208479
|
-
const { setViewState, viewState, layers, spatialAxisFixed } = this.props;
|
|
208480
|
-
const use3d = layers == null ? void 0 : layers.some((l2) => l2.use3d);
|
|
208481
|
-
setViewState({
|
|
208482
|
-
...nextViewState,
|
|
208483
|
-
target: spatialAxisFixed && use3d ? viewState.target : nextViewState.target
|
|
208484
|
-
});
|
|
208485
|
-
}
|
|
208486
|
-
onInitializeViewInfo({ viewport }) {
|
|
208487
|
-
this.viewport = viewport;
|
|
208488
|
-
}
|
|
208489
|
-
onWebGLInitialized(gl) {
|
|
208490
|
-
this.setState({ gl });
|
|
208491
|
-
}
|
|
208492
|
-
onToolChange(tool) {
|
|
208493
|
-
const { onToolChange: onToolChangeProp } = this.props;
|
|
208494
|
-
this.setState({ tool });
|
|
208495
|
-
if (onToolChangeProp) {
|
|
208496
|
-
onToolChangeProp(tool);
|
|
208497
|
-
}
|
|
208498
|
-
}
|
|
208499
|
-
getLayers() {
|
|
208500
|
-
return [];
|
|
208501
|
-
}
|
|
208502
|
-
onHover(info2) {
|
|
208503
|
-
const { coordinate, sourceLayer: layer, tile } = info2;
|
|
208504
|
-
const { setCellHighlight, cellHighlight, setComponentHover, layers } = this.props;
|
|
208505
|
-
const hasBitmask = (layers || []).some((l2) => l2.type === "bitmask");
|
|
208506
|
-
if (!setCellHighlight || !tile) {
|
|
208507
|
-
return null;
|
|
208508
|
-
}
|
|
208509
|
-
if (!layer || !coordinate) {
|
|
208510
|
-
if (cellHighlight && hasBitmask) {
|
|
208511
|
-
setCellHighlight(null);
|
|
208512
|
-
}
|
|
208513
|
-
return null;
|
|
208514
|
-
}
|
|
208515
|
-
const { content: content2, bbox: bbox2, z } = tile;
|
|
208516
|
-
if (!content2) {
|
|
208517
|
-
if (cellHighlight && hasBitmask) {
|
|
208518
|
-
setCellHighlight(null);
|
|
208519
|
-
}
|
|
208520
|
-
return null;
|
|
208521
|
-
}
|
|
208522
|
-
const { data: data2, width: width2, height: height2 } = content2;
|
|
208523
|
-
const { left: left2, right: right2, top: top2, bottom: bottom2 } = bbox2;
|
|
208524
|
-
const bounds2 = [
|
|
208525
|
-
left2,
|
|
208526
|
-
data2.height < layer.tileSize ? height2 : bottom2,
|
|
208527
|
-
data2.width < layer.tileSize ? width2 : right2,
|
|
208528
|
-
top2
|
|
208529
|
-
];
|
|
208530
|
-
if (!data2) {
|
|
208531
|
-
if (cellHighlight && hasBitmask) {
|
|
208532
|
-
setCellHighlight(null);
|
|
208533
|
-
}
|
|
208534
|
-
return null;
|
|
208535
|
-
}
|
|
208536
|
-
if (layer.id.includes("bitmask")) {
|
|
208537
|
-
const layerZoomScale = Math.max(1, 2 ** Math.round(-z));
|
|
208538
|
-
const dataCoords = [
|
|
208539
|
-
Math.floor((coordinate[0] - bounds2[0]) / layerZoomScale),
|
|
208540
|
-
Math.floor((coordinate[1] - bounds2[3]) / layerZoomScale)
|
|
208541
|
-
];
|
|
208542
|
-
const coords = dataCoords[1] * width2 + dataCoords[0];
|
|
208543
|
-
const hoverData = data2.map((d) => d[coords]);
|
|
208544
|
-
const cellId = hoverData.find((i2) => i2 > 0);
|
|
208545
|
-
if (cellId !== Number(cellHighlight)) {
|
|
208546
|
-
if (setComponentHover) {
|
|
208547
|
-
setComponentHover();
|
|
208548
|
-
}
|
|
208549
|
-
setCellHighlight(cellId ? String(cellId) : null);
|
|
208550
|
-
}
|
|
208551
|
-
}
|
|
208552
|
-
}
|
|
208553
|
-
viewInfoDidUpdate(obsIndex, obsLocations, makeGetObsCoords) {
|
|
208554
|
-
const { updateViewInfo, uuid } = this.props;
|
|
208555
|
-
const { viewport } = this;
|
|
208556
|
-
if (updateViewInfo && viewport) {
|
|
208557
|
-
updateViewInfo({
|
|
208558
|
-
uuid,
|
|
208559
|
-
project: (obsId) => {
|
|
208560
|
-
try {
|
|
208561
|
-
if (obsIndex && obsLocations) {
|
|
208562
|
-
const getObsCoords = makeGetObsCoords(obsLocations);
|
|
208563
|
-
const obsIdx = obsIndex.indexOf(obsId);
|
|
208564
|
-
const obsCoord = getObsCoords(obsIdx);
|
|
208565
|
-
return viewport.project(obsCoord);
|
|
208566
|
-
}
|
|
208567
|
-
return [null, null];
|
|
208568
|
-
} catch (e3) {
|
|
208569
|
-
return [null, null];
|
|
208570
|
-
}
|
|
208571
|
-
}
|
|
208572
|
-
});
|
|
208573
|
-
}
|
|
208574
|
-
}
|
|
208575
|
-
componentDidUpdate() {
|
|
208576
|
-
}
|
|
208577
|
-
use3d() {
|
|
208578
|
-
return false;
|
|
208579
|
-
}
|
|
208580
|
-
render() {
|
|
208581
|
-
var _a3, _b2, _c, _d;
|
|
208582
|
-
const { deckRef, viewState, uuid, hideTools } = this.props;
|
|
208583
|
-
const { gl, tool } = this.state;
|
|
208584
|
-
const layers = this.getLayers();
|
|
208585
|
-
const use3d = this.use3d();
|
|
208586
|
-
const showCellSelectionTools = this.obsSegmentationsData !== null;
|
|
208587
|
-
const showPanTool = layers.length > 0;
|
|
208588
|
-
const useDevicePixels = !use3d && (((_b2 = (_a3 = this.obsSegmentationsData) == null ? void 0 : _a3.shape) == null ? void 0 : _b2[0]) < 1e5 || ((_d = (_c = this.obsLocationsData) == null ? void 0 : _c.shape) == null ? void 0 : _d[1]) < 1e5);
|
|
208589
|
-
return jsxs(Fragment, { children: [jsx(ToolMenu, { activeTool: tool, setActiveTool: this.onToolChange, visibleTools: {
|
|
208590
|
-
pan: showPanTool && !hideTools,
|
|
208591
|
-
selectRectangle: showCellSelectionTools && !hideTools,
|
|
208592
|
-
selectLasso: showCellSelectionTools && !hideTools
|
|
208593
|
-
} }), jsx(DeckGL$1, { id: `deckgl-overlay-${uuid}`, ref: deckRef, views: [
|
|
208594
|
-
use3d ? new OrbitView({ id: "orbit", controller: true, orbitAxis: "Y" }) : new OrthographicView({
|
|
208595
|
-
id: "ortho"
|
|
208596
|
-
})
|
|
208597
|
-
], layers: gl && viewState.target.slice(0, 2).every((i2) => typeof i2 === "number") ? layers : [], glOptions: DEFAULT_GL_OPTIONS, onWebGLInitialized: this.onWebGLInitialized, onViewStateChange: this.onViewStateChange, viewState, useDevicePixels, controller: tool ? { dragPan: false } : true, getCursor: tool ? getCursorWithTool : getCursor, onHover: this.onHover, children: this.onInitializeViewInfo })] });
|
|
208598
|
-
}
|
|
208599
|
-
}
|
|
208600
|
-
function createQuadTree(obsEmbedding, getCellCoords) {
|
|
208601
|
-
if (!obsEmbedding) {
|
|
208602
|
-
return null;
|
|
208603
|
-
}
|
|
208604
|
-
const tree2 = quadtree$1().x((i2) => getCellCoords(i2)[0]).y((i2) => getCellCoords(i2)[1]).addAll(range_1(obsEmbedding.shape[1]));
|
|
208605
|
-
return tree2;
|
|
208606
|
-
}
|
|
208607
|
-
function constant$5(v) {
|
|
208608
|
-
return () => v;
|
|
208609
|
-
}
|
|
208610
|
-
function jiggle$1(v) {
|
|
208611
|
-
return v + (Math.random() - 0.5) * 1e-6;
|
|
208612
|
-
}
|
|
208613
|
-
function forceCollideRects() {
|
|
208614
|
-
let nodes;
|
|
208615
|
-
let masses;
|
|
208616
|
-
let strength = 1;
|
|
208617
|
-
let iterations2 = 1;
|
|
208618
|
-
let sizes;
|
|
208619
|
-
let size2 = constant$5([0, 0]);
|
|
208620
|
-
function xCenter(d) {
|
|
208621
|
-
return d.x + d.vx + sizes[d.index][0] / 2;
|
|
208622
|
-
}
|
|
208623
|
-
function yCenter(d) {
|
|
208624
|
-
return d.y + d.vy + sizes[d.index][1] / 2;
|
|
208625
|
-
}
|
|
208626
|
-
function prepare2(quad2) {
|
|
208627
|
-
if (quad2.data) {
|
|
208628
|
-
quad2.size = sizes[quad2.data.index];
|
|
208629
|
-
} else {
|
|
208630
|
-
quad2.size = [0, 0];
|
|
208631
|
-
for (let i2 = 0; i2 < 4; i2++) {
|
|
208632
|
-
if (quad2[i2] && quad2[i2].size) {
|
|
208633
|
-
quad2.size[0] = Math.max(quad2.size[0], quad2[i2].size[0]);
|
|
208634
|
-
quad2.size[1] = Math.max(quad2.size[1], quad2[i2].size[1]);
|
|
208635
|
-
}
|
|
208636
|
-
}
|
|
208637
|
-
}
|
|
208638
|
-
}
|
|
208639
|
-
function force2() {
|
|
208640
|
-
let node;
|
|
208641
|
-
let nodeSize;
|
|
208642
|
-
let nodeMass;
|
|
208643
|
-
let xi;
|
|
208644
|
-
let yi;
|
|
208645
|
-
const tree2 = quadtree$1(nodes, xCenter, yCenter).visitAfter(prepare2);
|
|
208646
|
-
function apply2(quad2, x02, y02, x12, y12) {
|
|
208647
|
-
const { data: data2 } = quad2;
|
|
208648
|
-
const xSize = (nodeSize[0] + quad2.size[0]) / 2;
|
|
208649
|
-
const ySize = (nodeSize[1] + quad2.size[1]) / 2;
|
|
208650
|
-
if (data2 && data2.index > node.index) {
|
|
208651
|
-
let x2 = jiggle$1(xi - xCenter(data2));
|
|
208652
|
-
let y2 = jiggle$1(yi - yCenter(data2));
|
|
208653
|
-
const xd = Math.abs(x2) - xSize;
|
|
208654
|
-
const yd = Math.abs(y2) - ySize;
|
|
208655
|
-
if (xd < 0 && yd < 0) {
|
|
208656
|
-
const l2 = Math.sqrt(x2 * x2 + y2 * y2);
|
|
208657
|
-
const m2 = masses[data2.index] / (nodeMass + masses[data2.index]);
|
|
208658
|
-
if (Math.abs(xd) < Math.abs(yd)) {
|
|
208659
|
-
node.vx -= (x2 *= xd / l2 * strength) * m2;
|
|
208660
|
-
data2.vx += x2 * (1 - m2);
|
|
208661
|
-
} else {
|
|
208662
|
-
node.vy -= (y2 *= yd / l2 * strength) * m2;
|
|
208663
|
-
data2.vy += y2 * (1 - m2);
|
|
208664
|
-
}
|
|
208665
|
-
}
|
|
208666
|
-
return x02 > xi + xSize || x12 < xi - xSize || y02 > yi + ySize || y12 < yi - ySize;
|
|
208667
|
-
}
|
|
208668
|
-
return false;
|
|
208669
|
-
}
|
|
208670
|
-
function iterate2() {
|
|
208671
|
-
for (let j = 0; j < nodes.length; j++) {
|
|
208672
|
-
node = nodes[j];
|
|
208673
|
-
nodeSize = sizes[j];
|
|
208674
|
-
nodeMass = masses[j];
|
|
208675
|
-
xi = xCenter(node);
|
|
208676
|
-
yi = yCenter(node);
|
|
208677
|
-
tree2.visit(apply2);
|
|
208678
|
-
}
|
|
208679
|
-
}
|
|
208680
|
-
for (let i2 = 0; i2 < iterations2; i2++) {
|
|
208681
|
-
iterate2();
|
|
208682
|
-
}
|
|
208683
|
-
}
|
|
208684
|
-
force2.initialize = (v) => {
|
|
208685
|
-
nodes = v;
|
|
208686
|
-
sizes = nodes.map(size2);
|
|
208687
|
-
masses = sizes.map((d) => d[0] + d[1]);
|
|
208688
|
-
};
|
|
208689
|
-
force2.iterations = (...v) => {
|
|
208690
|
-
if (v.length) {
|
|
208691
|
-
iterations2 = +v[0];
|
|
208692
|
-
return force2;
|
|
208693
|
-
}
|
|
208694
|
-
return iterations2;
|
|
208695
|
-
};
|
|
208696
|
-
force2.strength = (...v) => {
|
|
208697
|
-
if (v.length) {
|
|
208698
|
-
strength = +v[0];
|
|
208699
|
-
return force2;
|
|
208700
|
-
}
|
|
208701
|
-
return strength;
|
|
208702
|
-
};
|
|
208703
|
-
force2.size = (...v) => {
|
|
208704
|
-
if (v.length) {
|
|
208705
|
-
size2 = typeof v[0] === "function" ? v[0] : constant$5(v[0]);
|
|
208706
|
-
return force2;
|
|
208707
|
-
}
|
|
208708
|
-
return size2;
|
|
208709
|
-
};
|
|
208710
|
-
return force2;
|
|
208711
|
-
}
|
|
208712
|
-
function baseClamp$1(number2, lower, upper) {
|
|
208713
|
-
if (number2 === number2) {
|
|
208714
|
-
if (upper !== void 0) {
|
|
208715
|
-
number2 = number2 <= upper ? number2 : upper;
|
|
208716
|
-
}
|
|
208717
|
-
if (lower !== void 0) {
|
|
208718
|
-
number2 = number2 >= lower ? number2 : lower;
|
|
208719
|
-
}
|
|
208720
|
-
}
|
|
208721
|
-
return number2;
|
|
208722
|
-
}
|
|
208723
|
-
var _baseClamp = baseClamp$1;
|
|
208724
|
-
var baseClamp = _baseClamp, toNumber$1 = toNumber_1$1;
|
|
208725
|
-
function clamp$1(number2, lower, upper) {
|
|
208726
|
-
if (upper === void 0) {
|
|
208727
|
-
upper = lower;
|
|
208728
|
-
lower = void 0;
|
|
208729
|
-
}
|
|
208730
|
-
if (upper !== void 0) {
|
|
208731
|
-
upper = toNumber$1(upper);
|
|
208732
|
-
upper = upper === upper ? upper : 0;
|
|
208733
|
-
}
|
|
208734
|
-
if (lower !== void 0) {
|
|
208735
|
-
lower = toNumber$1(lower);
|
|
208736
|
-
lower = lower === lower ? lower : 0;
|
|
208737
|
-
}
|
|
208738
|
-
return baseClamp(toNumber$1(number2), lower, upper);
|
|
208739
|
-
}
|
|
208740
|
-
var clamp_1 = clamp$1;
|
|
208741
|
-
function getPointSizeDevicePixels(devicePixelRatio2, zoom2, xRange, yRange, width2, height2) {
|
|
208742
|
-
const pointSize = 5e-4;
|
|
208743
|
-
const pointScreenSizeMax = 10;
|
|
208744
|
-
const pointScreenSizeMin = 1 / devicePixelRatio2;
|
|
208745
|
-
const scaleFactor = 2 ** zoom2;
|
|
208746
|
-
const xAxisRange = 2 / (xRange * scaleFactor / width2);
|
|
208747
|
-
const yAxisRange = 2 / (yRange * scaleFactor / height2);
|
|
208748
|
-
const diagonalScreenSize = Math.sqrt(width2 ** 2 + height2 ** 2);
|
|
208749
|
-
const diagonalAxisRange = Math.sqrt(xAxisRange ** 2 + yAxisRange ** 2);
|
|
208750
|
-
const diagonalFraction = pointSize / diagonalAxisRange;
|
|
208751
|
-
const deviceSize = diagonalFraction * diagonalScreenSize;
|
|
208752
|
-
const pointSizeDevicePixels = clamp_1(deviceSize, pointScreenSizeMin, pointScreenSizeMax);
|
|
208753
|
-
return pointSizeDevicePixels;
|
|
208754
|
-
}
|
|
208755
|
-
function getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, avgFillDensity) {
|
|
208756
|
-
const N2 = numCells;
|
|
208757
|
-
const [minX, minY, maxX, maxY2] = new OrthographicView({ zoom: zoom2 }).makeViewport({
|
|
208758
|
-
height: height2,
|
|
208759
|
-
width: width2,
|
|
208760
|
-
viewState: { zoom: zoom2, target: [0, 0, 0] }
|
|
208761
|
-
}).getBounds();
|
|
208762
|
-
const X3 = maxY2 - minY;
|
|
208763
|
-
const Y3 = maxX - minX;
|
|
208764
|
-
const X02 = xRange;
|
|
208765
|
-
const Y02 = yRange;
|
|
208766
|
-
const W = width2;
|
|
208767
|
-
const H = height2;
|
|
208768
|
-
let rho = avgFillDensity;
|
|
208769
|
-
if (!rho) {
|
|
208770
|
-
rho = Math.min(1, 1 / 10 ** (Math.log10(N2) - 3));
|
|
208771
|
-
}
|
|
208772
|
-
const alpha2 = rho * W * H / N2 * (Y02 / Y3) * (X02 / X3);
|
|
208773
|
-
const pointOpacity = clamp_1(alpha2, 1.01 / 255, 1);
|
|
208774
|
-
return pointOpacity;
|
|
208775
|
-
}
|
|
208776
|
-
const CELLS_LAYER_ID$1 = "scatterplot";
|
|
208777
|
-
const LABEL_FONT_FAMILY = "-apple-system, 'Helvetica Neue', Arial, sans-serif";
|
|
208778
|
-
const NUM_FORCE_SIMULATION_TICKS = 100;
|
|
208779
|
-
const LABEL_UPDATE_ZOOM_DELTA = 0.25;
|
|
208780
|
-
const makeDefaultGetCellColors$1 = (cellColors, obsIndex, theme) => (object2, { index: index2 }) => {
|
|
208781
|
-
const [r3, g2, b2, a2] = cellColors && obsIndex && cellColors.get(obsIndex[index2]) || getDefaultColor(theme);
|
|
208782
|
-
return [r3, g2, b2, 255 * (a2 || 1)];
|
|
208783
|
-
};
|
|
208784
|
-
const makeDefaultGetObsCoords$1 = (obsEmbedding) => (i2) => [
|
|
208785
|
-
obsEmbedding.data[0][i2],
|
|
208786
|
-
obsEmbedding.data[1][i2],
|
|
208787
|
-
0
|
|
208788
|
-
];
|
|
208789
|
-
const makeFlippedGetObsCoords = (obsEmbedding) => (i2) => [
|
|
208790
|
-
obsEmbedding.data[0][i2],
|
|
208791
|
-
-obsEmbedding.data[1][i2],
|
|
208792
|
-
0
|
|
208793
|
-
];
|
|
208794
|
-
const getPosition = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
208795
|
-
target2[0] = data2.src.obsEmbedding.data[0][index2];
|
|
208796
|
-
target2[1] = -data2.src.obsEmbedding.data[1][index2];
|
|
208797
|
-
target2[2] = 0;
|
|
208798
|
-
return target2;
|
|
208799
|
-
};
|
|
208800
|
-
class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
208801
|
-
constructor(props2) {
|
|
208802
|
-
super(props2);
|
|
208803
|
-
this.cellsQuadTree = null;
|
|
208804
|
-
this.cellsLayer = null;
|
|
208805
|
-
this.cellsData = null;
|
|
208806
|
-
this.cellSetsForceSimulation = forceCollideRects();
|
|
208807
|
-
this.cellSetsLabelPrevZoom = null;
|
|
208808
|
-
this.cellSetsLayers = [];
|
|
208809
|
-
this.onUpdateCellsData();
|
|
208810
|
-
this.onUpdateCellsLayer();
|
|
208811
|
-
this.onUpdateCellSetsLayers();
|
|
208812
|
-
}
|
|
208813
|
-
createCellsLayer() {
|
|
208814
|
-
const {
|
|
208815
|
-
obsEmbeddingIndex: obsIndex,
|
|
208816
|
-
theme,
|
|
208817
|
-
cellRadius = 1,
|
|
208818
|
-
cellOpacity = 1,
|
|
208819
|
-
cellSelection,
|
|
208820
|
-
setCellHighlight,
|
|
208821
|
-
setComponentHover,
|
|
208822
|
-
getCellIsSelected,
|
|
208823
|
-
cellColors,
|
|
208824
|
-
getCellColor = makeDefaultGetCellColors$1(cellColors, obsIndex, theme),
|
|
208825
|
-
getExpressionValue,
|
|
208826
|
-
onCellClick,
|
|
208827
|
-
geneExpressionColormap,
|
|
208828
|
-
geneExpressionColormapRange = [0, 1],
|
|
208829
|
-
cellColorEncoding
|
|
208830
|
-
} = this.props;
|
|
208831
|
-
return new ScatterplotLayer({
|
|
208832
|
-
id: CELLS_LAYER_ID$1,
|
|
208833
|
-
data: this.cellsData,
|
|
208834
|
-
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
208835
|
-
visible: true,
|
|
208836
|
-
pickable: true,
|
|
208837
|
-
autoHighlight: true,
|
|
208838
|
-
filled: true,
|
|
208839
|
-
stroked: true,
|
|
208840
|
-
backgroundColor: theme === "dark" ? [0, 0, 0] : [241, 241, 241],
|
|
208841
|
-
getCellIsSelected,
|
|
208842
|
-
opacity: cellOpacity,
|
|
208843
|
-
radiusScale: cellRadius,
|
|
208844
|
-
radiusMinPixels: 1,
|
|
208845
|
-
radiusMaxPixels: 30,
|
|
208846
|
-
radiusUnits: "pixels",
|
|
208847
|
-
lineWidthUnits: "pixels",
|
|
208848
|
-
getPosition,
|
|
208849
|
-
getFillColor: getCellColor,
|
|
208850
|
-
getLineColor: getCellColor,
|
|
208851
|
-
getRadius: 1,
|
|
208852
|
-
getExpressionValue,
|
|
208853
|
-
getLineWidth: 0,
|
|
208854
|
-
extensions: [
|
|
208855
|
-
new ScaledExpressionExtension(),
|
|
208856
|
-
new SelectionExtension({ instanced: true })
|
|
208857
|
-
],
|
|
208858
|
-
colorScaleLo: geneExpressionColormapRange[0],
|
|
208859
|
-
colorScaleHi: geneExpressionColormapRange[1],
|
|
208860
|
-
isExpressionMode: cellColorEncoding === "geneSelection",
|
|
208861
|
-
colormap: geneExpressionColormap,
|
|
208862
|
-
onClick: (info2) => {
|
|
208863
|
-
if (onCellClick) {
|
|
208864
|
-
onCellClick(info2);
|
|
208865
|
-
}
|
|
208866
|
-
},
|
|
208867
|
-
onHover: getOnHoverCallback(obsIndex, setCellHighlight, setComponentHover),
|
|
208868
|
-
updateTriggers: {
|
|
208869
|
-
getExpressionValue,
|
|
208870
|
-
getFillColor: [cellColorEncoding, cellSelection, cellColors],
|
|
208871
|
-
getLineColor: [cellColorEncoding, cellSelection, cellColors],
|
|
208872
|
-
getCellIsSelected
|
|
208873
|
-
}
|
|
208874
|
-
});
|
|
208875
|
-
}
|
|
208876
|
-
createCellSetsLayers() {
|
|
208877
|
-
const { theme, cellSetPolygons, viewState, cellSetPolygonsVisible, cellSetLabelsVisible, cellSetLabelSize } = this.props;
|
|
208878
|
-
const result = [];
|
|
208879
|
-
if (cellSetPolygonsVisible) {
|
|
208880
|
-
result.push(new PolygonLayer({
|
|
208881
|
-
id: "cell-sets-polygon-layer",
|
|
208882
|
-
data: cellSetPolygons,
|
|
208883
|
-
stroked: true,
|
|
208884
|
-
filled: false,
|
|
208885
|
-
wireframe: true,
|
|
208886
|
-
lineWidthMaxPixels: 1,
|
|
208887
|
-
getPolygon: (d) => d.hull,
|
|
208888
|
-
getLineColor: (d) => d.color,
|
|
208889
|
-
getLineWidth: 1
|
|
208890
|
-
}));
|
|
208891
|
-
}
|
|
208892
|
-
if (cellSetLabelsVisible) {
|
|
208893
|
-
const { zoom: zoom2 } = viewState;
|
|
208894
|
-
const nodes = cellSetPolygons.map((p) => ({
|
|
208895
|
-
x: p.centroid[0],
|
|
208896
|
-
y: p.centroid[1],
|
|
208897
|
-
label: p.name
|
|
208898
|
-
}));
|
|
208899
|
-
const collisionForce = this.cellSetsForceSimulation.size((d) => [
|
|
208900
|
-
cellSetLabelSize * 1 / 2 ** zoom2 * 4 * d.label.length,
|
|
208901
|
-
cellSetLabelSize * 1 / 2 ** zoom2 * 1.5
|
|
208902
|
-
]);
|
|
208903
|
-
forceSimulation$1().nodes(nodes).force("collision", collisionForce).tick(NUM_FORCE_SIMULATION_TICKS);
|
|
208904
|
-
result.push(new TextLayer({
|
|
208905
|
-
id: "cell-sets-text-layer",
|
|
208906
|
-
data: nodes,
|
|
208907
|
-
getPosition: (d) => [d.x, d.y],
|
|
208908
|
-
getText: (d) => d.label,
|
|
208909
|
-
getColor: theme === "dark" ? [255, 255, 255] : [0, 0, 0],
|
|
208910
|
-
getSize: cellSetLabelSize,
|
|
208911
|
-
getAngle: 0,
|
|
208912
|
-
getTextAnchor: "middle",
|
|
208913
|
-
getAlignmentBaseline: "center",
|
|
208914
|
-
fontFamily: LABEL_FONT_FAMILY,
|
|
208915
|
-
fontWeight: "normal"
|
|
208916
|
-
}));
|
|
208917
|
-
}
|
|
208918
|
-
return result;
|
|
208919
|
-
}
|
|
208920
|
-
createSelectionLayers() {
|
|
208921
|
-
const { obsEmbeddingIndex: obsIndex, obsEmbedding, viewState, setCellSelection } = this.props;
|
|
208922
|
-
const { tool } = this.state;
|
|
208923
|
-
const { cellsQuadTree } = this;
|
|
208924
|
-
const flipYTooltip = true;
|
|
208925
|
-
const getCellCoords = makeDefaultGetObsCoords$1(obsEmbedding);
|
|
208926
|
-
return getSelectionLayers(tool, viewState.zoom, CELLS_LAYER_ID$1, getCellCoords, obsIndex, setCellSelection, cellsQuadTree, flipYTooltip);
|
|
208927
|
-
}
|
|
208928
|
-
getLayers() {
|
|
208929
|
-
const { cellsLayer, cellSetsLayers } = this;
|
|
208930
|
-
return [
|
|
208931
|
-
cellsLayer,
|
|
208932
|
-
...cellSetsLayers,
|
|
208933
|
-
...this.createSelectionLayers()
|
|
208934
|
-
];
|
|
208935
|
-
}
|
|
208936
|
-
onUpdateCellsData() {
|
|
208937
|
-
const { obsEmbedding } = this.props;
|
|
208938
|
-
if (obsEmbedding) {
|
|
208939
|
-
const getCellCoords = makeDefaultGetObsCoords$1(obsEmbedding);
|
|
208940
|
-
this.cellsQuadTree = createQuadTree(obsEmbedding, getCellCoords);
|
|
208941
|
-
this.cellsData = {
|
|
208942
|
-
src: {
|
|
208943
|
-
obsEmbedding
|
|
208944
|
-
},
|
|
208945
|
-
length: obsEmbedding.shape[1]
|
|
208946
|
-
};
|
|
208947
|
-
}
|
|
208948
|
-
}
|
|
208949
|
-
onUpdateCellsLayer() {
|
|
208950
|
-
const { obsEmbeddingIndex, obsEmbedding } = this.props;
|
|
208951
|
-
if (obsEmbeddingIndex && obsEmbedding) {
|
|
208952
|
-
this.cellsLayer = this.createCellsLayer();
|
|
208953
|
-
} else {
|
|
208954
|
-
this.cellsLayer = null;
|
|
208955
|
-
}
|
|
208956
|
-
}
|
|
208957
|
-
onUpdateCellSetsLayers(onlyViewStateChange) {
|
|
208958
|
-
if (onlyViewStateChange) {
|
|
208959
|
-
const { viewState, cellSetLabelsVisible } = this.props;
|
|
208960
|
-
const { zoom: zoom2 } = viewState;
|
|
208961
|
-
const { cellSetsLabelPrevZoom } = this;
|
|
208962
|
-
if (cellSetLabelsVisible && (cellSetsLabelPrevZoom === null || Math.abs(cellSetsLabelPrevZoom - zoom2) > LABEL_UPDATE_ZOOM_DELTA)) {
|
|
208963
|
-
this.cellSetsLayers = this.createCellSetsLayers();
|
|
208964
|
-
this.cellSetsLabelPrevZoom = zoom2;
|
|
208965
|
-
}
|
|
208966
|
-
} else {
|
|
208967
|
-
this.cellSetsLayers = this.createCellSetsLayers();
|
|
208968
|
-
}
|
|
208969
|
-
}
|
|
208970
|
-
viewInfoDidUpdate() {
|
|
208971
|
-
const { obsEmbeddingIndex, obsEmbedding } = this.props;
|
|
208972
|
-
super.viewInfoDidUpdate(obsEmbeddingIndex, obsEmbedding, makeFlippedGetObsCoords);
|
|
208973
|
-
}
|
|
208974
|
-
componentDidUpdate(prevProps) {
|
|
208975
|
-
this.viewInfoDidUpdate();
|
|
208976
|
-
const shallowDiff = (propName) => prevProps[propName] !== this.props[propName];
|
|
208977
|
-
let forceUpdate = false;
|
|
208978
|
-
if (["obsEmbedding"].some(shallowDiff)) {
|
|
208979
|
-
this.onUpdateCellsData();
|
|
208980
|
-
forceUpdate = true;
|
|
208981
|
-
}
|
|
208982
|
-
if ([
|
|
208983
|
-
"obsEmbeddingIndex",
|
|
208984
|
-
"obsEmbedding",
|
|
208985
|
-
"cellFilter",
|
|
208986
|
-
"cellSelection",
|
|
208987
|
-
"cellColors",
|
|
208988
|
-
"cellRadius",
|
|
208989
|
-
"cellOpacity",
|
|
208990
|
-
"cellRadiusMode",
|
|
208991
|
-
"geneExpressionColormap",
|
|
208992
|
-
"geneExpressionColormapRange",
|
|
208993
|
-
"geneSelection",
|
|
208994
|
-
"cellColorEncoding"
|
|
208995
|
-
].some(shallowDiff)) {
|
|
208996
|
-
this.onUpdateCellsLayer();
|
|
208997
|
-
forceUpdate = true;
|
|
208998
|
-
}
|
|
208999
|
-
if ([
|
|
209000
|
-
"cellSetPolygons",
|
|
209001
|
-
"cellSetPolygonsVisible",
|
|
209002
|
-
"cellSetLabelsVisible",
|
|
209003
|
-
"cellSetLabelSize"
|
|
209004
|
-
].some(shallowDiff)) {
|
|
209005
|
-
this.onUpdateCellSetsLayers(false);
|
|
209006
|
-
forceUpdate = true;
|
|
209007
|
-
}
|
|
209008
|
-
if (shallowDiff("viewState")) {
|
|
209009
|
-
this.onUpdateCellSetsLayers(true);
|
|
209010
|
-
forceUpdate = true;
|
|
209011
|
-
}
|
|
209012
|
-
if (forceUpdate) {
|
|
209013
|
-
this.forceUpdate();
|
|
209014
|
-
}
|
|
209015
|
-
}
|
|
209016
|
-
}
|
|
209017
|
-
const ScatterplotWrapper = forwardRef((props2, deckRef) => jsx(Scatterplot, { ...props2, deckRef }));
|
|
209018
|
-
function ScatterplotOptions(props2) {
|
|
209019
|
-
const { children: children3, observationsLabel, cellRadius, setCellRadius, cellRadiusMode, setCellRadiusMode, cellOpacity, setCellOpacity, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange } = props2;
|
|
209020
|
-
const observationsLabelNice = capitalize$2(observationsLabel);
|
|
209021
|
-
const classes = useStyles$b();
|
|
209022
|
-
function handleCellRadiusModeChange(event2) {
|
|
209023
|
-
setCellRadiusMode(event2.target.value);
|
|
209024
|
-
}
|
|
209025
|
-
function handleCellOpacityModeChange(event2) {
|
|
209026
|
-
setCellOpacityMode(event2.target.value);
|
|
209027
|
-
}
|
|
209028
|
-
function handleRadiusChange(event2, value2) {
|
|
209029
|
-
setCellRadius(value2);
|
|
209030
|
-
}
|
|
209031
|
-
function handleOpacityChange(event2, value2) {
|
|
209032
|
-
setCellOpacity(value2);
|
|
209033
|
-
}
|
|
209034
|
-
function handleLabelVisibilityChange(event2) {
|
|
209035
|
-
setCellSetLabelsVisible(event2.target.checked);
|
|
209036
|
-
}
|
|
209037
|
-
function handleLabelSizeChange(event2, value2) {
|
|
209038
|
-
setCellSetLabelSize(value2);
|
|
209039
|
-
}
|
|
209040
|
-
function handlePolygonVisibilityChange(event2) {
|
|
209041
|
-
setCellSetPolygonsVisible(event2.target.checked);
|
|
209042
|
-
}
|
|
209043
|
-
function handleGeneExpressionColormapChange(event2) {
|
|
209044
|
-
setGeneExpressionColormap(event2.target.value);
|
|
209045
|
-
}
|
|
209046
|
-
function handleColormapRangeChange(event2, value2) {
|
|
209047
|
-
setGeneExpressionColormapRange(value2);
|
|
209048
|
-
}
|
|
209049
|
-
const handleColormapRangeChangeDebounced = useCallback(debounce_1$1(handleColormapRangeChange, 5, { trailing: true }), [handleColormapRangeChange]);
|
|
209050
|
-
return jsxs(OptionsContainer, { children: [children3, jsx(CellColorEncodingOption, { observationsLabel, cellColorEncoding, setCellColorEncoding }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Set Labels Visible"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Checkbox$1, { className: classes.checkbox, checked: cellSetLabelsVisible, onChange: handleLabelVisibilityChange, name: "scatterplot-option-cell-set-labels", color: "default" }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Set Label Size"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { disabled: !cellSetLabelsVisible, classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: cellSetLabelSize, onChange: handleLabelSizeChange, "aria-labelledby": "cell-set-label-size-slider", valueLabelDisplay: "auto", step: 1, min: 8, max: 36 }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Set Polygons Visible"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Checkbox$1, { className: classes.checkbox, checked: cellSetPolygonsVisible, onChange: handlePolygonVisibilityChange, name: "scatterplot-option-cell-set-polygons", color: "default" }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, htmlFor: "cell-radius-mode-select", children: [observationsLabelNice, " Radius Mode"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsxs(OptionSelect, { className: classes.select, value: cellRadiusMode, onChange: handleCellRadiusModeChange, inputProps: {
|
|
209051
|
-
id: "cell-radius-mode-select"
|
|
209052
|
-
}, children: [jsx("option", { value: "auto", children: "Auto" }), jsx("option", { value: "manual", children: "Manual" })] }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Radius"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { disabled: cellRadiusMode !== "manual", classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: cellRadius, onChange: handleRadiusChange, "aria-labelledby": "cell-radius-slider", valueLabelDisplay: "auto", step: 0.01, min: 0.01, max: 10 }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, htmlFor: "cell-opacity-mode-select", children: [observationsLabelNice, " Opacity Mode"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsxs(OptionSelect, { className: classes.select, value: cellOpacityMode, onChange: handleCellOpacityModeChange, inputProps: {
|
|
209053
|
-
id: "cell-opacity-mode-select"
|
|
209054
|
-
}, children: [jsx("option", { value: "auto", children: "Auto" }), jsx("option", { value: "manual", children: "Manual" })] }) })] }), jsxs(TableRow$1, { children: [jsxs(TableCell$1, { className: classes.labelCell, children: [observationsLabelNice, " Opacity"] }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { disabled: cellOpacityMode !== "manual", classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: cellOpacity, onChange: handleOpacityChange, "aria-labelledby": "cell-opacity-slider", valueLabelDisplay: "auto", step: 0.05, min: 0, max: 1 }) })] }), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, htmlFor: "gene-expression-colormap-select", children: "Gene Expression Colormap" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(OptionSelect, { className: classes.select, value: geneExpressionColormap, onChange: handleGeneExpressionColormapChange, inputProps: {
|
|
209055
|
-
id: "gene-expression-colormap-select"
|
|
209056
|
-
}, children: GLSL_COLORMAPS.map((cmap) => jsx("option", { value: cmap, children: cmap }, cmap)) }) })] }), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: "Gene Expression Colormap Range" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(Slider$1, { classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: geneExpressionColormapRange, onChange: handleColormapRangeChangeDebounced, "aria-labelledby": "gene-expression-colormap-range-slider", valueLabelDisplay: "auto", step: 5e-3, min: 0, max: 1 }) })] })] });
|
|
209057
|
-
}
|
|
209058
|
-
const styles34 = makeStyles(() => ({
|
|
209059
|
-
tooltipAnchor: {
|
|
209060
|
-
position: "relative",
|
|
209061
|
-
width: "0px",
|
|
209062
|
-
height: "0px",
|
|
209063
|
-
pointerEvents: "none",
|
|
209064
|
-
userSelect: "none"
|
|
209065
|
-
},
|
|
209066
|
-
tooltipContent: {
|
|
209067
|
-
opacity: 0.9,
|
|
209068
|
-
padding: "5px",
|
|
209069
|
-
pointerEvents: "none",
|
|
209070
|
-
"& table > tbody > tr > th, & table > tbody > tr > td": {
|
|
209071
|
-
fontSize: "80%",
|
|
209072
|
-
opacity: 0.8,
|
|
209073
|
-
outline: 0,
|
|
209074
|
-
padding: "0 2px"
|
|
209075
|
-
},
|
|
209076
|
-
"& table": {
|
|
209077
|
-
borderCollapse: "collapse"
|
|
209078
|
-
}
|
|
209079
|
-
}
|
|
209080
|
-
}));
|
|
209081
|
-
function Tooltip2(props2) {
|
|
209082
|
-
const { x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props2;
|
|
209083
|
-
const ref2 = useRef();
|
|
209084
|
-
const classes = styles34();
|
|
209085
|
-
const [placementX, setPlacementX] = useState("start");
|
|
209086
|
-
const [placementY, setPlacementY] = useState("bottom");
|
|
209087
|
-
const getTooltipContainer = useVitessceContainer(ref2);
|
|
209088
|
-
useEffect(() => {
|
|
209089
|
-
if (ref2 && ref2.current) {
|
|
209090
|
-
const flipX = x2 > parentWidth / 2;
|
|
209091
|
-
const flipY = y2 > parentHeight / 2;
|
|
209092
|
-
setPlacementX(flipX ? "end" : "start");
|
|
209093
|
-
setPlacementY(flipY ? "top" : "bottom");
|
|
209094
|
-
ref2.current.style.left = `${x2 + (flipX ? -20 : 5)}px`;
|
|
209095
|
-
ref2.current.style.top = `${y2 + (flipY ? -20 : 5)}px`;
|
|
209096
|
-
}
|
|
209097
|
-
}, [x2, y2, parentWidth, parentHeight]);
|
|
209098
|
-
return jsx("div", { ref: ref2, className: classes.tooltipAnchor, children: ref2 && ref2.current ? jsx(Popper$1, { open: true, anchorEl: ref2.current, container: getTooltipContainer, transition: true, placement: `${placementY}-${placementX}`, children: jsx(Paper$1, { elevation: 4, className: classes.tooltipContent, children: children3 }) }) : null });
|
|
209099
|
-
}
|
|
209100
|
-
function Tooltip2D(props2) {
|
|
209101
|
-
const { parentUuid, sourceUuid, x: x2, y: y2, parentWidth, parentHeight, children: children3 } = props2;
|
|
209102
|
-
if (x2 < 0 || x2 > parentWidth || y2 < 0 || y2 > parentHeight) {
|
|
209103
|
-
return null;
|
|
209104
|
-
}
|
|
209105
|
-
const isTooltipVisible = parentUuid === sourceUuid;
|
|
209106
|
-
const crosshairWidth = 1;
|
|
209107
|
-
return jsx(Fragment, { children: isTooltipVisible ? jsx(Tooltip2, { x: x2, y: y2, parentWidth, parentHeight, children: children3 }) : jsxs(Fragment, { children: [x2 !== null ? jsx("div", { className: "cell-emphasis-crosshair", style: {
|
|
209108
|
-
left: `${x2 - crosshairWidth / 2}px`,
|
|
209109
|
-
top: 0,
|
|
209110
|
-
width: `${crosshairWidth}px`,
|
|
209111
|
-
height: `${parentHeight}px`
|
|
209112
|
-
} }) : null, y2 !== null ? jsx("div", { className: "cell-emphasis-crosshair", style: {
|
|
209113
|
-
left: 0,
|
|
209114
|
-
top: `${y2 - crosshairWidth / 2}px`,
|
|
209115
|
-
width: `${parentWidth}px`,
|
|
209116
|
-
height: `${crosshairWidth}px`
|
|
209117
|
-
} }) : null] }) });
|
|
209118
|
-
}
|
|
209119
|
-
function TooltipContent(props2) {
|
|
209120
|
-
const { info: info2 } = props2;
|
|
209121
|
-
return jsx("table", { children: jsx("tbody", { children: Object.entries(info2).map(([key2, value2]) => jsxs("tr", { children: [jsx("th", { children: key2 }), jsx("td", { children: value2 })] }, key2)) }) });
|
|
209122
|
-
}
|
|
209123
|
-
function ScatterplotTooltipSubscriber(props2) {
|
|
209124
|
-
const { parentUuid, obsHighlight, width: width2, height: height2, getObsInfo } = props2;
|
|
209125
|
-
const sourceUuid = useComponentHover();
|
|
209126
|
-
const viewInfo = useComponentViewInfo(parentUuid);
|
|
209127
|
-
const [cellInfo, x2, y2] = obsHighlight && getObsInfo ? [
|
|
209128
|
-
getObsInfo(obsHighlight),
|
|
209129
|
-
...viewInfo && viewInfo.project ? viewInfo.project(obsHighlight) : [null, null]
|
|
209130
|
-
] : [null, null, null];
|
|
209131
|
-
return cellInfo ? jsx(Tooltip2D, { x: x2, y: y2, parentUuid, sourceUuid, parentWidth: width2, parentHeight: height2, children: jsx(TooltipContent, { info: cellInfo }) }) : null;
|
|
209132
|
-
}
|
|
209133
|
-
function EmptyMessage(props2) {
|
|
209134
|
-
const { visible, message } = props2;
|
|
209135
|
-
return visible ? jsx("div", { children: message }) : null;
|
|
209136
|
-
}
|
|
209137
|
-
function EmbeddingScatterplotSubscriber(props2) {
|
|
209138
|
-
const {
|
|
209139
|
-
uuid,
|
|
209140
|
-
coordinationScopes,
|
|
209141
|
-
removeGridComponent,
|
|
209142
|
-
theme,
|
|
209143
|
-
disableTooltip = false,
|
|
209144
|
-
observationsLabelOverride,
|
|
209145
|
-
title: titleOverride,
|
|
209146
|
-
averageFillDensity
|
|
209147
|
-
} = props2;
|
|
209148
|
-
const loaders = useLoaders();
|
|
209149
|
-
const setComponentHover = useSetComponentHover();
|
|
209150
|
-
const setComponentViewInfo = useSetComponentViewInfo(uuid);
|
|
209151
|
-
const [{ dataset, obsType, featureType, featureValueType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT], coordinationScopes);
|
|
209152
|
-
const observationsLabel = observationsLabelOverride || obsType;
|
|
209153
|
-
const [urls2, addUrl2] = useUrls(loaders, dataset);
|
|
209154
|
-
const [width2, height2, deckRef] = useDeckCanvasSize();
|
|
209155
|
-
const title2 = titleOverride || `Scatterplot (${mapping})`;
|
|
209156
|
-
const [obsLabelsTypes, obsLabelsData] = useMultiObsLabels(coordinationScopes, obsType, loaders, dataset, addUrl2);
|
|
209157
|
-
const [{ obsIndex: obsEmbeddingIndex, obsEmbedding }, obsEmbeddingStatus] = useObsEmbeddingData(loaders, dataset, addUrl2, true, {}, {}, { obsType, embeddingType: mapping });
|
|
209158
|
-
const cellsCount = (obsEmbeddingIndex == null ? void 0 : obsEmbeddingIndex.length) || 0;
|
|
209159
|
-
const [{ obsSets: cellSets, obsSetsMembership }, obsSetsStatus] = useObsSetsData(loaders, dataset, addUrl2, false, { setObsSetSelection: setCellSetSelection, setObsSetColor: setCellSetColor }, { obsSetSelection: cellSetSelection, obsSetColor: cellSetColor }, { obsType });
|
|
209160
|
-
const [expressionData, loadedFeatureSelection, featureSelectionStatus] = useFeatureSelection(loaders, dataset, false, geneSelection, { obsType, featureType, featureValueType });
|
|
209161
|
-
const [{ obsIndex: matrixObsIndex }, matrixIndicesStatus] = useObsFeatureMatrixIndices(loaders, dataset, addUrl2, false, { obsType, featureType, featureValueType });
|
|
209162
|
-
const isReady = useReady([
|
|
209163
|
-
obsEmbeddingStatus,
|
|
209164
|
-
obsSetsStatus,
|
|
209165
|
-
featureSelectionStatus,
|
|
209166
|
-
matrixIndicesStatus
|
|
209167
|
-
]);
|
|
209168
|
-
const [dynamicCellRadius, setDynamicCellRadius] = useState(cellRadiusFixed);
|
|
209169
|
-
const [dynamicCellOpacity, setDynamicCellOpacity] = useState(cellOpacityFixed);
|
|
209170
|
-
const mergedCellSets = useMemo(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
|
|
209171
|
-
const setCellSelectionProp = useCallback((v) => {
|
|
209172
|
-
setObsSelection(v, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding);
|
|
209173
|
-
}, [
|
|
209174
|
-
additionalCellSets,
|
|
209175
|
-
cellSetColor,
|
|
209176
|
-
setCellColorEncoding,
|
|
209177
|
-
setAdditionalCellSets,
|
|
209178
|
-
setCellSetColor,
|
|
209179
|
-
setCellSetSelection
|
|
209180
|
-
]);
|
|
209181
|
-
const cellColors = useMemo(() => getCellColors({
|
|
209182
|
-
cellColorEncoding,
|
|
209183
|
-
expressionData: expressionData && expressionData[0],
|
|
209184
|
-
geneSelection,
|
|
209185
|
-
cellSets: mergedCellSets,
|
|
209186
|
-
cellSetSelection,
|
|
209187
|
-
cellSetColor,
|
|
209188
|
-
obsIndex: matrixObsIndex,
|
|
209189
|
-
theme
|
|
209190
|
-
}), [
|
|
209191
|
-
cellColorEncoding,
|
|
209192
|
-
geneSelection,
|
|
209193
|
-
mergedCellSets,
|
|
209194
|
-
theme,
|
|
209195
|
-
cellSetSelection,
|
|
209196
|
-
cellSetColor,
|
|
209197
|
-
expressionData,
|
|
209198
|
-
matrixObsIndex
|
|
209199
|
-
]);
|
|
209200
|
-
const [cellSetPolygonCache, setCellSetPolygonCache] = useState([]);
|
|
209201
|
-
const cacheHas2 = (cache2, key2) => cache2.findIndex((el2) => isEqual_1(el2[0], key2)) !== -1;
|
|
209202
|
-
const cacheGet = (cache2, key2) => {
|
|
209203
|
-
var _a3;
|
|
209204
|
-
return (_a3 = cache2.find((el2) => isEqual_1(el2[0], key2))) == null ? void 0 : _a3[1];
|
|
209205
|
-
};
|
|
209206
|
-
const cellSetPolygons = useMemo(() => {
|
|
209207
|
-
var _a3;
|
|
209208
|
-
if ((cellSetLabelsVisible || cellSetPolygonsVisible) && !cacheHas2(cellSetPolygonCache, cellSetSelection) && ((_a3 = mergedCellSets == null ? void 0 : mergedCellSets.tree) == null ? void 0 : _a3.length) && obsEmbedding && obsEmbeddingIndex && (cellSetColor == null ? void 0 : cellSetColor.length)) {
|
|
209209
|
-
const newCellSetPolygons = getCellSetPolygons({
|
|
209210
|
-
obsIndex: obsEmbeddingIndex,
|
|
209211
|
-
obsEmbedding,
|
|
209212
|
-
cellSets: mergedCellSets,
|
|
209213
|
-
cellSetSelection,
|
|
209214
|
-
cellSetColor,
|
|
209215
|
-
theme
|
|
209216
|
-
});
|
|
209217
|
-
setCellSetPolygonCache((cache2) => [...cache2, [cellSetSelection, newCellSetPolygons]]);
|
|
209218
|
-
return newCellSetPolygons;
|
|
209219
|
-
}
|
|
209220
|
-
return cacheGet(cellSetPolygonCache, cellSetSelection) || [];
|
|
209221
|
-
}, [
|
|
209222
|
-
cellSetPolygonsVisible,
|
|
209223
|
-
cellSetPolygonCache,
|
|
209224
|
-
cellSetLabelsVisible,
|
|
209225
|
-
theme,
|
|
209226
|
-
obsEmbeddingIndex,
|
|
209227
|
-
obsEmbedding,
|
|
209228
|
-
mergedCellSets,
|
|
209229
|
-
cellSetSelection,
|
|
209230
|
-
cellSetColor
|
|
209231
|
-
]);
|
|
209232
|
-
const cellSelection = useMemo(() => Array.from(cellColors.keys()), [cellColors]);
|
|
209233
|
-
const [xRange, yRange, xExtent, yExtent, numCells] = useMemo(() => {
|
|
209234
|
-
if (obsEmbedding && obsEmbedding.data && obsEmbedding.shape) {
|
|
209235
|
-
const cellCount = obsEmbedding.shape[1];
|
|
209236
|
-
const xE = extent$2(obsEmbedding.data[0]);
|
|
209237
|
-
const yE = extent$2(obsEmbedding.data[1]);
|
|
209238
|
-
const xR = xE[1] - xE[0];
|
|
209239
|
-
const yR = yE[1] - yE[0];
|
|
209240
|
-
return [xR, yR, xE, yE, cellCount];
|
|
209241
|
-
}
|
|
209242
|
-
return [null, null, null, null, null];
|
|
209243
|
-
}, [obsEmbedding]);
|
|
209244
|
-
useEffect(() => {
|
|
209245
|
-
if (xRange && yRange) {
|
|
209246
|
-
const pointSizeDevicePixels = getPointSizeDevicePixels(window.devicePixelRatio, zoom2, xRange, yRange, width2, height2);
|
|
209247
|
-
setDynamicCellRadius(pointSizeDevicePixels);
|
|
209248
|
-
const nextCellOpacityScale = getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, averageFillDensity);
|
|
209249
|
-
setDynamicCellOpacity(nextCellOpacityScale);
|
|
209250
|
-
if (typeof targetX2 !== "number" || typeof targetY2 !== "number") {
|
|
209251
|
-
const newTargetX = xExtent[0] + xRange / 2;
|
|
209252
|
-
const newTargetY = yExtent[0] + yRange / 2;
|
|
209253
|
-
const newZoom = Math.log2(Math.min(width2 / xRange, height2 / yRange));
|
|
209254
|
-
setTargetX(newTargetX);
|
|
209255
|
-
setTargetY(-newTargetY);
|
|
209256
|
-
setZoom(newZoom);
|
|
209257
|
-
}
|
|
209258
|
-
}
|
|
209259
|
-
}, [
|
|
209260
|
-
xRange,
|
|
209261
|
-
yRange,
|
|
209262
|
-
xExtent,
|
|
209263
|
-
yExtent,
|
|
209264
|
-
numCells,
|
|
209265
|
-
width2,
|
|
209266
|
-
height2,
|
|
209267
|
-
zoom2,
|
|
209268
|
-
averageFillDensity
|
|
209269
|
-
]);
|
|
209270
|
-
const getObsInfo = useGetObsInfo(observationsLabel, obsLabelsTypes, obsLabelsData, obsSetsMembership);
|
|
209271
|
-
const cellSelectionSet = useMemo(() => new Set(cellSelection), [cellSelection]);
|
|
209272
|
-
const getCellIsSelected = useCallback((object2, { index: index2 }) => (cellSelectionSet || /* @__PURE__ */ new Set([])).has(obsEmbeddingIndex[index2]) ? 1 : 0, [cellSelectionSet, obsEmbeddingIndex]);
|
|
209273
|
-
const cellRadius = cellRadiusMode === "manual" ? cellRadiusFixed : dynamicCellRadius;
|
|
209274
|
-
const cellOpacity = cellOpacityMode === "manual" ? cellOpacityFixed : dynamicCellOpacity;
|
|
209275
|
-
const getExpressionValue = useExpressionValueGetter({
|
|
209276
|
-
instanceObsIndex: obsEmbeddingIndex,
|
|
209277
|
-
matrixObsIndex,
|
|
209278
|
-
expressionData
|
|
209279
|
-
});
|
|
209280
|
-
return jsxs(TitleInfo, { title: title2, info: `${commaNumber(cellsCount)} ${plur(observationsLabel, cellsCount)}`, removeGridComponent, urls: urls2, theme, isReady, options: jsx(ScatterplotOptions, { observationsLabel, cellRadius: cellRadiusFixed, setCellRadius: setCellRadiusFixed, cellRadiusMode, setCellRadiusMode, cellOpacity: cellOpacityFixed, setCellOpacity: setCellOpacityFixed, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange }), children: [jsx(ScatterplotWrapper, { ref: deckRef, uuid, theme, viewState: { zoom: zoom2, target: [targetX2, targetY2, targetZ] }, setViewState: ({ zoom: newZoom, target: target2 }) => {
|
|
209281
|
-
setZoom(newZoom);
|
|
209282
|
-
setTargetX(target2[0]);
|
|
209283
|
-
setTargetY(target2[1]);
|
|
209284
|
-
setTargetZ(target2[2] || 0);
|
|
209285
|
-
}, obsEmbeddingIndex, obsEmbedding, cellFilter, cellSelection, cellHighlight, cellColors, cellSetPolygons, cellSetLabelSize, cellSetLabelsVisible, cellSetPolygonsVisible, setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight, cellRadius, cellOpacity, cellColorEncoding, geneExpressionColormap, geneExpressionColormapRange, setComponentHover: () => {
|
|
209286
|
-
setComponentHover(uuid);
|
|
209287
|
-
}, updateViewInfo: setComponentViewInfo, getExpressionValue, getCellIsSelected }), !disableTooltip && jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo })] });
|
|
209288
|
-
}
|
|
209289
|
-
function register$c() {
|
|
209290
|
-
registerPluginViewType(ViewType$2.SCATTERPLOT, EmbeddingScatterplotSubscriber, COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT]);
|
|
209291
|
-
}
|
|
209292
|
-
function GatingScatterplotOptions(props2) {
|
|
209293
|
-
const { featureType, gatingFeatureSelectionX, setGatingFeatureSelectionX, gatingFeatureSelectionY, setGatingFeatureSelectionY, gatingFeatureValueTransform, setGatingFeatureValueTransform, gatingFeatureValueTransformCoefficient, setGatingFeatureValueTransformCoefficient, geneSelectOptions, transformOptions } = props2;
|
|
209294
|
-
const classes = useStyles$b();
|
|
209295
|
-
const handleGeneSelectChange = (event2) => {
|
|
209296
|
-
const { options } = event2.target;
|
|
209297
|
-
const newValues = [];
|
|
209298
|
-
for (let i2 = 0, l2 = options.length; i2 < l2; i2 += 1) {
|
|
209299
|
-
if (options[i2].selected) {
|
|
209300
|
-
newValues.push(options[i2].value);
|
|
209301
|
-
}
|
|
209302
|
-
}
|
|
209303
|
-
if (newValues.length === 1 && gatingFeatureSelectionX && !gatingFeatureSelectionY && newValues[0] !== gatingFeatureSelectionX) {
|
|
209304
|
-
setGatingFeatureSelectionY(newValues[0]);
|
|
209305
|
-
} else if (newValues.length <= 2) {
|
|
209306
|
-
setGatingFeatureSelectionX(newValues[0]);
|
|
209307
|
-
setGatingFeatureSelectionY(newValues[1]);
|
|
209308
|
-
}
|
|
209309
|
-
};
|
|
209310
|
-
const handleTransformChange = (event2) => {
|
|
209311
|
-
setGatingFeatureValueTransform(event2.target.value === "" ? null : event2.target.value);
|
|
209312
|
-
};
|
|
209313
|
-
const handleTransformCoefficientChange = (event2) => {
|
|
209314
|
-
const { value: value2 } = event2.target;
|
|
209315
|
-
if (!value2) {
|
|
209316
|
-
setGatingFeatureValueTransformCoefficient(value2);
|
|
209317
|
-
} else {
|
|
209318
|
-
const newCoefficient = Number(value2);
|
|
209319
|
-
if (!Number.isNaN(newCoefficient) && newCoefficient >= 0) {
|
|
209320
|
-
setGatingFeatureValueTransformCoefficient(value2);
|
|
209321
|
-
}
|
|
209322
|
-
}
|
|
209323
|
-
};
|
|
209324
|
-
return jsxs(Fragment, { children: [jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: capitalize$2(plur(featureType, geneSelectOptions == null ? void 0 : geneSelectOptions.length)) }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(OptionSelect, { multiple: true, className: classes.select, value: [gatingFeatureSelectionX, gatingFeatureSelectionY].filter((v) => v), onChange: handleGeneSelectChange, inputProps: {
|
|
209325
|
-
id: "scatterplot-gene-select"
|
|
209326
|
-
}, children: geneSelectOptions.map((name2) => jsx("option", { value: name2, children: name2 }, name2)) }, "gating-gene-select") })] }, "gene-option-row"), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: "Transform" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(OptionSelect, { className: classes.select, value: gatingFeatureValueTransform === null ? "" : gatingFeatureValueTransform, onChange: handleTransformChange, inputProps: {
|
|
209327
|
-
id: "scatterplot-transform-select"
|
|
209328
|
-
}, children: transformOptions.map((opt) => jsx("option", { value: opt.value === null ? "" : opt.value, children: opt.name }, opt.name)) }, "gating-transform-select") })] }, "transform-option-row"), jsxs(TableRow$1, { children: [jsx(TableCell$1, { className: classes.labelCell, children: "Transform Coefficient" }), jsx(TableCell$1, { className: classes.inputCell, children: jsx(TextField$1, { label: "Number", type: "number", onChange: handleTransformCoefficientChange, value: gatingFeatureValueTransformCoefficient, InputLabelProps: {
|
|
209329
|
-
shrink: true
|
|
209330
|
-
} }) })] }, "transform-coefficient-option-row")] });
|
|
209331
|
-
}
|
|
209332
|
-
function GatingSubscriber(props2) {
|
|
209333
|
-
const {
|
|
209334
|
-
uuid,
|
|
209335
|
-
coordinationScopes,
|
|
209336
|
-
removeGridComponent,
|
|
209337
|
-
theme,
|
|
209338
|
-
disableTooltip = false,
|
|
209339
|
-
title: titleOverride,
|
|
209340
|
-
averageFillDensity
|
|
209341
|
-
} = props2;
|
|
209342
|
-
const loaders = useLoaders();
|
|
209343
|
-
const setComponentHover = useSetComponentHover();
|
|
209344
|
-
const setComponentViewInfo = useSetComponentViewInfo(uuid);
|
|
209345
|
-
const [{ dataset, obsType, featureType, featureValueType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, obsFilter: cellFilter, obsHighlight: cellHighlight, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, featureSelection: gatingFeatureSelectionColor, featureValueTransform, featureValueTransformCoefficient, gatingFeatureSelectionX, gatingFeatureSelectionY }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setFeatureValueTransform, setFeatureValueTransformCoefficient, setGatingFeatureSelectionX, setGatingFeatureSelectionY }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.GATING], coordinationScopes);
|
|
209346
|
-
const [urls2, addUrl2] = useUrls(loaders, dataset);
|
|
209347
|
-
const [width2, height2, deckRef] = useDeckCanvasSize();
|
|
209348
|
-
const title2 = useMemo(() => {
|
|
209349
|
-
if (titleOverride) {
|
|
209350
|
-
return titleOverride;
|
|
209351
|
-
}
|
|
209352
|
-
if (!(gatingFeatureSelectionX && gatingFeatureSelectionY)) {
|
|
209353
|
-
return "Gating";
|
|
209354
|
-
}
|
|
209355
|
-
return `Gating (${gatingFeatureSelectionX} vs ${gatingFeatureSelectionY})`;
|
|
209356
|
-
}, [titleOverride, gatingFeatureSelectionX, gatingFeatureSelectionY]);
|
|
209357
|
-
const featureSelectionX = useMemo(() => gatingFeatureSelectionX ? [gatingFeatureSelectionX] : null, [gatingFeatureSelectionX]);
|
|
209358
|
-
const featureSelectionY = useMemo(() => gatingFeatureSelectionY ? [gatingFeatureSelectionY] : null, [gatingFeatureSelectionY]);
|
|
209359
|
-
const [{ obsSets: cellSets }, obsSetsStatus] = useObsSetsData(loaders, dataset, addUrl2, false, { setObsSetSelection: setCellSetSelection, setObsSetColor: setCellSetColor }, { obsSetSelection: cellSetSelection, obsSetColor: cellSetColor }, { obsType });
|
|
209360
|
-
const [expressionDataColor, loadedColor, featureSelectionColorStatus] = useFeatureSelection(loaders, dataset, false, gatingFeatureSelectionColor, { obsType, featureType, featureValueType });
|
|
209361
|
-
const [expressionDataX, loadedX, featureSelectionXStatus] = useFeatureSelection(loaders, dataset, false, featureSelectionX, { obsType, featureType, featureValueType });
|
|
209362
|
-
const [expressionDataY, loadedY, featureSelectionYStatus] = useFeatureSelection(loaders, dataset, false, featureSelectionY, { obsType, featureType, featureValueType });
|
|
209363
|
-
const [{ obsIndex, featureIndex }, matrixIndicesStatus] = useObsFeatureMatrixIndices(loaders, dataset, addUrl2, false, { obsType, featureType, featureValueType });
|
|
209364
|
-
const cellsCount = (obsIndex == null ? void 0 : obsIndex.length) || 0;
|
|
209365
|
-
const isReady = useReady([
|
|
209366
|
-
obsSetsStatus,
|
|
209367
|
-
featureSelectionColorStatus,
|
|
209368
|
-
featureSelectionXStatus,
|
|
209369
|
-
featureSelectionYStatus,
|
|
209370
|
-
matrixIndicesStatus
|
|
209371
|
-
]);
|
|
209372
|
-
const obsXY = useMemo(() => {
|
|
209373
|
-
if (!(cellsCount && (expressionDataX == null ? void 0 : expressionDataX[0]) && (expressionDataY == null ? void 0 : expressionDataY[0]) && featureSelectionX && featureSelectionY)) {
|
|
209374
|
-
return null;
|
|
209375
|
-
}
|
|
209376
|
-
let coefficient = 1;
|
|
209377
|
-
const parsedTransformCoefficient = Number(featureValueTransformCoefficient);
|
|
209378
|
-
if (!Number.isNaN(parsedTransformCoefficient) && parsedTransformCoefficient > 0) {
|
|
209379
|
-
coefficient = parsedTransformCoefficient;
|
|
209380
|
-
}
|
|
209381
|
-
const transformFunction = getValueTransformFunction(featureValueTransform, coefficient);
|
|
209382
|
-
const obsX = new Float32Array(cellsCount);
|
|
209383
|
-
const obsY = new Float32Array(cellsCount);
|
|
209384
|
-
for (let i2 = 0; i2 < cellsCount; i2 += 1) {
|
|
209385
|
-
obsX[i2] = transformFunction(expressionDataX[0][i2]);
|
|
209386
|
-
obsY[i2] = transformFunction(expressionDataY[0][i2]);
|
|
209387
|
-
}
|
|
209388
|
-
return {
|
|
209389
|
-
data: [obsX, obsY],
|
|
209390
|
-
shape: [2, cellsCount]
|
|
209391
|
-
};
|
|
209392
|
-
}, [
|
|
209393
|
-
cellsCount,
|
|
209394
|
-
expressionDataX,
|
|
209395
|
-
expressionDataY,
|
|
209396
|
-
featureValueTransform,
|
|
209397
|
-
featureValueTransformCoefficient,
|
|
209398
|
-
featureSelectionX,
|
|
209399
|
-
featureSelectionY
|
|
209400
|
-
]);
|
|
209401
|
-
const [dynamicCellRadius, setDynamicCellRadius] = useState(cellRadiusFixed);
|
|
209402
|
-
const [dynamicCellOpacity, setDynamicCellOpacity] = useState(cellOpacityFixed);
|
|
209403
|
-
const mergedCellSets = useMemo(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
|
|
209404
|
-
const setCellSelectionProp = useCallback((v) => {
|
|
209405
|
-
setObsSelection(v, additionalCellSets, cellSetColor, setCellSetSelection, setAdditionalCellSets, setCellSetColor, setCellColorEncoding);
|
|
209406
|
-
}, [
|
|
209407
|
-
additionalCellSets,
|
|
209408
|
-
cellSetColor,
|
|
209409
|
-
setCellColorEncoding,
|
|
209410
|
-
setAdditionalCellSets,
|
|
209411
|
-
setCellSetColor,
|
|
209412
|
-
setCellSetSelection
|
|
209413
|
-
]);
|
|
209414
|
-
const cellColors = useMemo(() => getCellColors({
|
|
209415
|
-
cellColorEncoding,
|
|
209416
|
-
expressionData: expressionDataColor && expressionDataColor[0],
|
|
209417
|
-
geneSelection: gatingFeatureSelectionColor,
|
|
209418
|
-
cellSets: mergedCellSets,
|
|
209419
|
-
cellSetSelection,
|
|
209420
|
-
cellSetColor,
|
|
209421
|
-
obsIndex,
|
|
209422
|
-
theme
|
|
209423
|
-
}), [
|
|
209424
|
-
cellColorEncoding,
|
|
209425
|
-
gatingFeatureSelectionColor,
|
|
209426
|
-
mergedCellSets,
|
|
209427
|
-
theme,
|
|
209428
|
-
cellSetSelection,
|
|
209429
|
-
cellSetColor,
|
|
209430
|
-
expressionDataColor,
|
|
209431
|
-
obsIndex
|
|
209432
|
-
]);
|
|
209433
|
-
const [cellSetPolygonCache, setCellSetPolygonCache] = useState([]);
|
|
209434
|
-
const cacheHas2 = (cache2, key2) => cache2.findIndex((el2) => isEqual_1(el2[0], key2)) !== -1;
|
|
209435
|
-
const cacheGet = (cache2, key2) => {
|
|
209436
|
-
var _a3;
|
|
209437
|
-
return (_a3 = cache2.find((el2) => isEqual_1(el2[0], key2))) == null ? void 0 : _a3[1];
|
|
209438
|
-
};
|
|
209439
|
-
const cellSetPolygons = useMemo(() => {
|
|
209440
|
-
var _a3;
|
|
209441
|
-
if ((cellSetLabelsVisible || cellSetPolygonsVisible) && !cacheHas2(cellSetPolygonCache, cellSetSelection) && ((_a3 = mergedCellSets == null ? void 0 : mergedCellSets.tree) == null ? void 0 : _a3.length) && obsXY && obsIndex && (cellSetColor == null ? void 0 : cellSetColor.length)) {
|
|
209442
|
-
const newCellSetPolygons = getCellSetPolygons({
|
|
209443
|
-
obsIndex,
|
|
209444
|
-
obsEmbedding: obsXY,
|
|
209445
|
-
cellSets: mergedCellSets,
|
|
209446
|
-
cellSetSelection,
|
|
209447
|
-
cellSetColor,
|
|
209448
|
-
theme
|
|
209449
|
-
});
|
|
209450
|
-
setCellSetPolygonCache((cache2) => [...cache2, [cellSetSelection, newCellSetPolygons]]);
|
|
209451
|
-
return newCellSetPolygons;
|
|
209452
|
-
}
|
|
209453
|
-
return cacheGet(cellSetPolygonCache, cellSetSelection) || [];
|
|
209454
|
-
}, [
|
|
209455
|
-
cellSetPolygonsVisible,
|
|
209456
|
-
cellSetPolygonCache,
|
|
209457
|
-
cellSetLabelsVisible,
|
|
209458
|
-
theme,
|
|
209459
|
-
obsIndex,
|
|
209460
|
-
obsXY,
|
|
209461
|
-
mergedCellSets,
|
|
209462
|
-
cellSetSelection,
|
|
209463
|
-
cellSetColor
|
|
209464
|
-
]);
|
|
209465
|
-
const cellSelection = useMemo(() => Array.from(cellColors.keys()), [cellColors]);
|
|
209466
|
-
const [xRange, yRange, xExtent, yExtent, numCells] = useMemo(() => {
|
|
209467
|
-
if (obsXY && obsXY.data && obsXY.shape) {
|
|
209468
|
-
const cellCount = obsXY.shape[1];
|
|
209469
|
-
const xE = extent$2(obsXY.data[0]);
|
|
209470
|
-
const yE = extent$2(obsXY.data[1]);
|
|
209471
|
-
const xR = xE[1] - xE[0];
|
|
209472
|
-
const yR = yE[1] - yE[0];
|
|
209473
|
-
return [xR, yR, xE, yE, cellCount];
|
|
209474
|
-
}
|
|
209475
|
-
return [null, null, null, null, null];
|
|
209476
|
-
}, [obsXY]);
|
|
209477
|
-
useEffect(() => {
|
|
209478
|
-
if (xRange && yRange) {
|
|
209479
|
-
const pointSizeDevicePixels = getPointSizeDevicePixels(window.devicePixelRatio, zoom2, xRange, yRange, width2, height2);
|
|
209480
|
-
setDynamicCellRadius(pointSizeDevicePixels);
|
|
209481
|
-
const nextCellOpacityScale = getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, averageFillDensity);
|
|
209482
|
-
setDynamicCellOpacity(nextCellOpacityScale);
|
|
209483
|
-
if (typeof targetX2 !== "number" || typeof targetY2 !== "number") {
|
|
209484
|
-
const newTargetX = xExtent[0] + xRange / 2;
|
|
209485
|
-
const newTargetY = yExtent[0] + yRange / 2;
|
|
209486
|
-
const newZoom = Math.log2(Math.min(width2 / xRange, height2 / yRange));
|
|
209487
|
-
setTargetX(newTargetX);
|
|
209488
|
-
setTargetY(-newTargetY);
|
|
209489
|
-
setZoom(newZoom);
|
|
209490
|
-
}
|
|
209491
|
-
}
|
|
209492
|
-
}, [
|
|
209493
|
-
xRange,
|
|
209494
|
-
yRange,
|
|
209495
|
-
xExtent,
|
|
209496
|
-
yExtent,
|
|
209497
|
-
numCells,
|
|
209498
|
-
width2,
|
|
209499
|
-
height2,
|
|
209500
|
-
zoom2,
|
|
209501
|
-
averageFillDensity
|
|
209502
|
-
]);
|
|
209503
|
-
const cellSelectionSet = useMemo(() => new Set(cellSelection), [cellSelection]);
|
|
209504
|
-
const getCellIsSelected = useCallback((object2, { index: index2 }) => (cellSelectionSet || /* @__PURE__ */ new Set([])).has(obsIndex[index2]) ? 1 : 0, [cellSelectionSet, obsIndex]);
|
|
209505
|
-
const cellRadius = cellRadiusMode === "manual" ? cellRadiusFixed : dynamicCellRadius;
|
|
209506
|
-
const cellOpacity = cellOpacityMode === "manual" ? cellOpacityFixed : dynamicCellOpacity;
|
|
209507
|
-
const getExpressionValue = useExpressionValueGetter({
|
|
209508
|
-
instanceObsIndex: obsIndex,
|
|
209509
|
-
matrixObsIndex: obsIndex,
|
|
209510
|
-
expressionData: expressionDataColor
|
|
209511
|
-
});
|
|
209512
|
-
const getObsInfo = useCallback((obsId) => {
|
|
209513
|
-
var _a3;
|
|
209514
|
-
const selectedTransformName = (_a3 = VALUE_TRANSFORM_OPTIONS.find((o2) => o2.value === featureValueTransform)) == null ? void 0 : _a3.name;
|
|
209515
|
-
const genePrefix = featureValueTransform ? `${selectedTransformName} ` : "";
|
|
209516
|
-
const obsIdx = obsIndex == null ? void 0 : obsIndex.indexOf(obsId);
|
|
209517
|
-
const obsInfo = { [`${capitalize$2(obsType)} ID`]: obsId };
|
|
209518
|
-
if (gatingFeatureSelectionX && gatingFeatureSelectionY) {
|
|
209519
|
-
obsInfo[genePrefix + gatingFeatureSelectionX] = obsXY.data[0][obsIdx];
|
|
209520
|
-
obsInfo[genePrefix + gatingFeatureSelectionY] = obsXY.data[1][obsIdx];
|
|
209521
|
-
}
|
|
209522
|
-
return obsInfo;
|
|
209523
|
-
}, [
|
|
209524
|
-
obsXY,
|
|
209525
|
-
obsIndex,
|
|
209526
|
-
featureValueTransform,
|
|
209527
|
-
gatingFeatureSelectionX,
|
|
209528
|
-
gatingFeatureSelectionY,
|
|
209529
|
-
obsType
|
|
209530
|
-
]);
|
|
209531
|
-
return jsxs(TitleInfo, { title: title2, info: `${commaNumber(cellsCount)} ${plur(obsType, cellsCount)}`, removeGridComponent, urls: urls2, theme, isReady, options: jsx(ScatterplotOptions, { observationsLabel: obsType, cellRadius: cellRadiusFixed, setCellRadius: setCellRadiusFixed, cellRadiusMode, setCellRadiusMode, cellOpacity: cellOpacityFixed, setCellOpacity: setCellOpacityFixed, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange, children: jsx(GatingScatterplotOptions, { featureType, gatingFeatureSelectionX, setGatingFeatureSelectionX, gatingFeatureSelectionY, setGatingFeatureSelectionY, gatingFeatureValueTransform: featureValueTransform, setGatingFeatureValueTransform: (newValue) => {
|
|
209532
|
-
setFeatureValueTransform(newValue);
|
|
209533
|
-
setTargetX(null);
|
|
209534
|
-
setTargetY(null);
|
|
209535
|
-
setZoom(null);
|
|
209536
|
-
}, gatingFeatureValueTransformCoefficient: featureValueTransformCoefficient, setGatingFeatureValueTransformCoefficient: setFeatureValueTransformCoefficient, geneSelectOptions: featureIndex, transformOptions: VALUE_TRANSFORM_OPTIONS }) }), children: [jsx(EmptyMessage, { visible: !(gatingFeatureSelectionX && gatingFeatureSelectionY), message: `Select two ${plur(featureType, 2)} in the plot settings.` }), jsx(ScatterplotWrapper, { ref: deckRef, uuid, theme, hideTools: !(gatingFeatureSelectionX && gatingFeatureSelectionY), viewState: { zoom: zoom2, target: [targetX2, targetY2, targetZ] }, setViewState: ({ zoom: newZoom, target: target2 }) => {
|
|
209537
|
-
setZoom(newZoom);
|
|
209538
|
-
setTargetX(target2[0]);
|
|
209539
|
-
setTargetY(target2[1]);
|
|
209540
|
-
setTargetZ(target2[2] || 0);
|
|
209541
|
-
}, obsEmbeddingIndex: obsIndex, obsEmbedding: obsXY, cellFilter, cellSelection, cellHighlight, cellColors, cellSetPolygons, cellSetLabelSize, cellSetLabelsVisible, cellSetPolygonsVisible, setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight, cellRadius, cellOpacity, cellColorEncoding, geneExpressionColormap, geneExpressionColormapRange, setComponentHover: () => {
|
|
209542
|
-
setComponentHover(uuid);
|
|
209543
|
-
}, updateViewInfo: setComponentViewInfo, getExpressionValue, getCellIsSelected }), !disableTooltip && jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo })] });
|
|
209544
|
-
}
|
|
209545
|
-
function register$b() {
|
|
209546
|
-
registerPluginViewType(ViewType$2.GATING, GatingSubscriber, COMPONENT_COORDINATION_TYPES[ViewType$2.GATING]);
|
|
209547
|
-
}
|
|
209548
209567
|
var shortNumber$1 = { exports: {} };
|
|
209549
209568
|
(function(module2, exports) {
|
|
209550
209569
|
(function(global2, factory2) {
|
|
@@ -209967,7 +209986,8 @@ class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
209967
209986
|
ySlice: layerDef.ySlice,
|
|
209968
209987
|
zSlice: layerDef.zSlice,
|
|
209969
209988
|
callback: layerDef.callback,
|
|
209970
|
-
visibilities: layerDef.channels.map((c2) => !layerDef.visible && typeof layerDef.visible === "boolean" ? false : c2.visible)
|
|
209989
|
+
visibilities: layerDef.channels.map((c2) => !layerDef.visible && typeof layerDef.visible === "boolean" ? false : c2.visible),
|
|
209990
|
+
excludeBackground: useTransparentColor
|
|
209971
209991
|
};
|
|
209972
209992
|
if (!loader2 || !layerProps)
|
|
209973
209993
|
return null;
|
|
@@ -210023,6 +210043,7 @@ class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
210023
210043
|
ySlice: layerProps.ySlice,
|
|
210024
210044
|
zSlice: layerProps.zSlice,
|
|
210025
210045
|
onViewportLoad: layerProps.callback,
|
|
210046
|
+
excludeBackground: layerProps.excludeBackground,
|
|
210026
210047
|
extensions
|
|
210027
210048
|
});
|
|
210028
210049
|
}
|