@vitessce/scatterplot-embedding 3.8.8 → 3.8.9
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-Dr6bxD0w.js → deflate-YIIHzd8y.js} +1 -1
- package/dist/{index-DXCCF6LM.js → index-DYO3tfis.js} +68 -8
- package/dist/index.js +1 -1
- package/dist/{jpeg-UKzKGs1t.js → jpeg-BBSvSY8b.js} +1 -1
- package/dist/{lerc-D62tGpqi.js → lerc-DsiDEIic.js} +1 -1
- package/dist/{lzw-Dbo7OpaS.js → lzw-B2nz96hr.js} +1 -1
- package/dist/{packbits-0X-GrQId.js → packbits-JodEChjB.js} +1 -1
- package/dist/{raw-CBdLq0ga.js → raw-xM2f2nBA.js} +1 -1
- package/dist/{webimage-C2vUudNG.js → webimage-Bk5jq0He.js} +1 -1
- package/dist-tsc/EmbeddingScatterplotSubscriber.d.ts.map +1 -1
- package/dist-tsc/EmbeddingScatterplotSubscriber.js +12 -2
- package/package.json +8 -8
- package/src/EmbeddingScatterplotSubscriber.js +14 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-SxljTded.js";
|
|
2
|
-
import { B as BaseDecoder } from "./index-
|
|
2
|
+
import { B as BaseDecoder } from "./index-DYO3tfis.js";
|
|
3
3
|
class DeflateDecoder extends BaseDecoder {
|
|
4
4
|
decodeBlock(buffer) {
|
|
5
5
|
return inflate_1(new Uint8Array(buffer)).buffer;
|
|
@@ -3098,6 +3098,59 @@ const PALETTE = [
|
|
|
3098
3098
|
[136, 34, 85],
|
|
3099
3099
|
[170, 68, 153]
|
|
3100
3100
|
];
|
|
3101
|
+
function aggregateFeatureArrays(arrays, strategy) {
|
|
3102
|
+
if (!arrays || arrays.length === 0)
|
|
3103
|
+
return null;
|
|
3104
|
+
let targetArray;
|
|
3105
|
+
if (strategy === "first" || typeof strategy === "number" && strategy === 0) {
|
|
3106
|
+
targetArray = arrays[0];
|
|
3107
|
+
} else if (strategy === "last") {
|
|
3108
|
+
targetArray = arrays[arrays.length - 1];
|
|
3109
|
+
} else if (typeof strategy === "number") {
|
|
3110
|
+
if (strategy >= 0 && strategy < arrays.length) {
|
|
3111
|
+
targetArray = arrays[strategy];
|
|
3112
|
+
} else {
|
|
3113
|
+
throw new Error(`Array index out of bounds: ${strategy}`);
|
|
3114
|
+
}
|
|
3115
|
+
}
|
|
3116
|
+
if (targetArray) {
|
|
3117
|
+
return targetArray;
|
|
3118
|
+
}
|
|
3119
|
+
const numArrays = arrays.length;
|
|
3120
|
+
const firstArrayLength = arrays[0].length;
|
|
3121
|
+
if (arrays.some((arr) => arr.length !== firstArrayLength)) {
|
|
3122
|
+
throw new Error("All arrays must have the same length for aggregation.");
|
|
3123
|
+
}
|
|
3124
|
+
if (strategy === "sum" || strategy === "mean") {
|
|
3125
|
+
const resultArray = new Float64Array(firstArrayLength);
|
|
3126
|
+
for (let i2 = 0; i2 < numArrays; i2++) {
|
|
3127
|
+
const arr = arrays[i2];
|
|
3128
|
+
for (let j = 0; j < firstArrayLength; j++) {
|
|
3129
|
+
resultArray[j] += arr[j];
|
|
3130
|
+
}
|
|
3131
|
+
}
|
|
3132
|
+
if (strategy === "mean") {
|
|
3133
|
+
for (let i2 = 0; i2 < firstArrayLength; i2++) {
|
|
3134
|
+
resultArray[i2] /= numArrays;
|
|
3135
|
+
}
|
|
3136
|
+
}
|
|
3137
|
+
return resultArray;
|
|
3138
|
+
}
|
|
3139
|
+
if (strategy === "difference") {
|
|
3140
|
+
if (numArrays !== 2) {
|
|
3141
|
+
console.warn("Difference strategy requires exactly 2 arrays.");
|
|
3142
|
+
return arrays[0];
|
|
3143
|
+
}
|
|
3144
|
+
const arr0 = arrays[0];
|
|
3145
|
+
const arr1 = arrays[1];
|
|
3146
|
+
const resultArray = new Float64Array(firstArrayLength);
|
|
3147
|
+
for (let i2 = 0; i2 < firstArrayLength; i2++) {
|
|
3148
|
+
resultArray[i2] = arr0[i2] - arr1[i2];
|
|
3149
|
+
}
|
|
3150
|
+
return resultArray;
|
|
3151
|
+
}
|
|
3152
|
+
throw new Error(`Unknown aggregation strategy: ${strategy}`);
|
|
3153
|
+
}
|
|
3101
3154
|
var util;
|
|
3102
3155
|
(function(util2) {
|
|
3103
3156
|
util2.assertEqual = (val) => val;
|
|
@@ -123348,22 +123401,22 @@ function addDecoder(cases, importFn) {
|
|
|
123348
123401
|
}
|
|
123349
123402
|
cases.forEach((c2) => registry$1.set(c2, importFn));
|
|
123350
123403
|
}
|
|
123351
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
123352
|
-
addDecoder(5, () => import("./lzw-
|
|
123404
|
+
addDecoder([void 0, 1], () => import("./raw-xM2f2nBA.js").then((m2) => m2.default));
|
|
123405
|
+
addDecoder(5, () => import("./lzw-B2nz96hr.js").then((m2) => m2.default));
|
|
123353
123406
|
addDecoder(6, () => {
|
|
123354
123407
|
throw new Error("old style JPEG compression is not supported.");
|
|
123355
123408
|
});
|
|
123356
|
-
addDecoder(7, () => import("./jpeg-
|
|
123357
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
123358
|
-
addDecoder(32773, () => import("./packbits-
|
|
123409
|
+
addDecoder(7, () => import("./jpeg-BBSvSY8b.js").then((m2) => m2.default));
|
|
123410
|
+
addDecoder([8, 32946], () => import("./deflate-YIIHzd8y.js").then((m2) => m2.default));
|
|
123411
|
+
addDecoder(32773, () => import("./packbits-JodEChjB.js").then((m2) => m2.default));
|
|
123359
123412
|
addDecoder(
|
|
123360
123413
|
34887,
|
|
123361
|
-
() => import("./lerc-
|
|
123414
|
+
() => import("./lerc-DsiDEIic.js").then(async (m2) => {
|
|
123362
123415
|
await m2.zstd.init();
|
|
123363
123416
|
return m2;
|
|
123364
123417
|
}).then((m2) => m2.default)
|
|
123365
123418
|
);
|
|
123366
|
-
addDecoder(50001, () => import("./webimage-
|
|
123419
|
+
addDecoder(50001, () => import("./webimage-Bk5jq0He.js").then((m2) => m2.default));
|
|
123367
123420
|
function decodeRowAcc(row, stride) {
|
|
123368
123421
|
let length2 = row.length - stride;
|
|
123369
123422
|
let offset2 = 0;
|
|
@@ -153768,11 +153821,18 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
153768
153821
|
const getCellIsSelected = useCallback((object2, { index: index2 }) => (cellSelectionSet || /* @__PURE__ */ new Set([])).has(obsEmbeddingIndex[index2]) ? 1 : 0, [cellSelectionSet, obsEmbeddingIndex]);
|
|
153769
153822
|
const cellRadius = cellRadiusMode === "manual" ? cellRadiusFixed : dynamicCellRadius;
|
|
153770
153823
|
const cellOpacity = cellOpacityMode === "manual" ? cellOpacityFixed : dynamicCellOpacity;
|
|
153824
|
+
const aggregatedExpressionData = useMemo(() => {
|
|
153825
|
+
if (featureAggregationStrategyToUse != null && expressionData && expressionData.length > 1) {
|
|
153826
|
+
const aggregated = aggregateFeatureArrays(expressionData, featureAggregationStrategyToUse);
|
|
153827
|
+
return [aggregated];
|
|
153828
|
+
}
|
|
153829
|
+
return expressionData;
|
|
153830
|
+
}, [expressionData, featureAggregationStrategyToUse]);
|
|
153771
153831
|
const {
|
|
153772
153832
|
normData: uint8ExpressionData,
|
|
153773
153833
|
extents: expressionExtents,
|
|
153774
153834
|
missing: expressionMissing
|
|
153775
|
-
} = useUint8FeatureSelection(
|
|
153835
|
+
} = useUint8FeatureSelection(aggregatedExpressionData);
|
|
153776
153836
|
const getExpressionValue = useExpressionValueGetter({
|
|
153777
153837
|
instanceObsIndex: obsEmbeddingIndex,
|
|
153778
153838
|
matrixObsIndex,
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { i as inflate_1 } from "./pako.esm-SxljTded.js";
|
|
2
|
-
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-DYO3tfis.js";
|
|
3
3
|
const LercParameters = {
|
|
4
4
|
AddCompression: 1
|
|
5
5
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EmbeddingScatterplotSubscriber.d.ts","sourceRoot":"","sources":["../src/EmbeddingScatterplotSubscriber.js"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;GAYG;AACH,sDAVG;IAAsB,IAAI,EAAlB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;CAEhB,
|
|
1
|
+
{"version":3,"file":"EmbeddingScatterplotSubscriber.d.ts","sourceRoot":"","sources":["../src/EmbeddingScatterplotSubscriber.js"],"names":[],"mappings":"AA6CA;;;;;;;;;;;;GAYG;AACH,sDAVG;IAAsB,IAAI,EAAlB,MAAM;IACQ,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;IAEU,mBAAmB;IAErB,KAAK,EAAnB,MAAM;IACQ,kBAAkB,EAAhC,MAAM;CAEhB,eA4mBA"}
|
|
@@ -5,7 +5,7 @@ import { isEqual } from 'lodash-es';
|
|
|
5
5
|
import { circle } from '@turf/circle';
|
|
6
6
|
import { TitleInfo, useReady, useUrls, useDeckCanvasSize, useUint8FeatureSelection, useExpressionValueGetter, useGetObsInfo, useObsEmbeddingData, useObsSetsData, useFeatureSelection, useObsFeatureMatrixIndices, useFeatureLabelsData, useMultiObsLabels, useSampleSetsData, useSampleEdgesData, useCoordination, useLoaders, useSetComponentHover, useSetComponentViewInfo, useInitialCoordination, useExpandedFeatureLabelsMap, useCoordinationScopes, } from '@vitessce/vit-s';
|
|
7
7
|
import { setObsSelection, mergeObsSets, getCellSetPolygons, getCellColors, stratifyArrays, } from '@vitessce/sets-utils';
|
|
8
|
-
import { pluralize as plur, commaNumber } from '@vitessce/utils';
|
|
8
|
+
import { pluralize as plur, commaNumber, aggregateFeatureArrays } from '@vitessce/utils';
|
|
9
9
|
import { Scatterplot, ScatterplotTooltipSubscriber, ScatterplotOptions, getPointSizeDevicePixels, getPointOpacity, } from '@vitessce/scatterplot';
|
|
10
10
|
import { Legend } from '@vitessce/legend';
|
|
11
11
|
import { ViewType, COMPONENT_COORDINATION_TYPES, ViewHelpMapping } from '@vitessce/constants-internal';
|
|
@@ -182,7 +182,17 @@ export function EmbeddingScatterplotSubscriber(props) {
|
|
|
182
182
|
const getCellIsSelected = useCallback((object, { index }) => ((cellSelectionSet || new Set([])).has(obsEmbeddingIndex[index]) ? 1.0 : 0.0), [cellSelectionSet, obsEmbeddingIndex]);
|
|
183
183
|
const cellRadius = (cellRadiusMode === 'manual' ? cellRadiusFixed : dynamicCellRadius);
|
|
184
184
|
const cellOpacity = (cellOpacityMode === 'manual' ? cellOpacityFixed : dynamicCellOpacity);
|
|
185
|
-
|
|
185
|
+
// Compute aggregated expression data if featureAggregationStrategyToUse is not null
|
|
186
|
+
// and we have multiple features to aggregate.
|
|
187
|
+
const aggregatedExpressionData = useMemo(() => {
|
|
188
|
+
if (featureAggregationStrategyToUse != null && expressionData && expressionData.length > 1) {
|
|
189
|
+
const aggregated = aggregateFeatureArrays(expressionData, featureAggregationStrategyToUse);
|
|
190
|
+
// Return as array with single element to match expressionData structure
|
|
191
|
+
return [aggregated];
|
|
192
|
+
}
|
|
193
|
+
return expressionData;
|
|
194
|
+
}, [expressionData, featureAggregationStrategyToUse]);
|
|
195
|
+
const { normData: uint8ExpressionData, extents: expressionExtents, missing: expressionMissing, } = useUint8FeatureSelection(aggregatedExpressionData);
|
|
186
196
|
// Set up a getter function for gene expression values, to be used
|
|
187
197
|
// by the DeckGL layer to obtain values for instanced attributes.
|
|
188
198
|
const getExpressionValue = useExpressionValueGetter({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/scatterplot-embedding",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.9",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"lodash-es": "^4.17.21",
|
|
21
21
|
"react-aria": "^3.28.0",
|
|
22
22
|
"@turf/circle": "^7.2.0",
|
|
23
|
-
"@vitessce/styles": "3.8.
|
|
24
|
-
"@vitessce/constants-internal": "3.8.
|
|
25
|
-
"@vitessce/legend": "3.8.
|
|
26
|
-
"@vitessce/
|
|
27
|
-
"@vitessce/utils": "3.8.
|
|
28
|
-
"@vitessce/
|
|
29
|
-
"@vitessce/
|
|
23
|
+
"@vitessce/styles": "3.8.9",
|
|
24
|
+
"@vitessce/constants-internal": "3.8.9",
|
|
25
|
+
"@vitessce/legend": "3.8.9",
|
|
26
|
+
"@vitessce/scatterplot": "3.8.9",
|
|
27
|
+
"@vitessce/sets-utils": "3.8.9",
|
|
28
|
+
"@vitessce/utils": "3.8.9",
|
|
29
|
+
"@vitessce/vit-s": "3.8.9"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"react": "18.3.1",
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
setObsSelection, mergeObsSets, getCellSetPolygons, getCellColors,
|
|
32
32
|
stratifyArrays,
|
|
33
33
|
} from '@vitessce/sets-utils';
|
|
34
|
-
import { pluralize as plur, commaNumber } from '@vitessce/utils';
|
|
34
|
+
import { pluralize as plur, commaNumber, aggregateFeatureArrays } from '@vitessce/utils';
|
|
35
35
|
import {
|
|
36
36
|
Scatterplot, ScatterplotTooltipSubscriber, ScatterplotOptions,
|
|
37
37
|
getPointSizeDevicePixels,
|
|
@@ -365,7 +365,7 @@ export function EmbeddingScatterplotSubscriber(props) {
|
|
|
365
365
|
setOriginalViewState({ target: [initialTargetX, initialTargetY, 0], zoom: initialZoom });
|
|
366
366
|
}
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
369
369
|
}, [xRange, yRange, xExtent, yExtent, numCells,
|
|
370
370
|
width, height, initialZoom, zoom, initialTargetX, initialTargetY, averageFillDensity]);
|
|
371
371
|
|
|
@@ -381,11 +381,22 @@ export function EmbeddingScatterplotSubscriber(props) {
|
|
|
381
381
|
const cellRadius = (cellRadiusMode === 'manual' ? cellRadiusFixed : dynamicCellRadius);
|
|
382
382
|
const cellOpacity = (cellOpacityMode === 'manual' ? cellOpacityFixed : dynamicCellOpacity);
|
|
383
383
|
|
|
384
|
+
// Compute aggregated expression data if featureAggregationStrategyToUse is not null
|
|
385
|
+
// and we have multiple features to aggregate.
|
|
386
|
+
const aggregatedExpressionData = useMemo(() => {
|
|
387
|
+
if (featureAggregationStrategyToUse != null && expressionData && expressionData.length > 1) {
|
|
388
|
+
const aggregated = aggregateFeatureArrays(expressionData, featureAggregationStrategyToUse);
|
|
389
|
+
// Return as array with single element to match expressionData structure
|
|
390
|
+
return [aggregated];
|
|
391
|
+
}
|
|
392
|
+
return expressionData;
|
|
393
|
+
}, [expressionData, featureAggregationStrategyToUse]);
|
|
394
|
+
|
|
384
395
|
const {
|
|
385
396
|
normData: uint8ExpressionData,
|
|
386
397
|
extents: expressionExtents,
|
|
387
398
|
missing: expressionMissing,
|
|
388
|
-
} = useUint8FeatureSelection(
|
|
399
|
+
} = useUint8FeatureSelection(aggregatedExpressionData);
|
|
389
400
|
|
|
390
401
|
// Set up a getter function for gene expression values, to be used
|
|
391
402
|
// by the DeckGL layer to obtain values for instanced attributes.
|