@vitessce/scatterplot-gating 3.2.1 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { B as BaseDecoder } from "./index-743f7ba3.js";
2
+ import { B as BaseDecoder } from "./index-ffb8adc6.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -10927,6 +10927,7 @@ const DataType$2 = {
10927
10927
  const FileType$1 = {
10928
10928
  // Joint file types
10929
10929
  ANNDATA_ZARR: "anndata.zarr",
10930
+ SPATIALDATA_ZARR: "spatialdata.zarr",
10930
10931
  // Atomic file types
10931
10932
  OBS_EMBEDDING_CSV: "obsEmbedding.csv",
10932
10933
  OBS_SPOTS_CSV: "obsSpots.csv",
@@ -10949,6 +10950,16 @@ const FileType$1 = {
10949
10950
  OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
10950
10951
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
10951
10952
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
10953
+ // SpatialData
10954
+ IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
10955
+ LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
10956
+ SHAPES_SPATIALDATA_ZARR: "shapes.spatialdata.zarr",
10957
+ OBS_FEATURE_MATRIX_SPATIALDATA_ZARR: "obsFeatureMatrix.spatialdata.zarr",
10958
+ OBS_SETS_SPATIALDATA_ZARR: "obsSets.spatialdata.zarr",
10959
+ OBS_SPOTS_SPATIALDATA_ZARR: "obsSpots.spatialdata.zarr",
10960
+ // TODO:
10961
+ // OBS_POINTS_SPATIALDATA_ZARR: 'obsPoints.spatialdata.zarr',
10962
+ // OBS_LOCATIONS_SPATIALDATA_ZARR: 'obsLocations.spatialdata.zarr',
10952
10963
  // MuData
10953
10964
  OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
10954
10965
  OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
@@ -11750,9 +11761,30 @@ z.object({
11750
11761
  offsetsUrl: z.string().optional(),
11751
11762
  coordinateTransformations: omeCoordinateTransformations.optional()
11752
11763
  });
11753
- z.object({
11764
+ const imageOmeZarrSchema = z.object({
11754
11765
  coordinateTransformations: omeCoordinateTransformations.optional()
11755
11766
  });
11767
+ imageOmeZarrSchema.extend({
11768
+ path: z.string()
11769
+ });
11770
+ z.object({
11771
+ path: z.string()
11772
+ });
11773
+ z.object({
11774
+ path: z.string()
11775
+ });
11776
+ z.object({
11777
+ path: z.string(),
11778
+ tablePath: z.string().optional().describe("The path to a table which annotates the spots. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected.")
11779
+ });
11780
+ annDataObsFeatureMatrix.extend({
11781
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
11782
+ });
11783
+ z.object({
11784
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
11785
+ tablePath: z.string().optional().describe("The path to a table which contains the index for the set values."),
11786
+ obsSets: annDataObsSets
11787
+ });
11756
11788
  z.object({
11757
11789
  obsIndex: z.string(),
11758
11790
  obsEmbedding: z.array(z.string()).length(2)
@@ -18472,9 +18504,9 @@ const schemePlasma = [[13, 8, 135], [16, 7, 136], [19, 7, 137], [22, 7, 138], [2
18472
18504
  function rgbSpline(spline) {
18473
18505
  return (colors) => {
18474
18506
  const n2 = colors.length;
18475
- let r2 = new Array(n2);
18476
- let g2 = new Array(n2);
18477
- let b = new Array(n2);
18507
+ const r2 = new Array(n2);
18508
+ const g2 = new Array(n2);
18509
+ const b = new Array(n2);
18478
18510
  let i2;
18479
18511
  let color;
18480
18512
  for (i2 = 0; i2 < n2; ++i2) {
@@ -18483,10 +18515,10 @@ function rgbSpline(spline) {
18483
18515
  g2[i2] = color[1] || 0;
18484
18516
  b[i2] = color[2] || 0;
18485
18517
  }
18486
- r2 = spline(r2);
18487
- g2 = spline(g2);
18488
- b = spline(b);
18489
- return (t2) => [r2(t2), g2(t2), b(t2)];
18518
+ const rFunc = spline(r2);
18519
+ const gFunc = spline(g2);
18520
+ const bFunc = spline(b);
18521
+ return (t2) => [rFunc(t2), gFunc(t2), bFunc(t2)];
18490
18522
  };
18491
18523
  }
18492
18524
  function basis(values2) {
@@ -121094,16 +121126,16 @@ function addDecoder(cases, importFn) {
121094
121126
  }
121095
121127
  cases.forEach((c2) => registry$1.set(c2, importFn));
121096
121128
  }
121097
- addDecoder([void 0, 1], () => import("./raw-4828923d.js").then((m2) => m2.default));
121098
- addDecoder(5, () => import("./lzw-8a95c676.js").then((m2) => m2.default));
121129
+ addDecoder([void 0, 1], () => import("./raw-d8d40fca.js").then((m2) => m2.default));
121130
+ addDecoder(5, () => import("./lzw-5c97cf9e.js").then((m2) => m2.default));
121099
121131
  addDecoder(6, () => {
121100
121132
  throw new Error("old style JPEG compression is not supported.");
121101
121133
  });
121102
- addDecoder(7, () => import("./jpeg-da2166c3.js").then((m2) => m2.default));
121103
- addDecoder([8, 32946], () => import("./deflate-10f9d67d.js").then((m2) => m2.default));
121104
- addDecoder(32773, () => import("./packbits-3b55e8df.js").then((m2) => m2.default));
121105
- addDecoder(34887, () => import("./lerc-ea6f16cd.js").then((m2) => m2.default));
121106
- addDecoder(50001, () => import("./webimage-f3457c94.js").then((m2) => m2.default));
121134
+ addDecoder(7, () => import("./jpeg-b7775743.js").then((m2) => m2.default));
121135
+ addDecoder([8, 32946], () => import("./deflate-db1c8f5b.js").then((m2) => m2.default));
121136
+ addDecoder(32773, () => import("./packbits-3e7a20be.js").then((m2) => m2.default));
121137
+ addDecoder(34887, () => import("./lerc-8db218c1.js").then((m2) => m2.default));
121138
+ addDecoder(50001, () => import("./webimage-adb9e0d3.js").then((m2) => m2.default));
121107
121139
  function decodeRowAcc(row, stride) {
121108
121140
  let length2 = row.length - stride;
121109
121141
  let offset5 = 0;
@@ -130003,6 +130035,67 @@ function makeBoundingBox(viewState) {
130003
130035
  viewport.unproject([0, viewport.height])
130004
130036
  ];
130005
130037
  }
130038
+ const TARGETS = [1, 2, 3, 4, 5, 10, 20, 25, 50, 100, 200, 250, 500, 1e3];
130039
+ const MIN_TARGET = TARGETS[0];
130040
+ const MAX_TARGET = TARGETS[TARGETS.length - 1];
130041
+ const SI_PREFIXES = [
130042
+ { symbol: "Y", exponent: 24 },
130043
+ { symbol: "Z", exponent: 21 },
130044
+ { symbol: "E", exponent: 18 },
130045
+ { symbol: "P", exponent: 15 },
130046
+ { symbol: "T", exponent: 12 },
130047
+ { symbol: "G", exponent: 9 },
130048
+ { symbol: "M", exponent: 6 },
130049
+ { symbol: "k", exponent: 3 },
130050
+ { symbol: "h", exponent: 2 },
130051
+ { symbol: "da", exponent: 1 },
130052
+ { symbol: "", exponent: 0 },
130053
+ { symbol: "d", exponent: -1 },
130054
+ { symbol: "c", exponent: -2 },
130055
+ { symbol: "m", exponent: -3 },
130056
+ { symbol: "µ", exponent: -6 },
130057
+ { symbol: "n", exponent: -9 },
130058
+ { symbol: "p", exponent: -12 },
130059
+ { symbol: "f", exponent: -15 },
130060
+ { symbol: "a", exponent: -18 },
130061
+ { symbol: "z", exponent: -21 },
130062
+ { symbol: "y", exponent: -24 }
130063
+ ];
130064
+ function sizeToMeters(size, unit) {
130065
+ if (!unit || unit === "m") {
130066
+ return size;
130067
+ }
130068
+ if (unit.length > 1) {
130069
+ let unitPrefix = unit.substring(0, unit.length - 1);
130070
+ if (unitPrefix === "u") {
130071
+ unitPrefix = "µ";
130072
+ }
130073
+ const unitObj = SI_PREFIXES.find((p) => p.symbol === unitPrefix);
130074
+ if (unitObj) {
130075
+ return size * 10 ** unitObj.exponent;
130076
+ }
130077
+ }
130078
+ throw new Error("Received unknown unit");
130079
+ }
130080
+ function snapValue(value) {
130081
+ let magnitude = 0;
130082
+ if (value < MIN_TARGET || value > MAX_TARGET) {
130083
+ magnitude = Math.floor(Math.log10(value));
130084
+ }
130085
+ let snappedUnit = SI_PREFIXES.find(
130086
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude
130087
+ );
130088
+ let adjustedValue = value / 10 ** snappedUnit.exponent;
130089
+ if (adjustedValue > 500 && adjustedValue <= 1e3) {
130090
+ snappedUnit = SI_PREFIXES.find(
130091
+ (p) => p.exponent % 3 === 0 && p.exponent <= magnitude + 3
130092
+ );
130093
+ adjustedValue = value / 10 ** snappedUnit.exponent;
130094
+ }
130095
+ const targetNewUnits = TARGETS.find((t2) => t2 > adjustedValue);
130096
+ const targetOrigUnits = targetNewUnits * 10 ** snappedUnit.exponent;
130097
+ return [targetOrigUnits, targetNewUnits, snappedUnit.symbol];
130098
+ }
130006
130099
  const fs$1$1 = `#define SHADER_NAME xr-layer-fragment-shader
130007
130100
 
130008
130101
  precision highp float;
@@ -130770,26 +130863,27 @@ const OverviewLayer = class extends CompositeLayer {
130770
130863
  OverviewLayer.layerName = "OverviewLayer";
130771
130864
  OverviewLayer.defaultProps = defaultProps$3;
130772
130865
  function getPosition$1(boundingBox, position, length2) {
130773
- const viewLength = boundingBox[2][0] - boundingBox[0][0];
130866
+ const viewWidth = boundingBox[2][0] - boundingBox[0][0];
130867
+ const viewHeight = boundingBox[2][1] - boundingBox[0][1];
130774
130868
  switch (position) {
130775
130869
  case "bottom-right": {
130776
- const yCoord = boundingBox[2][1] - (boundingBox[2][1] - boundingBox[0][1]) * length2;
130777
- const xLeftCoord = boundingBox[2][0] - viewLength * length2;
130870
+ const yCoord = boundingBox[2][1] - viewHeight * length2;
130871
+ const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
130778
130872
  return [yCoord, xLeftCoord];
130779
130873
  }
130780
130874
  case "top-right": {
130781
- const yCoord = (boundingBox[2][1] - boundingBox[0][1]) * length2;
130782
- const xLeftCoord = boundingBox[2][0] - viewLength * length2;
130875
+ const yCoord = boundingBox[0][1] + viewHeight * length2;
130876
+ const xLeftCoord = boundingBox[2][0] - viewWidth * length2;
130783
130877
  return [yCoord, xLeftCoord];
130784
130878
  }
130785
130879
  case "top-left": {
130786
- const yCoord = (boundingBox[2][1] - boundingBox[0][1]) * length2;
130787
- const xLeftCoord = viewLength * length2;
130880
+ const yCoord = boundingBox[0][1] + viewHeight * length2;
130881
+ const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
130788
130882
  return [yCoord, xLeftCoord];
130789
130883
  }
130790
130884
  case "bottom-left": {
130791
- const yCoord = boundingBox[2][1] - (boundingBox[2][1] - boundingBox[0][1]) * length2;
130792
- const xLeftCoord = viewLength * length2;
130885
+ const yCoord = boundingBox[2][1] - viewHeight * length2;
130886
+ const xLeftCoord = boundingBox[0][0] + viewWidth * length2;
130793
130887
  return [yCoord, xLeftCoord];
130794
130888
  }
130795
130889
  default: {
@@ -130807,11 +130901,12 @@ const defaultProps$2$1 = {
130807
130901
  unit: { type: "string", value: "", compare: true },
130808
130902
  size: { type: "number", value: 1, compare: true },
130809
130903
  position: { type: "string", value: "bottom-right", compare: true },
130810
- length: { type: "number", value: 0.085, compare: true }
130904
+ length: { type: "number", value: 0.085, compare: true },
130905
+ snap: { type: "boolean", value: false, compare: true }
130811
130906
  };
130812
130907
  const ScaleBarLayer = class extends CompositeLayer {
130813
130908
  renderLayers() {
130814
- const { id, unit, size, position, viewState, length: length2 } = this.props;
130909
+ const { id, unit, size, position, viewState, length: length2, snap } = this.props;
130815
130910
  const boundingBox = makeBoundingBox(viewState);
130816
130911
  const { zoom } = viewState;
130817
130912
  const viewLength = boundingBox[2][0] - boundingBox[0][0];
@@ -130820,15 +130915,27 @@ const ScaleBarLayer = class extends CompositeLayer {
130820
130915
  2 ** (-zoom + 1.5),
130821
130916
  (boundingBox[2][1] - boundingBox[0][1]) * 7e-3
130822
130917
  );
130823
- const numUnits = barLength * size;
130918
+ let adjustedBarLength = barLength;
130919
+ let displayNumber = (barLength * size).toPrecision(5);
130920
+ let displayUnit = unit;
130921
+ if (snap) {
130922
+ const meterSize = sizeToMeters(size, unit);
130923
+ const numUnits = barLength * meterSize;
130924
+ const [snappedOrigUnits, snappedNewUnits, snappedUnitPrefix] = snapValue(numUnits);
130925
+ adjustedBarLength = snappedOrigUnits / meterSize;
130926
+ displayNumber = snappedNewUnits;
130927
+ displayUnit = `${snappedUnitPrefix}m`;
130928
+ }
130824
130929
  const [yCoord, xLeftCoord] = getPosition$1(boundingBox, position, length2);
130930
+ const xRightCoord = xLeftCoord + barLength;
130931
+ const isLeft = position.endsWith("-left");
130825
130932
  const lengthBar = new LineLayer({
130826
130933
  id: `scale-bar-length-${id}`,
130827
130934
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
130828
130935
  data: [
130829
130936
  [
130830
- [xLeftCoord, yCoord],
130831
- [xLeftCoord + barLength, yCoord]
130937
+ [isLeft ? xLeftCoord : xRightCoord - adjustedBarLength, yCoord],
130938
+ [isLeft ? xLeftCoord + adjustedBarLength : xRightCoord, yCoord]
130832
130939
  ]
130833
130940
  ],
130834
130941
  getSourcePosition: (d) => d[0],
@@ -130841,8 +130948,14 @@ const ScaleBarLayer = class extends CompositeLayer {
130841
130948
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
130842
130949
  data: [
130843
130950
  [
130844
- [xLeftCoord, yCoord - barHeight],
130845
- [xLeftCoord, yCoord + barHeight]
130951
+ [
130952
+ isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
130953
+ yCoord - barHeight
130954
+ ],
130955
+ [
130956
+ isLeft ? xLeftCoord : xRightCoord - adjustedBarLength,
130957
+ yCoord + barHeight
130958
+ ]
130846
130959
  ]
130847
130960
  ],
130848
130961
  getSourcePosition: (d) => d[0],
@@ -130855,8 +130968,14 @@ const ScaleBarLayer = class extends CompositeLayer {
130855
130968
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
130856
130969
  data: [
130857
130970
  [
130858
- [xLeftCoord + barLength, yCoord - barHeight],
130859
- [xLeftCoord + barLength, yCoord + barHeight]
130971
+ [
130972
+ isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
130973
+ yCoord - barHeight
130974
+ ],
130975
+ [
130976
+ isLeft ? xLeftCoord + adjustedBarLength : xRightCoord,
130977
+ yCoord + barHeight
130978
+ ]
130860
130979
  ]
130861
130980
  ],
130862
130981
  getSourcePosition: (d) => d[0],
@@ -130869,8 +130988,11 @@ const ScaleBarLayer = class extends CompositeLayer {
130869
130988
  coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
130870
130989
  data: [
130871
130990
  {
130872
- text: numUnits.toPrecision(5) + unit,
130873
- position: [xLeftCoord + barLength * 0.5, yCoord + barHeight * 4]
130991
+ text: `${displayNumber}${displayUnit}`,
130992
+ position: [
130993
+ isLeft ? xLeftCoord + barLength * 0.5 : xRightCoord - barLength * 0.5,
130994
+ yCoord + barHeight * 4
130995
+ ]
130874
130996
  }
130875
130997
  ],
130876
130998
  getColor: [220, 220, 220, 255],
@@ -130879,7 +131001,7 @@ const ScaleBarLayer = class extends CompositeLayer {
130879
131001
  sizeUnits: "meters",
130880
131002
  sizeScale: 2 ** -zoom,
130881
131003
  characterSet: [
130882
- ...unit.split(""),
131004
+ ...displayUnit.split(""),
130883
131005
  ...range(10).map((i2) => String(i2)),
130884
131006
  ".",
130885
131007
  "e",
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { G } from "./index-743f7ba3.js";
1
+ import { G } from "./index-ffb8adc6.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-743f7ba3.js";
1
+ import { B as BaseDecoder } from "./index-ffb8adc6.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-743f7ba3.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-ffb8adc6.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-743f7ba3.js";
1
+ import { B as BaseDecoder } from "./index-ffb8adc6.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-743f7ba3.js";
1
+ import { B as BaseDecoder } from "./index-ffb8adc6.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-743f7ba3.js";
1
+ import { B as BaseDecoder } from "./index-ffb8adc6.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-743f7ba3.js";
1
+ import { B as BaseDecoder } from "./index-ffb8adc6.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/scatterplot-gating",
3
- "version": "3.2.1",
3
+ "version": "3.3.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -20,11 +20,11 @@
20
20
  "d3-array": "^2.4.0",
21
21
  "lodash-es": "^4.17.21",
22
22
  "react-aria": "^3.28.0",
23
- "@vitessce/constants-internal": "3.2.1",
24
- "@vitessce/scatterplot": "3.2.1",
25
- "@vitessce/sets-utils": "3.2.1",
26
- "@vitessce/utils": "3.2.1",
27
- "@vitessce/vit-s": "3.2.1"
23
+ "@vitessce/constants-internal": "3.3.0",
24
+ "@vitessce/scatterplot": "3.3.0",
25
+ "@vitessce/sets-utils": "3.3.0",
26
+ "@vitessce/utils": "3.3.0",
27
+ "@vitessce/vit-s": "3.3.0"
28
28
  },
29
29
  "devDependencies": {
30
30
  "react": "^18.0.0",