@vitessce/statistical-plots 3.4.12 → 3.5.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-65c79335.js";
2
+ import { B as BaseDecoder } from "./index-5a8190d9.js";
3
3
  import "react";
4
4
  import "@vitessce/vit-s";
5
5
  import "react-dom";
@@ -957,7 +957,8 @@ const ViewType$1 = {
957
957
  OBS_SET_FEATURE_VALUE_DISTRIBUTION: "obsSetFeatureValueDistribution",
958
958
  FEATURE_VALUE_HISTOGRAM: "featureValueHistogram",
959
959
  DOT_PLOT: "dotPlot",
960
- FEATURE_BAR_PLOT: "featureBarPlot"
960
+ FEATURE_BAR_PLOT: "featureBarPlot",
961
+ BIOMARKER_SELECT: "biomarkerSelect"
961
962
  };
962
963
  const DataType$2 = {
963
964
  OBS_LABELS: "obsLabels",
@@ -996,6 +997,9 @@ const FileType$1 = {
996
997
  // OME-Zarr
997
998
  IMAGE_OME_ZARR: "image.ome-zarr",
998
999
  OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
1000
+ // OME-Zarr - Zipped
1001
+ IMAGE_OME_ZARR_ZIP: "image.ome-zarr.zip",
1002
+ OBS_SEGMENTATIONS_OME_ZARR_ZIP: "obsSegmentations.ome-zarr.zip",
999
1003
  // AnnData
1000
1004
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
1001
1005
  OBS_FEATURE_COLUMNS_ANNDATA_ZARR: "obsFeatureColumns.anndata.zarr",
@@ -1649,6 +1653,11 @@ const COMPONENT_COORDINATION_TYPES = {
1649
1653
  CoordinationType$1.OBS_SET_COLOR,
1650
1654
  CoordinationType$1.OBS_COLOR_ENCODING,
1651
1655
  CoordinationType$1.ADDITIONAL_OBS_SETS
1656
+ ],
1657
+ [ViewType$1.BIOMARKER_SELECT]: [
1658
+ CoordinationType$1.FEATURE_SELECTION,
1659
+ CoordinationType$1.SAMPLE_SET_SELECTION
1660
+ // TODO: create coordination types for internal state of the biomarker selection view?
1652
1661
  ]
1653
1662
  };
1654
1663
  function commonjsRequire(path2) {
@@ -11936,24 +11945,29 @@ const imageOmeZarrSchema = z.object({
11936
11945
  imageOmeZarrSchema.extend({
11937
11946
  obsTypesFromChannelNames: z.boolean().optional()
11938
11947
  });
11939
- const imageSpatialdataSchema = imageOmeZarrSchema.extend({
11940
- path: z.string()
11948
+ const imageSpatialdataSchema = z.object({
11949
+ path: z.string(),
11950
+ coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.')
11941
11951
  });
11942
11952
  const obsSegmentationsSpatialdataSchema = z.object({
11943
- // TODO: should this also extend the imageOmeZarrSchema?
11944
11953
  // TODO: should this be renamed labelsSpatialdataSchema?
11945
11954
  // TODO: support obsTypesFromChannelNames?
11946
- path: z.string()
11955
+ path: z.string(),
11956
+ tablePath: z.string().optional().describe("The path to a table which annotates the labels. If available but not specified, the spot identifiers may not be aligned with associated tabular data as expected."),
11957
+ coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.')
11947
11958
  });
11948
11959
  z.object({
11949
- path: z.string()
11960
+ path: z.string(),
11961
+ coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the coordinates. If not provided, the "global" coordinate system is assumed.')
11950
11962
  });
11951
11963
  const obsSpotsSpatialdataSchema = z.object({
11952
11964
  path: z.string(),
11953
- 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.")
11965
+ 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."),
11966
+ coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the coordinates and radii. If not provided, the "global" coordinate system is assumed.')
11954
11967
  });
11955
11968
  const obsFeatureMatrixSpatialdataSchema = annDataObsFeatureMatrix.extend({
11956
- region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional()
11969
+ region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
11970
+ coordinateSystem: z.string().optional().describe('The name of a coordinate transformation output used to transform the image. If not provided, the "global" coordinate system is assumed.')
11957
11971
  });
11958
11972
  const obsSetsSpatialdataSchema = z.object({
11959
11973
  region: z.string().describe("The name of a region to use to filter instances (i.e., rows) in the table").optional(),
@@ -12054,15 +12068,21 @@ anndataZarrSchema.extend({
12054
12068
  z.object({
12055
12069
  // TODO: should `image` be a special schema
12056
12070
  // to allow specifying fileUid (like for embeddingType)?
12071
+ // TODO: allow multiple images
12057
12072
  image: imageSpatialdataSchema,
12058
12073
  // TODO: should this be a special schema
12059
12074
  // to allow specifying fileUid (like for embeddingType)?
12075
+ // TODO: allow multiple labels
12060
12076
  labels: obsSegmentationsSpatialdataSchema,
12061
12077
  obsFeatureMatrix: obsFeatureMatrixSpatialdataSchema,
12062
12078
  obsSpots: obsSpotsSpatialdataSchema,
12063
12079
  // TODO: obsPoints
12064
12080
  // TODO: obsLocations
12065
- obsSets: obsSetsSpatialdataSchema
12081
+ obsSets: obsSetsSpatialdataSchema,
12082
+ // TODO: obsEmbedding
12083
+ // TODO: obsLabels
12084
+ // TODO: featureLabels
12085
+ coordinateSystem: z.string().optional().describe("The name of a coordinate transformation output used to transform all elements which lack a per-element coordinateSystem property.")
12066
12086
  }).partial();
12067
12087
  z.object({
12068
12088
  obsLabelsTypes: z.array(z.string()).optional(),
@@ -18923,15 +18943,13 @@ function stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, exp
18923
18943
  }
18924
18944
  function aggregateStratifiedExpressionData(stratifiedResult, geneSelection) {
18925
18945
  const result = new InternMap([], JSON.stringify);
18926
- if (stratifiedResult) {
18927
- Array.from(stratifiedResult.keys()).forEach((cellSetKey) => {
18928
- result.set(cellSetKey, new InternMap([], JSON.stringify));
18929
- Array.from(stratifiedResult.get(cellSetKey).keys()).forEach((sampleSetKey) => {
18930
- const values2 = stratifiedResult.get(cellSetKey).get(sampleSetKey).get(geneSelection[0]);
18931
- result.get(cellSetKey).set(sampleSetKey, values2);
18932
- });
18946
+ Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
18947
+ result.set(cellSetKey, new InternMap([], JSON.stringify));
18948
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
18949
+ const values2 = secondLevelInternMap.get(geneSelection[0]);
18950
+ result.get(cellSetKey).set(sampleSetKey, values2);
18933
18951
  });
18934
- }
18952
+ });
18935
18953
  return result;
18936
18954
  }
18937
18955
  const $b5e257d569688ac6$var$defaultContext = {
@@ -98965,7 +98983,7 @@ keysShim.shim = function shimObjectKeys() {
98965
98983
  return Object.keys || keysShim;
98966
98984
  };
98967
98985
  var objectKeys$1 = keysShim;
98968
- var shams$2 = function hasSymbols() {
98986
+ var shams$1 = function hasSymbols() {
98969
98987
  if (typeof Symbol !== "function" || typeof Object.getOwnPropertySymbols !== "function") {
98970
98988
  return false;
98971
98989
  }
@@ -99010,9 +99028,9 @@ var shams$2 = function hasSymbols() {
99010
99028
  }
99011
99029
  return true;
99012
99030
  };
99013
- var hasSymbols$4 = shams$2;
99014
- var shams$1 = function hasToStringTagShams() {
99015
- return hasSymbols$4() && !!Symbol.toStringTag;
99031
+ var hasSymbols$3 = shams$1;
99032
+ var shams = function hasToStringTagShams() {
99033
+ return hasSymbols$3() && !!Symbol.toStringTag;
99016
99034
  };
99017
99035
  var esErrors = Error;
99018
99036
  var _eval = EvalError;
@@ -99022,8 +99040,8 @@ var syntax = SyntaxError;
99022
99040
  var type$1 = TypeError;
99023
99041
  var uri = URIError;
99024
99042
  var origSymbol = typeof Symbol !== "undefined" && Symbol;
99025
- var hasSymbolSham = shams$2;
99026
- var hasSymbols$3 = function hasNativeSymbols() {
99043
+ var hasSymbolSham = shams$1;
99044
+ var hasSymbols$2 = function hasNativeSymbols() {
99027
99045
  if (typeof origSymbol !== "function") {
99028
99046
  return false;
99029
99047
  }
@@ -99039,11 +99057,12 @@ var hasSymbols$3 = function hasNativeSymbols() {
99039
99057
  return hasSymbolSham();
99040
99058
  };
99041
99059
  var test$1 = {
99060
+ __proto__: null,
99042
99061
  foo: {}
99043
99062
  };
99044
99063
  var $Object$1 = Object;
99045
99064
  var hasProto$1 = function hasProto() {
99046
- return { __proto__: test$1 }.foo === test$1.foo && !({ __proto__: null } instanceof $Object$1);
99065
+ return { __proto__: test$1 }.foo === test$1.foo && !(test$1 instanceof $Object$1);
99047
99066
  };
99048
99067
  var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
99049
99068
  var toStr$2 = Object.prototype.toString;
@@ -99158,7 +99177,7 @@ var ThrowTypeError = $gOPD$2 ? function() {
99158
99177
  }
99159
99178
  }
99160
99179
  }() : throwTypeError;
99161
- var hasSymbols$2 = hasSymbols$3();
99180
+ var hasSymbols$1 = hasSymbols$2();
99162
99181
  var hasProto2 = hasProto$1();
99163
99182
  var getProto$2 = Object.getPrototypeOf || (hasProto2 ? function(x2) {
99164
99183
  return x2.__proto__;
@@ -99170,7 +99189,7 @@ var INTRINSICS = {
99170
99189
  "%AggregateError%": typeof AggregateError === "undefined" ? undefined$2 : AggregateError,
99171
99190
  "%Array%": Array,
99172
99191
  "%ArrayBuffer%": typeof ArrayBuffer === "undefined" ? undefined$2 : ArrayBuffer,
99173
- "%ArrayIteratorPrototype%": hasSymbols$2 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$2,
99192
+ "%ArrayIteratorPrototype%": hasSymbols$1 && getProto$2 ? getProto$2([][Symbol.iterator]()) : undefined$2,
99174
99193
  "%AsyncFromSyncIteratorPrototype%": undefined$2,
99175
99194
  "%AsyncFunction%": needsEval,
99176
99195
  "%AsyncGenerator%": needsEval,
@@ -99201,10 +99220,10 @@ var INTRINSICS = {
99201
99220
  "%Int32Array%": typeof Int32Array === "undefined" ? undefined$2 : Int32Array,
99202
99221
  "%isFinite%": isFinite,
99203
99222
  "%isNaN%": isNaN,
99204
- "%IteratorPrototype%": hasSymbols$2 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$2,
99223
+ "%IteratorPrototype%": hasSymbols$1 && getProto$2 ? getProto$2(getProto$2([][Symbol.iterator]())) : undefined$2,
99205
99224
  "%JSON%": typeof JSON === "object" ? JSON : undefined$2,
99206
99225
  "%Map%": typeof Map === "undefined" ? undefined$2 : Map,
99207
- "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols$2 || !getProto$2 ? undefined$2 : getProto$2((/* @__PURE__ */ new Map())[Symbol.iterator]()),
99226
+ "%MapIteratorPrototype%": typeof Map === "undefined" || !hasSymbols$1 || !getProto$2 ? undefined$2 : getProto$2((/* @__PURE__ */ new Map())[Symbol.iterator]()),
99208
99227
  "%Math%": Math,
99209
99228
  "%Number%": Number,
99210
99229
  "%Object%": Object,
@@ -99217,11 +99236,11 @@ var INTRINSICS = {
99217
99236
  "%Reflect%": typeof Reflect === "undefined" ? undefined$2 : Reflect,
99218
99237
  "%RegExp%": RegExp,
99219
99238
  "%Set%": typeof Set === "undefined" ? undefined$2 : Set,
99220
- "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols$2 || !getProto$2 ? undefined$2 : getProto$2((/* @__PURE__ */ new Set())[Symbol.iterator]()),
99239
+ "%SetIteratorPrototype%": typeof Set === "undefined" || !hasSymbols$1 || !getProto$2 ? undefined$2 : getProto$2((/* @__PURE__ */ new Set())[Symbol.iterator]()),
99221
99240
  "%SharedArrayBuffer%": typeof SharedArrayBuffer === "undefined" ? undefined$2 : SharedArrayBuffer,
99222
99241
  "%String%": String,
99223
- "%StringIteratorPrototype%": hasSymbols$2 && getProto$2 ? getProto$2(""[Symbol.iterator]()) : undefined$2,
99224
- "%Symbol%": hasSymbols$2 ? Symbol : undefined$2,
99242
+ "%StringIteratorPrototype%": hasSymbols$1 && getProto$2 ? getProto$2(""[Symbol.iterator]()) : undefined$2,
99243
+ "%Symbol%": hasSymbols$1 ? Symbol : undefined$2,
99225
99244
  "%SyntaxError%": $SyntaxError$1,
99226
99245
  "%ThrowTypeError%": ThrowTypeError,
99227
99246
  "%TypedArray%": TypedArray,
@@ -99590,7 +99609,7 @@ var callBound$2 = function callBoundIntrinsic(name2, allowMissing) {
99590
99609
  }
99591
99610
  return intrinsic;
99592
99611
  };
99593
- var hasToStringTag$2 = shams$1();
99612
+ var hasToStringTag$2 = shams();
99594
99613
  var callBound$1 = callBound$2;
99595
99614
  var $toString$1 = callBound$1("Object.prototype.toString");
99596
99615
  var isStandardArguments = function isArguments2(value2) {
@@ -99635,7 +99654,7 @@ hasPropertyDescriptors2.hasArrayLengthDefineBug = function hasArrayLengthDefineB
99635
99654
  };
99636
99655
  var hasPropertyDescriptors_1 = hasPropertyDescriptors2;
99637
99656
  var keys$4 = objectKeys$1;
99638
- var hasSymbols$1 = typeof Symbol === "function" && typeof Symbol("foo") === "symbol";
99657
+ var hasSymbols2 = typeof Symbol === "function" && typeof Symbol("foo") === "symbol";
99639
99658
  var toStr$1 = Object.prototype.toString;
99640
99659
  var concat = Array.prototype.concat;
99641
99660
  var defineDataProperty2 = defineDataProperty$1;
@@ -99662,7 +99681,7 @@ var defineProperty$1 = function(object2, name2, value2, predicate) {
99662
99681
  var defineProperties = function(object2, map2) {
99663
99682
  var predicates = arguments.length > 2 ? arguments[2] : {};
99664
99683
  var props = keys$4(map2);
99665
- if (hasSymbols$1) {
99684
+ if (hasSymbols2) {
99666
99685
  props = concat.call(props, Object.getOwnPropertySymbols(map2));
99667
99686
  }
99668
99687
  for (var i2 = 0; i2 < props.length; i2 += 1) {
@@ -99713,10 +99732,6 @@ define$4(polyfill$1, {
99713
99732
  shim: shim$2
99714
99733
  });
99715
99734
  var objectIs = polyfill$1;
99716
- var hasSymbols2 = shams$2;
99717
- var shams = function hasToStringTagShams2() {
99718
- return hasSymbols2() && !!Symbol.toStringTag;
99719
- };
99720
99735
  var callBound = callBound$2;
99721
99736
  var hasToStringTag$1 = shams();
99722
99737
  var has$2;
@@ -99923,7 +99938,7 @@ var tryDateObject = function tryDateGetDayCall(value2) {
99923
99938
  };
99924
99939
  var toStr = Object.prototype.toString;
99925
99940
  var dateClass = "[object Date]";
99926
- var hasToStringTag = shams$1();
99941
+ var hasToStringTag = shams();
99927
99942
  var isDateObject = function isDateObject2(value2) {
99928
99943
  if (typeof value2 !== "object" || value2 === null) {
99929
99944
  return false;
@@ -133209,16 +133224,16 @@ function addDecoder(cases2, importFn) {
133209
133224
  }
133210
133225
  cases2.forEach((c2) => registry$1.set(c2, importFn));
133211
133226
  }
133212
- addDecoder([void 0, 1], () => import("./raw-d637b4c6.js").then((m2) => m2.default));
133213
- addDecoder(5, () => import("./lzw-f0fcb4b1.js").then((m2) => m2.default));
133227
+ addDecoder([void 0, 1], () => import("./raw-ee5f13d0.js").then((m2) => m2.default));
133228
+ addDecoder(5, () => import("./lzw-401bb3ee.js").then((m2) => m2.default));
133214
133229
  addDecoder(6, () => {
133215
133230
  throw new Error("old style JPEG compression is not supported.");
133216
133231
  });
133217
- addDecoder(7, () => import("./jpeg-7970799f.js").then((m2) => m2.default));
133218
- addDecoder([8, 32946], () => import("./deflate-eda0aad4.js").then((m2) => m2.default));
133219
- addDecoder(32773, () => import("./packbits-4fa7d5d8.js").then((m2) => m2.default));
133220
- addDecoder(34887, () => import("./lerc-8d94d4f9.js").then((m2) => m2.default));
133221
- addDecoder(50001, () => import("./webimage-9a9c8587.js").then((m2) => m2.default));
133232
+ addDecoder(7, () => import("./jpeg-c60720b8.js").then((m2) => m2.default));
133233
+ addDecoder([8, 32946], () => import("./deflate-9412420e.js").then((m2) => m2.default));
133234
+ addDecoder(32773, () => import("./packbits-3219f1f5.js").then((m2) => m2.default));
133235
+ addDecoder(34887, () => import("./lerc-922b46fe.js").then((m2) => m2.default));
133236
+ addDecoder(50001, () => import("./webimage-9f8ff63a.js").then((m2) => m2.default));
133222
133237
  function decodeRowAcc(row, stride) {
133223
133238
  let length2 = row.length - stride;
133224
133239
  let offset5 = 0;
@@ -153767,21 +153782,21 @@ function summarize(iterable, keepZeros) {
153767
153782
  }
153768
153783
  function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
153769
153784
  const result = new InternMap([], JSON.stringify);
153770
- Array.from(stratifiedResult.keys()).forEach((cellSetKey) => {
153785
+ Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
153771
153786
  result.set(cellSetKey, new InternMap([], JSON.stringify));
153772
- Array.from(stratifiedResult.get(cellSetKey).keys()).forEach((sampleSetKey) => {
153787
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
153773
153788
  result.get(cellSetKey).set(sampleSetKey, new InternMap([], JSON.stringify));
153774
- const allGenes = stratifiedResult.get(cellSetKey).get(sampleSetKey);
153775
- Array.from(allGenes.keys()).forEach((geneKey) => {
153776
- const values2 = allGenes.get(geneKey);
153777
- const exprMean = mean$1(values2);
153778
- const numPos = values2.reduce((acc, val) => val > posThreshold ? acc + 1 : acc, 0);
153779
- const fracPos = numPos / values2.length;
153780
- const dotSummary = {
153781
- meanExpInGroup: exprMean,
153782
- fracPosInGroup: fracPos
153783
- };
153784
- result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
153789
+ Array.from(secondLevelInternMap.entries()).forEach(([geneKey, values2]) => {
153790
+ if (values2) {
153791
+ const exprMean = mean$1(values2);
153792
+ const numPos = values2.reduce((acc, val) => val > posThreshold ? acc + 1 : acc, 0);
153793
+ const fracPos = numPos / values2.length;
153794
+ const dotSummary = {
153795
+ meanExpInGroup: exprMean,
153796
+ fracPosInGroup: fracPos
153797
+ };
153798
+ result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
153799
+ }
153785
153800
  });
153786
153801
  });
153787
153802
  });
@@ -153789,10 +153804,10 @@ function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
153789
153804
  }
153790
153805
  function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
153791
153806
  const summarizedResult = new InternMap([], JSON.stringify);
153792
- Array.from(stratifiedResult.keys()).forEach((cellSetKey) => {
153807
+ Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
153793
153808
  summarizedResult.set(cellSetKey, new InternMap([], JSON.stringify));
153794
- Array.from(stratifiedResult.get(cellSetKey).keys()).forEach((sampleSetKey) => {
153795
- const values2 = stratifiedResult.get(cellSetKey).get(sampleSetKey);
153809
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
153810
+ const values2 = secondLevelInternMap;
153796
153811
  const summary = summarize(values2, keepZeros);
153797
153812
  summarizedResult.get(cellSetKey).set(sampleSetKey, summary);
153798
153813
  });
@@ -153800,11 +153815,11 @@ function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
153800
153815
  return summarizedResult;
153801
153816
  }
153802
153817
  function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp) {
153803
- const groupSummaries = Array.from(summarizedResult.keys()).map((cellSetKey) => ({
153818
+ const groupSummaries = Array.from(summarizedResult.entries()).map(([cellSetKey, firstLevelInternMap]) => ({
153804
153819
  key: cellSetKey,
153805
- value: Array.from(summarizedResult.get(cellSetKey).keys()).map((sampleSetKey) => ({
153820
+ value: Array.from(firstLevelInternMap.entries()).map(([sampleSetKey, secondLevelInternMap]) => ({
153806
153821
  key: sampleSetKey,
153807
- value: summarizedResult.get(cellSetKey).get(sampleSetKey)
153822
+ value: secondLevelInternMap
153808
153823
  }))
153809
153824
  }));
153810
153825
  const groupData = groupSummaries.map(({ key: key2, value: value2 }) => ({
@@ -153819,7 +153834,9 @@ function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp)
153819
153834
  key: kv.key,
153820
153835
  value: kv.value.map((subKv) => ({ key: subKv.key, value: histogram(subKv.value) }))
153821
153836
  }));
153822
- const groupBinsMax = max$3(groupBins.flatMap((d) => d.value.flatMap((subKv) => subKv.value.map((v) => v.length))));
153837
+ const groupBinsMax = max$3(
153838
+ groupBins.flatMap((d) => d.value.flatMap((subKv) => subKv.value.map((v) => v.length)))
153839
+ );
153823
153840
  return {
153824
153841
  // Array of [{ key, value: [
153825
153842
  // { key, value: {
@@ -205692,7 +205709,7 @@ function CellSetSizesPlot(props) {
205692
205709
  field: "keyName",
205693
205710
  type: "nominal",
205694
205711
  axis: { labelExpr: `substring(datum.label, ${keyLength})` },
205695
- title: "Cell Set",
205712
+ title: `${captializedObsType} Set`,
205696
205713
  sort: keys3
205697
205714
  },
205698
205715
  y: {
@@ -206229,10 +206246,9 @@ function useExpressionSummaries(sampleEdges, sampleSets, sampleSetSelection, exp
206229
206246
  JSON.stringify
206230
206247
  );
206231
206248
  const result = [];
206232
- Array.from(dotData.keys()).forEach((cellSetKey) => {
206233
- Array.from(dotData.get(cellSetKey).keys()).forEach((sampleSetKey) => {
206234
- Array.from(dotData.get(cellSetKey).get(sampleSetKey).keys()).forEach((geneKey) => {
206235
- const dotObj = dotData.get(cellSetKey).get(sampleSetKey).get(geneKey);
206249
+ Array.from(dotData.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
206250
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
206251
+ Array.from(secondLevelInternMap.entries()).forEach(([geneKey, dotObj]) => {
206236
206252
  const featureName = geneKey;
206237
206253
  result.push({
206238
206254
  key: v4$1(),
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { c, C, b, a, e, D, d, E, F } from "./index-65c79335.js";
1
+ import { c, C, b, a, e, D, d, E, F } from "./index-5a8190d9.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-65c79335.js";
1
+ import { B as BaseDecoder } from "./index-5a8190d9.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-65c79335.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-5a8190d9.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-65c79335.js";
1
+ import { B as BaseDecoder } from "./index-5a8190d9.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-65c79335.js";
1
+ import { B as BaseDecoder } from "./index-5a8190d9.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-65c79335.js";
1
+ import { B as BaseDecoder } from "./index-5a8190d9.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-65c79335.js";
1
+ import { B as BaseDecoder } from "./index-5a8190d9.js";
2
2
  import "react";
3
3
  import "@vitessce/vit-s";
4
4
  import "react-dom";
@@ -85,7 +85,7 @@ export default function CellSetSizesPlot(props) {
85
85
  field: 'keyName',
86
86
  type: 'nominal',
87
87
  axis: { labelExpr: `substring(datum.label, ${keyLength})` },
88
- title: 'Cell Set',
88
+ title: `${captializedObsType} Set`,
89
89
  sort: keys,
90
90
  },
91
91
  y: {
@@ -1 +1 @@
1
- {"version":3,"file":"dot-plot-hook.d.ts","sourceRoot":"","sources":["../src/dot-plot-hook.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iJAbW,MAAM,sBACN,MAAM,iBAEN,KAAK,oBACL,KAAK,gBACL,MAAM,EAAE,yBACR,MAAM,GAAC,IAAI,oCAEX,MAAM,mDA8EhB"}
1
+ {"version":3,"file":"dot-plot-hook.d.ts","sourceRoot":"","sources":["../src/dot-plot-hook.js"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,iJAbW,MAAM,sBACN,MAAM,iBAEN,KAAK,oBACL,KAAK,gBACL,MAAM,EAAE,yBACR,MAAM,GAAC,IAAI,oCAEX,MAAM,mDA6EhB"}
@@ -1,3 +1,4 @@
1
+ /* eslint-disable max-len */
1
2
  import { useMemo } from 'react';
2
3
  import { InternMap } from 'internmap';
3
4
  import { v4 as uuidv4 } from 'uuid';
@@ -36,10 +37,9 @@ export function useExpressionSummaries(sampleEdges, sampleSets, sampleSetSelecti
36
37
  const cellSetToUuid = new InternMap(cellSetSelection?.map(sampleSet => ([sampleSet, uuidv4()])), JSON.stringify);
37
38
  const sampleSetToUuid = new InternMap(sampleSetSelection?.map(sampleSet => ([sampleSet, uuidv4()])), JSON.stringify);
38
39
  const result = [];
39
- Array.from(dotData.keys()).forEach((cellSetKey) => {
40
- Array.from(dotData.get(cellSetKey).keys()).forEach((sampleSetKey) => {
41
- Array.from(dotData.get(cellSetKey).get(sampleSetKey).keys()).forEach((geneKey) => {
42
- const dotObj = dotData.get(cellSetKey).get(sampleSetKey).get(geneKey);
40
+ Array.from(dotData.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
41
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
42
+ Array.from(secondLevelInternMap.entries()).forEach(([geneKey, dotObj]) => {
43
43
  const featureName = geneKey;
44
44
  result.push({
45
45
  key: uuidv4(), // Unique key for this dot.
@@ -42,10 +42,10 @@ export function histogramStratifiedExpressionData(summarizedResult: any, binCoun
42
42
  key: any;
43
43
  value: {
44
44
  key: any;
45
- value: any;
45
+ value: import("d3-array").Bin<number, number>[];
46
46
  }[];
47
47
  }[];
48
- groupBinsMax: any;
48
+ groupBinsMax: number | undefined;
49
49
  y: any;
50
50
  };
51
51
  //# sourceMappingURL=expr-hooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expr-hooks.d.ts","sourceRoot":"","sources":["../src/expr-hooks.js"],"names":[],"mappings":"AAgDA;;;;;;GAMG;AACH,8DAJW,GAAC,gBACD,GAAC,OA+BX;AAED;;;;;;GAMG;AACH,oEAJW,GAAC,aACD,GAAC,OAkBX;AAED;;;;;;;;GAQG;AACH,oEALW,GAAC,YACD,GAAC,YACD,GAAC;;;;;;;;;;;;;;;;;;;;;;;;EAsDX"}
1
+ {"version":3,"file":"expr-hooks.d.ts","sourceRoot":"","sources":["../src/expr-hooks.js"],"names":[],"mappings":"AAiDA;;;;;;GAMG;AACH,8DAJW,GAAC,gBACD,GAAC,OA4BX;AAED;;;;;;GAMG;AACH,oEAJW,GAAC,aACD,GAAC,OAkBX;AAED;;;;;;;;GAQG;AACH,oEALW,GAAC,YACD,GAAC,YACD,GAAC;;;;;;;;;;;;;;;;;;;;;;;;EA4DX"}
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable camelcase */
2
+ /* eslint-disable max-len */
2
3
  import { InternMap } from 'internmap';
3
4
  import { scaleLinear } from 'd3-scale';
4
5
  import { bin, min, max, mean as d3_mean, deviation as d3_deviation, ascending as d3_ascending, quantileSorted, } from 'd3-array';
@@ -45,21 +46,21 @@ function summarize(iterable, keepZeros) {
45
46
  */
46
47
  export function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
47
48
  const result = new InternMap([], JSON.stringify);
48
- Array.from(stratifiedResult.keys()).forEach((cellSetKey) => {
49
+ Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
49
50
  result.set(cellSetKey, new InternMap([], JSON.stringify));
50
- Array.from(stratifiedResult.get(cellSetKey).keys()).forEach((sampleSetKey) => {
51
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
51
52
  result.get(cellSetKey).set(sampleSetKey, new InternMap([], JSON.stringify));
52
- const allGenes = stratifiedResult.get(cellSetKey).get(sampleSetKey);
53
- Array.from(allGenes.keys()).forEach((geneKey) => {
54
- const values = allGenes.get(geneKey);
55
- const exprMean = d3_mean(values);
56
- const numPos = values.reduce((acc, val) => (val > posThreshold ? acc + 1 : acc), 0);
57
- const fracPos = numPos / values.length;
58
- const dotSummary = {
59
- meanExpInGroup: exprMean,
60
- fracPosInGroup: fracPos,
61
- };
62
- result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
53
+ Array.from(secondLevelInternMap.entries()).forEach(([geneKey, values]) => {
54
+ if (values) {
55
+ const exprMean = d3_mean(values);
56
+ const numPos = values.reduce((acc, val) => (val > posThreshold ? acc + 1 : acc), 0);
57
+ const fracPos = numPos / values.length;
58
+ const dotSummary = {
59
+ meanExpInGroup: exprMean,
60
+ fracPosInGroup: fracPos,
61
+ };
62
+ result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
63
+ }
63
64
  });
64
65
  });
65
66
  });
@@ -74,10 +75,10 @@ export function dotStratifiedExpressionData(stratifiedResult, posThreshold) {
74
75
  */
75
76
  export function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
76
77
  const summarizedResult = new InternMap([], JSON.stringify);
77
- Array.from(stratifiedResult.keys()).forEach((cellSetKey) => {
78
+ Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
78
79
  summarizedResult.set(cellSetKey, new InternMap([], JSON.stringify));
79
- Array.from(stratifiedResult.get(cellSetKey).keys()).forEach((sampleSetKey) => {
80
- const values = stratifiedResult.get(cellSetKey).get(sampleSetKey);
80
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
81
+ const values = secondLevelInternMap;
81
82
  const summary = summarize(values, keepZeros);
82
83
  summarizedResult.get(cellSetKey).set(sampleSetKey, summary);
83
84
  });
@@ -94,11 +95,13 @@ export function summarizeStratifiedExpressionData(stratifiedResult, keepZeros) {
94
95
  * @returns
95
96
  */
96
97
  export function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp) {
97
- const groupSummaries = Array.from(summarizedResult.keys()).map(cellSetKey => ({
98
+ const groupSummaries = Array.from(summarizedResult.entries())
99
+ .map(([cellSetKey, firstLevelInternMap]) => ({
98
100
  key: cellSetKey,
99
- value: Array.from(summarizedResult.get(cellSetKey).keys()).map(sampleSetKey => ({
101
+ value: Array.from(firstLevelInternMap.entries())
102
+ .map(([sampleSetKey, secondLevelInternMap]) => ({
100
103
  key: sampleSetKey,
101
- value: summarizedResult.get(cellSetKey).get(sampleSetKey),
104
+ value: secondLevelInternMap,
102
105
  })),
103
106
  }));
104
107
  const groupData = groupSummaries
@@ -106,7 +109,9 @@ export function histogramStratifiedExpressionData(summarizedResult, binCount, yM
106
109
  key,
107
110
  value: value.map(({ key: subKey, value: subValue }) => ({ key: subKey, value: subValue.nonOutliers })),
108
111
  }));
109
- const trimmedData = groupData.map(kv => kv.value.map(subKv => subKv.value).flat()).flat();
112
+ const trimmedData = groupData
113
+ .map(kv => kv.value.map(subKv => subKv.value).flat())
114
+ .flat();
110
115
  const yMin = (yMinProp === null ? Math.min(0, min(trimmedData)) : yMinProp);
111
116
  // For the y domain, use the yMin prop
112
117
  // to support a use case such as 'Aspect Ratio',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitessce/statistical-plots",
3
- "version": "3.4.12",
4
- "author": "Gehlenborg Lab",
3
+ "version": "3.5.0",
4
+ "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
7
7
  "type": "git",
@@ -28,12 +28,12 @@
28
28
  "react-aria": "^3.28.0",
29
29
  "internmap": "^2.0.3",
30
30
  "uuid": "^9.0.0",
31
- "@vitessce/constants-internal": "3.4.12",
32
- "@vitessce/sets-utils": "3.4.12",
33
- "@vitessce/utils": "3.4.12",
34
- "@vitessce/vega": "3.4.12",
35
- "@vitessce/vit-s": "3.4.12",
36
- "@vitessce/gl": "3.4.12"
31
+ "@vitessce/constants-internal": "3.5.0",
32
+ "@vitessce/sets-utils": "3.5.0",
33
+ "@vitessce/utils": "3.5.0",
34
+ "@vitessce/vega": "3.5.0",
35
+ "@vitessce/vit-s": "3.5.0",
36
+ "@vitessce/gl": "3.5.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "react": "^18.0.0",
@@ -99,7 +99,7 @@ export default function CellSetSizesPlot(props) {
99
99
  field: 'keyName',
100
100
  type: 'nominal',
101
101
  axis: { labelExpr: `substring(datum.label, ${keyLength})` },
102
- title: 'Cell Set',
102
+ title: `${captializedObsType} Set`,
103
103
  sort: keys,
104
104
  },
105
105
  y: {
@@ -1,4 +1,4 @@
1
-
1
+ /* eslint-disable max-len */
2
2
  import { useMemo } from 'react';
3
3
  import { InternMap } from 'internmap';
4
4
  import { v4 as uuidv4 } from 'uuid';
@@ -68,10 +68,9 @@ export function useExpressionSummaries(
68
68
  );
69
69
 
70
70
  const result = [];
71
- Array.from(dotData.keys()).forEach((cellSetKey) => {
72
- Array.from(dotData.get(cellSetKey).keys()).forEach((sampleSetKey) => {
73
- Array.from(dotData.get(cellSetKey).get(sampleSetKey).keys()).forEach((geneKey) => {
74
- const dotObj = dotData.get(cellSetKey).get(sampleSetKey).get(geneKey);
71
+ Array.from(dotData.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
72
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
73
+ Array.from(secondLevelInternMap.entries()).forEach(([geneKey, dotObj]) => {
75
74
  const featureName = geneKey;
76
75
  result.push({
77
76
  key: uuidv4(), // Unique key for this dot.
package/src/expr-hooks.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /* eslint-disable camelcase */
2
+ /* eslint-disable max-len */
2
3
  import { InternMap } from 'internmap';
3
4
  import { scaleLinear } from 'd3-scale';
4
5
  import {
@@ -57,26 +58,23 @@ export function dotStratifiedExpressionData(
57
58
  stratifiedResult, posThreshold,
58
59
  ) {
59
60
  const result = new InternMap([], JSON.stringify);
60
- Array.from(stratifiedResult.keys()).forEach((cellSetKey) => {
61
+ Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
61
62
  result.set(cellSetKey, new InternMap([], JSON.stringify));
62
- Array.from(stratifiedResult.get(cellSetKey).keys()).forEach((sampleSetKey) => {
63
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
63
64
  result.get(cellSetKey).set(sampleSetKey, new InternMap([], JSON.stringify));
64
-
65
- const allGenes = stratifiedResult.get(cellSetKey).get(sampleSetKey);
66
-
67
- Array.from(allGenes.keys()).forEach((geneKey) => {
68
- const values = allGenes.get(geneKey);
69
-
70
- const exprMean = d3_mean(values);
71
- const numPos = values.reduce((acc, val) => (val > posThreshold ? acc + 1 : acc), 0);
72
- const fracPos = numPos / values.length;
73
-
74
- const dotSummary = {
75
- meanExpInGroup: exprMean,
76
- fracPosInGroup: fracPos,
77
- };
78
-
79
- result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
65
+ Array.from(secondLevelInternMap.entries()).forEach(([geneKey, values]) => {
66
+ if (values) {
67
+ const exprMean = d3_mean(values);
68
+ const numPos = values.reduce((acc, val) => (val > posThreshold ? acc + 1 : acc), 0);
69
+ const fracPos = numPos / values.length;
70
+
71
+ const dotSummary = {
72
+ meanExpInGroup: exprMean,
73
+ fracPosInGroup: fracPos,
74
+ };
75
+
76
+ result.get(cellSetKey).get(sampleSetKey).set(geneKey, dotSummary);
77
+ }
80
78
  });
81
79
  });
82
80
  });
@@ -95,10 +93,10 @@ export function summarizeStratifiedExpressionData(
95
93
  ) {
96
94
  const summarizedResult = new InternMap([], JSON.stringify);
97
95
 
98
- Array.from(stratifiedResult.keys()).forEach((cellSetKey) => {
96
+ Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
99
97
  summarizedResult.set(cellSetKey, new InternMap([], JSON.stringify));
100
- Array.from(stratifiedResult.get(cellSetKey).keys()).forEach((sampleSetKey) => {
101
- const values = stratifiedResult.get(cellSetKey).get(sampleSetKey);
98
+ Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
99
+ const values = secondLevelInternMap;
102
100
  const summary = summarize(values, keepZeros);
103
101
  summarizedResult.get(cellSetKey).set(sampleSetKey, summary);
104
102
  });
@@ -119,13 +117,15 @@ export function summarizeStratifiedExpressionData(
119
117
  export function histogramStratifiedExpressionData(
120
118
  summarizedResult, binCount, yMinProp,
121
119
  ) {
122
- const groupSummaries = Array.from(summarizedResult.keys()).map(cellSetKey => ({
123
- key: cellSetKey,
124
- value: Array.from(summarizedResult.get(cellSetKey).keys()).map(sampleSetKey => ({
125
- key: sampleSetKey,
126
- value: summarizedResult.get(cellSetKey).get(sampleSetKey),
127
- })),
128
- }));
120
+ const groupSummaries = Array.from(summarizedResult.entries())
121
+ .map(([cellSetKey, firstLevelInternMap]) => ({
122
+ key: cellSetKey,
123
+ value: Array.from(firstLevelInternMap.entries())
124
+ .map(([sampleSetKey, secondLevelInternMap]) => ({
125
+ key: sampleSetKey,
126
+ value: secondLevelInternMap,
127
+ })),
128
+ }));
129
129
 
130
130
  const groupData = groupSummaries
131
131
  .map(({ key, value }) => ({
@@ -134,7 +134,9 @@ export function histogramStratifiedExpressionData(
134
134
  { key: subKey, value: subValue.nonOutliers }
135
135
  )),
136
136
  }));
137
- const trimmedData = groupData.map(kv => kv.value.map(subKv => subKv.value).flat()).flat();
137
+ const trimmedData = groupData
138
+ .map(kv => kv.value.map(subKv => subKv.value).flat())
139
+ .flat();
138
140
 
139
141
  const yMin = (yMinProp === null ? Math.min(0, min(trimmedData)) : yMinProp);
140
142
 
@@ -152,8 +154,10 @@ export function histogramStratifiedExpressionData(
152
154
  value: kv.value.map(subKv => (
153
155
  { key: subKv.key, value: histogram(subKv.value) }
154
156
  )) }));
155
- const groupBinsMax = max(groupBins
156
- .flatMap(d => d.value.flatMap(subKv => subKv.value.map(v => v.length))));
157
+ const groupBinsMax = max(
158
+ groupBins
159
+ .flatMap(d => d.value.flatMap(subKv => subKv.value.map(v => v.length))),
160
+ );
157
161
 
158
162
  return {
159
163
  // Array of [{ key, value: [