@vitessce/sets-utils 3.5.6 → 3.5.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2458,6 +2458,258 @@ function getNextScope(prevScopes) {
2458
2458
  } while (prevScopes.includes(nextScope));
2459
2459
  return nextScope;
2460
2460
  }
2461
+ var loglevel = { exports: {} };
2462
+ (function(module2) {
2463
+ (function(root2, definition) {
2464
+ if (module2.exports) {
2465
+ module2.exports = definition();
2466
+ } else {
2467
+ root2.log = definition();
2468
+ }
2469
+ })(commonjsGlobal, function() {
2470
+ var noop = function() {
2471
+ };
2472
+ var undefinedType2 = "undefined";
2473
+ var isIE = typeof window !== undefinedType2 && typeof window.navigator !== undefinedType2 && /Trident\/|MSIE /.test(window.navigator.userAgent);
2474
+ var logMethods = [
2475
+ "trace",
2476
+ "debug",
2477
+ "info",
2478
+ "warn",
2479
+ "error"
2480
+ ];
2481
+ var _loggersByName = {};
2482
+ var defaultLogger = null;
2483
+ function bindMethod(obj, methodName) {
2484
+ var method = obj[methodName];
2485
+ if (typeof method.bind === "function") {
2486
+ return method.bind(obj);
2487
+ } else {
2488
+ try {
2489
+ return Function.prototype.bind.call(method, obj);
2490
+ } catch (e) {
2491
+ return function() {
2492
+ return Function.prototype.apply.apply(method, [obj, arguments]);
2493
+ };
2494
+ }
2495
+ }
2496
+ }
2497
+ function traceForIE() {
2498
+ if (console.log) {
2499
+ if (console.log.apply) {
2500
+ console.log.apply(console, arguments);
2501
+ } else {
2502
+ Function.prototype.apply.apply(console.log, [console, arguments]);
2503
+ }
2504
+ }
2505
+ if (console.trace)
2506
+ console.trace();
2507
+ }
2508
+ function realMethod(methodName) {
2509
+ if (methodName === "debug") {
2510
+ methodName = "log";
2511
+ }
2512
+ if (typeof console === undefinedType2) {
2513
+ return false;
2514
+ } else if (methodName === "trace" && isIE) {
2515
+ return traceForIE;
2516
+ } else if (console[methodName] !== void 0) {
2517
+ return bindMethod(console, methodName);
2518
+ } else if (console.log !== void 0) {
2519
+ return bindMethod(console, "log");
2520
+ } else {
2521
+ return noop;
2522
+ }
2523
+ }
2524
+ function replaceLoggingMethods() {
2525
+ var level = this.getLevel();
2526
+ for (var i = 0; i < logMethods.length; i++) {
2527
+ var methodName = logMethods[i];
2528
+ this[methodName] = i < level ? noop : this.methodFactory(methodName, level, this.name);
2529
+ }
2530
+ this.log = this.debug;
2531
+ if (typeof console === undefinedType2 && level < this.levels.SILENT) {
2532
+ return "No console available for logging";
2533
+ }
2534
+ }
2535
+ function enableLoggingWhenConsoleArrives(methodName) {
2536
+ return function() {
2537
+ if (typeof console !== undefinedType2) {
2538
+ replaceLoggingMethods.call(this);
2539
+ this[methodName].apply(this, arguments);
2540
+ }
2541
+ };
2542
+ }
2543
+ function defaultMethodFactory(methodName, _level, _loggerName) {
2544
+ return realMethod(methodName) || enableLoggingWhenConsoleArrives.apply(this, arguments);
2545
+ }
2546
+ function Logger(name, factory) {
2547
+ var self2 = this;
2548
+ var inheritedLevel;
2549
+ var defaultLevel;
2550
+ var userLevel;
2551
+ var storageKey = "loglevel";
2552
+ if (typeof name === "string") {
2553
+ storageKey += ":" + name;
2554
+ } else if (typeof name === "symbol") {
2555
+ storageKey = void 0;
2556
+ }
2557
+ function persistLevelIfPossible(levelNum) {
2558
+ var levelName = (logMethods[levelNum] || "silent").toUpperCase();
2559
+ if (typeof window === undefinedType2 || !storageKey)
2560
+ return;
2561
+ try {
2562
+ window.localStorage[storageKey] = levelName;
2563
+ return;
2564
+ } catch (ignore) {
2565
+ }
2566
+ try {
2567
+ window.document.cookie = encodeURIComponent(storageKey) + "=" + levelName + ";";
2568
+ } catch (ignore) {
2569
+ }
2570
+ }
2571
+ function getPersistedLevel() {
2572
+ var storedLevel;
2573
+ if (typeof window === undefinedType2 || !storageKey)
2574
+ return;
2575
+ try {
2576
+ storedLevel = window.localStorage[storageKey];
2577
+ } catch (ignore) {
2578
+ }
2579
+ if (typeof storedLevel === undefinedType2) {
2580
+ try {
2581
+ var cookie = window.document.cookie;
2582
+ var cookieName = encodeURIComponent(storageKey);
2583
+ var location = cookie.indexOf(cookieName + "=");
2584
+ if (location !== -1) {
2585
+ storedLevel = /^([^;]+)/.exec(
2586
+ cookie.slice(location + cookieName.length + 1)
2587
+ )[1];
2588
+ }
2589
+ } catch (ignore) {
2590
+ }
2591
+ }
2592
+ if (self2.levels[storedLevel] === void 0) {
2593
+ storedLevel = void 0;
2594
+ }
2595
+ return storedLevel;
2596
+ }
2597
+ function clearPersistedLevel() {
2598
+ if (typeof window === undefinedType2 || !storageKey)
2599
+ return;
2600
+ try {
2601
+ window.localStorage.removeItem(storageKey);
2602
+ } catch (ignore) {
2603
+ }
2604
+ try {
2605
+ window.document.cookie = encodeURIComponent(storageKey) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
2606
+ } catch (ignore) {
2607
+ }
2608
+ }
2609
+ function normalizeLevel(input) {
2610
+ var level = input;
2611
+ if (typeof level === "string" && self2.levels[level.toUpperCase()] !== void 0) {
2612
+ level = self2.levels[level.toUpperCase()];
2613
+ }
2614
+ if (typeof level === "number" && level >= 0 && level <= self2.levels.SILENT) {
2615
+ return level;
2616
+ } else {
2617
+ throw new TypeError("log.setLevel() called with invalid level: " + input);
2618
+ }
2619
+ }
2620
+ self2.name = name;
2621
+ self2.levels = {
2622
+ "TRACE": 0,
2623
+ "DEBUG": 1,
2624
+ "INFO": 2,
2625
+ "WARN": 3,
2626
+ "ERROR": 4,
2627
+ "SILENT": 5
2628
+ };
2629
+ self2.methodFactory = factory || defaultMethodFactory;
2630
+ self2.getLevel = function() {
2631
+ if (userLevel != null) {
2632
+ return userLevel;
2633
+ } else if (defaultLevel != null) {
2634
+ return defaultLevel;
2635
+ } else {
2636
+ return inheritedLevel;
2637
+ }
2638
+ };
2639
+ self2.setLevel = function(level, persist) {
2640
+ userLevel = normalizeLevel(level);
2641
+ if (persist !== false) {
2642
+ persistLevelIfPossible(userLevel);
2643
+ }
2644
+ return replaceLoggingMethods.call(self2);
2645
+ };
2646
+ self2.setDefaultLevel = function(level) {
2647
+ defaultLevel = normalizeLevel(level);
2648
+ if (!getPersistedLevel()) {
2649
+ self2.setLevel(level, false);
2650
+ }
2651
+ };
2652
+ self2.resetLevel = function() {
2653
+ userLevel = null;
2654
+ clearPersistedLevel();
2655
+ replaceLoggingMethods.call(self2);
2656
+ };
2657
+ self2.enableAll = function(persist) {
2658
+ self2.setLevel(self2.levels.TRACE, persist);
2659
+ };
2660
+ self2.disableAll = function(persist) {
2661
+ self2.setLevel(self2.levels.SILENT, persist);
2662
+ };
2663
+ self2.rebuild = function() {
2664
+ if (defaultLogger !== self2) {
2665
+ inheritedLevel = normalizeLevel(defaultLogger.getLevel());
2666
+ }
2667
+ replaceLoggingMethods.call(self2);
2668
+ if (defaultLogger === self2) {
2669
+ for (var childName in _loggersByName) {
2670
+ _loggersByName[childName].rebuild();
2671
+ }
2672
+ }
2673
+ };
2674
+ inheritedLevel = normalizeLevel(
2675
+ defaultLogger ? defaultLogger.getLevel() : "WARN"
2676
+ );
2677
+ var initialLevel = getPersistedLevel();
2678
+ if (initialLevel != null) {
2679
+ userLevel = normalizeLevel(initialLevel);
2680
+ }
2681
+ replaceLoggingMethods.call(self2);
2682
+ }
2683
+ defaultLogger = new Logger();
2684
+ defaultLogger.getLogger = function getLogger(name) {
2685
+ if (typeof name !== "symbol" && typeof name !== "string" || name === "") {
2686
+ throw new TypeError("You must supply a name when creating a logger.");
2687
+ }
2688
+ var logger = _loggersByName[name];
2689
+ if (!logger) {
2690
+ logger = _loggersByName[name] = new Logger(
2691
+ name,
2692
+ defaultLogger.methodFactory
2693
+ );
2694
+ }
2695
+ return logger;
2696
+ };
2697
+ var _log = typeof window !== undefinedType2 ? window.log : void 0;
2698
+ defaultLogger.noConflict = function() {
2699
+ if (typeof window !== undefinedType2 && window.log === defaultLogger) {
2700
+ window.log = _log;
2701
+ }
2702
+ return defaultLogger;
2703
+ };
2704
+ defaultLogger.getLoggers = function getLoggers() {
2705
+ return _loggersByName;
2706
+ };
2707
+ defaultLogger["default"] = defaultLogger;
2708
+ return defaultLogger;
2709
+ });
2710
+ })(loglevel);
2711
+ var loglevelExports = loglevel.exports;
2712
+ const log = /* @__PURE__ */ getDefaultExportFromCjs(loglevelExports);
2461
2713
  const DEFAULT_DARK_COLOR = [50, 50, 50];
2462
2714
  const DEFAULT_LIGHT_COLOR = [200, 200, 200];
2463
2715
  const DEFAULT_LIGHT2_COLOR = [235, 235, 235];
@@ -6886,7 +7138,7 @@ function upgradeFrom1_0_14(config) {
6886
7138
  Object.entries(propAnalogies).forEach(([oldProp, newType]) => {
6887
7139
  var _a;
6888
7140
  if ((_a = viewDef.props) == null ? void 0 : _a[oldProp]) {
6889
- console.warn(`Warning: the '${oldProp}' prop on the ${viewDef.component} view is deprecated. Please use the '${newType}' coordination type instead.`);
7141
+ log.warn(`Warning: the '${oldProp}' prop on the ${viewDef.component} view is deprecated. Please use the '${newType}' coordination type instead.`);
6890
7142
  }
6891
7143
  });
6892
7144
  });
@@ -6909,7 +7161,7 @@ function upgradeFrom1_0_15(config) {
6909
7161
  Object.entries(coordinationScopes).forEach(([coordinationType, coordinationScope]) => {
6910
7162
  if (!Array.isArray(coordinationScope) && typeof coordinationScope === "object") {
6911
7163
  if (coordinationType === "dataset") {
6912
- console.error("Expected coordinationScopes.dataset value to be either string or string[], but got object.");
7164
+ log.error("Expected coordinationScopes.dataset value to be either string or string[], but got object.");
6913
7165
  }
6914
7166
  coordinationScopesBy.dataset[coordinationType] = coordinationScope;
6915
7167
  } else if (Array.isArray(coordinationScope) || typeof coordinationScope === "string") {
@@ -9122,7 +9374,8 @@ const ViewType$1 = {
9122
9374
  FEATURE_BAR_PLOT: "featureBarPlot",
9123
9375
  BIOMARKER_SELECT: "biomarkerSelect",
9124
9376
  LINK_CONTROLLER: "linkController",
9125
- DUAL_SCATTERPLOT: "dualScatterplot"
9377
+ DUAL_SCATTERPLOT: "dualScatterplot",
9378
+ TREEMAP: "treemap"
9126
9379
  };
9127
9380
  const DataType$1 = {
9128
9381
  OBS_LABELS: "obsLabels",
@@ -9176,6 +9429,7 @@ const FileType$1 = {
9176
9429
  OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
9177
9430
  FEATURE_LABELS_ANNDATA_ZARR: "featureLabels.anndata.zarr",
9178
9431
  SAMPLE_EDGES_ANNDATA_ZARR: "sampleEdges.anndata.zarr",
9432
+ SAMPLE_SETS_ANNDATA_ZARR: "sampleSets.anndata.zarr",
9179
9433
  // AnnData - zipped
9180
9434
  OBS_FEATURE_MATRIX_ANNDATA_ZARR_ZIP: "obsFeatureMatrix.anndata.zarr.zip",
9181
9435
  OBS_FEATURE_COLUMNS_ANNDATA_ZARR_ZIP: "obsFeatureColumns.anndata.zarr.zip",
@@ -9188,6 +9442,7 @@ const FileType$1 = {
9188
9442
  OBS_LABELS_ANNDATA_ZARR_ZIP: "obsLabels.anndata.zarr.zip",
9189
9443
  FEATURE_LABELS_ANNDATA_ZARR_ZIP: "featureLabels.anndata.zarr.zip",
9190
9444
  SAMPLE_EDGES_ANNDATA_ZARR_ZIP: "sampleEdges.anndata.zarr.zip",
9445
+ SAMPLE_SETS_ANNDATA_ZARR_ZIP: "sampleSets.anndata.zarr.zip",
9191
9446
  // AnnData - h5ad via reference spec
9192
9447
  OBS_FEATURE_MATRIX_ANNDATA_H5AD: "obsFeatureMatrix.anndata.h5ad",
9193
9448
  OBS_FEATURE_COLUMNS_ANNDATA_H5AD: "obsFeatureColumns.anndata.h5ad",
@@ -9200,6 +9455,7 @@ const FileType$1 = {
9200
9455
  OBS_LABELS_ANNDATA_H5AD: "obsLabels.anndata.h5ad",
9201
9456
  FEATURE_LABELS_ANNDATA_H5AD: "featureLabels.anndata.h5ad",
9202
9457
  SAMPLE_EDGES_ANNDATA_H5AD: "sampleEdges.anndata.h5ad",
9458
+ SAMPLE_SETS_ANNDATA_H5AD: "sampleSets.anndata.h5ad",
9203
9459
  // SpatialData
9204
9460
  IMAGE_SPATIALDATA_ZARR: "image.spatialdata.zarr",
9205
9461
  LABELS_SPATIALDATA_ZARR: "labels.spatialdata.zarr",
@@ -9391,12 +9647,15 @@ const CoordinationType$1 = {
9391
9647
  SAMPLE_SET_FILTER: "sampleSetFilter",
9392
9648
  SAMPLE_FILTER_MODE: "sampleFilterMode",
9393
9649
  SAMPLE_SET_COLOR: "sampleSetColor",
9650
+ SAMPLE_HIGHLIGHT: "sampleHighlight",
9394
9651
  EMBEDDING_POINTS_VISIBLE: "embeddingPointsVisible",
9395
9652
  EMBEDDING_CONTOURS_VISIBLE: "embeddingContoursVisible",
9396
9653
  EMBEDDING_CONTOURS_FILLED: "embeddingContoursFilled",
9397
9654
  EMBEDDING_CONTOUR_PERCENTILES: "embeddingContourPercentiles",
9398
9655
  CONTOUR_COLOR_ENCODING: "contourColorEncoding",
9399
- CONTOUR_COLOR: "contourColor"
9656
+ CONTOUR_COLOR: "contourColor",
9657
+ // Treemap
9658
+ HIERARCHY_LEVELS: "hierarchyLevels"
9400
9659
  };
9401
9660
  const ViewType = {
9402
9661
  GENES: [
@@ -9564,7 +9823,7 @@ function makeConstantWithDeprecationMessage(currObj, oldObj) {
9564
9823
  const oldKeys = Object.keys(oldObj);
9565
9824
  const propKey = String(prop);
9566
9825
  if (oldKeys.includes(propKey)) {
9567
- console.warn(`Notice about the constant mapping ${propKey}: '${oldObj[propKey][0]}':
9826
+ log.warn(`Notice about the constant mapping ${propKey}: '${oldObj[propKey][0]}':
9568
9827
  ${oldObj[propKey][1]}`);
9569
9828
  return oldObj[propKey];
9570
9829
  }
@@ -9662,6 +9921,9 @@ const annDataObsSetsArr = z.array(z.object({
9662
9921
  z.object({
9663
9922
  obsSets: annDataObsSetsArr
9664
9923
  });
9924
+ z.object({
9925
+ sampleSets: annDataObsSetsArr
9926
+ });
9665
9927
  const annDataObsFeatureColumnsArr = z.array(z.object({
9666
9928
  path: z.string()
9667
9929
  }));
@@ -17518,7 +17780,7 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
17518
17780
  sampleSetKeys.forEach((sampleSetKey) => {
17519
17781
  const finalInsertionIndex = result.get(cellSetKey).get(sampleSetKey).get("i");
17520
17782
  if (finalInsertionIndex !== result.get(cellSetKey).get(sampleSetKey).get("obsIndex").length) {
17521
- console.warn("The final insertion index is lower than expected.");
17783
+ log.warn("The final insertion index is lower than expected.");
17522
17784
  }
17523
17785
  result.get(cellSetKey).get(sampleSetKey).delete("i");
17524
17786
  });
@@ -1 +1 @@
1
- {"version":3,"file":"expr-utils.d.ts","sourceRoot":"","sources":["../src/expr-utils.js"],"names":[],"mappings":"AASA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,4CAbW,GAAC,wCACD,GAAC,sBACD,GAAC,YAED,GAAC,kBACD,GAAC,oBAED,GAAC,8BAoIX;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,oDAbW,GAAC,cACD,GAAC,sBACD,GAAC,kBACD,GAAC,YACD,GAAC,kBACD,GAAC,iBACD,GAAC,oBACD,GAAC,gBACD,GAAC,yBACD,GAAC,oCACD,GAAC,SAiFX;AAED;;;;;;;;;;GAUG;AACH,oEAJW,GAAC,iBACD,GAAC,OAiBX"}
1
+ {"version":3,"file":"expr-utils.d.ts","sourceRoot":"","sources":["../src/expr-utils.js"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,4CAbW,GAAC,wCACD,GAAC,sBACD,GAAC,YAED,GAAC,kBACD,GAAC,oBAED,GAAC,8BAoIX;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,oDAbW,GAAC,cACD,GAAC,sBACD,GAAC,kBACD,GAAC,YACD,GAAC,kBACD,GAAC,iBACD,GAAC,oBACD,GAAC,gBACD,GAAC,yBACD,GAAC,oCACD,GAAC,SAiFX;AAED;;;;;;;;;;GAUG;AACH,oEAJW,GAAC,iBACD,GAAC,OAiBX"}
@@ -2,6 +2,7 @@
2
2
  import { InternMap } from 'internmap';
3
3
  import { getValueTransformFunction } from '@vitessce/utils';
4
4
  import { isEqual } from 'lodash-es';
5
+ import { log } from '@vitessce/globals';
5
6
  import { treeToSelectedSetMap, treeToObsIdsBySetNames, } from './cell-set-utils.js';
6
7
  /**
7
8
  * Input: selections and data.
@@ -123,7 +124,7 @@ export function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sam
123
124
  sampleSetKeys.forEach((sampleSetKey) => {
124
125
  const finalInsertionIndex = result.get(cellSetKey).get(sampleSetKey).get('i');
125
126
  if (finalInsertionIndex !== result.get(cellSetKey).get(sampleSetKey).get('obsIndex').length) {
126
- console.warn('The final insertion index is lower than expected.');
127
+ log.warn('The final insertion index is lower than expected.');
127
128
  }
128
129
  result.get(cellSetKey).get(sampleSetKey).delete('i');
129
130
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/sets-utils",
3
- "version": "3.5.6",
3
+ "version": "3.5.7",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -25,8 +25,9 @@
25
25
  "lodash-es": "^4.17.21",
26
26
  "tinycolor2": "^1.4.1",
27
27
  "uuid": "^9.0.0",
28
- "@vitessce/schemas": "3.5.6",
29
- "@vitessce/utils": "3.5.6"
28
+ "@vitessce/schemas": "3.5.7",
29
+ "@vitessce/utils": "3.5.7",
30
+ "@vitessce/globals": "3.5.7"
30
31
  },
31
32
  "scripts": {
32
33
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
package/src/expr-utils.js CHANGED
@@ -2,6 +2,7 @@
2
2
  import { InternMap } from 'internmap';
3
3
  import { getValueTransformFunction } from '@vitessce/utils';
4
4
  import { isEqual } from 'lodash-es';
5
+ import { log } from '@vitessce/globals';
5
6
  import {
6
7
  treeToSelectedSetMap,
7
8
  treeToObsIdsBySetNames,
@@ -150,7 +151,7 @@ export function stratifyArrays(
150
151
  sampleSetKeys.forEach((sampleSetKey) => {
151
152
  const finalInsertionIndex = result.get(cellSetKey).get(sampleSetKey).get('i');
152
153
  if (finalInsertionIndex !== result.get(cellSetKey).get(sampleSetKey).get('obsIndex').length) {
153
- console.warn('The final insertion index is lower than expected.');
154
+ log.warn('The final insertion index is lower than expected.');
154
155
  }
155
156
  result.get(cellSetKey).get(sampleSetKey).delete('i');
156
157
  });