@vitessce/heatmap 3.5.10 → 3.5.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-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-de9c69b2.js";
2
+ import { B as BaseDecoder } from "./index-5cd0c9fa.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -11431,6 +11431,7 @@ const CoordinationType$1 = {
11431
11431
  FEATURE_VALUE_COLORMAP: "featureValueColormap",
11432
11432
  FEATURE_VALUE_TRANSFORM: "featureValueTransform",
11433
11433
  FEATURE_VALUE_COLORMAP_RANGE: "featureValueColormapRange",
11434
+ FEATURE_AGGREGATION_STRATEGY: "featureAggregationStrategy",
11434
11435
  OBS_COLOR_ENCODING: "obsColorEncoding",
11435
11436
  SPATIAL_IMAGE_LAYER: "spatialImageLayer",
11436
11437
  SPATIAL_SEGMENTATION_LAYER: "spatialSegmentationLayer",
@@ -11573,6 +11574,7 @@ const COMPONENT_COORDINATION_TYPES = {
11573
11574
  CoordinationType$1.FEATURE_SELECTION,
11574
11575
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
11575
11576
  CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
11577
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11576
11578
  CoordinationType$1.OBS_COLOR_ENCODING,
11577
11579
  CoordinationType$1.ADDITIONAL_OBS_SETS,
11578
11580
  CoordinationType$1.TOOLTIPS_VISIBLE,
@@ -11616,6 +11618,7 @@ const COMPONENT_COORDINATION_TYPES = {
11616
11618
  CoordinationType$1.FEATURE_SELECTION,
11617
11619
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
11618
11620
  CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
11621
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11619
11622
  CoordinationType$1.OBS_COLOR_ENCODING,
11620
11623
  CoordinationType$1.ADDITIONAL_OBS_SETS,
11621
11624
  CoordinationType$1.TOOLTIPS_VISIBLE,
@@ -11695,6 +11698,7 @@ const COMPONENT_COORDINATION_TYPES = {
11695
11698
  CoordinationType$1.FEATURE_SELECTION,
11696
11699
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
11697
11700
  CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
11701
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11698
11702
  CoordinationType$1.OBS_COLOR_ENCODING,
11699
11703
  CoordinationType$1.ADDITIONAL_OBS_SETS,
11700
11704
  CoordinationType$1.MOLECULE_HIGHLIGHT,
@@ -11732,6 +11736,7 @@ const COMPONENT_COORDINATION_TYPES = {
11732
11736
  CoordinationType$1.FEATURE_SELECTION,
11733
11737
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
11734
11738
  CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
11739
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11735
11740
  CoordinationType$1.OBS_COLOR_ENCODING,
11736
11741
  CoordinationType$1.ADDITIONAL_OBS_SETS,
11737
11742
  CoordinationType$1.MOLECULE_HIGHLIGHT,
@@ -11845,6 +11850,7 @@ const COMPONENT_COORDINATION_TYPES = {
11845
11850
  CoordinationType$1.FEATURE_SELECTION,
11846
11851
  CoordinationType$1.FEATURE_VALUE_TRANSFORM,
11847
11852
  CoordinationType$1.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
11853
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11848
11854
  CoordinationType$1.OBS_SET_SELECTION,
11849
11855
  CoordinationType$1.OBS_SET_FILTER,
11850
11856
  CoordinationType$1.OBS_SET_HIGHLIGHT,
@@ -11860,6 +11866,7 @@ const COMPONENT_COORDINATION_TYPES = {
11860
11866
  CoordinationType$1.FEATURE_TYPE,
11861
11867
  CoordinationType$1.FEATURE_VALUE_TYPE,
11862
11868
  CoordinationType$1.FEATURE_SELECTION,
11869
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11863
11870
  CoordinationType$1.ADDITIONAL_OBS_SETS,
11864
11871
  CoordinationType$1.OBS_SET_COLOR,
11865
11872
  CoordinationType$1.OBS_COLOR_ENCODING,
@@ -11938,6 +11945,7 @@ const COMPONENT_COORDINATION_TYPES = {
11938
11945
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
11939
11946
  CoordinationType$1.FEATURE_VALUE_COLORMAP_RANGE,
11940
11947
  CoordinationType$1.FEATURE_SELECTION,
11948
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11941
11949
  CoordinationType$1.TOOLTIPS_VISIBLE,
11942
11950
  CoordinationType$1.TOOLTIP_CROSSHAIRS_VISIBLE,
11943
11951
  CoordinationType$1.LEGEND_VISIBLE,
@@ -11978,6 +11986,7 @@ const COMPONENT_COORDINATION_TYPES = {
11978
11986
  CoordinationType$1.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
11979
11987
  CoordinationType$1.FEATURE_VALUE_POSITIVITY_THRESHOLD,
11980
11988
  CoordinationType$1.FEATURE_VALUE_COLORMAP,
11989
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
11981
11990
  CoordinationType$1.OBS_SET_SELECTION,
11982
11991
  CoordinationType$1.OBS_SET_FILTER,
11983
11992
  CoordinationType$1.OBS_SET_HIGHLIGHT,
@@ -12006,6 +12015,7 @@ const COMPONENT_COORDINATION_TYPES = {
12006
12015
  CoordinationType$1.FEATURE_SELECTION,
12007
12016
  CoordinationType$1.FEATURE_VALUE_TRANSFORM,
12008
12017
  CoordinationType$1.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
12018
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
12009
12019
  CoordinationType$1.OBS_SET_SELECTION,
12010
12020
  CoordinationType$1.OBS_SET_HIGHLIGHT,
12011
12021
  CoordinationType$1.OBS_HIGHLIGHT,
@@ -12110,6 +12120,7 @@ const COMPONENT_COORDINATION_TYPES = {
12110
12120
  CoordinationType$1.OBS_TYPE,
12111
12121
  CoordinationType$1.SAMPLE_TYPE,
12112
12122
  CoordinationType$1.FEATURE_SELECTION,
12123
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
12113
12124
  CoordinationType$1.SAMPLE_SET_SELECTION,
12114
12125
  CoordinationType$1.SAMPLE_SET_FILTER,
12115
12126
  CoordinationType$1.OBS_SET_SELECTION,
@@ -12417,6 +12428,7 @@ z.object({
12417
12428
  termColumn: z.string().optional(),
12418
12429
  pValueColumn: z.string(),
12419
12430
  pValueAdjusted: z.boolean().optional(),
12431
+ featureSetLibrary: z.string().optional().describe("Optionally, provide a feature set library name. By default, Reactome_2022."),
12420
12432
  analysisType: z.string().optional().describe("Optionally, provide an analysis_type name. By default, pertpy_hypergeometric.")
12421
12433
  });
12422
12434
  z.object({
@@ -12427,7 +12439,6 @@ z.object({
12427
12439
  foldChangeColumn: z.string().describe("The log-fold change is then calculated between this expected sample and the expected sample with no active covariates from the intercept section."),
12428
12440
  foldChangeTransformation: z.enum(["log2"]).optional(),
12429
12441
  isCredibleEffectColumn: z.string().describe("Column which annotates effects as being credible or not (boolean)."),
12430
- covariateColumn: z.string().describe("Column which defines the covariate used in the analysis."),
12431
12442
  analysisType: z.string().optional().describe("Optionally, provide an analysis_type name. By default, sccoda_df.")
12432
12443
  });
12433
12444
  const annDataObsLabels = annDataObs;
@@ -31759,8 +31770,50 @@ const titleHeight = 10;
31759
31770
  const rectHeight = 8;
31760
31771
  const rectMarginY = 2;
31761
31772
  const rectMarginX = 2;
31773
+ function combineExtents(extents, featureAggregationStrategy) {
31774
+ if (Array.isArray(extents)) {
31775
+ if (featureAggregationStrategy === "first") {
31776
+ return extents[0];
31777
+ }
31778
+ if (featureAggregationStrategy === "last") {
31779
+ return extents.at(-1);
31780
+ }
31781
+ if (typeof featureAggregationStrategy === "number") {
31782
+ const i2 = featureAggregationStrategy;
31783
+ return extents[i2];
31784
+ }
31785
+ if (featureAggregationStrategy === "sum") {
31786
+ return extents.reduce((a2, h) => [a2[0] + h[0], a2[1] + h[1]]);
31787
+ }
31788
+ if (featureAggregationStrategy === "mean") {
31789
+ return extents.reduce((a2, h) => [a2[0] + h[0], a2[1] + h[1]]).map((v) => v / extents.length);
31790
+ }
31791
+ }
31792
+ return null;
31793
+ }
31794
+ function combineMissings(missings, featureAggregationStrategy) {
31795
+ if (Array.isArray(missings)) {
31796
+ if (featureAggregationStrategy === "first") {
31797
+ return missings[0];
31798
+ }
31799
+ if (featureAggregationStrategy === "last") {
31800
+ return missings.at(-1);
31801
+ }
31802
+ if (typeof featureAggregationStrategy === "number") {
31803
+ const i2 = featureAggregationStrategy;
31804
+ return missings[i2];
31805
+ }
31806
+ if (featureAggregationStrategy === "sum") {
31807
+ return missings.reduce((a2, h) => a2 + h, 0);
31808
+ }
31809
+ if (featureAggregationStrategy === "mean") {
31810
+ return missings.reduce((a2, h) => a2 + h / missings.length, 0);
31811
+ }
31812
+ }
31813
+ return null;
31814
+ }
31762
31815
  function Legend(props) {
31763
- const { visible: visibleProp, positionRelative = false, highContrast = false, obsType, featureValueType, considerSelections = true, obsColorEncoding, featureSelection, featureLabelsMap, featureValueColormap, featureValueColormapRange, spatialChannelColor, spatialLayerColor, obsSetSelection, obsSetColor, extent: extent2, missing, width = 100, height = 36, theme, showObsLabel = false, pointsVisible = true, contoursVisible = false, contoursFilled, contourPercentiles, contourThresholds } = props;
31816
+ const { visible: visibleProp, positionRelative = false, highContrast = false, obsType, featureValueType, considerSelections = true, obsColorEncoding, featureSelection, featureLabelsMap, featureValueColormap, featureValueColormapRange, spatialChannelColor, spatialLayerColor, obsSetSelection, obsSetColor, featureAggregationStrategy, extent: extent2, missing, width = 100, height = 36, theme, showObsLabel = false, pointsVisible = true, contoursVisible = false, contoursFilled, contourPercentiles, contourThresholds } = props;
31764
31817
  const svgRef = useRef();
31765
31818
  const classes = useStyles$1();
31766
31819
  const isDarkTheme = theme === "dark";
@@ -31769,9 +31822,9 @@ function Legend(props) {
31769
31822
  const layerColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme);
31770
31823
  const channelColor = Array.isArray(spatialChannelColor) && spatialChannelColor.length === 3 ? spatialChannelColor : getDefaultColor(theme);
31771
31824
  const staticColor = obsColorEncoding === "spatialChannelColor" ? channelColor : layerColor;
31772
- const visible = visibleProp && (!considerSelections || obsColorEncoding === "geneSelection" && featureSelection && Array.isArray(featureSelection) && featureSelection.length === 1 || isSetColor && (obsSetSelection == null ? void 0 : obsSetSelection.length) > 0 && (obsSetColor == null ? void 0 : obsSetColor.length) > 0 || isStaticColor);
31825
+ const visible = visibleProp && (!considerSelections || obsColorEncoding === "geneSelection" && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && (obsSetSelection == null ? void 0 : obsSetSelection.length) > 0 && (obsSetColor == null ? void 0 : obsSetColor.length) > 0 || isStaticColor);
31773
31826
  const levelZeroNames = useMemo(() => Array.from(new Set((obsSetSelection == null ? void 0 : obsSetSelection.map((setPath) => setPath[0])) || [])), [obsSetSelection]);
31774
- const dynamicHeight = isSetColor ? levelZeroNames.length * titleHeight + (obsSetSelection == null ? void 0 : obsSetSelection.length) * (rectHeight + rectMarginY) : height + (!pointsVisible && contoursVisible ? 25 : 0);
31827
+ const dynamicHeight = isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + (obsSetSelection == null ? void 0 : obsSetSelection.length) * (rectHeight + rectMarginY) : height + (!pointsVisible && contoursVisible ? 25 : 0);
31775
31828
  useEffect(() => {
31776
31829
  const domElement = svgRef.current;
31777
31830
  const foregroundColor = highContrast ? "black" : isDarkTheme ? "white" : "black";
@@ -31780,7 +31833,7 @@ function Legend(props) {
31780
31833
  svg.attr("width", width).attr("height", dynamicHeight);
31781
31834
  const g2 = svg.append("g").attr("width", width).attr("height", dynamicHeight);
31782
31835
  if (!considerSelections || obsColorEncoding === "geneSelection") {
31783
- const [xMin, xMax] = extent2 || [0, 1];
31836
+ const [xMin, xMax] = combineExtents(extent2, featureAggregationStrategy) || [0, 1];
31784
31837
  if (featureValueColormap && pointsVisible) {
31785
31838
  const xlinkHref = getXlinkHref(featureValueColormap);
31786
31839
  g2.append("image").attr("x", 0).attr("y", titleHeight).attr("width", width).attr("height", rectHeight).attr("preserveAspectRatio", "none").attr("href", xlinkHref);
@@ -31844,8 +31897,19 @@ function Legend(props) {
31844
31897
  });
31845
31898
  });
31846
31899
  }
31847
- const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? (featureLabelsMap == null ? void 0 : featureLabelsMap.get(featureSelection[0])) || (featureLabelsMap == null ? void 0 : featureLabelsMap.get(cleanFeatureId(featureSelection[0]))) || featureSelection[0] : null;
31848
- const featureSelectionLabel = missing ? `${featureSelectionLabelRaw} (${Math.round(missing * 100)}% NaN)` : featureSelectionLabelRaw;
31900
+ const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? featureSelection.map((geneName) => (featureLabelsMap == null ? void 0 : featureLabelsMap.get(geneName)) || (featureLabelsMap == null ? void 0 : featureLabelsMap.get(cleanFeatureId(geneName))) || geneName) : null;
31901
+ let featureSelectionLabelRawStr = "";
31902
+ if (featureAggregationStrategy === "first") {
31903
+ featureSelectionLabelRawStr = featureSelectionLabelRaw == null ? void 0 : featureSelectionLabelRaw[0];
31904
+ } else if (featureAggregationStrategy === "last") {
31905
+ featureSelectionLabelRawStr = featureSelectionLabelRaw == null ? void 0 : featureSelectionLabelRaw.at(-1);
31906
+ } else if (featureAggregationStrategy === "sum") {
31907
+ featureSelectionLabelRawStr = "Sum of features";
31908
+ } else if (featureAggregationStrategy === "mean") {
31909
+ featureSelectionLabelRawStr = "Mean of features";
31910
+ }
31911
+ const combinedMissing = combineMissings(missing, featureAggregationStrategy);
31912
+ const featureSelectionLabel = combinedMissing ? `${featureSelectionLabelRawStr} (${Math.round(combinedMissing * 100)}% NaN)` : featureSelectionLabelRawStr;
31849
31913
  const obsLabel = capitalize$1(obsType);
31850
31914
  const featureLabel = considerSelections ? featureSelectionLabel || capitalize$1(featureValueType) : capitalize$1(featureValueType);
31851
31915
  const mainLabel = showObsLabel ? obsLabel : featureLabel;
@@ -31879,7 +31943,8 @@ function Legend(props) {
31879
31943
  contourThresholds,
31880
31944
  contoursFilled,
31881
31945
  contoursVisible,
31882
- pointsVisible
31946
+ pointsVisible,
31947
+ featureAggregationStrategy
31883
31948
  ]);
31884
31949
  return jsxRuntimeExports.jsx("div", { className: clsx(classes.legend, {
31885
31950
  [classes.legendRelative]: positionRelative,
@@ -139071,8 +139136,15 @@ class SelectionLayer extends CompositeLayer {
139071
139136
  if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
139072
139137
  return true;
139073
139138
  }
139074
- if (node.data && booleanPointInPolygon$1(point$1([].slice.call(getObsCoords(node.data))), selectedPolygon)) {
139075
- pickingInfos.push(node.data);
139139
+ if (node.data) {
139140
+ let current = node;
139141
+ while (current) {
139142
+ const pointCoords = [].slice.call(getObsCoords(current.data));
139143
+ if (booleanPointInPolygon$1(point$1(pointCoords), selectedPolygon)) {
139144
+ pickingInfos.push(current.data);
139145
+ }
139146
+ current = current.next;
139147
+ }
139076
139148
  }
139077
139149
  return false;
139078
139150
  });
@@ -140255,16 +140327,16 @@ function addDecoder(cases, importFn) {
140255
140327
  }
140256
140328
  cases.forEach((c) => registry$1.set(c, importFn));
140257
140329
  }
140258
- addDecoder([void 0, 1], () => import("./raw-fa20d93e.js").then((m) => m.default));
140259
- addDecoder(5, () => import("./lzw-eb7143f8.js").then((m) => m.default));
140330
+ addDecoder([void 0, 1], () => import("./raw-0424ecb4.js").then((m) => m.default));
140331
+ addDecoder(5, () => import("./lzw-08a4e34f.js").then((m) => m.default));
140260
140332
  addDecoder(6, () => {
140261
140333
  throw new Error("old style JPEG compression is not supported.");
140262
140334
  });
140263
- addDecoder(7, () => import("./jpeg-91b6cf9a.js").then((m) => m.default));
140264
- addDecoder([8, 32946], () => import("./deflate-388f87f7.js").then((m) => m.default));
140265
- addDecoder(32773, () => import("./packbits-90e50bfa.js").then((m) => m.default));
140266
- addDecoder(34887, () => import("./lerc-73f4cfa5.js").then((m) => m.default));
140267
- addDecoder(50001, () => import("./webimage-f3e4d686.js").then((m) => m.default));
140335
+ addDecoder(7, () => import("./jpeg-f5eab55f.js").then((m) => m.default));
140336
+ addDecoder([8, 32946], () => import("./deflate-e7a29866.js").then((m) => m.default));
140337
+ addDecoder(32773, () => import("./packbits-35c6bfd6.js").then((m) => m.default));
140338
+ addDecoder(34887, () => import("./lerc-95fccfab.js").then((m) => m.default));
140339
+ addDecoder(50001, () => import("./webimage-e25730c6.js").then((m) => m.default));
140268
140340
  function decodeRowAcc(row, stride) {
140269
140341
  let length2 = row.length - stride;
140270
140342
  let offset5 = 0;
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a, H } from "./index-de9c69b2.js";
1
+ import { a, H } from "./index-5cd0c9fa.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-de9c69b2.js";
1
+ import { B as BaseDecoder } from "./index-5cd0c9fa.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-de9c69b2.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-5cd0c9fa.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-de9c69b2.js";
1
+ import { B as BaseDecoder } from "./index-5cd0c9fa.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-de9c69b2.js";
1
+ import { B as BaseDecoder } from "./index-5cd0c9fa.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-de9c69b2.js";
1
+ import { B as BaseDecoder } from "./index-5cd0c9fa.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-de9c69b2.js";
1
+ import { B as BaseDecoder } from "./index-5cd0c9fa.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/heatmap",
3
- "version": "3.5.10",
3
+ "version": "3.5.11",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,14 +20,14 @@
20
20
  "lodash-es": "^4.17.21",
21
21
  "uuid": "^9.0.0",
22
22
  "react-aria": "^3.28.0",
23
- "@vitessce/constants-internal": "3.5.10",
24
- "@vitessce/gl": "3.5.10",
25
- "@vitessce/legend": "3.5.10",
26
- "@vitessce/sets-utils": "3.5.10",
27
- "@vitessce/tooltip": "3.5.10",
28
- "@vitessce/utils": "3.5.10",
29
- "@vitessce/vit-s": "3.5.10",
30
- "@vitessce/workers": "3.5.10"
23
+ "@vitessce/constants-internal": "3.5.11",
24
+ "@vitessce/gl": "3.5.11",
25
+ "@vitessce/sets-utils": "3.5.11",
26
+ "@vitessce/tooltip": "3.5.11",
27
+ "@vitessce/utils": "3.5.11",
28
+ "@vitessce/vit-s": "3.5.11",
29
+ "@vitessce/workers": "3.5.11",
30
+ "@vitessce/legend": "3.5.11"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@testing-library/jest-dom": "^5.16.4",