@vitessce/json 3.5.2 → 3.5.4
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/{deflate-58b908e0.js → deflate-d33865aa.js} +1 -2
- package/dist/{index-d55d3dac.js → index-632fc942.js} +337 -259
- package/dist/index.js +1 -2
- package/dist/{jpeg-48992c30.js → jpeg-07d1dca7.js} +1 -2
- package/dist/{lerc-62158a51.js → lerc-f83bf545.js} +1 -2
- package/dist/{lzw-1570af86.js → lzw-456d51f1.js} +1 -2
- package/dist/{packbits-773a0731.js → packbits-99411d35.js} +1 -2
- package/dist/{raw-eb81714a.js → raw-8ccd763d.js} +1 -2
- package/dist/{webimage-f760ad83.js → webimage-e3bf9749.js} +1 -2
- package/dist-tsc/JsonSource.js +1 -1
- package/dist-tsc/json-loaders/JsonLoader.d.ts +2 -1
- package/dist-tsc/json-loaders/JsonLoader.d.ts.map +1 -1
- package/dist-tsc/json-loaders/JsonLoader.js +1 -1
- package/dist-tsc/json-loaders/ObsSegmentationsJson.d.ts +9 -1
- package/dist-tsc/json-loaders/ObsSegmentationsJson.d.ts.map +1 -1
- package/dist-tsc/json-loaders/ObsSegmentationsJson.js +1 -1
- package/dist-tsc/json-loaders/ObsSetsJson.d.ts +6 -1
- package/dist-tsc/json-loaders/ObsSetsJson.d.ts.map +1 -1
- package/dist-tsc/json-loaders/ObsSetsJson.js +1 -1
- package/dist-tsc/json-loaders/ObsSetsJson.test-old.js +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsEmbedding.d.ts +8 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsEmbedding.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsEmbedding.js +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsLabels.d.ts +5 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsLabels.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsLabels.js +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsLocations.d.ts +8 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsLocations.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsLocations.js +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsSegmentations.d.ts +17 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsSegmentations.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/CellsJsonAsObsSegmentations.js +12 -2
- package/dist-tsc/legacy-loaders/CellsJsonLoaders.test.js +7 -2
- package/dist-tsc/legacy-loaders/ClustersJsonAsObsFeatureMatrix.d.ts +8 -1
- package/dist-tsc/legacy-loaders/ClustersJsonAsObsFeatureMatrix.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/ClustersJsonAsObsFeatureMatrix.js +1 -1
- package/dist-tsc/legacy-loaders/ClustersJsonLoaders.test.js +1 -1
- package/dist-tsc/legacy-loaders/GenesJsonAsObsFeatureMatrix.d.ts +8 -1
- package/dist-tsc/legacy-loaders/GenesJsonAsObsFeatureMatrix.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/GenesJsonAsObsFeatureMatrix.js +1 -1
- package/dist-tsc/legacy-loaders/GenesJsonLoaders.test.js +1 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLabels.d.ts +5 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLabels.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLabels.js +1 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLocations.d.ts +8 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLocations.d.ts.map +1 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonAsObsLocations.js +1 -1
- package/dist-tsc/legacy-loaders/MoleculesJsonLoaders.test.js +1 -1
- package/dist-tsc/raster-json-loaders/RasterJsonAsImageLoader.d.ts +7 -0
- package/dist-tsc/raster-json-loaders/RasterJsonAsImageLoader.d.ts.map +1 -1
- package/dist-tsc/raster-json-loaders/RasterJsonAsImageLoader.js +1 -1
- package/dist-tsc/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.d.ts +8 -0
- package/dist-tsc/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.d.ts.map +1 -1
- package/dist-tsc/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.js +1 -1
- package/dist-tsc/raster-json-loaders/RasterJsonLoader.js +1 -1
- package/package.json +10 -10
- package/src/JsonSource.js +1 -1
- package/src/json-loaders/JsonLoader.js +1 -1
- package/src/json-loaders/ObsSegmentationsJson.js +1 -1
- package/src/json-loaders/ObsSetsJson.js +1 -1
- package/src/json-loaders/ObsSetsJson.test-old.js +1 -1
- package/src/legacy-loaders/CellsJsonAsObsEmbedding.js +1 -1
- package/src/legacy-loaders/CellsJsonAsObsLabels.js +1 -1
- package/src/legacy-loaders/CellsJsonAsObsLocations.js +1 -1
- package/src/legacy-loaders/CellsJsonAsObsSegmentations.js +13 -2
- package/src/legacy-loaders/CellsJsonLoaders.test.js +10 -2
- package/src/legacy-loaders/ClustersJsonAsObsFeatureMatrix.js +1 -1
- package/src/legacy-loaders/ClustersJsonLoaders.test.js +1 -1
- package/src/legacy-loaders/GenesJsonAsObsFeatureMatrix.js +1 -1
- package/src/legacy-loaders/GenesJsonLoaders.test.js +1 -1
- package/src/legacy-loaders/MoleculesJsonAsObsLabels.js +1 -1
- package/src/legacy-loaders/MoleculesJsonAsObsLocations.js +1 -1
- package/src/legacy-loaders/MoleculesJsonLoaders.test.js +1 -1
- package/src/raster-json-loaders/RasterJsonAsImageLoader.js +1 -1
- package/src/raster-json-loaders/RasterJsonAsObsSegmentationsLoader.js +1 -1
- package/src/raster-json-loaders/RasterJsonLoader.js +1 -1
|
@@ -27,7 +27,6 @@ var __privateMethod = (obj, member, method) => {
|
|
|
27
27
|
return method;
|
|
28
28
|
};
|
|
29
29
|
var _bytes, _encoder, _data, _strides, _TypedArray, _BYTES_PER_ELEMENT, _shape, _endian, _encoder_config, _decoder_config, _shape2, _strides2, _metadata, _metadata2, _a2, _b, _overrides, _use_suffix_request, _merge_init, merge_init_fn, _overrides2, _refs, _opts, _overrides3;
|
|
30
|
-
import { DataSourceFetchError, AbstractTwoStepLoader, AbstractLoaderError, LoaderResult, LoaderValidationError } from "@vitessce/vit-s";
|
|
31
30
|
import "react";
|
|
32
31
|
function _mergeNamespaces(n3, m) {
|
|
33
32
|
for (var i2 = 0; i2 < m.length; i2++) {
|
|
@@ -48,6 +47,88 @@ function _mergeNamespaces(n3, m) {
|
|
|
48
47
|
}
|
|
49
48
|
return Object.freeze(Object.defineProperty(n3, Symbol.toStringTag, { value: "Module" }));
|
|
50
49
|
}
|
|
50
|
+
class LoaderResult {
|
|
51
|
+
/**
|
|
52
|
+
* @param {LoaderDataType} data
|
|
53
|
+
* @param {object[]|string|null} url Single URL or array of { url, name } objects.
|
|
54
|
+
* @param {object|null} coordinationValues
|
|
55
|
+
* @param {RequestInit|null} requestInit
|
|
56
|
+
*/
|
|
57
|
+
constructor(data, url, coordinationValues = null, requestInit2 = null) {
|
|
58
|
+
this.data = data;
|
|
59
|
+
this.url = url;
|
|
60
|
+
this.coordinationValues = coordinationValues;
|
|
61
|
+
this.requestInit = requestInit2;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
class AbstractLoader {
|
|
65
|
+
/**
|
|
66
|
+
*
|
|
67
|
+
* @param {LoaderParams} params
|
|
68
|
+
*/
|
|
69
|
+
constructor({ type: type2, fileType, url, requestInit: requestInit2, options, coordinationValues }) {
|
|
70
|
+
this.fileType = fileType;
|
|
71
|
+
this.type = type2;
|
|
72
|
+
this.url = url;
|
|
73
|
+
this.requestInit = requestInit2;
|
|
74
|
+
this.options = options;
|
|
75
|
+
this.coordinationValues = coordinationValues;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
*
|
|
79
|
+
* @returns {Promise<LoaderResult<any>>}
|
|
80
|
+
*/
|
|
81
|
+
// eslint-disable-next-line class-methods-use-this
|
|
82
|
+
async load() {
|
|
83
|
+
return Promise.resolve(new LoaderResult(true, null));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
class AbstractTwoStepLoader extends AbstractLoader {
|
|
87
|
+
/**
|
|
88
|
+
*
|
|
89
|
+
* @param {DataSourceType} dataSource
|
|
90
|
+
* @param {LoaderParams} params
|
|
91
|
+
*/
|
|
92
|
+
constructor(dataSource, params) {
|
|
93
|
+
super(params);
|
|
94
|
+
this.dataSource = dataSource;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
class AbstractLoaderError {
|
|
98
|
+
constructor(message) {
|
|
99
|
+
this.message = message;
|
|
100
|
+
}
|
|
101
|
+
// eslint-disable-next-line class-methods-use-this
|
|
102
|
+
warnInConsole() {
|
|
103
|
+
throw new Error("The warnInConsole() method has not been implemented.");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
class LoaderValidationError extends AbstractLoaderError {
|
|
107
|
+
constructor(datasetType, datasetFileType, datasetUrl, reason) {
|
|
108
|
+
super(`Error while validating ${datasetType}.`);
|
|
109
|
+
this.name = "LoaderValidationError";
|
|
110
|
+
this.datasetType = datasetType;
|
|
111
|
+
this.datasetFileType = datasetFileType;
|
|
112
|
+
this.datasetUrl = datasetUrl;
|
|
113
|
+
this.reason = reason;
|
|
114
|
+
}
|
|
115
|
+
warnInConsole() {
|
|
116
|
+
const { datasetType, datasetUrl, reason } = this;
|
|
117
|
+
console.warn(`${datasetType} from ${datasetUrl}: validation failed`, JSON.stringify(reason, null, 2));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
class DataSourceFetchError extends AbstractLoaderError {
|
|
121
|
+
constructor(source, url, headers) {
|
|
122
|
+
super(`${source} Error HTTP Status fetching from ${url}`);
|
|
123
|
+
this.source = source;
|
|
124
|
+
this.url = url;
|
|
125
|
+
this.headers = headers;
|
|
126
|
+
}
|
|
127
|
+
warnInConsole() {
|
|
128
|
+
const { source, url, headers } = this;
|
|
129
|
+
console.warn(`${source} failed to fetch from ${url} with headers ${JSON.stringify(headers)}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
51
132
|
class JsonSource {
|
|
52
133
|
constructor({ url, requestInit: requestInit2 }) {
|
|
53
134
|
this.url = url;
|
|
@@ -83,7 +164,8 @@ const ViewType$1 = {
|
|
|
83
164
|
FEATURE_VALUE_HISTOGRAM: "featureValueHistogram",
|
|
84
165
|
DOT_PLOT: "dotPlot",
|
|
85
166
|
FEATURE_BAR_PLOT: "featureBarPlot",
|
|
86
|
-
BIOMARKER_SELECT: "biomarkerSelect"
|
|
167
|
+
BIOMARKER_SELECT: "biomarkerSelect",
|
|
168
|
+
LINK_CONTROLLER: "linkController"
|
|
87
169
|
};
|
|
88
170
|
const DataType$2 = {
|
|
89
171
|
OBS_LABELS: "obsLabels",
|
|
@@ -346,6 +428,30 @@ const CoordinationType$1 = {
|
|
|
346
428
|
CONTOUR_COLOR_ENCODING: "contourColorEncoding",
|
|
347
429
|
CONTOUR_COLOR: "contourColor"
|
|
348
430
|
};
|
|
431
|
+
const GLOBAL_LABELS = ["z", "t"];
|
|
432
|
+
const DEFAULT_RASTER_DOMAIN_TYPE = "Min/Max";
|
|
433
|
+
const DEFAULT_MOLECULES_LAYER = {
|
|
434
|
+
opacity: 1,
|
|
435
|
+
radius: 20,
|
|
436
|
+
visible: true
|
|
437
|
+
};
|
|
438
|
+
const DEFAULT_CELLS_LAYER = {
|
|
439
|
+
opacity: 1,
|
|
440
|
+
radius: 50,
|
|
441
|
+
visible: true,
|
|
442
|
+
stroked: false
|
|
443
|
+
};
|
|
444
|
+
const DEFAULT_RASTER_LAYER_PROPS = {
|
|
445
|
+
visible: true,
|
|
446
|
+
colormap: null,
|
|
447
|
+
opacity: 1,
|
|
448
|
+
domainType: DEFAULT_RASTER_DOMAIN_TYPE,
|
|
449
|
+
transparentColor: [0, 0, 0],
|
|
450
|
+
// Importing the full viv package here would add a lot of weight to the bundle
|
|
451
|
+
renderingMode: "Additive",
|
|
452
|
+
// viv.RENDERING_MODES.ADDITIVE,
|
|
453
|
+
use3d: false
|
|
454
|
+
};
|
|
349
455
|
var util;
|
|
350
456
|
(function(util2) {
|
|
351
457
|
util2.assertEqual = (val) => val;
|
|
@@ -17629,6 +17735,219 @@ class CellsJsonAsObsLocationsLoader extends JsonLoader {
|
|
|
17629
17735
|
));
|
|
17630
17736
|
}
|
|
17631
17737
|
}
|
|
17738
|
+
function square(x2, y2, r2) {
|
|
17739
|
+
return [[x2, y2 + r2], [x2 + r2, y2], [x2, y2 - r2], [x2 - r2, y2]];
|
|
17740
|
+
}
|
|
17741
|
+
class CellsJsonAsObsSegmentationsLoader extends JsonLoader {
|
|
17742
|
+
constructor(dataSource, params) {
|
|
17743
|
+
super(dataSource, params);
|
|
17744
|
+
this.schema = cellsSchema;
|
|
17745
|
+
}
|
|
17746
|
+
loadFromCache(data) {
|
|
17747
|
+
var _a3;
|
|
17748
|
+
if (this.cachedResult) {
|
|
17749
|
+
return this.cachedResult;
|
|
17750
|
+
}
|
|
17751
|
+
const obsIndex = Object.keys(data);
|
|
17752
|
+
const cellObjs = Object.values(data);
|
|
17753
|
+
if (cellObjs.length > 0 && !Array.isArray(cellObjs[0].poly) && !Array.isArray(cellObjs[0].xy)) {
|
|
17754
|
+
this.cachedResult = null;
|
|
17755
|
+
} else {
|
|
17756
|
+
let cellPolygons;
|
|
17757
|
+
if (!Array.isArray(cellObjs[0].poly) || !((_a3 = cellObjs[0].poly) == null ? void 0 : _a3.length)) {
|
|
17758
|
+
const radius = 50;
|
|
17759
|
+
cellPolygons = cellObjs.map((cellObj) => square(cellObj.xy[0], cellObj.xy[1], radius));
|
|
17760
|
+
} else {
|
|
17761
|
+
cellPolygons = cellObjs.map((cellObj) => cellObj.poly);
|
|
17762
|
+
}
|
|
17763
|
+
const obsSegmentations = {
|
|
17764
|
+
data: cellPolygons,
|
|
17765
|
+
shape: [cellPolygons.length, cellPolygons[0].length]
|
|
17766
|
+
};
|
|
17767
|
+
this.cachedResult = { obsIndex, obsSegmentations };
|
|
17768
|
+
}
|
|
17769
|
+
return this.cachedResult;
|
|
17770
|
+
}
|
|
17771
|
+
async load() {
|
|
17772
|
+
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
17773
|
+
if (payload instanceof AbstractLoaderError) {
|
|
17774
|
+
return Promise.reject(payload);
|
|
17775
|
+
}
|
|
17776
|
+
const { data, url } = payload;
|
|
17777
|
+
const result = this.loadFromCache(data);
|
|
17778
|
+
const coordinationValues = {
|
|
17779
|
+
spatialSegmentationLayer: DEFAULT_CELLS_LAYER
|
|
17780
|
+
};
|
|
17781
|
+
return Promise.resolve(new LoaderResult({
|
|
17782
|
+
...result,
|
|
17783
|
+
obsSegmentationsType: "polygon"
|
|
17784
|
+
}, url, coordinationValues));
|
|
17785
|
+
}
|
|
17786
|
+
}
|
|
17787
|
+
function extent$1(values2, valueof) {
|
|
17788
|
+
let min2;
|
|
17789
|
+
let max2;
|
|
17790
|
+
if (valueof === void 0) {
|
|
17791
|
+
for (const value of values2) {
|
|
17792
|
+
if (value != null) {
|
|
17793
|
+
if (min2 === void 0) {
|
|
17794
|
+
if (value >= value)
|
|
17795
|
+
min2 = max2 = value;
|
|
17796
|
+
} else {
|
|
17797
|
+
if (min2 > value)
|
|
17798
|
+
min2 = value;
|
|
17799
|
+
if (max2 < value)
|
|
17800
|
+
max2 = value;
|
|
17801
|
+
}
|
|
17802
|
+
}
|
|
17803
|
+
}
|
|
17804
|
+
} else {
|
|
17805
|
+
let index2 = -1;
|
|
17806
|
+
for (let value of values2) {
|
|
17807
|
+
if ((value = valueof(value, ++index2, values2)) != null) {
|
|
17808
|
+
if (min2 === void 0) {
|
|
17809
|
+
if (value >= value)
|
|
17810
|
+
min2 = max2 = value;
|
|
17811
|
+
} else {
|
|
17812
|
+
if (min2 > value)
|
|
17813
|
+
min2 = value;
|
|
17814
|
+
if (max2 < value)
|
|
17815
|
+
max2 = value;
|
|
17816
|
+
}
|
|
17817
|
+
}
|
|
17818
|
+
}
|
|
17819
|
+
}
|
|
17820
|
+
return [min2, max2];
|
|
17821
|
+
}
|
|
17822
|
+
function max$2(values2, valueof) {
|
|
17823
|
+
let max2;
|
|
17824
|
+
if (valueof === void 0) {
|
|
17825
|
+
for (const value of values2) {
|
|
17826
|
+
if (value != null && (max2 < value || max2 === void 0 && value >= value)) {
|
|
17827
|
+
max2 = value;
|
|
17828
|
+
}
|
|
17829
|
+
}
|
|
17830
|
+
} else {
|
|
17831
|
+
let index2 = -1;
|
|
17832
|
+
for (let value of values2) {
|
|
17833
|
+
if ((value = valueof(value, ++index2, values2)) != null && (max2 < value || max2 === void 0 && value >= value)) {
|
|
17834
|
+
max2 = value;
|
|
17835
|
+
}
|
|
17836
|
+
}
|
|
17837
|
+
}
|
|
17838
|
+
return max2;
|
|
17839
|
+
}
|
|
17840
|
+
const clustersSchema = z.object({
|
|
17841
|
+
rows: z.array(z.string()),
|
|
17842
|
+
cols: z.array(z.string()),
|
|
17843
|
+
matrix: z.array(z.array(z.number()))
|
|
17844
|
+
}).strict();
|
|
17845
|
+
class ClustersJsonAsObsFeatureMatrixLoader extends JsonLoader {
|
|
17846
|
+
constructor(dataSource, params) {
|
|
17847
|
+
super(dataSource, params);
|
|
17848
|
+
this.schema = clustersSchema;
|
|
17849
|
+
}
|
|
17850
|
+
loadFromCache(data) {
|
|
17851
|
+
if (this.cachedResult) {
|
|
17852
|
+
return this.cachedResult;
|
|
17853
|
+
}
|
|
17854
|
+
const { rows: featureIndex, cols: obsIndex, matrix: matrix2 } = data;
|
|
17855
|
+
const attrs = {
|
|
17856
|
+
rows: obsIndex,
|
|
17857
|
+
cols: featureIndex
|
|
17858
|
+
};
|
|
17859
|
+
const shape = [attrs.rows.length, attrs.cols.length];
|
|
17860
|
+
const normalizedMatrix = matrix2.map((col) => {
|
|
17861
|
+
const [min2, max2] = extent$1(col);
|
|
17862
|
+
const normalize2 = (d) => Math.floor((d - min2) / (max2 - min2) * 255);
|
|
17863
|
+
return col.map(normalize2);
|
|
17864
|
+
});
|
|
17865
|
+
const tNormalizedMatrix = range$8(shape[0]).map((i2) => range$8(shape[1]).map((j) => normalizedMatrix[j][i2]));
|
|
17866
|
+
const normalizedFlatMatrix = tNormalizedMatrix.flat();
|
|
17867
|
+
const obsFeatureMatrix = { data: Uint8Array.from(normalizedFlatMatrix) };
|
|
17868
|
+
this.cachedResult = { obsIndex, featureIndex, obsFeatureMatrix };
|
|
17869
|
+
return this.cachedResult;
|
|
17870
|
+
}
|
|
17871
|
+
async load() {
|
|
17872
|
+
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
17873
|
+
if (payload instanceof AbstractLoaderError) {
|
|
17874
|
+
return Promise.reject(payload);
|
|
17875
|
+
}
|
|
17876
|
+
const { data, url } = payload;
|
|
17877
|
+
const result = this.loadFromCache(data);
|
|
17878
|
+
return Promise.resolve(new LoaderResult(
|
|
17879
|
+
result,
|
|
17880
|
+
url
|
|
17881
|
+
));
|
|
17882
|
+
}
|
|
17883
|
+
}
|
|
17884
|
+
const genesSchema = z.record(z.object({
|
|
17885
|
+
max: z.number(),
|
|
17886
|
+
cells: z.record(z.number())
|
|
17887
|
+
}));
|
|
17888
|
+
class GenesJsonAsObsFeatureMatrixLoader extends JsonLoader {
|
|
17889
|
+
constructor(dataSource, params) {
|
|
17890
|
+
super(dataSource, params);
|
|
17891
|
+
this.schema = genesSchema;
|
|
17892
|
+
}
|
|
17893
|
+
loadFromCache(data) {
|
|
17894
|
+
if (this.cachedResult) {
|
|
17895
|
+
return this.cachedResult;
|
|
17896
|
+
}
|
|
17897
|
+
const cols = Object.keys(data);
|
|
17898
|
+
const rows = cols.length > 0 ? Object.keys(data[cols[0]].cells) : [];
|
|
17899
|
+
const normalizedFlatMatrix = rows.flatMap((cellId) => cols.map(
|
|
17900
|
+
(geneId) => data[geneId].cells[cellId] / data[geneId].max * 255
|
|
17901
|
+
));
|
|
17902
|
+
const featureIndex = cols;
|
|
17903
|
+
const obsIndex = rows;
|
|
17904
|
+
const obsFeatureMatrix = { data: Uint8Array.from(normalizedFlatMatrix) };
|
|
17905
|
+
this.cachedResult = { obsIndex, featureIndex, obsFeatureMatrix };
|
|
17906
|
+
return this.cachedResult;
|
|
17907
|
+
}
|
|
17908
|
+
async load() {
|
|
17909
|
+
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
17910
|
+
if (payload instanceof AbstractLoaderError) {
|
|
17911
|
+
return Promise.reject(payload);
|
|
17912
|
+
}
|
|
17913
|
+
const { data, url } = payload;
|
|
17914
|
+
const result = this.loadFromCache(data);
|
|
17915
|
+
return Promise.resolve(new LoaderResult(
|
|
17916
|
+
result,
|
|
17917
|
+
url
|
|
17918
|
+
));
|
|
17919
|
+
}
|
|
17920
|
+
}
|
|
17921
|
+
class MoleculesJsonAsObsLabelsLoader extends JsonLoader {
|
|
17922
|
+
constructor(dataSource, params) {
|
|
17923
|
+
super(dataSource, params);
|
|
17924
|
+
this.schema = moleculesSchema;
|
|
17925
|
+
}
|
|
17926
|
+
loadFromCache(data) {
|
|
17927
|
+
if (this.cachedResult) {
|
|
17928
|
+
return this.cachedResult;
|
|
17929
|
+
}
|
|
17930
|
+
const obsIndex = range$8(sum$3(Object.values(data).map((v) => v.length))).map((i2) => String(i2));
|
|
17931
|
+
let obsLabels = [];
|
|
17932
|
+
Object.entries(data).forEach(([gene, locations]) => {
|
|
17933
|
+
obsLabels = [
|
|
17934
|
+
...obsLabels,
|
|
17935
|
+
...range$8(locations.length).map(() => gene)
|
|
17936
|
+
];
|
|
17937
|
+
});
|
|
17938
|
+
this.cachedResult = { obsIndex, obsLabels };
|
|
17939
|
+
return this.cachedResult;
|
|
17940
|
+
}
|
|
17941
|
+
async load() {
|
|
17942
|
+
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
17943
|
+
if (payload instanceof AbstractLoaderError) {
|
|
17944
|
+
return Promise.reject(payload);
|
|
17945
|
+
}
|
|
17946
|
+
const { data, url } = payload;
|
|
17947
|
+
const result = this.loadFromCache(data);
|
|
17948
|
+
return Promise.resolve(new LoaderResult(result, url));
|
|
17949
|
+
}
|
|
17950
|
+
}
|
|
17632
17951
|
function assert$d(condition, message) {
|
|
17633
17952
|
if (!condition) {
|
|
17634
17953
|
throw new Error("math.gl assertion ".concat(message));
|
|
@@ -25714,7 +26033,7 @@ function clone$6(obj) {
|
|
|
25714
26033
|
Decimal2.log = log$5;
|
|
25715
26034
|
Decimal2.log10 = log10;
|
|
25716
26035
|
Decimal2.log2 = log2$1;
|
|
25717
|
-
Decimal2.max = max$
|
|
26036
|
+
Decimal2.max = max$1;
|
|
25718
26037
|
Decimal2.min = min;
|
|
25719
26038
|
Decimal2.mod = mod$2;
|
|
25720
26039
|
Decimal2.mul = mul;
|
|
@@ -25785,7 +26104,7 @@ function log2$1(x2) {
|
|
|
25785
26104
|
function log10(x2) {
|
|
25786
26105
|
return new this(x2).log(10);
|
|
25787
26106
|
}
|
|
25788
|
-
function max$
|
|
26107
|
+
function max$1() {
|
|
25789
26108
|
return maxOrMin(this, arguments, "lt");
|
|
25790
26109
|
}
|
|
25791
26110
|
function min() {
|
|
@@ -100279,7 +100598,7 @@ var hasProto$1 = function hasProto() {
|
|
|
100279
100598
|
};
|
|
100280
100599
|
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
100281
100600
|
var toStr$2 = Object.prototype.toString;
|
|
100282
|
-
var max
|
|
100601
|
+
var max = Math.max;
|
|
100283
100602
|
var funcType = "[object Function]";
|
|
100284
100603
|
var concatty = function concatty2(a2, b) {
|
|
100285
100604
|
var arr = [];
|
|
@@ -100331,7 +100650,7 @@ var implementation$7 = function bind2(that) {
|
|
|
100331
100650
|
concatty(args, arguments)
|
|
100332
100651
|
);
|
|
100333
100652
|
};
|
|
100334
|
-
var boundLength = max
|
|
100653
|
+
var boundLength = max(0, target.length - args.length);
|
|
100335
100654
|
var boundArgs = [];
|
|
100336
100655
|
for (var i2 = 0; i2 < boundLength; i2++) {
|
|
100337
100656
|
boundArgs[i2] = "$" + i2;
|
|
@@ -112595,7 +112914,7 @@ function clipExtent(x02, y02, x12, y12) {
|
|
|
112595
112914
|
return clipStream;
|
|
112596
112915
|
};
|
|
112597
112916
|
}
|
|
112598
|
-
function extent
|
|
112917
|
+
function extent() {
|
|
112599
112918
|
var x02 = 0, y02 = 0, x12 = 960, y12 = 500, cache2, cacheStream, clip2;
|
|
112600
112919
|
return clip2 = {
|
|
112601
112920
|
stream: function(stream) {
|
|
@@ -114002,7 +114321,7 @@ const d3Geo$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
114002
114321
|
geoBounds: bounds,
|
|
114003
114322
|
geoCentroid: centroid$3,
|
|
114004
114323
|
geoCircle: circle$2,
|
|
114005
|
-
geoClipExtent: extent
|
|
114324
|
+
geoClipExtent: extent,
|
|
114006
114325
|
geoConicConformal: conicConformal,
|
|
114007
114326
|
geoConicConformalRaw: conicConformalRaw,
|
|
114008
114327
|
geoConicEqualArea: conicEqualArea,
|
|
@@ -135078,16 +135397,16 @@ async function getDecoder(fileDirectory) {
|
|
|
135078
135397
|
const Decoder = await importFn();
|
|
135079
135398
|
return new Decoder(fileDirectory);
|
|
135080
135399
|
}
|
|
135081
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
135082
|
-
addDecoder(5, () => import("./lzw-
|
|
135400
|
+
addDecoder([void 0, 1], () => import("./raw-8ccd763d.js").then((m) => m.default));
|
|
135401
|
+
addDecoder(5, () => import("./lzw-456d51f1.js").then((m) => m.default));
|
|
135083
135402
|
addDecoder(6, () => {
|
|
135084
135403
|
throw new Error("old style JPEG compression is not supported.");
|
|
135085
135404
|
});
|
|
135086
|
-
addDecoder(7, () => import("./jpeg-
|
|
135087
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
135088
|
-
addDecoder(32773, () => import("./packbits-
|
|
135089
|
-
addDecoder(34887, () => import("./lerc-
|
|
135090
|
-
addDecoder(50001, () => import("./webimage-
|
|
135405
|
+
addDecoder(7, () => import("./jpeg-07d1dca7.js").then((m) => m.default));
|
|
135406
|
+
addDecoder([8, 32946], () => import("./deflate-d33865aa.js").then((m) => m.default));
|
|
135407
|
+
addDecoder(32773, () => import("./packbits-99411d35.js").then((m) => m.default));
|
|
135408
|
+
addDecoder(34887, () => import("./lerc-f83bf545.js").then((m) => m.default));
|
|
135409
|
+
addDecoder(50001, () => import("./webimage-e3bf9749.js").then((m) => m.default));
|
|
135091
135410
|
function copyNewSize(array, width, height, samplesPerPixel = 1) {
|
|
135092
135411
|
return new (Object.getPrototypeOf(array)).constructor(width * height * samplesPerPixel);
|
|
135093
135412
|
}
|
|
@@ -144133,12 +144452,6 @@ const DTYPE_VALUES = {
|
|
|
144133
144452
|
cast: (data) => new Float32Array(data)
|
|
144134
144453
|
}
|
|
144135
144454
|
};
|
|
144136
|
-
var RENDERING_MODES = /* @__PURE__ */ ((RENDERING_MODES2) => {
|
|
144137
|
-
RENDERING_MODES2["MAX_INTENSITY_PROJECTION"] = "Maximum Intensity Projection";
|
|
144138
|
-
RENDERING_MODES2["MIN_INTENSITY_PROJECTION"] = "Minimum Intensity Projection";
|
|
144139
|
-
RENDERING_MODES2["ADDITIVE"] = "Additive";
|
|
144140
|
-
return RENDERING_MODES2;
|
|
144141
|
-
})(RENDERING_MODES || {});
|
|
144142
144455
|
const apply_transparent_color = `vec4 apply_transparent_color(vec3 color, vec3 transparentColor, bool useTransparentColor, float opacity){
|
|
144143
144456
|
return vec4(color, (color == transparentColor && useTransparentColor) ? 0. : opacity);
|
|
144144
144457
|
}
|
|
@@ -148418,61 +148731,8 @@ void main() {
|
|
|
148418
148731
|
DECKGL_FILTER_COLOR(gl_FragColor, geometry);
|
|
148419
148732
|
}
|
|
148420
148733
|
`;
|
|
148421
|
-
function extent(values2, valueof) {
|
|
148422
|
-
let min2;
|
|
148423
|
-
let max2;
|
|
148424
|
-
if (valueof === void 0) {
|
|
148425
|
-
for (const value of values2) {
|
|
148426
|
-
if (value != null) {
|
|
148427
|
-
if (min2 === void 0) {
|
|
148428
|
-
if (value >= value)
|
|
148429
|
-
min2 = max2 = value;
|
|
148430
|
-
} else {
|
|
148431
|
-
if (min2 > value)
|
|
148432
|
-
min2 = value;
|
|
148433
|
-
if (max2 < value)
|
|
148434
|
-
max2 = value;
|
|
148435
|
-
}
|
|
148436
|
-
}
|
|
148437
|
-
}
|
|
148438
|
-
} else {
|
|
148439
|
-
let index2 = -1;
|
|
148440
|
-
for (let value of values2) {
|
|
148441
|
-
if ((value = valueof(value, ++index2, values2)) != null) {
|
|
148442
|
-
if (min2 === void 0) {
|
|
148443
|
-
if (value >= value)
|
|
148444
|
-
min2 = max2 = value;
|
|
148445
|
-
} else {
|
|
148446
|
-
if (min2 > value)
|
|
148447
|
-
min2 = value;
|
|
148448
|
-
if (max2 < value)
|
|
148449
|
-
max2 = value;
|
|
148450
|
-
}
|
|
148451
|
-
}
|
|
148452
|
-
}
|
|
148453
|
-
}
|
|
148454
|
-
return [min2, max2];
|
|
148455
|
-
}
|
|
148456
|
-
function max(values2, valueof) {
|
|
148457
|
-
let max2;
|
|
148458
|
-
if (valueof === void 0) {
|
|
148459
|
-
for (const value of values2) {
|
|
148460
|
-
if (value != null && (max2 < value || max2 === void 0 && value >= value)) {
|
|
148461
|
-
max2 = value;
|
|
148462
|
-
}
|
|
148463
|
-
}
|
|
148464
|
-
} else {
|
|
148465
|
-
let index2 = -1;
|
|
148466
|
-
for (let value of values2) {
|
|
148467
|
-
if ((value = valueof(value, ++index2, values2)) != null && (max2 < value || max2 === void 0 && value >= value)) {
|
|
148468
|
-
max2 = value;
|
|
148469
|
-
}
|
|
148470
|
-
}
|
|
148471
|
-
}
|
|
148472
|
-
return max2;
|
|
148473
|
-
}
|
|
148474
148734
|
function normalize(arr) {
|
|
148475
|
-
const [min2, max2] = extent(arr);
|
|
148735
|
+
const [min2, max2] = extent$1(arr);
|
|
148476
148736
|
const ratio = 255 / (max2 - min2);
|
|
148477
148737
|
const data = new Uint8Array(arr.map((i2) => Math.floor((i2 - min2) * ratio)));
|
|
148478
148738
|
return data;
|
|
@@ -148484,9 +148744,9 @@ function multiSetsToTextureData(multiFeatureValues, multiMatrixObsIndex, setColo
|
|
|
148484
148744
|
var _a3, _b2, _c, _d;
|
|
148485
148745
|
if (isSetColorMode) {
|
|
148486
148746
|
totalColorsLength += (((_b2 = (_a3 = setColorValues[channelIndex]) == null ? void 0 : _a3.setColors) == null ? void 0 : _b2.length) || 0) * 3;
|
|
148487
|
-
totalValuesLength += ((_c = setColorValues[channelIndex]) == null ? void 0 : _c.obsIndex) ? max(setColorValues[channelIndex].obsIndex.map((d) => parseInt(d))) : 0;
|
|
148747
|
+
totalValuesLength += ((_c = setColorValues[channelIndex]) == null ? void 0 : _c.obsIndex) ? max$2(setColorValues[channelIndex].obsIndex.map((d) => parseInt(d))) : 0;
|
|
148488
148748
|
} else {
|
|
148489
|
-
totalValuesLength += multiMatrixObsIndex[channelIndex] ? max(multiMatrixObsIndex[channelIndex].map((d) => parseInt(d))) : ((_d = multiFeatureValues[channelIndex]) == null ? void 0 : _d.length) || 0;
|
|
148749
|
+
totalValuesLength += multiMatrixObsIndex[channelIndex] ? max$2(multiMatrixObsIndex[channelIndex].map((d) => parseInt(d))) : ((_d = multiFeatureValues[channelIndex]) == null ? void 0 : _d.length) || 0;
|
|
148490
148750
|
}
|
|
148491
148751
|
});
|
|
148492
148752
|
const valueTexHeight = Math.max(2, Math.ceil(totalValuesLength / texSize));
|
|
@@ -148898,31 +149158,6 @@ const getMultiSelectionStats = async ({ loader, selections, use3d }) => {
|
|
|
148898
149158
|
const sliders = stats.map((stat) => stat.slider);
|
|
148899
149159
|
return { domains, sliders };
|
|
148900
149160
|
};
|
|
148901
|
-
function square(x2, y2, r2) {
|
|
148902
|
-
return [[x2, y2 + r2], [x2 + r2, y2], [x2, y2 - r2], [x2 - r2, y2]];
|
|
148903
|
-
}
|
|
148904
|
-
const GLOBAL_LABELS = ["z", "t"];
|
|
148905
|
-
const DEFAULT_RASTER_DOMAIN_TYPE = "Min/Max";
|
|
148906
|
-
const DEFAULT_RASTER_LAYER_PROPS = {
|
|
148907
|
-
visible: true,
|
|
148908
|
-
colormap: null,
|
|
148909
|
-
opacity: 1,
|
|
148910
|
-
domainType: DEFAULT_RASTER_DOMAIN_TYPE,
|
|
148911
|
-
transparentColor: [0, 0, 0],
|
|
148912
|
-
renderingMode: RENDERING_MODES.ADDITIVE,
|
|
148913
|
-
use3d: false
|
|
148914
|
-
};
|
|
148915
|
-
const DEFAULT_MOLECULES_LAYER = {
|
|
148916
|
-
opacity: 1,
|
|
148917
|
-
radius: 20,
|
|
148918
|
-
visible: true
|
|
148919
|
-
};
|
|
148920
|
-
const DEFAULT_CELLS_LAYER = {
|
|
148921
|
-
opacity: 1,
|
|
148922
|
-
radius: 50,
|
|
148923
|
-
visible: true,
|
|
148924
|
-
stroked: false
|
|
148925
|
-
};
|
|
148926
149161
|
function getSourceFromLoader(loader, level) {
|
|
148927
149162
|
const { data } = loader;
|
|
148928
149163
|
const source = Array.isArray(data) ? data[level || data.length - 1] : data;
|
|
@@ -151945,163 +152180,6 @@ function getDomains() {
|
|
|
151945
152180
|
return domains;
|
|
151946
152181
|
}
|
|
151947
152182
|
getDomains();
|
|
151948
|
-
class CellsJsonAsObsSegmentationsLoader extends JsonLoader {
|
|
151949
|
-
constructor(dataSource, params) {
|
|
151950
|
-
super(dataSource, params);
|
|
151951
|
-
this.schema = cellsSchema;
|
|
151952
|
-
}
|
|
151953
|
-
loadFromCache(data) {
|
|
151954
|
-
var _a3;
|
|
151955
|
-
if (this.cachedResult) {
|
|
151956
|
-
return this.cachedResult;
|
|
151957
|
-
}
|
|
151958
|
-
const obsIndex = Object.keys(data);
|
|
151959
|
-
const cellObjs = Object.values(data);
|
|
151960
|
-
if (cellObjs.length > 0 && !Array.isArray(cellObjs[0].poly) && !Array.isArray(cellObjs[0].xy)) {
|
|
151961
|
-
this.cachedResult = null;
|
|
151962
|
-
} else {
|
|
151963
|
-
let cellPolygons;
|
|
151964
|
-
if (!Array.isArray(cellObjs[0].poly) || !((_a3 = cellObjs[0].poly) == null ? void 0 : _a3.length)) {
|
|
151965
|
-
const radius = 50;
|
|
151966
|
-
cellPolygons = cellObjs.map((cellObj) => square(cellObj.xy[0], cellObj.xy[1], radius));
|
|
151967
|
-
} else {
|
|
151968
|
-
cellPolygons = cellObjs.map((cellObj) => cellObj.poly);
|
|
151969
|
-
}
|
|
151970
|
-
const obsSegmentations = {
|
|
151971
|
-
data: cellPolygons,
|
|
151972
|
-
shape: [cellPolygons.length, cellPolygons[0].length]
|
|
151973
|
-
};
|
|
151974
|
-
this.cachedResult = { obsIndex, obsSegmentations };
|
|
151975
|
-
}
|
|
151976
|
-
return this.cachedResult;
|
|
151977
|
-
}
|
|
151978
|
-
async load() {
|
|
151979
|
-
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
151980
|
-
if (payload instanceof AbstractLoaderError) {
|
|
151981
|
-
return Promise.reject(payload);
|
|
151982
|
-
}
|
|
151983
|
-
const { data, url } = payload;
|
|
151984
|
-
const result = this.loadFromCache(data);
|
|
151985
|
-
const coordinationValues = {
|
|
151986
|
-
spatialSegmentationLayer: DEFAULT_CELLS_LAYER
|
|
151987
|
-
};
|
|
151988
|
-
return Promise.resolve(new LoaderResult({
|
|
151989
|
-
...result,
|
|
151990
|
-
obsSegmentationsType: "polygon"
|
|
151991
|
-
}, url, coordinationValues));
|
|
151992
|
-
}
|
|
151993
|
-
}
|
|
151994
|
-
const clustersSchema = z.object({
|
|
151995
|
-
rows: z.array(z.string()),
|
|
151996
|
-
cols: z.array(z.string()),
|
|
151997
|
-
matrix: z.array(z.array(z.number()))
|
|
151998
|
-
}).strict();
|
|
151999
|
-
class ClustersJsonAsObsFeatureMatrixLoader extends JsonLoader {
|
|
152000
|
-
constructor(dataSource, params) {
|
|
152001
|
-
super(dataSource, params);
|
|
152002
|
-
this.schema = clustersSchema;
|
|
152003
|
-
}
|
|
152004
|
-
loadFromCache(data) {
|
|
152005
|
-
if (this.cachedResult) {
|
|
152006
|
-
return this.cachedResult;
|
|
152007
|
-
}
|
|
152008
|
-
const { rows: featureIndex, cols: obsIndex, matrix: matrix2 } = data;
|
|
152009
|
-
const attrs = {
|
|
152010
|
-
rows: obsIndex,
|
|
152011
|
-
cols: featureIndex
|
|
152012
|
-
};
|
|
152013
|
-
const shape = [attrs.rows.length, attrs.cols.length];
|
|
152014
|
-
const normalizedMatrix = matrix2.map((col) => {
|
|
152015
|
-
const [min2, max2] = extent(col);
|
|
152016
|
-
const normalize2 = (d) => Math.floor((d - min2) / (max2 - min2) * 255);
|
|
152017
|
-
return col.map(normalize2);
|
|
152018
|
-
});
|
|
152019
|
-
const tNormalizedMatrix = range$8(shape[0]).map((i2) => range$8(shape[1]).map((j) => normalizedMatrix[j][i2]));
|
|
152020
|
-
const normalizedFlatMatrix = tNormalizedMatrix.flat();
|
|
152021
|
-
const obsFeatureMatrix = { data: Uint8Array.from(normalizedFlatMatrix) };
|
|
152022
|
-
this.cachedResult = { obsIndex, featureIndex, obsFeatureMatrix };
|
|
152023
|
-
return this.cachedResult;
|
|
152024
|
-
}
|
|
152025
|
-
async load() {
|
|
152026
|
-
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
152027
|
-
if (payload instanceof AbstractLoaderError) {
|
|
152028
|
-
return Promise.reject(payload);
|
|
152029
|
-
}
|
|
152030
|
-
const { data, url } = payload;
|
|
152031
|
-
const result = this.loadFromCache(data);
|
|
152032
|
-
return Promise.resolve(new LoaderResult(
|
|
152033
|
-
result,
|
|
152034
|
-
url
|
|
152035
|
-
));
|
|
152036
|
-
}
|
|
152037
|
-
}
|
|
152038
|
-
const genesSchema = z.record(z.object({
|
|
152039
|
-
max: z.number(),
|
|
152040
|
-
cells: z.record(z.number())
|
|
152041
|
-
}));
|
|
152042
|
-
class GenesJsonAsObsFeatureMatrixLoader extends JsonLoader {
|
|
152043
|
-
constructor(dataSource, params) {
|
|
152044
|
-
super(dataSource, params);
|
|
152045
|
-
this.schema = genesSchema;
|
|
152046
|
-
}
|
|
152047
|
-
loadFromCache(data) {
|
|
152048
|
-
if (this.cachedResult) {
|
|
152049
|
-
return this.cachedResult;
|
|
152050
|
-
}
|
|
152051
|
-
const cols = Object.keys(data);
|
|
152052
|
-
const rows = cols.length > 0 ? Object.keys(data[cols[0]].cells) : [];
|
|
152053
|
-
const normalizedFlatMatrix = rows.flatMap((cellId) => cols.map(
|
|
152054
|
-
(geneId) => data[geneId].cells[cellId] / data[geneId].max * 255
|
|
152055
|
-
));
|
|
152056
|
-
const featureIndex = cols;
|
|
152057
|
-
const obsIndex = rows;
|
|
152058
|
-
const obsFeatureMatrix = { data: Uint8Array.from(normalizedFlatMatrix) };
|
|
152059
|
-
this.cachedResult = { obsIndex, featureIndex, obsFeatureMatrix };
|
|
152060
|
-
return this.cachedResult;
|
|
152061
|
-
}
|
|
152062
|
-
async load() {
|
|
152063
|
-
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
152064
|
-
if (payload instanceof AbstractLoaderError) {
|
|
152065
|
-
return Promise.reject(payload);
|
|
152066
|
-
}
|
|
152067
|
-
const { data, url } = payload;
|
|
152068
|
-
const result = this.loadFromCache(data);
|
|
152069
|
-
return Promise.resolve(new LoaderResult(
|
|
152070
|
-
result,
|
|
152071
|
-
url
|
|
152072
|
-
));
|
|
152073
|
-
}
|
|
152074
|
-
}
|
|
152075
|
-
class MoleculesJsonAsObsLabelsLoader extends JsonLoader {
|
|
152076
|
-
constructor(dataSource, params) {
|
|
152077
|
-
super(dataSource, params);
|
|
152078
|
-
this.schema = moleculesSchema;
|
|
152079
|
-
}
|
|
152080
|
-
loadFromCache(data) {
|
|
152081
|
-
if (this.cachedResult) {
|
|
152082
|
-
return this.cachedResult;
|
|
152083
|
-
}
|
|
152084
|
-
const obsIndex = range$8(sum$3(Object.values(data).map((v) => v.length))).map((i2) => String(i2));
|
|
152085
|
-
let obsLabels = [];
|
|
152086
|
-
Object.entries(data).forEach(([gene, locations]) => {
|
|
152087
|
-
obsLabels = [
|
|
152088
|
-
...obsLabels,
|
|
152089
|
-
...range$8(locations.length).map(() => gene)
|
|
152090
|
-
];
|
|
152091
|
-
});
|
|
152092
|
-
this.cachedResult = { obsIndex, obsLabels };
|
|
152093
|
-
return this.cachedResult;
|
|
152094
|
-
}
|
|
152095
|
-
async load() {
|
|
152096
|
-
const payload = await super.load().catch((reason) => Promise.resolve(reason));
|
|
152097
|
-
if (payload instanceof AbstractLoaderError) {
|
|
152098
|
-
return Promise.reject(payload);
|
|
152099
|
-
}
|
|
152100
|
-
const { data, url } = payload;
|
|
152101
|
-
const result = this.loadFromCache(data);
|
|
152102
|
-
return Promise.resolve(new LoaderResult(result, url));
|
|
152103
|
-
}
|
|
152104
|
-
}
|
|
152105
152183
|
class MoleculesJsonAsObsLocationsLoader extends JsonLoader {
|
|
152106
152184
|
constructor(dataSource, params) {
|
|
152107
152185
|
super(dataSource, params);
|