@vitessce/statistical-plots 3.6.10 → 3.6.11

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.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { B as BaseDecoder } from "./index-Dhdy8_KV.js";
2
+ import { B as BaseDecoder } from "./index-CIqXsmFh.js";
3
3
  class DeflateDecoder extends BaseDecoder {
4
4
  decodeBlock(buffer) {
5
5
  return inflate_1(new Uint8Array(buffer)).buffer;
@@ -177630,7 +177630,8 @@ const PIXELATED_TEXTURE_PARAMETERS = {
177630
177630
  const GLSL_COLORMAPS = [
177631
177631
  "plasma",
177632
177632
  "viridis",
177633
- "jet"
177633
+ "jet",
177634
+ "greys"
177634
177635
  ];
177635
177636
  const GLSL_COLORMAP_DEFAULT = "plasma";
177636
177637
  const COLORMAP_SHADER_PLACEHOLDER = "COLORMAP_FUNC";
@@ -178719,22 +178720,22 @@ function addDecoder(cases2, importFn) {
178719
178720
  }
178720
178721
  cases2.forEach((c2) => registry$1.set(c2, importFn));
178721
178722
  }
178722
- addDecoder([void 0, 1], () => import("./raw-TJbs5T8I.js").then((m2) => m2.default));
178723
- addDecoder(5, () => import("./lzw--6K-CH9V.js").then((m2) => m2.default));
178723
+ addDecoder([void 0, 1], () => import("./raw-BMmSKVDS.js").then((m2) => m2.default));
178724
+ addDecoder(5, () => import("./lzw-DdkwQP4Y.js").then((m2) => m2.default));
178724
178725
  addDecoder(6, () => {
178725
178726
  throw new Error("old style JPEG compression is not supported.");
178726
178727
  });
178727
- addDecoder(7, () => import("./jpeg-BAsU3Uj1.js").then((m2) => m2.default));
178728
- addDecoder([8, 32946], () => import("./deflate-DFg7j2aM.js").then((m2) => m2.default));
178729
- addDecoder(32773, () => import("./packbits-DIcMoiDr.js").then((m2) => m2.default));
178728
+ addDecoder(7, () => import("./jpeg-B_rzx3DO.js").then((m2) => m2.default));
178729
+ addDecoder([8, 32946], () => import("./deflate-Dm0PZc2F.js").then((m2) => m2.default));
178730
+ addDecoder(32773, () => import("./packbits-kigCEjo4.js").then((m2) => m2.default));
178730
178731
  addDecoder(
178731
178732
  34887,
178732
- () => import("./lerc-Bs40GmLw.js").then(async (m2) => {
178733
+ () => import("./lerc-DtYkE7gf.js").then(async (m2) => {
178733
178734
  await m2.zstd.init();
178734
178735
  return m2;
178735
178736
  }).then((m2) => m2.default)
178736
178737
  );
178737
- addDecoder(50001, () => import("./webimage-DcmYEYr-.js").then((m2) => m2.default));
178738
+ addDecoder(50001, () => import("./webimage-Ba4jGxpB.js").then((m2) => m2.default));
178738
178739
  function decodeRowAcc(row, stride) {
178739
178740
  let length2 = row.length - stride;
178740
178741
  let offset2 = 0;
@@ -250177,10 +250178,10 @@ function DotPlot(props) {
250177
250178
  featureType,
250178
250179
  featureValueType,
250179
250180
  featureValueTransformName,
250180
- // TODO: re-enable featureValueColormap coordination
250181
- // featureValueColormap,
250181
+ featureValueColormap,
250182
250182
  obsSetSelection,
250183
- obsSetColor
250183
+ obsSetColor,
250184
+ onDotSelect
250184
250185
  } = props;
250185
250186
  const vegaContainerRef = useRef();
250186
250187
  const data2 = rawData.map((d) => ({
@@ -250219,6 +250220,26 @@ function DotPlot(props) {
250219
250220
  // Reference: https://vega.github.io/vega-lite/docs/mark.html
250220
250221
  opacity: 1
250221
250222
  },
250223
+ params: [
250224
+ {
250225
+ name: "dot_select",
250226
+ select: {
250227
+ type: "point",
250228
+ on: "click[event.shiftKey === false]",
250229
+ fields: ["feature"],
250230
+ empty: "none"
250231
+ }
250232
+ },
250233
+ {
250234
+ name: "shift_dot_select",
250235
+ select: {
250236
+ type: "point",
250237
+ on: "click[event.shiftKey]",
250238
+ fields: ["feature"],
250239
+ empty: "none"
250240
+ }
250241
+ }
250242
+ ],
250222
250243
  encoding: {
250223
250244
  [transpose2 ? "y" : "x"]: {
250224
250245
  field: "keyFeature",
@@ -250240,8 +250261,7 @@ function DotPlot(props) {
250240
250261
  type: "quantitative",
250241
250262
  title: meanTransform,
250242
250263
  scale: {
250243
- // scheme: featureValueColormap,
250244
- scheme: "greys"
250264
+ scheme: featureValueColormap
250245
250265
  },
250246
250266
  legend: {
250247
250267
  direction: "horizontal",
@@ -250283,6 +250303,14 @@ function DotPlot(props) {
250283
250303
  } : {}
250284
250304
  }
250285
250305
  };
250306
+ const handleSignal = (name2, value2) => {
250307
+ if (name2 === "dot_select") {
250308
+ onDotSelect(value2.feature);
250309
+ } else if (name2 === "shift_dot_select") {
250310
+ onDotSelect(value2.feature, true);
250311
+ }
250312
+ };
250313
+ const signalListeners = { dot_select: handleSignal, shift_dot_select: handleSignal };
250286
250314
  const getTooltipText = useCallback((item) => ({
250287
250315
  [`${capitalize$3(featureType)}`]: item.datum.feature,
250288
250316
  [`${capitalize$3(obsType)} Set`]: item.datum.group,
@@ -250317,6 +250345,7 @@ function DotPlot(props) {
250317
250345
  data: data2,
250318
250346
  spec,
250319
250347
  onNewView,
250348
+ signalListeners,
250320
250349
  getTooltipText,
250321
250350
  renderer: "svg"
250322
250351
  }
@@ -250421,12 +250450,15 @@ function DotPlotSubscriber(props) {
250421
250450
  obsSetColor: cellSetColor,
250422
250451
  additionalObsSets: additionalCellSets,
250423
250452
  sampleType,
250424
- sampleSetSelection
250453
+ sampleSetSelection,
250454
+ // eslint-disable-next-line no-unused-vars
250455
+ featureAggregationStrategy
250425
250456
  }, {
250426
250457
  setFeatureValueTransform,
250427
250458
  setFeatureValueTransformCoefficient,
250428
250459
  setFeatureValuePositivityThreshold: setPosThreshold,
250429
- setFeatureValueColormap
250460
+ setFeatureValueColormap,
250461
+ setFeatureAggregationStrategy
250430
250462
  }] = useCoordination(
250431
250463
  COMPONENT_COORDINATION_TYPES[ViewType$1.DOT_PLOT],
250432
250464
  coordinationScopes
@@ -250552,6 +250584,12 @@ function DotPlotSubscriber(props) {
250552
250584
  const selectedTransformName = (_a3 = transformOptions.find(
250553
250585
  (o2) => o2.value === featureValueTransform
250554
250586
  )) == null ? void 0 : _a3.name;
250587
+ const onDotSelect = useCallback((featureName, isShiftDown = false) => {
250588
+ const featureI = geneSelection.indexOf(featureName == null ? void 0 : featureName[0]);
250589
+ if (featureI >= 0) {
250590
+ setFeatureAggregationStrategy(featureI);
250591
+ }
250592
+ }, [setFeatureAggregationStrategy, geneSelection]);
250555
250593
  return /* @__PURE__ */ React__default.createElement(
250556
250594
  TitleInfo,
250557
250595
  {
@@ -250594,7 +250632,8 @@ function DotPlotSubscriber(props) {
250594
250632
  featureValueTransformName: selectedTransformName,
250595
250633
  featureValueColormap,
250596
250634
  obsSetSelection: cellSetSelection,
250597
- obsSetColor: cellSetColor
250635
+ obsSetColor: cellSetColor,
250636
+ onDotSelect
250598
250637
  }
250599
250638
  ) : /* @__PURE__ */ React__default.createElement("span", null, "Select at least one ", featureType, "."))
250600
250639
  );
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b, f, C, e, a, i, D, h, E, F, c, d, T, V } from "./index-Dhdy8_KV.js";
1
+ import { b, f, C, e, a, i, D, h, E, F, c, d, T, V } from "./index-CIqXsmFh.js";
2
2
  export {
3
3
  b as CellSetCompositionBarPlotSubscriber,
4
4
  f as CellSetExpressionPlot,
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Dhdy8_KV.js";
1
+ import { B as BaseDecoder } from "./index-CIqXsmFh.js";
2
2
  const dctZigZag = new Int32Array([
3
3
  0,
4
4
  1,
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-SxljTded.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-Dhdy8_KV.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-CIqXsmFh.js";
3
3
  const LercParameters = {
4
4
  AddCompression: 1
5
5
  };
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Dhdy8_KV.js";
1
+ import { B as BaseDecoder } from "./index-CIqXsmFh.js";
2
2
  const MIN_BITS = 9;
3
3
  const CLEAR_CODE = 256;
4
4
  const EOI_CODE = 257;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Dhdy8_KV.js";
1
+ import { B as BaseDecoder } from "./index-CIqXsmFh.js";
2
2
  class PackbitsDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  const dataView = new DataView(buffer);
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Dhdy8_KV.js";
1
+ import { B as BaseDecoder } from "./index-CIqXsmFh.js";
2
2
  class RawDecoder extends BaseDecoder {
3
3
  decodeBlock(buffer) {
4
4
  return buffer;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-Dhdy8_KV.js";
1
+ import { B as BaseDecoder } from "./index-CIqXsmFh.js";
2
2
  class WebImageDecoder extends BaseDecoder {
3
3
  constructor() {
4
4
  super();
@@ -1 +1 @@
1
- {"version":3,"file":"DotPlot.d.ts","sourceRoot":"","sources":["../src/DotPlot.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;GAiBG;AACH,uCAdG;IAAwB,IAAI,EAApB,MAAM,EAAE;IAEM,KAAK,EAAnB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,MAAM,EAApB,MAAM;IACQ,WAAW,EAAzB,MAAM;IAGQ,YAAY,EAA1B,MAAM;IAGa,yBAAyB,EAA5C,MAAM,GAAC,IAAI;CAErB,eA4NA"}
1
+ {"version":3,"file":"DotPlot.d.ts","sourceRoot":"","sources":["../src/DotPlot.js"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;;GAiBG;AACH,uCAdG;IAAwB,IAAI,EAApB,MAAM,EAAE;IAEM,KAAK,EAAnB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,MAAM,EAApB,MAAM;IACQ,WAAW,EAAzB,MAAM;IAGQ,YAAY,EAA1B,MAAM;IAGa,yBAAyB,EAA5C,MAAM,GAAC,IAAI;CAErB,eAyPA"}
@@ -24,10 +24,7 @@ import { getColorScale } from './utils.js';
24
24
  * for the feature value transformation function.
25
25
  */
26
26
  export default function DotPlot(props) {
27
- const { isStratified, transpose, data: rawData, theme, width, height, marginRight, marginBottom, obsType, sampleType, keyLength = 36, featureType, featureValueType, featureValueTransformName,
28
- // TODO: re-enable featureValueColormap coordination
29
- // featureValueColormap,
30
- obsSetSelection, obsSetColor, } = props;
27
+ const { isStratified, transpose, data: rawData, theme, width, height, marginRight, marginBottom, obsType, sampleType, keyLength = 36, featureType, featureValueType, featureValueTransformName, featureValueColormap, obsSetSelection, obsSetColor, onDotSelect, } = props;
31
28
  const vegaContainerRef = useRef();
32
29
  // Add a property `keyGroup` and `keyFeature` which concatenates the key and the name,
33
30
  // which is both unique and can easily be converted
@@ -87,6 +84,26 @@ export default function DotPlot(props) {
87
84
  // Reference: https://vega.github.io/vega-lite/docs/mark.html
88
85
  opacity: 1.0,
89
86
  },
87
+ params: [
88
+ {
89
+ name: 'dot_select',
90
+ select: {
91
+ type: 'point',
92
+ on: 'click[event.shiftKey === false]',
93
+ fields: ['feature'],
94
+ empty: 'none',
95
+ },
96
+ },
97
+ {
98
+ name: 'shift_dot_select',
99
+ select: {
100
+ type: 'point',
101
+ on: 'click[event.shiftKey]',
102
+ fields: ['feature'],
103
+ empty: 'none',
104
+ },
105
+ },
106
+ ],
90
107
  encoding: {
91
108
  [(transpose ? 'y' : 'x')]: {
92
109
  field: 'keyFeature',
@@ -110,8 +127,7 @@ export default function DotPlot(props) {
110
127
  type: 'quantitative',
111
128
  title: meanTransform,
112
129
  scale: {
113
- // scheme: featureValueColormap,
114
- scheme: 'greys',
130
+ scheme: featureValueColormap,
115
131
  },
116
132
  legend: {
117
133
  direction: 'horizontal',
@@ -152,6 +168,15 @@ export default function DotPlot(props) {
152
168
  } : {}),
153
169
  },
154
170
  };
171
+ const handleSignal = (name, value) => {
172
+ if (name === 'dot_select') {
173
+ onDotSelect(value.feature);
174
+ }
175
+ else if (name === 'shift_dot_select') {
176
+ onDotSelect(value.feature, true);
177
+ }
178
+ };
179
+ const signalListeners = { dot_select: handleSignal, shift_dot_select: handleSignal };
155
180
  const getTooltipText = useCallback(item => ({
156
181
  [`${capitalize(featureType)}`]: item.datum.feature,
157
182
  [`${capitalize(obsType)} Set`]: item.datum.group,
@@ -193,5 +218,5 @@ export default function DotPlot(props) {
193
218
  useEffect(() => {
194
219
  setVegaRenderIncrement(prev => prev + 1);
195
220
  }, [rawData]);
196
- return (_jsx("div", { ref: vegaContainerRef, children: _jsx(VegaPlot, { data: data, spec: spec, onNewView: onNewView, getTooltipText: getTooltipText, renderer: "svg" }) }));
221
+ return (_jsx("div", { ref: vegaContainerRef, children: _jsx(VegaPlot, { data: data, spec: spec, onNewView: onNewView, signalListeners: signalListeners, getTooltipText: getTooltipText, renderer: "svg" }) }));
197
222
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DotPlotSubscriber.d.ts","sourceRoot":"","sources":["../src/DotPlotSubscriber.js"],"names":[],"mappings":"AAmBA;;;;;;;GAOG;AACH,yCALG;IAAwB,mBAAmB;IACrB,kBAAkB,EAAhC,MAAM;IAEQ,KAAK,EAAnB,MAAM;CAChB,eA6KA"}
1
+ {"version":3,"file":"DotPlotSubscriber.d.ts","sourceRoot":"","sources":["../src/DotPlotSubscriber.js"],"names":[],"mappings":"AAmBA;;;;;;;GAOG;AACH,yCALG;IAAwB,mBAAmB;IACrB,kBAAkB,EAAhC,MAAM;IAEQ,KAAK,EAAnB,MAAM;CAChB,eA2LA"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
2
+ import React, { useCallback } from 'react';
3
3
  import { TitleInfo, useCoordination, useLoaders, useUrls, useReady, useGridItemSize, useFeatureSelection, useObsSetsData, useObsFeatureMatrixIndices, useFeatureLabelsData, useSampleSetsData, useSampleEdgesData, } from '@vitessce/vit-s';
4
4
  import { ViewType, COMPONENT_COORDINATION_TYPES, ViewHelpMapping } from '@vitessce/constants-internal';
5
5
  import { VALUE_TRANSFORM_OPTIONS } from '@vitessce/utils';
@@ -20,7 +20,9 @@ export function DotPlotSubscriber(props) {
20
20
  const { classes } = useStyles();
21
21
  const loaders = useLoaders();
22
22
  // Get "props" from the coordination space.
23
- const [{ dataset, obsType, featureType, featureValueType, featureSelection: geneSelection, featureValueTransform, featureValueTransformCoefficient, featureValuePositivityThreshold: posThreshold, featureValueColormap, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, additionalObsSets: additionalCellSets, sampleType, sampleSetSelection, }, { setFeatureValueTransform, setFeatureValueTransformCoefficient, setFeatureValuePositivityThreshold: setPosThreshold, setFeatureValueColormap, }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.DOT_PLOT], coordinationScopes);
23
+ const [{ dataset, obsType, featureType, featureValueType, featureSelection: geneSelection, featureValueTransform, featureValueTransformCoefficient, featureValuePositivityThreshold: posThreshold, featureValueColormap, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, additionalObsSets: additionalCellSets, sampleType, sampleSetSelection,
24
+ // eslint-disable-next-line no-unused-vars
25
+ featureAggregationStrategy, }, { setFeatureValueTransform, setFeatureValueTransformCoefficient, setFeatureValuePositivityThreshold: setPosThreshold, setFeatureValueColormap, setFeatureAggregationStrategy, }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType.DOT_PLOT], coordinationScopes);
24
26
  const [width, height, containerRef] = useGridItemSize();
25
27
  const transformOptions = VALUE_TRANSFORM_OPTIONS;
26
28
  const isStratified = Array.isArray(sampleSetSelection) && sampleSetSelection.length > 1;
@@ -60,5 +62,14 @@ export function DotPlotSubscriber(props) {
60
62
  ]);
61
63
  const [resultArr, meanExpressionMax] = useExpressionSummaries(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, posThreshold, featureLabelsMap);
62
64
  const selectedTransformName = transformOptions.find(o => o.value === featureValueTransform)?.name;
63
- return (_jsx(TitleInfo, { title: title, removeGridComponent: removeGridComponent, urls: urls, theme: theme, isReady: isReady, helpText: helpText, errors: errors, options: (_jsx(CellSetExpressionPlotOptions, { featureValueTransform: featureValueTransform, setFeatureValueTransform: setFeatureValueTransform, featureValueTransformCoefficient: featureValueTransformCoefficient, setFeatureValueTransformCoefficient: setFeatureValueTransformCoefficient, transformOptions: transformOptions, featureValuePositivityThreshold: posThreshold, setFeatureValuePositivityThreshold: setPosThreshold, featureValueColormap: featureValueColormap, setFeatureValueColormap: setFeatureValueColormap })), children: _jsx("div", { ref: containerRef, className: classes.vegaContainer, children: resultArr ? (_jsx(DotPlot, { isStratified: isStratified, transpose: transpose, domainMax: meanExpressionMax, data: resultArr, theme: theme, width: width, height: height, obsType: obsType, sampleType: sampleType, featureType: featureType, featureValueType: featureValueType, featureValueTransformName: selectedTransformName, featureValueColormap: featureValueColormap, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor })) : (_jsxs("span", { children: ["Select at least one ", featureType, "."] })) }) }));
65
+ // eslint-disable-next-line no-unused-vars
66
+ const onDotSelect = useCallback((featureName, isShiftDown = false) => {
67
+ // TODO: Implement different behavior when isShiftDown
68
+ // / (featureName array will need to be aggregated)
69
+ const featureI = geneSelection.indexOf(featureName?.[0]);
70
+ if (featureI >= 0) {
71
+ setFeatureAggregationStrategy(featureI);
72
+ }
73
+ }, [setFeatureAggregationStrategy, geneSelection]);
74
+ return (_jsx(TitleInfo, { title: title, removeGridComponent: removeGridComponent, urls: urls, theme: theme, isReady: isReady, helpText: helpText, errors: errors, options: (_jsx(CellSetExpressionPlotOptions, { featureValueTransform: featureValueTransform, setFeatureValueTransform: setFeatureValueTransform, featureValueTransformCoefficient: featureValueTransformCoefficient, setFeatureValueTransformCoefficient: setFeatureValueTransformCoefficient, transformOptions: transformOptions, featureValuePositivityThreshold: posThreshold, setFeatureValuePositivityThreshold: setPosThreshold, featureValueColormap: featureValueColormap, setFeatureValueColormap: setFeatureValueColormap })), children: _jsx("div", { ref: containerRef, className: classes.vegaContainer, children: resultArr ? (_jsx(DotPlot, { isStratified: isStratified, transpose: transpose, domainMax: meanExpressionMax, data: resultArr, theme: theme, width: width, height: height, obsType: obsType, sampleType: sampleType, featureType: featureType, featureValueType: featureValueType, featureValueTransformName: selectedTransformName, featureValueColormap: featureValueColormap, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, onDotSelect: onDotSelect })) : (_jsxs("span", { children: ["Select at least one ", featureType, "."] })) }) }));
64
75
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/statistical-plots",
3
- "version": "3.6.10",
3
+ "version": "3.6.11",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -28,13 +28,13 @@
28
28
  "react-aria": "^3.28.0",
29
29
  "internmap": "^2.0.3",
30
30
  "uuid": "^9.0.0",
31
- "@vitessce/styles": "3.6.10",
32
- "@vitessce/constants-internal": "3.6.10",
33
- "@vitessce/sets-utils": "3.6.10",
34
- "@vitessce/utils": "3.6.10",
35
- "@vitessce/vega": "3.6.10",
36
- "@vitessce/vit-s": "3.6.10",
37
- "@vitessce/gl": "3.6.10"
31
+ "@vitessce/styles": "3.6.11",
32
+ "@vitessce/constants-internal": "3.6.11",
33
+ "@vitessce/sets-utils": "3.6.11",
34
+ "@vitessce/utils": "3.6.11",
35
+ "@vitessce/vega": "3.6.11",
36
+ "@vitessce/vit-s": "3.6.11",
37
+ "@vitessce/gl": "3.6.11"
38
38
  },
39
39
  "devDependencies": {
40
40
  "react": "^18.0.0",
package/src/DotPlot.js CHANGED
@@ -39,10 +39,10 @@ export default function DotPlot(props) {
39
39
  featureType,
40
40
  featureValueType,
41
41
  featureValueTransformName,
42
- // TODO: re-enable featureValueColormap coordination
43
- // featureValueColormap,
42
+ featureValueColormap,
44
43
  obsSetSelection,
45
44
  obsSetColor,
45
+ onDotSelect,
46
46
  } = props;
47
47
 
48
48
  const vegaContainerRef = useRef();
@@ -112,6 +112,26 @@ export default function DotPlot(props) {
112
112
  // Reference: https://vega.github.io/vega-lite/docs/mark.html
113
113
  opacity: 1.0,
114
114
  },
115
+ params: [
116
+ {
117
+ name: 'dot_select',
118
+ select: {
119
+ type: 'point',
120
+ on: 'click[event.shiftKey === false]',
121
+ fields: ['feature'],
122
+ empty: 'none',
123
+ },
124
+ },
125
+ {
126
+ name: 'shift_dot_select',
127
+ select: {
128
+ type: 'point',
129
+ on: 'click[event.shiftKey]',
130
+ fields: ['feature'],
131
+ empty: 'none',
132
+ },
133
+ },
134
+ ],
115
135
  encoding: {
116
136
  [(transpose ? 'y' : 'x')]: {
117
137
  field: 'keyFeature',
@@ -135,8 +155,7 @@ export default function DotPlot(props) {
135
155
  type: 'quantitative',
136
156
  title: meanTransform,
137
157
  scale: {
138
- // scheme: featureValueColormap,
139
- scheme: 'greys',
158
+ scheme: featureValueColormap,
140
159
  },
141
160
  legend: {
142
161
  direction: 'horizontal',
@@ -178,6 +197,15 @@ export default function DotPlot(props) {
178
197
  },
179
198
  };
180
199
 
200
+ const handleSignal = (name, value) => {
201
+ if (name === 'dot_select') {
202
+ onDotSelect(value.feature);
203
+ } else if (name === 'shift_dot_select') {
204
+ onDotSelect(value.feature, true);
205
+ }
206
+ };
207
+
208
+ const signalListeners = { dot_select: handleSignal, shift_dot_select: handleSignal };
181
209
  const getTooltipText = useCallback(item => ({
182
210
  [`${capitalize(featureType)}`]: item.datum.feature,
183
211
  [`${capitalize(obsType)} Set`]: item.datum.group,
@@ -237,6 +265,7 @@ export default function DotPlot(props) {
237
265
  data={data}
238
266
  spec={spec}
239
267
  onNewView={onNewView}
268
+ signalListeners={signalListeners}
240
269
  getTooltipText={getTooltipText}
241
270
  renderer="svg"
242
271
  />
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useCallback } from 'react';
2
2
  import {
3
3
  TitleInfo,
4
4
  useCoordination, useLoaders,
@@ -54,11 +54,14 @@ export function DotPlotSubscriber(props) {
54
54
  additionalObsSets: additionalCellSets,
55
55
  sampleType,
56
56
  sampleSetSelection,
57
+ // eslint-disable-next-line no-unused-vars
58
+ featureAggregationStrategy,
57
59
  }, {
58
60
  setFeatureValueTransform,
59
61
  setFeatureValueTransformCoefficient,
60
62
  setFeatureValuePositivityThreshold: setPosThreshold,
61
63
  setFeatureValueColormap,
64
+ setFeatureAggregationStrategy,
62
65
  }] = useCoordination(
63
66
  COMPONENT_COORDINATION_TYPES[ViewType.DOT_PLOT],
64
67
  coordinationScopes,
@@ -149,6 +152,16 @@ export function DotPlotSubscriber(props) {
149
152
  o => o.value === featureValueTransform,
150
153
  )?.name;
151
154
 
155
+ // eslint-disable-next-line no-unused-vars
156
+ const onDotSelect = useCallback((featureName, isShiftDown = false) => {
157
+ // TODO: Implement different behavior when isShiftDown
158
+ // / (featureName array will need to be aggregated)
159
+ const featureI = geneSelection.indexOf(featureName?.[0]);
160
+ if (featureI >= 0) {
161
+ setFeatureAggregationStrategy(featureI);
162
+ }
163
+ }, [setFeatureAggregationStrategy, geneSelection]);
164
+
152
165
  return (
153
166
  <TitleInfo
154
167
  title={title}
@@ -190,6 +203,7 @@ export function DotPlotSubscriber(props) {
190
203
  featureValueColormap={featureValueColormap}
191
204
  obsSetSelection={cellSetSelection}
192
205
  obsSetColor={cellSetColor}
206
+ onDotSelect={onDotSelect}
193
207
  />
194
208
  ) : (
195
209
  <span>Select at least one {featureType}.</span>