@vitessce/dev 3.5.10 → 3.5.11
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-e7ea1676.js → deflate-d498ba89.js} +1 -1
- package/dist/{higlass-c5004fea.js → higlass-24a2d79c.js} +1 -1
- package/dist/{index-f1a9e799.js → index-2c304ba6.js} +1 -1
- package/dist/{index-5fa58d34.js → index-7a69579f.js} +515 -215
- package/dist/{index-800e8a7d.js → index-9956beb7.js} +2 -2
- package/dist/index.js +1 -1
- package/dist/{jpeg-2fa62753.js → jpeg-391a6a8b.js} +1 -1
- package/dist/{lerc-49d3fc18.js → lerc-ca7a3f4f.js} +1 -1
- package/dist/{lzw-664d7a22.js → lzw-e89447c6.js} +1 -1
- package/dist/{packbits-7bd305e5.js → packbits-9c2adfe3.js} +1 -1
- package/dist/{raw-7abf6614.js → raw-3b2ecece.js} +1 -1
- package/dist/{troika-three-text.esm-39d94b6d.js → troika-three-text.esm-a0868f69.js} +1 -1
- package/dist/{webimage-8c8572cd.js → webimage-21345225.js} +1 -1
- package/package.json +5 -5
|
@@ -318,6 +318,7 @@ const CoordinationType$2 = {
|
|
|
318
318
|
FEATURE_VALUE_COLORMAP: "featureValueColormap",
|
|
319
319
|
FEATURE_VALUE_TRANSFORM: "featureValueTransform",
|
|
320
320
|
FEATURE_VALUE_COLORMAP_RANGE: "featureValueColormapRange",
|
|
321
|
+
FEATURE_AGGREGATION_STRATEGY: "featureAggregationStrategy",
|
|
321
322
|
OBS_COLOR_ENCODING: "obsColorEncoding",
|
|
322
323
|
SPATIAL_IMAGE_LAYER: "spatialImageLayer",
|
|
323
324
|
SPATIAL_SEGMENTATION_LAYER: "spatialSegmentationLayer",
|
|
@@ -585,7 +586,8 @@ const AUTO_INDEPENDENT_COORDINATION_TYPES = [
|
|
|
585
586
|
CoordinationType$2.EMBEDDING_OBS_SET_LABELS_VISIBLE,
|
|
586
587
|
CoordinationType$2.EMBEDDING_OBS_SET_LABEL_SIZE,
|
|
587
588
|
CoordinationType$2.EMBEDDING_OBS_RADIUS,
|
|
588
|
-
CoordinationType$2.EMBEDDING_OBS_OPACITY
|
|
589
|
+
CoordinationType$2.EMBEDDING_OBS_OPACITY,
|
|
590
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY
|
|
589
591
|
];
|
|
590
592
|
const COMPONENT_COORDINATION_TYPES = {
|
|
591
593
|
[ViewType$2.NEUROGLANCER]: [
|
|
@@ -620,6 +622,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
620
622
|
CoordinationType$2.FEATURE_SELECTION,
|
|
621
623
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
622
624
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
625
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
623
626
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
624
627
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
625
628
|
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
@@ -663,6 +666,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
663
666
|
CoordinationType$2.FEATURE_SELECTION,
|
|
664
667
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
665
668
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
669
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
666
670
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
667
671
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
668
672
|
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
@@ -742,6 +746,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
742
746
|
CoordinationType$2.FEATURE_SELECTION,
|
|
743
747
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
744
748
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
749
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
745
750
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
746
751
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
747
752
|
CoordinationType$2.MOLECULE_HIGHLIGHT,
|
|
@@ -779,6 +784,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
779
784
|
CoordinationType$2.FEATURE_SELECTION,
|
|
780
785
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
781
786
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
787
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
782
788
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
783
789
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
784
790
|
CoordinationType$2.MOLECULE_HIGHLIGHT,
|
|
@@ -892,6 +898,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
892
898
|
CoordinationType$2.FEATURE_SELECTION,
|
|
893
899
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM,
|
|
894
900
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
901
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
895
902
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
896
903
|
CoordinationType$2.OBS_SET_FILTER,
|
|
897
904
|
CoordinationType$2.OBS_SET_HIGHLIGHT,
|
|
@@ -907,6 +914,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
907
914
|
CoordinationType$2.FEATURE_TYPE,
|
|
908
915
|
CoordinationType$2.FEATURE_VALUE_TYPE,
|
|
909
916
|
CoordinationType$2.FEATURE_SELECTION,
|
|
917
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
910
918
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
911
919
|
CoordinationType$2.OBS_SET_COLOR,
|
|
912
920
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
@@ -985,6 +993,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
985
993
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
986
994
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
987
995
|
CoordinationType$2.FEATURE_SELECTION,
|
|
996
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
988
997
|
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
989
998
|
CoordinationType$2.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
990
999
|
CoordinationType$2.LEGEND_VISIBLE,
|
|
@@ -1025,6 +1034,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1025
1034
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
1026
1035
|
CoordinationType$2.FEATURE_VALUE_POSITIVITY_THRESHOLD,
|
|
1027
1036
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
1037
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
1028
1038
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
1029
1039
|
CoordinationType$2.OBS_SET_FILTER,
|
|
1030
1040
|
CoordinationType$2.OBS_SET_HIGHLIGHT,
|
|
@@ -1053,6 +1063,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1053
1063
|
CoordinationType$2.FEATURE_SELECTION,
|
|
1054
1064
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM,
|
|
1055
1065
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
1066
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
1056
1067
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
1057
1068
|
CoordinationType$2.OBS_SET_HIGHLIGHT,
|
|
1058
1069
|
CoordinationType$2.OBS_HIGHLIGHT,
|
|
@@ -1157,6 +1168,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1157
1168
|
CoordinationType$2.OBS_TYPE,
|
|
1158
1169
|
CoordinationType$2.SAMPLE_TYPE,
|
|
1159
1170
|
CoordinationType$2.FEATURE_SELECTION,
|
|
1171
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
1160
1172
|
CoordinationType$2.SAMPLE_SET_SELECTION,
|
|
1161
1173
|
CoordinationType$2.SAMPLE_SET_FILTER,
|
|
1162
1174
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
@@ -1197,10 +1209,10 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1197
1209
|
]
|
|
1198
1210
|
};
|
|
1199
1211
|
const note = "This file is autogenerated by .changeset/post-changelog.mjs.";
|
|
1200
|
-
const version$6 = "3.5.
|
|
1201
|
-
const date$5 = "2025-03
|
|
1212
|
+
const version$6 = "3.5.11";
|
|
1213
|
+
const date$5 = "2025-04-03";
|
|
1202
1214
|
const branch = "changeset-release/main";
|
|
1203
|
-
const hash$1 = "
|
|
1215
|
+
const hash$1 = "8043908f";
|
|
1204
1216
|
const META_VERSION = {
|
|
1205
1217
|
note,
|
|
1206
1218
|
version: version$6,
|
|
@@ -39148,6 +39160,7 @@ const annDataFeatureSetStats = z.object({
|
|
|
39148
39160
|
termColumn: z.string().optional(),
|
|
39149
39161
|
pValueColumn: z.string(),
|
|
39150
39162
|
pValueAdjusted: z.boolean().optional(),
|
|
39163
|
+
featureSetLibrary: z.string().optional().describe("Optionally, provide a feature set library name. By default, Reactome_2022."),
|
|
39151
39164
|
analysisType: z.string().optional().describe("Optionally, provide an analysis_type name. By default, pertpy_hypergeometric.")
|
|
39152
39165
|
});
|
|
39153
39166
|
const annDataObsSetStats = z.object({
|
|
@@ -39158,7 +39171,6 @@ const annDataObsSetStats = z.object({
|
|
|
39158
39171
|
foldChangeColumn: z.string().describe("The log-fold change is then calculated between this expected sample and the expected sample with no active covariates from the intercept section."),
|
|
39159
39172
|
foldChangeTransformation: z.enum(["log2"]).optional(),
|
|
39160
39173
|
isCredibleEffectColumn: z.string().describe("Column which annotates effects as being credible or not (boolean)."),
|
|
39161
|
-
covariateColumn: z.string().describe("Column which defines the covariate used in the analysis."),
|
|
39162
39174
|
analysisType: z.string().optional().describe("Optionally, provide an analysis_type name. By default, sccoda_df.")
|
|
39163
39175
|
});
|
|
39164
39176
|
const annDataObsLabels = annDataObs;
|
|
@@ -68453,7 +68465,7 @@ function getCellColors(params2) {
|
|
|
68453
68465
|
}
|
|
68454
68466
|
return /* @__PURE__ */ new Map();
|
|
68455
68467
|
}
|
|
68456
|
-
function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, obsIndex, mergedCellSets, cellSetSelection, arraysToStratify) {
|
|
68468
|
+
function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, obsIndex, mergedCellSets, cellSetSelection, arraysToStratify, featureAggregationStrategy) {
|
|
68457
68469
|
const result = new InternMap$1([], JSON.stringify);
|
|
68458
68470
|
const hasSampleSetSelection = Array.isArray(sampleSetSelection) && sampleSetSelection.length > 0;
|
|
68459
68471
|
const hasCellSetSelection = Array.isArray(cellSetSelection) && cellSetSelection.length > 0;
|
|
@@ -68463,9 +68475,13 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68463
68475
|
if (arrKeys.includes("obsIndex") || arrKeys.includes("i")) {
|
|
68464
68476
|
throw new Error('The keys "obsIndex" and "i" are reserved for internal use.');
|
|
68465
68477
|
}
|
|
68466
|
-
if (Object.
|
|
68467
|
-
|
|
68468
|
-
|
|
68478
|
+
if (Object.entries(arraysToStratify).some(([arrKey, arr]) => {
|
|
68479
|
+
if (arrKey === "featureValue") {
|
|
68480
|
+
return arr.some((a2) => a2.length !== obsIndex.length);
|
|
68481
|
+
}
|
|
68482
|
+
return arr.length !== obsIndex.length;
|
|
68483
|
+
}))
|
|
68484
|
+
;
|
|
68469
68485
|
const sampleSetInfo = sampleSets && sampleSetSelection ? treeToObsIdsBySetNames(sampleSets, sampleSetSelection) : null;
|
|
68470
68486
|
const cellSetInfo = mergedCellSets && cellSetSelection ? treeToObsIdsBySetNames(mergedCellSets, cellSetSelection) : null;
|
|
68471
68487
|
cellSetKeys.forEach((cellSetKey) => {
|
|
@@ -68494,6 +68510,7 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68494
68510
|
});
|
|
68495
68511
|
const sampleIdToSetMap = sampleSets && sampleSetSelection ? treeToSelectedSetMap(sampleSets, sampleSetSelection) : null;
|
|
68496
68512
|
const cellIdToSetMap = mergedCellSets && cellSetSelection ? treeToSelectedSetMap(mergedCellSets, cellSetSelection) : null;
|
|
68513
|
+
let cellCount = 0;
|
|
68497
68514
|
for (let i2 = 0; i2 < obsIndex.length; i2 += 1) {
|
|
68498
68515
|
const obsId = obsIndex[i2];
|
|
68499
68516
|
const cellSet = cellIdToSetMap?.get(obsId) || null;
|
|
@@ -68504,10 +68521,28 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68504
68521
|
}
|
|
68505
68522
|
const insertionIndex = result.get(cellSet).get(sampleSet).get("i");
|
|
68506
68523
|
arrKeys.forEach((arrKey) => {
|
|
68507
|
-
|
|
68524
|
+
let value2;
|
|
68525
|
+
if (arrKey === "featureValue") {
|
|
68526
|
+
if (featureAggregationStrategy === "first") {
|
|
68527
|
+
value2 = arraysToStratify[arrKey][0][i2];
|
|
68528
|
+
} else if (featureAggregationStrategy === "last") {
|
|
68529
|
+
value2 = arraysToStratify[arrKey].at(-1)[i2];
|
|
68530
|
+
} else if (typeof featureAggregationStrategy === "number") {
|
|
68531
|
+
const j = featureAggregationStrategy;
|
|
68532
|
+
value2 = arraysToStratify[arrKey][j][i2];
|
|
68533
|
+
} else if (featureAggregationStrategy === "sum" || featureAggregationStrategy === "mean") {
|
|
68534
|
+
value2 = arraysToStratify[arrKey].reduce((a2, h2) => a2 + h2[i2], 0);
|
|
68535
|
+
if (featureAggregationStrategy === "mean") {
|
|
68536
|
+
value2 /= arraysToStratify[arrKey].length;
|
|
68537
|
+
}
|
|
68538
|
+
}
|
|
68539
|
+
} else {
|
|
68540
|
+
value2 = arraysToStratify[arrKey][i2];
|
|
68541
|
+
}
|
|
68508
68542
|
result.get(cellSet).get(sampleSet).get(arrKey)[insertionIndex] = value2;
|
|
68509
68543
|
});
|
|
68510
68544
|
result.get(cellSet).get(sampleSet).set("i", insertionIndex + 1);
|
|
68545
|
+
cellCount += 1;
|
|
68511
68546
|
}
|
|
68512
68547
|
cellSetKeys.forEach((cellSetKey) => {
|
|
68513
68548
|
sampleSetKeys.forEach((sampleSetKey) => {
|
|
@@ -68518,7 +68553,7 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68518
68553
|
result.get(cellSetKey).get(sampleSetKey).delete("i");
|
|
68519
68554
|
});
|
|
68520
68555
|
});
|
|
68521
|
-
return result;
|
|
68556
|
+
return [result, cellCount];
|
|
68522
68557
|
}
|
|
68523
68558
|
function stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, mergedCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient) {
|
|
68524
68559
|
const result = new InternMap$1([], JSON.stringify);
|
|
@@ -68561,12 +68596,38 @@ function stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, exp
|
|
|
68561
68596
|
}
|
|
68562
68597
|
return [null, null];
|
|
68563
68598
|
}
|
|
68564
|
-
function aggregateStratifiedExpressionData(stratifiedResult, geneSelection) {
|
|
68599
|
+
function aggregateStratifiedExpressionData(stratifiedResult, geneSelection, featureAggregationStrategy) {
|
|
68565
68600
|
const result = new InternMap$1([], JSON.stringify);
|
|
68566
68601
|
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
|
68567
68602
|
result.set(cellSetKey, new InternMap$1([], JSON.stringify));
|
|
68568
68603
|
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
|
68569
|
-
|
|
68604
|
+
let values3;
|
|
68605
|
+
if (featureAggregationStrategy === "first") {
|
|
68606
|
+
values3 = secondLevelInternMap.get(geneSelection[0]);
|
|
68607
|
+
} else if (featureAggregationStrategy === "last") {
|
|
68608
|
+
values3 = secondLevelInternMap.get(geneSelection.at(-1));
|
|
68609
|
+
} else if (typeof featureAggregationStrategy === "number") {
|
|
68610
|
+
const i2 = featureAggregationStrategy;
|
|
68611
|
+
if (i2 >= 0 && i2 < geneSelection.length) {
|
|
68612
|
+
values3 = secondLevelInternMap.get(geneSelection[i2]);
|
|
68613
|
+
} else {
|
|
68614
|
+
throw new Error("Feature index used for featureAggregationStrategy is invalid.");
|
|
68615
|
+
}
|
|
68616
|
+
} else if (featureAggregationStrategy === "sum" || featureAggregationStrategy === "mean") {
|
|
68617
|
+
const subarrays = geneSelection.map((geneId) => secondLevelInternMap.get(geneId));
|
|
68618
|
+
values3 = subarrays.reduce((acc, curr) => acc.map((val, idx) => val + curr[idx]));
|
|
68619
|
+
if (featureAggregationStrategy === "mean") {
|
|
68620
|
+
const N2 = geneSelection.length;
|
|
68621
|
+
values3 = values3.map((val) => val / N2);
|
|
68622
|
+
}
|
|
68623
|
+
} else if (featureAggregationStrategy === "difference") {
|
|
68624
|
+
if (geneSelection.length === 2) {
|
|
68625
|
+
const subarrays = geneSelection.map((geneId) => secondLevelInternMap.get(geneId));
|
|
68626
|
+
values3 = subarrays.reduce((acc, curr) => acc.map((val, idx) => val - curr[idx]));
|
|
68627
|
+
} else {
|
|
68628
|
+
throw new Error("Expected exactly two selected features when featureAggregationStrategy is difference.");
|
|
68629
|
+
}
|
|
68630
|
+
}
|
|
68570
68631
|
result.get(cellSetKey).set(sampleSetKey, values3);
|
|
68571
68632
|
});
|
|
68572
68633
|
});
|
|
@@ -68855,10 +68916,10 @@ var _objectKeysInternal = function(object2, names) {
|
|
|
68855
68916
|
return result;
|
|
68856
68917
|
};
|
|
68857
68918
|
var _enumBugKeys = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
|
|
68858
|
-
var $keys$
|
|
68919
|
+
var $keys$2 = _objectKeysInternal;
|
|
68859
68920
|
var enumBugKeys$1 = _enumBugKeys;
|
|
68860
68921
|
var _objectKeys$1 = Object.keys || function keys(O) {
|
|
68861
|
-
return $keys$
|
|
68922
|
+
return $keys$2(O, enumBugKeys$1);
|
|
68862
68923
|
};
|
|
68863
68924
|
var _objectGops = {};
|
|
68864
68925
|
_objectGops.f = Object.getOwnPropertySymbols;
|
|
@@ -69309,20 +69370,13 @@ var _isArray = Array.isArray || function isArray2(arg) {
|
|
|
69309
69370
|
};
|
|
69310
69371
|
var _objectGopnExt = {};
|
|
69311
69372
|
var _objectGopn = {};
|
|
69312
|
-
var
|
|
69313
|
-
|
|
69314
|
-
|
|
69315
|
-
|
|
69316
|
-
|
|
69317
|
-
var $keys2 = _objectKeysInternal;
|
|
69318
|
-
var hiddenKeys = _enumBugKeys.concat("length", "prototype");
|
|
69319
|
-
_objectGopn.f = Object.getOwnPropertyNames || function getOwnPropertyNames4(O) {
|
|
69320
|
-
return $keys2(O, hiddenKeys);
|
|
69321
|
-
};
|
|
69322
|
-
return _objectGopn;
|
|
69323
|
-
}
|
|
69373
|
+
var $keys$1 = _objectKeysInternal;
|
|
69374
|
+
var hiddenKeys = _enumBugKeys.concat("length", "prototype");
|
|
69375
|
+
_objectGopn.f = Object.getOwnPropertyNames || function getOwnPropertyNames2(O) {
|
|
69376
|
+
return $keys$1(O, hiddenKeys);
|
|
69377
|
+
};
|
|
69324
69378
|
var toIObject$2 = _toIobject;
|
|
69325
|
-
var gOPN$1 =
|
|
69379
|
+
var gOPN$1 = _objectGopn.f;
|
|
69326
69380
|
var toString$4 = {}.toString;
|
|
69327
69381
|
var windowNames = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
|
|
69328
69382
|
var getWindowNames = function(it2) {
|
|
@@ -69332,7 +69386,7 @@ var getWindowNames = function(it2) {
|
|
|
69332
69386
|
return windowNames.slice();
|
|
69333
69387
|
}
|
|
69334
69388
|
};
|
|
69335
|
-
_objectGopnExt.f = function
|
|
69389
|
+
_objectGopnExt.f = function getOwnPropertyNames3(it2) {
|
|
69336
69390
|
return windowNames && toString$4.call(it2) == "[object Window]" ? getWindowNames(it2) : gOPN$1(toIObject$2(it2));
|
|
69337
69391
|
};
|
|
69338
69392
|
var _objectGopd = {};
|
|
@@ -69471,7 +69525,7 @@ var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor3(it2, key2) {
|
|
|
69471
69525
|
D2.enumerable = true;
|
|
69472
69526
|
return D2;
|
|
69473
69527
|
};
|
|
69474
|
-
var $getOwnPropertyNames = function
|
|
69528
|
+
var $getOwnPropertyNames = function getOwnPropertyNames4(it2) {
|
|
69475
69529
|
var names = gOPN(toIObject(it2));
|
|
69476
69530
|
var result = [];
|
|
69477
69531
|
var i2 = 0;
|
|
@@ -69515,7 +69569,7 @@ if (!USE_NATIVE) {
|
|
|
69515
69569
|
});
|
|
69516
69570
|
$GOPD.f = $getOwnPropertyDescriptor;
|
|
69517
69571
|
$DP.f = $defineProperty;
|
|
69518
|
-
|
|
69572
|
+
_objectGopn.f = gOPNExt.f = $getOwnPropertyNames;
|
|
69519
69573
|
_objectPie.f = $propertyIsEnumerable;
|
|
69520
69574
|
$GOPS.f = $getOwnPropertySymbols;
|
|
69521
69575
|
if (DESCRIPTORS && !_library) {
|
|
@@ -189124,8 +189178,15 @@ class SelectionLayer extends CompositeLayer {
|
|
|
189124
189178
|
if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
|
|
189125
189179
|
return true;
|
|
189126
189180
|
}
|
|
189127
|
-
if (node2.data
|
|
189128
|
-
|
|
189181
|
+
if (node2.data) {
|
|
189182
|
+
let current2 = node2;
|
|
189183
|
+
while (current2) {
|
|
189184
|
+
const pointCoords = [].slice.call(getObsCoords(current2.data));
|
|
189185
|
+
if (booleanPointInPolygon$1(point$a(pointCoords), selectedPolygon)) {
|
|
189186
|
+
pickingInfos.push(current2.data);
|
|
189187
|
+
}
|
|
189188
|
+
current2 = current2.next;
|
|
189189
|
+
}
|
|
189129
189190
|
}
|
|
189130
189191
|
return false;
|
|
189131
189192
|
});
|
|
@@ -191018,16 +191079,16 @@ async function getDecoder(fileDirectory) {
|
|
|
191018
191079
|
const Decoder = await importFn();
|
|
191019
191080
|
return new Decoder(fileDirectory);
|
|
191020
191081
|
}
|
|
191021
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
191022
|
-
addDecoder(5, () => import("./lzw-
|
|
191082
|
+
addDecoder([void 0, 1], () => import("./raw-3b2ecece.js").then((m2) => m2.default));
|
|
191083
|
+
addDecoder(5, () => import("./lzw-e89447c6.js").then((m2) => m2.default));
|
|
191023
191084
|
addDecoder(6, () => {
|
|
191024
191085
|
throw new Error("old style JPEG compression is not supported.");
|
|
191025
191086
|
});
|
|
191026
|
-
addDecoder(7, () => import("./jpeg-
|
|
191027
|
-
addDecoder([8, 32946], () => import("./deflate-
|
|
191028
|
-
addDecoder(32773, () => import("./packbits-
|
|
191029
|
-
addDecoder(34887, () => import("./lerc-
|
|
191030
|
-
addDecoder(50001, () => import("./webimage-
|
|
191087
|
+
addDecoder(7, () => import("./jpeg-391a6a8b.js").then((m2) => m2.default));
|
|
191088
|
+
addDecoder([8, 32946], () => import("./deflate-d498ba89.js").then((m2) => m2.default));
|
|
191089
|
+
addDecoder(32773, () => import("./packbits-9c2adfe3.js").then((m2) => m2.default));
|
|
191090
|
+
addDecoder(34887, () => import("./lerc-ca7a3f4f.js").then((m2) => m2.default));
|
|
191091
|
+
addDecoder(50001, () => import("./webimage-21345225.js").then((m2) => m2.default));
|
|
191031
191092
|
function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
|
|
191032
191093
|
return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
|
|
191033
191094
|
}
|
|
@@ -205433,7 +205494,7 @@ const getPosition = (object2, { index: index2, data: data2, target: target2 }) =
|
|
|
205433
205494
|
target2[2] = POINT_LAYER_Z_INDEX;
|
|
205434
205495
|
return target2;
|
|
205435
205496
|
};
|
|
205436
|
-
const contourGetWeight = (object2, { index: index2, data: data2 }) => data2.src.featureValues[index2];
|
|
205497
|
+
const contourGetWeight = (object2, { index: index2, data: data2 }) => data2.src.featureValues?.[index2];
|
|
205437
205498
|
const contourGetPosition = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
205438
205499
|
target2[0] = data2.src.embeddingX[index2];
|
|
205439
205500
|
target2[1] = -data2.src.embeddingY[index2];
|
|
@@ -205726,6 +205787,16 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
205726
205787
|
const { obsEmbeddingIndex, obsEmbedding } = this.props;
|
|
205727
205788
|
super.viewInfoDidUpdate(obsEmbeddingIndex, obsEmbedding, makeFlippedGetObsCoords);
|
|
205728
205789
|
}
|
|
205790
|
+
componentWillUnmount() {
|
|
205791
|
+
delete this.cellsQuadTree;
|
|
205792
|
+
delete this.cellsLayer;
|
|
205793
|
+
delete this.cellsData;
|
|
205794
|
+
delete this.stratifiedData;
|
|
205795
|
+
delete this.cellSetsForceSimulation;
|
|
205796
|
+
delete this.cellSetsLabelPrevZoom;
|
|
205797
|
+
delete this.cellSetsLayers;
|
|
205798
|
+
delete this.contourLayers;
|
|
205799
|
+
}
|
|
205729
205800
|
/**
|
|
205730
205801
|
* Here, asynchronously check whether props have
|
|
205731
205802
|
* updated which require re-computing memoized variables,
|
|
@@ -205806,8 +205877,9 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
205806
205877
|
}
|
|
205807
205878
|
const ScatterplotWrapper = forwardRef((props, deckRef) => jsxRuntimeExports.jsx(Scatterplot, { ...props, deckRef }));
|
|
205808
205879
|
ScatterplotWrapper.displayName = "ScatterplotWrapper";
|
|
205880
|
+
const FEATURE_AGGREGATION_STRATEGIES$1 = ["first", "last", "sum", "mean"];
|
|
205809
205881
|
function ScatterplotOptions(props) {
|
|
205810
|
-
const { children: children3, observationsLabel, cellRadius, setCellRadius, cellRadiusMode, setCellRadiusMode, cellOpacity, setCellOpacity, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, tooltipsVisible, setTooltipsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange, embeddingPointsVisible, setEmbeddingPointsVisible, embeddingContoursVisible, setEmbeddingContoursVisible, embeddingContoursFilled, setEmbeddingContoursFilled, contourPercentiles, setContourPercentiles, defaultContourPercentiles, contourColorEncoding, setContourColorEncoding } = props;
|
|
205882
|
+
const { children: children3, observationsLabel, cellRadius, setCellRadius, cellRadiusMode, setCellRadiusMode, cellOpacity, setCellOpacity, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, tooltipsVisible, setTooltipsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange, embeddingPointsVisible, setEmbeddingPointsVisible, embeddingContoursVisible, setEmbeddingContoursVisible, embeddingContoursFilled, setEmbeddingContoursFilled, contourPercentiles, setContourPercentiles, defaultContourPercentiles, contourColorEncoding, setContourColorEncoding, featureAggregationStrategy, setFeatureAggregationStrategy } = props;
|
|
205811
205883
|
const scatterplotOptionsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
205812
205884
|
const observationsLabelNice = capitalize$2(observationsLabel);
|
|
205813
205885
|
const classes = useStyles$u();
|
|
@@ -205858,6 +205930,9 @@ function ScatterplotOptions(props) {
|
|
|
205858
205930
|
setContourPercentiles(values3);
|
|
205859
205931
|
}
|
|
205860
205932
|
const handlePercentilesChangeDebounced = useCallback(debounce$3(handlePercentilesChange, 5, { trailing: true }), [handlePercentilesChange]);
|
|
205933
|
+
function handleFeatureAggregationStrategyChange(event2) {
|
|
205934
|
+
setFeatureAggregationStrategy(event2.target.value);
|
|
205935
|
+
}
|
|
205861
205936
|
return jsxRuntimeExports.jsxs(OptionsContainer, { children: [children3, jsxRuntimeExports.jsx(CellColorEncodingOption, { observationsLabel, cellColorEncoding, setCellColorEncoding }), jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, variant: "head", scope: "row", children: jsxRuntimeExports.jsxs("label", { htmlFor: `scatterplot-set-labels-visible-${scatterplotOptionsId}`, children: [observationsLabelNice, " Set Labels Visible"] }) }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, variant: "body", children: jsxRuntimeExports.jsx(w$3, { className: classes.checkbox, checked: cellSetLabelsVisible, onChange: handleLabelVisibilityChange, name: "scatterplot-option-cell-set-labels", color: "default", inputProps: {
|
|
205862
205937
|
"aria-label": "Show or hide set labels",
|
|
205863
205938
|
id: `scatterplot-set-labels-visible-${scatterplotOptionsId}`
|
|
@@ -205899,7 +205974,9 @@ function ScatterplotOptions(props) {
|
|
|
205899
205974
|
id: `scatterplot-contours-filled-${scatterplotOptionsId}`
|
|
205900
205975
|
} }) })] }), jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, variant: "head", scope: "row", children: jsxRuntimeExports.jsx("label", { htmlFor: `scatterplot-contour-color-encoding-${scatterplotOptionsId}`, children: "Contour Color Encoding" }) }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, variant: "body", children: jsxRuntimeExports.jsxs(OptionSelect, { className: classes.select, value: contourColorEncoding, onChange: handleContourColorEncodingChange, inputProps: {
|
|
205901
205976
|
id: `scatterplot-contour-color-encoding-${scatterplotOptionsId}`
|
|
205902
|
-
}, children: [jsxRuntimeExports.jsx("option", { value: "sampleSetSelection", children: "Sample Sets" }), jsxRuntimeExports.jsxs("option", { value: "cellSetSelection", children: [observationsLabelNice, " Sets"] }), jsxRuntimeExports.jsx("option", { value: "staticColor", children: "Static Color" })] }) })] }), jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, variant: "head", scope: "row", children: jsxRuntimeExports.jsx("label", { htmlFor: `scatterplot-contour-percentiles-${scatterplotOptionsId}`, children: "Contour Percentiles" }) }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, variant: "body", children: jsxRuntimeExports.jsx(Slider$1, { classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: contourPercentiles || defaultContourPercentiles, onChange: handlePercentilesChangeDebounced, "aria-label": "Scatterplot sliders for contour percentile thresholds", id: `scatterplot-contour-percentiles-${scatterplotOptionsId}`, valueLabelDisplay: "auto", step: 5e-3, min: 9e-3, max: 0.999 }) })] })
|
|
205977
|
+
}, children: [jsxRuntimeExports.jsx("option", { value: "sampleSetSelection", children: "Sample Sets" }), jsxRuntimeExports.jsxs("option", { value: "cellSetSelection", children: [observationsLabelNice, " Sets"] }), jsxRuntimeExports.jsx("option", { value: "staticColor", children: "Static Color" })] }) })] }), jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, variant: "head", scope: "row", children: jsxRuntimeExports.jsx("label", { htmlFor: `scatterplot-contour-percentiles-${scatterplotOptionsId}`, children: "Contour Percentiles" }) }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, variant: "body", children: jsxRuntimeExports.jsx(Slider$1, { classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: contourPercentiles || defaultContourPercentiles, onChange: handlePercentilesChangeDebounced, "aria-label": "Scatterplot sliders for contour percentile thresholds", id: `scatterplot-contour-percentiles-${scatterplotOptionsId}`, valueLabelDisplay: "auto", step: 5e-3, min: 9e-3, max: 0.999 }) })] }), setFeatureAggregationStrategy ? jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, variant: "head", scope: "row", children: jsxRuntimeExports.jsx("label", { htmlFor: `feature-aggregation-strategy-${scatterplotOptionsId}`, children: "Feature Aggregation Strategy" }) }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, variant: "body", children: jsxRuntimeExports.jsx(OptionSelect, { className: classes.select, value: featureAggregationStrategy ?? "first", onChange: handleFeatureAggregationStrategyChange, inputProps: {
|
|
205978
|
+
id: `feature-aggregation-strategy-${scatterplotOptionsId}`
|
|
205979
|
+
}, children: FEATURE_AGGREGATION_STRATEGIES$1.map((opt) => jsxRuntimeExports.jsx("option", { value: opt, children: capitalize$2(opt) }, opt)) }) })] }) : null] });
|
|
205903
205980
|
}
|
|
205904
205981
|
const styles$1 = makeStyles((theme) => ({
|
|
205905
205982
|
tooltipAnchor: {
|
|
@@ -210366,8 +210443,50 @@ const titleHeight = 10;
|
|
|
210366
210443
|
const rectHeight = 8;
|
|
210367
210444
|
const rectMarginY = 2;
|
|
210368
210445
|
const rectMarginX = 2;
|
|
210446
|
+
function combineExtents(extents, featureAggregationStrategy) {
|
|
210447
|
+
if (Array.isArray(extents)) {
|
|
210448
|
+
if (featureAggregationStrategy === "first") {
|
|
210449
|
+
return extents[0];
|
|
210450
|
+
}
|
|
210451
|
+
if (featureAggregationStrategy === "last") {
|
|
210452
|
+
return extents.at(-1);
|
|
210453
|
+
}
|
|
210454
|
+
if (typeof featureAggregationStrategy === "number") {
|
|
210455
|
+
const i2 = featureAggregationStrategy;
|
|
210456
|
+
return extents[i2];
|
|
210457
|
+
}
|
|
210458
|
+
if (featureAggregationStrategy === "sum") {
|
|
210459
|
+
return extents.reduce((a2, h2) => [a2[0] + h2[0], a2[1] + h2[1]]);
|
|
210460
|
+
}
|
|
210461
|
+
if (featureAggregationStrategy === "mean") {
|
|
210462
|
+
return extents.reduce((a2, h2) => [a2[0] + h2[0], a2[1] + h2[1]]).map((v2) => v2 / extents.length);
|
|
210463
|
+
}
|
|
210464
|
+
}
|
|
210465
|
+
return null;
|
|
210466
|
+
}
|
|
210467
|
+
function combineMissings(missings, featureAggregationStrategy) {
|
|
210468
|
+
if (Array.isArray(missings)) {
|
|
210469
|
+
if (featureAggregationStrategy === "first") {
|
|
210470
|
+
return missings[0];
|
|
210471
|
+
}
|
|
210472
|
+
if (featureAggregationStrategy === "last") {
|
|
210473
|
+
return missings.at(-1);
|
|
210474
|
+
}
|
|
210475
|
+
if (typeof featureAggregationStrategy === "number") {
|
|
210476
|
+
const i2 = featureAggregationStrategy;
|
|
210477
|
+
return missings[i2];
|
|
210478
|
+
}
|
|
210479
|
+
if (featureAggregationStrategy === "sum") {
|
|
210480
|
+
return missings.reduce((a2, h2) => a2 + h2, 0);
|
|
210481
|
+
}
|
|
210482
|
+
if (featureAggregationStrategy === "mean") {
|
|
210483
|
+
return missings.reduce((a2, h2) => a2 + h2 / missings.length, 0);
|
|
210484
|
+
}
|
|
210485
|
+
}
|
|
210486
|
+
return null;
|
|
210487
|
+
}
|
|
210369
210488
|
function Legend(props) {
|
|
210370
|
-
const { visible: visibleProp, positionRelative = false, highContrast = false, obsType, featureValueType, considerSelections = true, obsColorEncoding, featureSelection, featureLabelsMap, featureValueColormap, featureValueColormapRange, spatialChannelColor, spatialLayerColor, obsSetSelection, obsSetColor, extent: extent2, missing, width: width2 = 100, height: height2 = 36, theme, showObsLabel = false, pointsVisible = true, contoursVisible = false, contoursFilled, contourPercentiles, contourThresholds } = props;
|
|
210489
|
+
const { visible: visibleProp, positionRelative = false, highContrast = false, obsType, featureValueType, considerSelections = true, obsColorEncoding, featureSelection, featureLabelsMap, featureValueColormap, featureValueColormapRange, spatialChannelColor, spatialLayerColor, obsSetSelection, obsSetColor, featureAggregationStrategy, extent: extent2, missing, width: width2 = 100, height: height2 = 36, theme, showObsLabel = false, pointsVisible = true, contoursVisible = false, contoursFilled, contourPercentiles, contourThresholds } = props;
|
|
210371
210490
|
const svgRef = useRef();
|
|
210372
210491
|
const classes = useStyles$p();
|
|
210373
210492
|
const isDarkTheme = theme === "dark";
|
|
@@ -210376,9 +210495,9 @@ function Legend(props) {
|
|
|
210376
210495
|
const layerColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme);
|
|
210377
210496
|
const channelColor = Array.isArray(spatialChannelColor) && spatialChannelColor.length === 3 ? spatialChannelColor : getDefaultColor(theme);
|
|
210378
210497
|
const staticColor = obsColorEncoding === "spatialChannelColor" ? channelColor : layerColor;
|
|
210379
|
-
const visible = visibleProp && (!considerSelections || obsColorEncoding === "geneSelection" && featureSelection && Array.isArray(featureSelection) && featureSelection.length
|
|
210498
|
+
const visible = visibleProp && (!considerSelections || obsColorEncoding === "geneSelection" && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && obsSetSelection?.length > 0 && obsSetColor?.length > 0 || isStaticColor);
|
|
210380
210499
|
const levelZeroNames = useMemo(() => Array.from(new Set(obsSetSelection?.map((setPath) => setPath[0]) || [])), [obsSetSelection]);
|
|
210381
|
-
const dynamicHeight = isSetColor ? levelZeroNames.length * titleHeight + obsSetSelection?.length * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0);
|
|
210500
|
+
const dynamicHeight = isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + obsSetSelection?.length * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0);
|
|
210382
210501
|
useEffect(() => {
|
|
210383
210502
|
const domElement = svgRef.current;
|
|
210384
210503
|
const foregroundColor = highContrast ? "black" : isDarkTheme ? "white" : "black";
|
|
@@ -210387,7 +210506,7 @@ function Legend(props) {
|
|
|
210387
210506
|
svg2.attr("width", width2).attr("height", dynamicHeight);
|
|
210388
210507
|
const g2 = svg2.append("g").attr("width", width2).attr("height", dynamicHeight);
|
|
210389
210508
|
if (!considerSelections || obsColorEncoding === "geneSelection") {
|
|
210390
|
-
const [xMin, xMax] = extent2 || [0, 1];
|
|
210509
|
+
const [xMin, xMax] = combineExtents(extent2, featureAggregationStrategy) || [0, 1];
|
|
210391
210510
|
if (featureValueColormap && pointsVisible) {
|
|
210392
210511
|
const xlinkHref = getXlinkHref(featureValueColormap);
|
|
210393
210512
|
g2.append("image").attr("x", 0).attr("y", titleHeight).attr("width", width2).attr("height", rectHeight).attr("preserveAspectRatio", "none").attr("href", xlinkHref);
|
|
@@ -210450,8 +210569,19 @@ function Legend(props) {
|
|
|
210450
210569
|
});
|
|
210451
210570
|
});
|
|
210452
210571
|
}
|
|
210453
|
-
const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? featureLabelsMap?.get(
|
|
210454
|
-
|
|
210572
|
+
const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? featureSelection.map((geneName) => featureLabelsMap?.get(geneName) || featureLabelsMap?.get(cleanFeatureId(geneName)) || geneName) : null;
|
|
210573
|
+
let featureSelectionLabelRawStr = "";
|
|
210574
|
+
if (featureAggregationStrategy === "first") {
|
|
210575
|
+
featureSelectionLabelRawStr = featureSelectionLabelRaw?.[0];
|
|
210576
|
+
} else if (featureAggregationStrategy === "last") {
|
|
210577
|
+
featureSelectionLabelRawStr = featureSelectionLabelRaw?.at(-1);
|
|
210578
|
+
} else if (featureAggregationStrategy === "sum") {
|
|
210579
|
+
featureSelectionLabelRawStr = "Sum of features";
|
|
210580
|
+
} else if (featureAggregationStrategy === "mean") {
|
|
210581
|
+
featureSelectionLabelRawStr = "Mean of features";
|
|
210582
|
+
}
|
|
210583
|
+
const combinedMissing = combineMissings(missing, featureAggregationStrategy);
|
|
210584
|
+
const featureSelectionLabel = combinedMissing ? `${featureSelectionLabelRawStr} (${Math.round(combinedMissing * 100)}% NaN)` : featureSelectionLabelRawStr;
|
|
210455
210585
|
const obsLabel = capitalize$2(obsType);
|
|
210456
210586
|
const featureLabel = considerSelections ? featureSelectionLabel || capitalize$2(featureValueType) : capitalize$2(featureValueType);
|
|
210457
210587
|
const mainLabel = showObsLabel ? obsLabel : featureLabel;
|
|
@@ -210485,7 +210615,8 @@ function Legend(props) {
|
|
|
210485
210615
|
contourThresholds,
|
|
210486
210616
|
contoursFilled,
|
|
210487
210617
|
contoursVisible,
|
|
210488
|
-
pointsVisible
|
|
210618
|
+
pointsVisible,
|
|
210619
|
+
featureAggregationStrategy
|
|
210489
210620
|
]);
|
|
210490
210621
|
return jsxRuntimeExports.jsx("div", { className: clsx(classes.legend, {
|
|
210491
210622
|
[classes.legendRelative]: positionRelative,
|
|
@@ -210643,6 +210774,7 @@ function ChannelNamesLegend(props) {
|
|
|
210643
210774
|
}) : null });
|
|
210644
210775
|
}
|
|
210645
210776
|
const DEFAULT_CONTOUR_PERCENTILES = [0.09, 0.9, 0.99];
|
|
210777
|
+
const DEFAULT_FEATURE_AGGREGATION_STRATEGY$1 = "first";
|
|
210646
210778
|
function EmbeddingScatterplotSubscriber(props) {
|
|
210647
210779
|
const {
|
|
210648
210780
|
uuid,
|
|
@@ -210662,10 +210794,11 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210662
210794
|
const loaders = useLoaders();
|
|
210663
210795
|
const setComponentHover = useSetComponentHover();
|
|
210664
210796
|
const setComponentViewInfo = useSetComponentViewInfo(uuid);
|
|
210665
|
-
const [{ dataset, obsType, featureType, featureValueType, sampleType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, sampleSetSelection: sampleSetSelectionFromCoordination, sampleSetColor, embeddingPointsVisible, embeddingContoursVisible, embeddingContoursFilled, embeddingContourPercentiles: contourPercentiles, contourColorEncoding, contourColor }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible, setEmbeddingPointsVisible, setEmbeddingContoursVisible, setEmbeddingContoursFilled, setEmbeddingContourPercentiles: setContourPercentiles, setContourColorEncoding }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT], coordinationScopes);
|
|
210797
|
+
const [{ dataset, obsType, featureType, featureValueType, sampleType, embeddingZoom: zoom2, embeddingTargetX: targetX2, embeddingTargetY: targetY2, embeddingTargetZ: targetZ, embeddingType: mapping, obsFilter: cellFilter, obsHighlight: cellHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, embeddingObsSetPolygonsVisible: cellSetPolygonsVisible, embeddingObsSetLabelsVisible: cellSetLabelsVisible, embeddingObsSetLabelSize: cellSetLabelSize, embeddingObsRadius: cellRadiusFixed, embeddingObsRadiusMode: cellRadiusMode, embeddingObsOpacity: cellOpacityFixed, embeddingObsOpacityMode: cellOpacityMode, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, sampleSetSelection: sampleSetSelectionFromCoordination, sampleSetColor, embeddingPointsVisible, embeddingContoursVisible, embeddingContoursFilled, embeddingContourPercentiles: contourPercentiles, contourColorEncoding, contourColor, featureAggregationStrategy }, { setEmbeddingZoom: setZoom, setEmbeddingTargetX: setTargetX, setEmbeddingTargetY: setTargetY, setEmbeddingTargetZ: setTargetZ, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setEmbeddingObsSetPolygonsVisible: setCellSetPolygonsVisible, setEmbeddingObsSetLabelsVisible: setCellSetLabelsVisible, setEmbeddingObsSetLabelSize: setCellSetLabelSize, setEmbeddingObsRadius: setCellRadiusFixed, setEmbeddingObsRadiusMode: setCellRadiusMode, setEmbeddingObsOpacity: setCellOpacityFixed, setEmbeddingObsOpacityMode: setCellOpacityMode, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible, setEmbeddingPointsVisible, setEmbeddingContoursVisible, setEmbeddingContoursFilled, setEmbeddingContourPercentiles: setContourPercentiles, setContourColorEncoding, setFeatureAggregationStrategy }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT], coordinationScopes);
|
|
210666
210798
|
const { embeddingZoom: initialZoom, embeddingTargetX: initialTargetX, embeddingTargetY: initialTargetY } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT], coordinationScopes);
|
|
210667
210799
|
const observationsLabel = observationsLabelOverride || obsType;
|
|
210668
210800
|
const sampleSetSelection = sampleSetSelectionFromProps || sampleSetSelectionFromCoordination;
|
|
210801
|
+
const featureAggregationStrategyToUse = featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$1;
|
|
210669
210802
|
const [width2, height2, deckRef] = useDeckCanvasSize();
|
|
210670
210803
|
const title2 = titleOverride || `Scatterplot (${mapping})`;
|
|
210671
210804
|
const [obsLabelsTypes, obsLabelsData] = useMultiObsLabels(coordinationScopes, obsType, loaders, dataset);
|
|
@@ -210764,7 +210897,7 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210764
210897
|
return [null, null, null, null, null];
|
|
210765
210898
|
}, [obsEmbedding]);
|
|
210766
210899
|
useEffect(() => {
|
|
210767
|
-
if (xRange && yRange) {
|
|
210900
|
+
if (xRange && yRange && width2 && height2) {
|
|
210768
210901
|
const pointSizeDevicePixels = getPointSizeDevicePixels(window.devicePixelRatio, zoom2, xRange, yRange, width2, height2);
|
|
210769
210902
|
setDynamicCellRadius(pointSizeDevicePixels);
|
|
210770
210903
|
const nextCellOpacityScale = getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, averageFillDensity);
|
|
@@ -210833,6 +210966,9 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210833
210966
|
originalViewState.target[1]
|
|
210834
210967
|
];
|
|
210835
210968
|
const scaleFactor = 2 ** originalViewState.zoom;
|
|
210969
|
+
if (!(typeof scaleFactor === "number" && typeof center2[0] === "number" && typeof center2[1] === "number") || Number.isNaN(scaleFactor)) {
|
|
210970
|
+
return null;
|
|
210971
|
+
}
|
|
210836
210972
|
const radius2 = Math.min(width2, height2) / 2 / scaleFactor;
|
|
210837
210973
|
const numPoints = 96;
|
|
210838
210974
|
const options = { steps: numPoints, units: "degrees" };
|
|
@@ -210877,17 +211013,16 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210877
211013
|
}
|
|
210878
211014
|
return null;
|
|
210879
211015
|
}, [sampleEdges]);
|
|
210880
|
-
const stratifiedData = useMemo(() => {
|
|
211016
|
+
const [stratifiedData, stratifiedDataCount] = useMemo(() => {
|
|
210881
211017
|
if (alignedEmbeddingData?.data) {
|
|
210882
|
-
const result = stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, alignedEmbeddingIndex, mergedCellSets, cellSetSelection, {
|
|
211018
|
+
const [result, cellCountResult] = stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, alignedEmbeddingIndex, mergedCellSets, cellSetSelection, {
|
|
210883
211019
|
obsEmbeddingX: alignedEmbeddingData.data[0],
|
|
210884
211020
|
obsEmbeddingY: alignedEmbeddingData.data[1],
|
|
210885
|
-
|
|
210886
|
-
|
|
210887
|
-
|
|
210888
|
-
return result;
|
|
211021
|
+
...uint8ExpressionData?.[0] ? { featureValue: uint8ExpressionData } : {}
|
|
211022
|
+
}, featureAggregationStrategyToUse);
|
|
211023
|
+
return [result, cellCountResult];
|
|
210889
211024
|
}
|
|
210890
|
-
return null;
|
|
211025
|
+
return [null, null];
|
|
210891
211026
|
}, [
|
|
210892
211027
|
alignedEmbeddingIndex,
|
|
210893
211028
|
alignedEmbeddingData,
|
|
@@ -210897,7 +211032,8 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210897
211032
|
sampleSets,
|
|
210898
211033
|
sampleSetSelection,
|
|
210899
211034
|
cellSetSelection,
|
|
210900
|
-
mergedCellSets
|
|
211035
|
+
mergedCellSets,
|
|
211036
|
+
featureAggregationStrategyToUse
|
|
210901
211037
|
]);
|
|
210902
211038
|
const setViewState = ({ zoom: newZoom, target: target2 }) => {
|
|
210903
211039
|
setZoom(newZoom);
|
|
@@ -210905,7 +211041,8 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210905
211041
|
setTargetY(target2[1]);
|
|
210906
211042
|
setTargetZ(target2[2] || 0);
|
|
210907
211043
|
};
|
|
210908
|
-
|
|
211044
|
+
const cellCountToUse = embeddingPointsVisible ? cellsCount : stratifiedDataCount ?? cellsCount;
|
|
211045
|
+
return jsxRuntimeExports.jsxs(TitleInfo, { title: title2, info: `${commaNumber(cellCountToUse)} ${pluralize(observationsLabel, cellCountToUse)}`, closeButtonVisible, downloadButtonVisible, removeGridComponent, urls: urls2, theme, isReady, helpText, options: jsxRuntimeExports.jsx(ScatterplotOptions, { observationsLabel, cellRadius: cellRadiusFixed, setCellRadius: setCellRadiusFixed, cellRadiusMode, setCellRadiusMode, cellOpacity: cellOpacityFixed, setCellOpacity: setCellOpacityFixed, cellOpacityMode, setCellOpacityMode, cellSetLabelsVisible, setCellSetLabelsVisible, tooltipsVisible, setTooltipsVisible, cellSetLabelSize, setCellSetLabelSize, cellSetPolygonsVisible, setCellSetPolygonsVisible, cellColorEncoding, setCellColorEncoding, geneExpressionColormap, setGeneExpressionColormap, geneExpressionColormapRange, setGeneExpressionColormapRange, embeddingPointsVisible, setEmbeddingPointsVisible, embeddingContoursVisible, setEmbeddingContoursVisible, embeddingContoursFilled, setEmbeddingContoursFilled, contourPercentiles, setContourPercentiles, defaultContourPercentiles: DEFAULT_CONTOUR_PERCENTILES, contourColorEncoding, setContourColorEncoding, featureAggregationStrategy, setFeatureAggregationStrategy }), children: [jsxRuntimeExports.jsx(ScatterplotWrapper, {
|
|
210909
211046
|
ref: deckRef,
|
|
210910
211047
|
uuid,
|
|
210911
211048
|
theme,
|
|
@@ -210951,7 +211088,7 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210951
211088
|
embeddingContoursVisible,
|
|
210952
211089
|
circleInfo,
|
|
210953
211090
|
featureSelection: geneSelection
|
|
210954
|
-
}), tooltipsVisible && jsxRuntimeExports.jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo: getObsInfo2, featureType, featureLabelsMap }), jsxRuntimeExports.jsx(Legend, {
|
|
211091
|
+
}), tooltipsVisible && width2 && height2 ? jsxRuntimeExports.jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo: getObsInfo2, featureType, featureLabelsMap }) : null, jsxRuntimeExports.jsx(Legend, {
|
|
210955
211092
|
visible: true,
|
|
210956
211093
|
theme,
|
|
210957
211094
|
featureType,
|
|
@@ -210962,14 +211099,15 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210962
211099
|
featureValueColormap: geneExpressionColormap,
|
|
210963
211100
|
featureValueColormapRange: geneExpressionColormapRange,
|
|
210964
211101
|
obsSetSelection: cellSetSelection,
|
|
210965
|
-
extent: expressionExtents
|
|
210966
|
-
missing: expressionMissing
|
|
211102
|
+
extent: expressionExtents,
|
|
211103
|
+
missing: expressionMissing,
|
|
210967
211104
|
// Contour percentile legend
|
|
210968
211105
|
pointsVisible: embeddingPointsVisible,
|
|
210969
211106
|
contoursVisible: embeddingContoursVisible,
|
|
210970
211107
|
contoursFilled: embeddingContoursFilled,
|
|
210971
211108
|
contourPercentiles: contourPercentiles || DEFAULT_CONTOUR_PERCENTILES,
|
|
210972
|
-
contourThresholds
|
|
211109
|
+
contourThresholds,
|
|
211110
|
+
featureAggregationStrategy: featureAggregationStrategyToUse
|
|
210973
211111
|
})] });
|
|
210974
211112
|
}
|
|
210975
211113
|
function DualEmbeddingScatterplotSubscriber(props) {
|
|
@@ -231932,7 +232070,7 @@ class ErrorBoundary2 extends React__default.Component {
|
|
|
231932
232070
|
}
|
|
231933
232071
|
}
|
|
231934
232072
|
const LazySpatialThree = React__default.lazy(async () => {
|
|
231935
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
232073
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-9956beb7.js");
|
|
231936
232074
|
return { default: SpatialWrapper2 };
|
|
231937
232075
|
});
|
|
231938
232076
|
const SpatialThreeAdapter = React__default.forwardRef((props, ref2) => jsxRuntimeExports.jsx("div", { ref: ref2, style: { width: "100%", height: "100%" }, children: jsxRuntimeExports.jsx(ErrorBoundary2, { children: jsxRuntimeExports.jsx(Suspense, { fallback: jsxRuntimeExports.jsx("div", { children: "Loading..." }), children: jsxRuntimeExports.jsx(LazySpatialThree, { ...props }) }) }) }));
|
|
@@ -241531,7 +241669,7 @@ const useStyles$6 = makeStyles((theme) => ({
|
|
|
241531
241669
|
}));
|
|
241532
241670
|
register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
|
|
241533
241671
|
const LazyHiGlassComponent = React__default.lazy(async () => {
|
|
241534
|
-
const { HiGlassComponent } = await import("./higlass-
|
|
241672
|
+
const { HiGlassComponent } = await import("./higlass-24a2d79c.js");
|
|
241535
241673
|
return { default: HiGlassComponent };
|
|
241536
241674
|
});
|
|
241537
241675
|
const HG_SIZE = 800;
|
|
@@ -244478,7 +244616,7 @@ const useStyles$5 = makeStyles(() => ({
|
|
|
244478
244616
|
}
|
|
244479
244617
|
}));
|
|
244480
244618
|
const LazyReactNeuroglancer = React__default.lazy(async () => {
|
|
244481
|
-
const ReactNeuroglancer = await import("./index-
|
|
244619
|
+
const ReactNeuroglancer = await import("./index-2c304ba6.js").then((n3) => n3.i);
|
|
244482
244620
|
return ReactNeuroglancer;
|
|
244483
244621
|
});
|
|
244484
244622
|
function createWorker() {
|
|
@@ -244501,16 +244639,20 @@ function NeuroglancerSubscriber(props) {
|
|
|
244501
244639
|
const { closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Neuroglancer", viewerState: viewerStateInitial = null, helpText = ViewHelpMapping.NEUROGLANCER } = props;
|
|
244502
244640
|
return jsxRuntimeExports.jsx(TitleInfo, { title: title2, helpText, isSpatial: true, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady: true, children: viewerStateInitial && jsxRuntimeExports.jsx(Neuroglancer, { viewerState: viewerStateInitial }) });
|
|
244503
244641
|
}
|
|
244642
|
+
const FEATURE_AGGREGATION_STRATEGIES = ["first", "last", "sum", "mean"];
|
|
244504
244643
|
function CellSetExpressionPlotOptions(props) {
|
|
244505
|
-
const { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions, featureValuePositivityThreshold, setFeatureValuePositivityThreshold, featureValueColormap, setFeatureValueColormap } = props;
|
|
244644
|
+
const { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions, featureValuePositivityThreshold, setFeatureValuePositivityThreshold, featureValueColormap, setFeatureValueColormap, featureAggregationStrategy, setFeatureAggregationStrategy } = props;
|
|
244506
244645
|
const cellSetExpressionPlotOptionsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
244507
244646
|
const classes = useStyles$u();
|
|
244508
244647
|
function handleFeatureValueColormapChange(event2) {
|
|
244509
244648
|
setFeatureValueColormap(event2.target.value);
|
|
244510
244649
|
}
|
|
244511
|
-
|
|
244650
|
+
function handleTransformChange(event2) {
|
|
244512
244651
|
setFeatureValueTransform(event2.target.value === "" ? null : event2.target.value);
|
|
244513
|
-
}
|
|
244652
|
+
}
|
|
244653
|
+
function handleFeatureAggregationStrategyChange(event2) {
|
|
244654
|
+
setFeatureAggregationStrategy(event2.target.value);
|
|
244655
|
+
}
|
|
244514
244656
|
function handlePositivityThresholdChange(event2, value2) {
|
|
244515
244657
|
setFeatureValuePositivityThreshold(value2);
|
|
244516
244658
|
}
|
|
@@ -244532,7 +244674,9 @@ function CellSetExpressionPlotOptions(props) {
|
|
|
244532
244674
|
id: `cellset-expression-transform-select-${cellSetExpressionPlotOptionsId}`
|
|
244533
244675
|
}, children: transformOptions.map((opt) => jsxRuntimeExports.jsx("option", { value: opt.value === null ? "" : opt.value, children: opt.name }, opt.name)) }) })] }), jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, variant: "head", scope: "row", children: jsxRuntimeExports.jsx("label", { htmlFor: `cellset-expression-transform-coeff-${cellSetExpressionPlotOptionsId}`, children: "Transform Coefficient" }) }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, variant: "body", children: jsxRuntimeExports.jsx(TextField$1, { label: "Transform Coefficient", type: "number", onChange: handleTransformCoefficientChange, value: featureValueTransformCoefficient, InputLabelProps: {
|
|
244534
244676
|
shrink: true
|
|
244535
|
-
}, id: `cellset-expression-transform-coeff-${cellSetExpressionPlotOptionsId}` }) })] }),
|
|
244677
|
+
}, id: `cellset-expression-transform-coeff-${cellSetExpressionPlotOptionsId}` }) })] }), setFeatureAggregationStrategy ? jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, variant: "head", scope: "row", children: jsxRuntimeExports.jsx("label", { htmlFor: `feature-aggregation-strategy-${cellSetExpressionPlotOptionsId}`, children: "Feature Aggregation Strategy" }) }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, variant: "body", children: jsxRuntimeExports.jsx(OptionSelect, { className: classes.select, value: featureAggregationStrategy ?? "first", onChange: handleFeatureAggregationStrategyChange, inputProps: {
|
|
244678
|
+
id: `feature-aggregation-strategy-${cellSetExpressionPlotOptionsId}`
|
|
244679
|
+
}, children: FEATURE_AGGREGATION_STRATEGIES.map((opt) => jsxRuntimeExports.jsx("option", { value: opt, children: capitalize$2(opt) }, opt)) }) })] }) : null, setFeatureValuePositivityThreshold ? jsxRuntimeExports.jsxs(TableRow$1, { children: [jsxRuntimeExports.jsx(TableCell$1, { className: classes.labelCell, children: "Positivity Threshold" }), jsxRuntimeExports.jsx(TableCell$1, { className: classes.inputCell, children: jsxRuntimeExports.jsx(Slider$1, { classes: { root: classes.slider, valueLabel: classes.sliderValueLabel }, value: featureValuePositivityThreshold, onChange: handlePositivityThresholdChange, "aria-labelledby": "pos-threshold-slider", valueLabelDisplay: "auto", step: 1, min: 0, max: 100 }) })] }, "transform-coefficient-option-row") : null] });
|
|
244536
244680
|
}
|
|
244537
244681
|
function bandSpace$1(count2, paddingInner2, paddingOuter2) {
|
|
244538
244682
|
var space2 = count2 - paddingInner2 + paddingOuter2 * 2;
|
|
@@ -249673,12 +249817,35 @@ function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp)
|
|
|
249673
249817
|
// d3.scaleLinear without a range set
|
|
249674
249818
|
};
|
|
249675
249819
|
}
|
|
249676
|
-
|
|
249820
|
+
const DEFAULT_FEATURE_AGGREGATION_STRATEGY = "first";
|
|
249821
|
+
function featureSummary(geneSelection, featureAggregationStrategy) {
|
|
249822
|
+
if (featureAggregationStrategy === "first") {
|
|
249823
|
+
return geneSelection?.[0];
|
|
249824
|
+
}
|
|
249825
|
+
if (featureAggregationStrategy === "last") {
|
|
249826
|
+
return geneSelection?.at(-1);
|
|
249827
|
+
}
|
|
249828
|
+
if (typeof featureAggregationStrategy === "number") {
|
|
249829
|
+
const i2 = featureAggregationStrategy;
|
|
249830
|
+
return geneSelection?.[i2];
|
|
249831
|
+
}
|
|
249832
|
+
if (featureAggregationStrategy === "sum") {
|
|
249833
|
+
return geneSelection?.join(" + ");
|
|
249834
|
+
}
|
|
249835
|
+
if (featureAggregationStrategy === "mean") {
|
|
249836
|
+
return `Mean of ${geneSelection?.join(", ")}`;
|
|
249837
|
+
}
|
|
249838
|
+
if (featureAggregationStrategy === "difference") {
|
|
249839
|
+
return geneSelection?.join(" - ");
|
|
249840
|
+
}
|
|
249841
|
+
return "";
|
|
249842
|
+
}
|
|
249843
|
+
function useExpressionByCellSet(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, theme, yMinProp, featureAggregationStrategy) {
|
|
249677
249844
|
const mergedCellSets = useMemo(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
|
|
249678
249845
|
const [expressionArr, expressionMax] = useMemo(() => {
|
|
249679
249846
|
const [stratifiedData, exprMax] = stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, mergedCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient);
|
|
249680
249847
|
if (stratifiedData) {
|
|
249681
|
-
const aggregateData = aggregateStratifiedExpressionData(stratifiedData, geneSelection);
|
|
249848
|
+
const aggregateData = aggregateStratifiedExpressionData(stratifiedData, geneSelection, featureAggregationStrategy);
|
|
249682
249849
|
const summarizedData = summarizeStratifiedExpressionData(aggregateData, true);
|
|
249683
249850
|
const histogramData = histogramStratifiedExpressionData(summarizedData, 16, yMinProp);
|
|
249684
249851
|
return [histogramData, exprMax];
|
|
@@ -249697,7 +249864,8 @@ function useExpressionByCellSet(sampleEdges, sampleSets, sampleSetSelection, exp
|
|
|
249697
249864
|
yMinProp,
|
|
249698
249865
|
sampleEdges,
|
|
249699
249866
|
sampleSets,
|
|
249700
|
-
sampleSetSelection
|
|
249867
|
+
sampleSetSelection,
|
|
249868
|
+
featureAggregationStrategy
|
|
249701
249869
|
]);
|
|
249702
249870
|
const setArr = useMemo(() => mergedCellSets && cellSetSelection && cellSetColor ? treeToSetSizesBySetNames(mergedCellSets, cellSetSelection, cellSetSelection, cellSetColor, theme) : [], [mergedCellSets, cellSetSelection, cellSetColor, theme]);
|
|
249703
249871
|
return [expressionArr, setArr, expressionMax];
|
|
@@ -249706,7 +249874,7 @@ function CellSetExpressionPlotSubscriber(props) {
|
|
|
249706
249874
|
const { coordinationScopes, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2, xAxisTitle, jitter: jitter2 = false, yMin = null, yUnits = null, helpText = ViewHelpMapping.OBS_SET_FEATURE_VALUE_DISTRIBUTION } = props;
|
|
249707
249875
|
const classes = useStyles$4();
|
|
249708
249876
|
const loaders = useLoaders();
|
|
249709
|
-
const [{ dataset, obsType, featureType, featureValueType, featureSelection: geneSelection, featureValueTransform, featureValueTransformCoefficient, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, additionalObsSets: additionalCellSets, sampleType, sampleSetSelection, sampleSetColor }, { setFeatureValueTransform, setFeatureValueTransformCoefficient, setSampleSetColor }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.OBS_SET_FEATURE_VALUE_DISTRIBUTION], coordinationScopes);
|
|
249877
|
+
const [{ dataset, obsType, featureType, featureValueType, featureSelection: geneSelection, featureValueTransform, featureValueTransformCoefficient, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, additionalObsSets: additionalCellSets, sampleType, sampleSetSelection, sampleSetColor, featureAggregationStrategy }, { setFeatureValueTransform, setFeatureValueTransformCoefficient, setSampleSetColor, setFeatureAggregationStrategy }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.OBS_SET_FEATURE_VALUE_DISTRIBUTION], coordinationScopes);
|
|
249710
249878
|
const [width2, height2, containerRef] = useGridItemSize();
|
|
249711
249879
|
const transformOptions = VALUE_TRANSFORM_OPTIONS;
|
|
249712
249880
|
const [expressionData, loadedFeatureSelection, featureSelectionStatus] = useFeatureSelection(loaders, dataset, false, geneSelection, { obsType, featureType, featureValueType });
|
|
@@ -249732,11 +249900,18 @@ function CellSetExpressionPlotSubscriber(props) {
|
|
|
249732
249900
|
sampleSetsUrls,
|
|
249733
249901
|
sampleEdgesUrls
|
|
249734
249902
|
]);
|
|
249735
|
-
const
|
|
249736
|
-
const
|
|
249903
|
+
const featureAggregationStrategyToUse = featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY;
|
|
249904
|
+
const [histogramData, setArr, exprMax] = useExpressionByCellSet(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, theme, yMin, featureAggregationStrategyToUse);
|
|
249905
|
+
const featureSuffix = useMemo(() => {
|
|
249906
|
+
const cleanedGeneSelection = geneSelection?.map((geneName) => featureLabelsMap?.get(geneName) || featureLabelsMap?.get(cleanFeatureId(geneName)) || geneName);
|
|
249907
|
+
if (Array.isArray(cleanedGeneSelection)) {
|
|
249908
|
+
return featureSummary(cleanedGeneSelection, featureAggregationStrategyToUse);
|
|
249909
|
+
}
|
|
249910
|
+
return null;
|
|
249911
|
+
}, [geneSelection, featureAggregationStrategyToUse]);
|
|
249737
249912
|
const selectedTransformName = transformOptions.find((o2) => o2.value === featureValueTransform)?.name;
|
|
249738
|
-
const titleSuffix =
|
|
249739
|
-
return jsxRuntimeExports.jsx(TitleInfo, { title: title2 ? `${title2}${titleSuffix}` : `Expression by ${capitalize$2(obsType)} Set${titleSuffix}`, closeButtonVisible, downloadButtonVisible, removeGridComponent, urls: urls2, theme, isReady, helpText, options: jsxRuntimeExports.jsx(CellSetExpressionPlotOptions, { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions }), children: jsxRuntimeExports.jsx("div", { ref: containerRef, className: classes.vegaContainer, children: histogramData ? jsxRuntimeExports.jsx(CellSetExpressionPlot, { yMin, yUnits, jitter: jitter2, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, sampleSetSelection, sampleSetColor, colors: setArr, data: histogramData, exprMax, theme, width: width2, height: height2, obsType, featureType, featureValueType, featureValueTransformName: selectedTransformName, xAxisTitle }) : jsxRuntimeExports.jsxs("span", { children: ["Select a ", featureType, "."] }) }) });
|
|
249913
|
+
const titleSuffix = featureSuffix ? ` (${featureSuffix})` : "";
|
|
249914
|
+
return jsxRuntimeExports.jsx(TitleInfo, { title: title2 ? `${title2}${titleSuffix}` : `Expression by ${capitalize$2(obsType)} Set${titleSuffix}`, closeButtonVisible, downloadButtonVisible, removeGridComponent, urls: urls2, theme, isReady, helpText, options: jsxRuntimeExports.jsx(CellSetExpressionPlotOptions, { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions, featureAggregationStrategy, setFeatureAggregationStrategy }), children: jsxRuntimeExports.jsx("div", { ref: containerRef, className: classes.vegaContainer, children: histogramData ? jsxRuntimeExports.jsx(CellSetExpressionPlot, { yMin, yUnits, jitter: jitter2, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, sampleSetSelection, sampleSetColor, colors: setArr, data: histogramData, exprMax, theme, width: width2, height: height2, obsType, featureType, featureValueType, featureValueTransformName: selectedTransformName, xAxisTitle }) : jsxRuntimeExports.jsxs("span", { children: ["Select a ", featureType, "."] }) }) });
|
|
249740
249915
|
}
|
|
249741
249916
|
/*! *****************************************************************************
|
|
249742
249917
|
Copyright (c) Microsoft Corporation.
|
|
@@ -301717,7 +301892,26 @@ function ExpressionHistogramSubscriber(props) {
|
|
|
301717
301892
|
return jsxRuntimeExports.jsx(TitleInfo, { title: `Histogram${firstGeneSelected ? ` (${firstGeneSelected})` : ""}`, closeButtonVisible, downloadButtonVisible, removeGridComponent, urls: urls2, theme, isReady, helpText, children: jsxRuntimeExports.jsx("div", { ref: containerRef, className: classes.vegaContainer, children: jsxRuntimeExports.jsx(ExpressionHistogram, { geneSelection, obsType, featureType, featureValueType, onSelect, data: data2, theme, width: width2, height: height2 }) }) });
|
|
301718
301893
|
}
|
|
301719
301894
|
function DotPlot(props) {
|
|
301720
|
-
const {
|
|
301895
|
+
const {
|
|
301896
|
+
isStratified,
|
|
301897
|
+
transpose: transpose2,
|
|
301898
|
+
data: rawData,
|
|
301899
|
+
theme,
|
|
301900
|
+
width: width2,
|
|
301901
|
+
height: height2,
|
|
301902
|
+
marginRight,
|
|
301903
|
+
marginBottom,
|
|
301904
|
+
obsType,
|
|
301905
|
+
sampleType,
|
|
301906
|
+
keyLength = 36,
|
|
301907
|
+
featureType,
|
|
301908
|
+
featureValueType,
|
|
301909
|
+
featureValueTransformName,
|
|
301910
|
+
// TODO: re-enable featureValueColormap coordination
|
|
301911
|
+
// featureValueColormap,
|
|
301912
|
+
obsSetSelection,
|
|
301913
|
+
obsSetColor
|
|
301914
|
+
} = props;
|
|
301721
301915
|
const vegaContainerRef = useRef();
|
|
301722
301916
|
const data2 = rawData.map((d) => ({
|
|
301723
301917
|
...d,
|
|
@@ -301775,7 +301969,8 @@ function DotPlot(props) {
|
|
|
301775
301969
|
type: "quantitative",
|
|
301776
301970
|
title: meanTransform,
|
|
301777
301971
|
scale: {
|
|
301778
|
-
scheme: featureValueColormap
|
|
301972
|
+
// scheme: featureValueColormap,
|
|
301973
|
+
scheme: "greys"
|
|
301779
301974
|
},
|
|
301780
301975
|
legend: {
|
|
301781
301976
|
direction: "horizontal",
|
|
@@ -302268,8 +302463,6 @@ function TreemapSubscriber(props) {
|
|
|
302268
302463
|
]);
|
|
302269
302464
|
const mergedObsSets = useMemo(() => mergeObsSets(obsSets, additionalObsSets), [obsSets, additionalObsSets]);
|
|
302270
302465
|
const mergedSampleSets = useMemo(() => mergeObsSets(sampleSets, null), [sampleSets]);
|
|
302271
|
-
const obsCount = obsIndex?.length || 0;
|
|
302272
|
-
const sampleCount = sampleIndex?.length || 0;
|
|
302273
302466
|
const [obsCounts, sampleCounts] = useMemo(() => {
|
|
302274
302467
|
const obsResult = new InternMap$1([], JSON.stringify);
|
|
302275
302468
|
const sampleResult = new InternMap$1([], JSON.stringify);
|
|
@@ -302288,7 +302481,7 @@ function TreemapSubscriber(props) {
|
|
|
302288
302481
|
const sampleSetSize = sampleSetSizes?.find((d) => isEqual$5(d.setNamePath, sampleSetKey))?.size;
|
|
302289
302482
|
sampleResult.set(sampleSetKey, sampleSetSize || 0);
|
|
302290
302483
|
});
|
|
302291
|
-
if (mergedObsSets && obsSetSelection) {
|
|
302484
|
+
if (mergedObsSets && obsSetSelection && obsIndex) {
|
|
302292
302485
|
const sampleIdToSetMap = sampleSets && sampleSetSelection ? treeToSelectedSetMap(sampleSets, sampleSetSelection) : null;
|
|
302293
302486
|
const cellIdToSetMap = treeToSelectedSetMap(mergedObsSets, obsSetSelection);
|
|
302294
302487
|
for (let i2 = 0; i2 < obsIndex.length; i2 += 1) {
|
|
@@ -302316,13 +302509,20 @@ function TreemapSubscriber(props) {
|
|
|
302316
302509
|
mergedObsSets,
|
|
302317
302510
|
obsSetSelection,
|
|
302318
302511
|
mergedSampleSets,
|
|
302319
|
-
sampleSetSelection
|
|
302512
|
+
sampleSetSelection,
|
|
302513
|
+
obsIndex
|
|
302320
302514
|
// TODO: consider filtering-related coordination values
|
|
302321
302515
|
]);
|
|
302516
|
+
const totalObsCount = obsIndex?.length || 0;
|
|
302517
|
+
const totalSampleCount = sampleIndex?.length || 0;
|
|
302518
|
+
const selectedObsCount = obsCounts.reduce((a2, h2) => a2 + h2.value, 0);
|
|
302519
|
+
const selectedSampleCount = sampleCounts.reduce((a2, h2) => a2 + h2.value, 0);
|
|
302520
|
+
const unselectedObsCount = totalObsCount - selectedObsCount;
|
|
302521
|
+
const unselectedSampleCount = totalSampleCount - selectedSampleCount;
|
|
302322
302522
|
const onNodeClick = useCallback((obsSetPath2) => {
|
|
302323
302523
|
setObsSetSelection([obsSetPath2]);
|
|
302324
302524
|
}, [setObsSetSelection]);
|
|
302325
|
-
return jsxRuntimeExports.
|
|
302525
|
+
return jsxRuntimeExports.jsxs(TitleInfo, { title: `Treemap of ${capitalize$2(pluralize(obsType, 2))}`, info: `${commaNumber(selectedObsCount)} ${pluralize(obsType, selectedObsCount)} from ${commaNumber(selectedSampleCount)} ${pluralize(sampleType, selectedSampleCount)}`, removeGridComponent, urls: urls2, theme, isReady, helpText, withPadding: false, options: jsxRuntimeExports.jsx(TreemapOptions, { obsType, sampleType, obsColorEncoding, setObsColorEncoding, hierarchyLevels: hierarchyLevels || DEFAULT_HIERARCHY_LEVELS, setHierarchyLevels }), children: [jsxRuntimeExports.jsx("div", { ref: containerRef, className: classes.vegaContainer, children: jsxRuntimeExports.jsx(Treemap, { obsCounts, sampleCounts, obsColorEncoding, hierarchyLevels: hierarchyLevels || DEFAULT_HIERARCHY_LEVELS, theme, width: width2, height: Math.max(height2 * (selectedObsCount / totalObsCount), 40), obsType, sampleType, obsSetColor, sampleSetColor, obsSetSelection, sampleSetSelection, onNodeClick }) }), jsxRuntimeExports.jsx("div", { style: { position: "absolute", right: "2px", bottom: "2px", fontSize: "10px" }, children: unselectedObsCount > 0 ? jsxRuntimeExports.jsx("span", { children: `${commaNumber(unselectedObsCount)} ${pluralize(obsType, unselectedObsCount)} from ${commaNumber(unselectedSampleCount)} ${pluralize(sampleType, unselectedSampleCount)} currently omitted` }) : null })] });
|
|
302326
302526
|
}
|
|
302327
302527
|
function VolcanoPlot(props) {
|
|
302328
302528
|
const { theme, width: width2, height: height2, obsType, featureType, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMappingReversed, sampleSetSelection, obsSetSelection, obsSetColor, sampleSetColor, data: data2, marginTop = 5, marginRight = 5, marginLeft = 50, marginBottom = 50, onFeatureClick, featurePointSignificanceThreshold, featurePointFoldChangeThreshold, featureLabelSignificanceThreshold, featureLabelFoldChangeThreshold } = props;
|
|
@@ -302478,8 +302678,10 @@ function VolcanoPlotSubscriber(props) {
|
|
|
302478
302678
|
}, [setFeatureSelection]);
|
|
302479
302679
|
return jsxRuntimeExports.jsx(TitleInfo, { title: title2, removeGridComponent, theme, isReady, helpText, options: jsxRuntimeExports.jsx(VolcanoPlotOptions, { obsType, featureType, featurePointSignificanceThreshold, featurePointFoldChangeThreshold, featureLabelSignificanceThreshold, featureLabelFoldChangeThreshold, setFeaturePointSignificanceThreshold, setFeaturePointFoldChangeThreshold, setFeatureLabelSignificanceThreshold, setFeatureLabelFoldChangeThreshold }), children: jsxRuntimeExports.jsx("div", { ref: containerRef, className: classes.vegaContainer, children: featureStats ? jsxRuntimeExports.jsx(VolcanoPlot, { theme, width: width2, height: height2, obsType, featureType, obsSetsColumnNameMapping, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMapping, sampleSetsColumnNameMappingReversed, sampleSetSelection, obsSetSelection, obsSetColor, sampleSetColor, data: featureStats, onFeatureClick, featurePointSignificanceThreshold, featurePointFoldChangeThreshold, featureLabelSignificanceThreshold, featureLabelFoldChangeThreshold }) : jsxRuntimeExports.jsxs("span", { children: ["Select at least one ", obsType, " set."] }) }) });
|
|
302480
302680
|
}
|
|
302681
|
+
const MAX_BAR_SIZE = 40;
|
|
302481
302682
|
function CellSetCompositionBarPlot(props) {
|
|
302482
|
-
const { data: data2, theme, width: width2, height:
|
|
302683
|
+
const { data: data2, theme, width: width2, height: heightProp, marginRight = 200, marginBottom = 60, keyLength = 36, obsType, onBarSelect, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMappingReversed, sampleSetSelection, obsSetSelection, obsSetColor, sampleSetColor } = props;
|
|
302684
|
+
const height2 = Array.isArray(obsSetSelection) && (heightProp - marginBottom) / obsSetSelection.length >= MAX_BAR_SIZE ? MAX_BAR_SIZE * obsSetSelection.length + marginBottom : heightProp;
|
|
302483
302685
|
const [obsSetColorScale, sampleSetColorScale] = useMemo(() => [
|
|
302484
302686
|
getColorScale(obsSetSelection, obsSetColor, theme),
|
|
302485
302687
|
getColorScale(sampleSetSelection, sampleSetColor, theme)
|
|
@@ -302488,16 +302690,15 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302488
302690
|
if (Array.isArray(data2) && data2.length === 1) {
|
|
302489
302691
|
const { df, metadata: metadata2 } = data2[0];
|
|
302490
302692
|
const referenceCellType = metadata2?.analysis_params?.reference_cell_type;
|
|
302693
|
+
const covariateValue = metadata2?.analysis_params?.covariate_value;
|
|
302491
302694
|
const coordinationValues = metadata2?.coordination_values;
|
|
302492
302695
|
const obsSetColumnName = coordinationValues?.obsSetSelection?.[0]?.[0];
|
|
302493
302696
|
const obsSetGroupName = obsSetsColumnNameMappingReversed?.[obsSetColumnName];
|
|
302494
302697
|
const sampleSetColumnName = coordinationValues?.sampleSetFilter?.[0]?.[0];
|
|
302495
302698
|
const sampleSetGroupName = sampleSetsColumnNameMappingReversed?.[sampleSetColumnName];
|
|
302496
|
-
const
|
|
302497
|
-
const firstCovariateValue = df.covariate?.[0]?.substring(covariatePrefix.length);
|
|
302498
|
-
const firstCovariateSetPath = [sampleSetGroupName, firstCovariateValue];
|
|
302699
|
+
const covariateSetPath = [sampleSetGroupName, covariateValue];
|
|
302499
302700
|
let shouldSwapFoldChangeDirection = false;
|
|
302500
|
-
if (isEqual$5(
|
|
302701
|
+
if (isEqual$5(covariateSetPath, sampleSetSelection[0])) {
|
|
302501
302702
|
shouldSwapFoldChangeDirection = true;
|
|
302502
302703
|
}
|
|
302503
302704
|
return df.obsSetId.map((obsSetId, i2) => {
|
|
@@ -302554,6 +302755,22 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302554
302755
|
domain: [true, false],
|
|
302555
302756
|
range: [2, 0.5]
|
|
302556
302757
|
};
|
|
302758
|
+
const xExtent = useMemo(() => {
|
|
302759
|
+
if (computedData) {
|
|
302760
|
+
const [min2, max2] = extent$2(computedData.map((d) => d.logFoldChange));
|
|
302761
|
+
const buffer2 = 1.05;
|
|
302762
|
+
const minAbs = Math.abs(min2) * buffer2;
|
|
302763
|
+
const maxAbs = Math.abs(max2) * buffer2;
|
|
302764
|
+
if (minAbs > maxAbs) {
|
|
302765
|
+
return [-minAbs, minAbs];
|
|
302766
|
+
}
|
|
302767
|
+
return [-maxAbs, maxAbs];
|
|
302768
|
+
}
|
|
302769
|
+
return void 0;
|
|
302770
|
+
}, [computedData]);
|
|
302771
|
+
const xScale = {
|
|
302772
|
+
domain: xExtent
|
|
302773
|
+
};
|
|
302557
302774
|
const spec = {
|
|
302558
302775
|
mark: { type: "bar", stroke: "black", cursor: "pointer" },
|
|
302559
302776
|
params: [
|
|
@@ -302588,7 +302805,8 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302588
302805
|
// TODO: support using intercept+effect here based on user-selected options?
|
|
302589
302806
|
field: "logFoldChange",
|
|
302590
302807
|
type: "quantitative",
|
|
302591
|
-
title: "Log fold-change"
|
|
302808
|
+
title: "Log fold-change",
|
|
302809
|
+
scale: xScale
|
|
302592
302810
|
},
|
|
302593
302811
|
color: {
|
|
302594
302812
|
field: "key",
|
|
@@ -302604,7 +302822,8 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302604
302822
|
strokeWidth: {
|
|
302605
302823
|
field: "isReferenceSet",
|
|
302606
302824
|
type: "nominal",
|
|
302607
|
-
scale: strokeWidthScale
|
|
302825
|
+
scale: strokeWidthScale,
|
|
302826
|
+
legend: null
|
|
302608
302827
|
},
|
|
302609
302828
|
tooltip: {
|
|
302610
302829
|
field: "effectExpectedSample",
|
|
@@ -302663,7 +302882,7 @@ function CellSetCompositionBarPlotSubscriber(props) {
|
|
|
302663
302882
|
return jsxRuntimeExports.jsx(TitleInfo, { title: `${capitalize$2(obsType)} Set Composition Analysis Plot`, removeGridComponent, theme, isReady, helpText, children: jsxRuntimeExports.jsx("div", { ref: containerRef, className: classes.vegaContainer, children: obsSetStats ? jsxRuntimeExports.jsx(CellSetCompositionBarPlot, { theme, width: width2, height: height2, obsType, obsSetsColumnNameMapping, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMapping, sampleSetsColumnNameMappingReversed, sampleSetSelection, obsSetSelection, obsSetColor, sampleSetColor, data: obsSetStats, onBarSelect }) : jsxRuntimeExports.jsxs("span", { children: ["Select at least one ", obsType, " set and a pair of ", sampleType, " sets."] }) }) });
|
|
302664
302883
|
}
|
|
302665
302884
|
function FeatureSetEnrichmentBarPlot(props) {
|
|
302666
|
-
const { data: data2, theme, width: width2, height: height2, marginRight =
|
|
302885
|
+
const { data: data2, theme, width: width2, height: height2, marginRight = 300, marginBottom = 120, keyLength = 36, featureType, onBarSelect, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMappingReversed, sampleSetSelection, obsSetSelection, obsSetColor, sampleSetColor, pValueThreshold } = props;
|
|
302667
302886
|
const [obsSetColorScale, sampleSetColorScale] = useMemo(() => [
|
|
302668
302887
|
getColorScale(obsSetSelection, obsSetColor, theme),
|
|
302669
302888
|
getColorScale(sampleSetSelection, sampleSetColor, theme)
|
|
@@ -302708,7 +302927,7 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302708
302927
|
}
|
|
302709
302928
|
return [...a2, h2];
|
|
302710
302929
|
}, []);
|
|
302711
|
-
const MAX_ROWS =
|
|
302930
|
+
const MAX_ROWS = 50;
|
|
302712
302931
|
result = result.slice(0, MAX_ROWS);
|
|
302713
302932
|
return result;
|
|
302714
302933
|
}
|
|
@@ -302739,7 +302958,7 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302739
302958
|
select: {
|
|
302740
302959
|
type: "point",
|
|
302741
302960
|
on: "click[event.shiftKey === false]",
|
|
302742
|
-
fields: ["name"],
|
|
302961
|
+
fields: ["name", "term"],
|
|
302743
302962
|
empty: "none"
|
|
302744
302963
|
}
|
|
302745
302964
|
},
|
|
@@ -302748,7 +302967,7 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302748
302967
|
select: {
|
|
302749
302968
|
type: "point",
|
|
302750
302969
|
on: "click[event.shiftKey]",
|
|
302751
|
-
fields: ["name"],
|
|
302970
|
+
fields: ["name", "term"],
|
|
302752
302971
|
empty: "none"
|
|
302753
302972
|
}
|
|
302754
302973
|
}
|
|
@@ -302796,9 +303015,9 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302796
303015
|
};
|
|
302797
303016
|
const handleSignal = (name2, value2) => {
|
|
302798
303017
|
if (name2 === "bar_select") {
|
|
302799
|
-
onBarSelect(value2.
|
|
303018
|
+
onBarSelect(value2.name?.[0], value2.term?.[0]);
|
|
302800
303019
|
} else if (name2 === "shift_bar_select") {
|
|
302801
|
-
onBarSelect(value2.
|
|
303020
|
+
onBarSelect(value2.name, value2.term, true);
|
|
302802
303021
|
}
|
|
302803
303022
|
};
|
|
302804
303023
|
const signalListeners = { bar_select: handleSignal, shift_bar_select: handleSignal };
|
|
@@ -302816,7 +303035,7 @@ function FeatureSetEnrichmentBarPlotSubscriber(props) {
|
|
|
302816
303035
|
const { coordinationScopes, removeGridComponent, theme, helpText = ViewHelpMapping.FEATURE_SET_ENRICHMENT_BAR_PLOT } = props;
|
|
302817
303036
|
const classes = useStyles$4();
|
|
302818
303037
|
const loaders = useLoaders();
|
|
302819
|
-
useAsyncFunction(AsyncFunctionType.TRANSFORM_FEATURE);
|
|
303038
|
+
const transformFeature2 = useAsyncFunction(AsyncFunctionType.TRANSFORM_FEATURE);
|
|
302820
303039
|
const [{ dataset, obsType, sampleType, featureType, featureValueType, obsFilter: cellFilter, obsHighlight: cellHighlight, obsSetSelection, obsSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, featurePointSignificanceThreshold, featurePointFoldChangeThreshold, featureLabelSignificanceThreshold, featureLabelFoldChangeThreshold, featureValueTransform, featureValueTransformCoefficient, gatingFeatureSelectionX, gatingFeatureSelectionY, featureSelection, sampleSetSelection, sampleSetColor }, { setObsFilter: setCellFilter, setObsSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setFeaturePointSignificanceThreshold, setFeaturePointFoldChangeThreshold, setFeatureLabelSignificanceThreshold, setFeatureLabelFoldChangeThreshold, setFeatureValueTransform, setFeatureValueTransformCoefficient, setGatingFeatureSelectionX, setGatingFeatureSelectionY, setFeatureSelection, setSampleSetSelection, setSampleSetColor }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.FEATURE_SET_ENRICHMENT_BAR_PLOT], coordinationScopes);
|
|
302821
303040
|
const [width2, height2, containerRef] = useGridItemSize();
|
|
302822
303041
|
const obsSetsLoader = useMatchingLoader(loaders, dataset, DataType$4.OBS_SETS, { obsType });
|
|
@@ -302839,6 +303058,11 @@ function FeatureSetEnrichmentBarPlotSubscriber(props) {
|
|
|
302839
303058
|
featureSetStatsStatus
|
|
302840
303059
|
]);
|
|
302841
303060
|
const onBarSelect = useCallback(async (featureSetName, featureSetTerm, isShiftDown = false) => {
|
|
303061
|
+
const kgNode = { nodeType: "pathway", term: featureSetTerm };
|
|
303062
|
+
const targetFeatureType = featureType;
|
|
303063
|
+
const targetsInPathway = await transformFeature2(kgNode, targetFeatureType);
|
|
303064
|
+
const featureIds = targetsInPathway.filter((d, i2) => i2 < 10).map((d) => d.label);
|
|
303065
|
+
setFeatureSelection(featureIds);
|
|
302842
303066
|
}, [setFeatureSelection]);
|
|
302843
303067
|
return jsxRuntimeExports.jsx(TitleInfo, { title: `${capitalize$2(featureType)} Set Enrichment Plot`, removeGridComponent, theme, isReady, helpText, children: jsxRuntimeExports.jsx("div", { ref: containerRef, className: classes.vegaContainer, children: featureSetStats ? jsxRuntimeExports.jsx(FeatureSetEnrichmentBarPlot, { theme, width: width2, height: height2, obsType, featureType, obsSetsColumnNameMapping, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMapping, sampleSetsColumnNameMappingReversed, sampleSetSelection, obsSetSelection, obsSetColor, sampleSetColor, data: featureSetStats, onBarSelect, pValueThreshold: 0.01 }) : jsxRuntimeExports.jsxs("span", { children: ["Select at least one ", obsType, " set."] }) }) });
|
|
302844
303068
|
}
|
|
@@ -308416,79 +308640,88 @@ class MoleculesJsonAsObsLocationsLoader extends JsonLoader {
|
|
|
308416
308640
|
}
|
|
308417
308641
|
}
|
|
308418
308642
|
async function initLoader(imageData) {
|
|
308419
|
-
|
|
308420
|
-
|
|
308421
|
-
|
|
308422
|
-
|
|
308423
|
-
|
|
308424
|
-
|
|
308425
|
-
|
|
308426
|
-
|
|
308427
|
-
|
|
308428
|
-
|
|
308429
|
-
|
|
308430
|
-
|
|
308431
|
-
|
|
308432
|
-
|
|
308433
|
-
|
|
308434
|
-
|
|
308435
|
-
|
|
308436
|
-
|
|
308437
|
-
}
|
|
308438
|
-
return { data: source2, metadata: { dimensions, transform: transform4 }, channels: (dimensions.find((d) => d.field === "channel") || dimensions[0]).values };
|
|
308439
|
-
}
|
|
308440
|
-
case "ome-tiff": {
|
|
308441
|
-
let loader2;
|
|
308442
|
-
if (metadata2 && "omeTiffOffsetsUrl" in metadata2) {
|
|
308443
|
-
const { omeTiffOffsetsUrl } = metadata2;
|
|
308444
|
-
const res = await fetch(omeTiffOffsetsUrl, requestInit2 || {});
|
|
308445
|
-
if (res.ok) {
|
|
308446
|
-
const offsets2 = await res.json();
|
|
308447
|
-
loader2 = await loadOmeTiff(url, {
|
|
308448
|
-
offsets: offsets2,
|
|
308449
|
-
headers: requestInit2?.headers
|
|
308450
|
-
});
|
|
308643
|
+
try {
|
|
308644
|
+
const { type: type3, url, metadata: metadata2, requestInit: requestInit2 } = imageData;
|
|
308645
|
+
switch (type3) {
|
|
308646
|
+
case "zarr": {
|
|
308647
|
+
const { dimensions, isPyramid, transform: transform4 } = metadata2 || {};
|
|
308648
|
+
const labels2 = dimensions.map((d) => d.field);
|
|
308649
|
+
let source2;
|
|
308650
|
+
const root2 = await zarrOpenRoot(url, null, { requestInit: requestInit2 });
|
|
308651
|
+
if (isPyramid) {
|
|
308652
|
+
const metadataUrl = `${url}${url.slice(-1) === "/" ? "" : "/"}.zmetadata`;
|
|
308653
|
+
const response = await fetch(metadataUrl);
|
|
308654
|
+
if (!response.ok)
|
|
308655
|
+
throw new Error(`Failed to fetch metadata: ${response.status}`);
|
|
308656
|
+
const { metadata: zarrMetadata } = await response.json();
|
|
308657
|
+
const paths = Object.keys(zarrMetadata).filter((metaKey) => metaKey.includes(".zarray")).map((arrMetaKeys) => arrMetaKeys.slice(0, -7));
|
|
308658
|
+
const data2 = await Promise.all(paths.map((path2) => open$1(root2.resolve(path2), { kind: "array" })));
|
|
308659
|
+
const tileSize = guessTileSize(data2[0]);
|
|
308660
|
+
source2 = data2.map((d) => new ZarritaPixelSource(createZarrArrayAdapter(d), labels2, tileSize));
|
|
308451
308661
|
} else {
|
|
308452
|
-
|
|
308662
|
+
const data2 = await open$1(root2, { kind: "array" });
|
|
308663
|
+
source2 = new ZarritaPixelSource(createZarrArrayAdapter(data2), labels2);
|
|
308453
308664
|
}
|
|
308454
|
-
|
|
308455
|
-
|
|
308456
|
-
|
|
308457
|
-
|
|
308458
|
-
|
|
308459
|
-
|
|
308460
|
-
|
|
308461
|
-
|
|
308462
|
-
|
|
308463
|
-
|
|
308464
|
-
|
|
308465
|
-
|
|
308466
|
-
|
|
308467
|
-
|
|
308468
|
-
|
|
308469
|
-
|
|
308470
|
-
|
|
308471
|
-
|
|
308472
|
-
|
|
308473
|
-
|
|
308474
|
-
|
|
308475
|
-
const { channels: channels2, name: omeroName } = omero;
|
|
308476
|
-
return {
|
|
308477
|
-
name: omeroName || "Image",
|
|
308478
|
-
channels: channels2.map((c2, i2) => c2.label || `Channel ${i2}`),
|
|
308479
|
-
...transformMatrix ? {
|
|
308480
|
-
metadata: {
|
|
308481
|
-
transform: {
|
|
308482
|
-
matrix: transformMatrix
|
|
308483
|
-
}
|
|
308665
|
+
return {
|
|
308666
|
+
data: source2,
|
|
308667
|
+
metadata: { dimensions, transform: transform4 },
|
|
308668
|
+
channels: (dimensions.find((d) => d.field === "channel") || dimensions[0]).values
|
|
308669
|
+
};
|
|
308670
|
+
}
|
|
308671
|
+
case "ome-tiff": {
|
|
308672
|
+
let loader2;
|
|
308673
|
+
if (metadata2?.omeTiffOffsetsUrl) {
|
|
308674
|
+
try {
|
|
308675
|
+
const res = await fetch(metadata2.omeTiffOffsetsUrl, requestInit2 || {});
|
|
308676
|
+
if (!res.ok)
|
|
308677
|
+
throw new Error(`Offsets not found: ${res.status} from ${res.url}`);
|
|
308678
|
+
const offsets2 = await res.json();
|
|
308679
|
+
loader2 = await loadOmeTiff(url, {
|
|
308680
|
+
offsets: offsets2,
|
|
308681
|
+
headers: requestInit2?.headers
|
|
308682
|
+
});
|
|
308683
|
+
} catch (err2) {
|
|
308684
|
+
log$f.error("Error loading OME-TIFF offsets:", err2);
|
|
308685
|
+
throw err2;
|
|
308484
308686
|
}
|
|
308485
|
-
}
|
|
308486
|
-
|
|
308487
|
-
|
|
308488
|
-
|
|
308489
|
-
|
|
308490
|
-
|
|
308687
|
+
} else {
|
|
308688
|
+
loader2 = await loadOmeTiff(url, { headers: requestInit2?.headers });
|
|
308689
|
+
}
|
|
308690
|
+
const { Pixels: { Channels } } = loader2.metadata;
|
|
308691
|
+
const channels2 = Array.isArray(Channels) ? Channels.map((channel, i2) => channel.Name || `Channel ${i2}`) : [Channels.Name || `Channel ${0}`];
|
|
308692
|
+
return { ...loader2, channels: channels2 };
|
|
308693
|
+
}
|
|
308694
|
+
case "ome-zarr": {
|
|
308695
|
+
const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata2 || {};
|
|
308696
|
+
const root2 = await zarrOpenRoot(url, null, { requestInit: requestInit2 });
|
|
308697
|
+
const loader2 = await loadOmeZarr(root2);
|
|
308698
|
+
const { metadata: loaderMetadata } = loader2;
|
|
308699
|
+
const { omero, multiscales } = loaderMetadata;
|
|
308700
|
+
if (!Array.isArray(multiscales) || multiscales.length === 0) {
|
|
308701
|
+
throw new Error("Multiscales array must exist and have at least one element");
|
|
308702
|
+
}
|
|
308703
|
+
const { coordinateTransformations } = multiscales[0];
|
|
308704
|
+
const axes = getNgffAxes(multiscales[0].axes);
|
|
308705
|
+
const transformMatrixFromOptions = coordinateTransformationsToMatrix(coordinateTransformationsFromOptions, axes);
|
|
308706
|
+
const transformMatrixFromFile = coordinateTransformationsToMatrix(coordinateTransformations, axes);
|
|
308707
|
+
const transformMatrix = transformMatrixFromFile.multiplyLeft(transformMatrixFromOptions);
|
|
308708
|
+
const { channels: channels2, name: omeroName } = omero;
|
|
308709
|
+
return {
|
|
308710
|
+
name: omeroName || "Image",
|
|
308711
|
+
channels: channels2.map((c2, i2) => c2.label || `Channel ${i2}`),
|
|
308712
|
+
...transformMatrix ? { metadata: { transform: { matrix: transformMatrix } } } : {},
|
|
308713
|
+
...loader2
|
|
308714
|
+
};
|
|
308715
|
+
}
|
|
308716
|
+
default: {
|
|
308717
|
+
const errorMessage = `Image type (${type3}) is not supported`;
|
|
308718
|
+
log$f.error(errorMessage);
|
|
308719
|
+
throw new Error(errorMessage);
|
|
308720
|
+
}
|
|
308491
308721
|
}
|
|
308722
|
+
} catch (error2) {
|
|
308723
|
+
log$f.error("Error in initLoader:", error2);
|
|
308724
|
+
throw error2;
|
|
308492
308725
|
}
|
|
308493
308726
|
}
|
|
308494
308727
|
class RasterLoader extends JsonLoader {
|
|
@@ -308639,6 +308872,15 @@ function basename(path2) {
|
|
|
308639
308872
|
}
|
|
308640
308873
|
return result;
|
|
308641
308874
|
}
|
|
308875
|
+
function prependSlash(path2) {
|
|
308876
|
+
if (typeof path2 === "string" && path2.length >= 1) {
|
|
308877
|
+
if (path2.charAt(0) === "/") {
|
|
308878
|
+
return path2;
|
|
308879
|
+
}
|
|
308880
|
+
return `/${path2}`;
|
|
308881
|
+
}
|
|
308882
|
+
return path2;
|
|
308883
|
+
}
|
|
308642
308884
|
class AnnDataSource extends ZarrDataSource {
|
|
308643
308885
|
/**
|
|
308644
308886
|
*
|
|
@@ -308706,29 +308948,33 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308706
308948
|
}
|
|
308707
308949
|
/**
|
|
308708
308950
|
*
|
|
308709
|
-
* @param {string}
|
|
308951
|
+
* @param {string} pathOrig
|
|
308710
308952
|
* @returns
|
|
308711
308953
|
*/
|
|
308712
|
-
async _loadColumn(
|
|
308954
|
+
async _loadColumn(pathOrig) {
|
|
308713
308955
|
const { storeRoot } = this;
|
|
308714
|
-
const
|
|
308956
|
+
const path2 = prependSlash(pathOrig);
|
|
308957
|
+
const prefixOrig = dirname(path2);
|
|
308958
|
+
const prefix2 = prependSlash(prefixOrig);
|
|
308715
308959
|
const { categories, "encoding-type": encodingType } = await this.getJson(`${path2}/.zattrs`);
|
|
308716
308960
|
let categoriesValues;
|
|
308717
308961
|
let codesPath;
|
|
308718
308962
|
if (categories) {
|
|
308719
|
-
const { dtype } = await open$1(storeRoot.resolve(
|
|
308720
|
-
if (dtype === "v2:object") {
|
|
308721
|
-
categoriesValues = await this.getFlatArrDecompressed(
|
|
308963
|
+
const { dtype } = await open$1(storeRoot.resolve(`${prefix2}/${categories}`), { kind: "array" });
|
|
308964
|
+
if (dtype === "v2:object" || dtype === "|O") {
|
|
308965
|
+
categoriesValues = await this.getFlatArrDecompressed(`${prefix2}/${categories}`);
|
|
308722
308966
|
}
|
|
308723
308967
|
} else if (encodingType === "categorical") {
|
|
308724
|
-
const { dtype } = await open$1(storeRoot.resolve(
|
|
308725
|
-
if (dtype === "v2:object") {
|
|
308726
|
-
categoriesValues = await this.getFlatArrDecompressed(
|
|
308968
|
+
const { dtype } = await open$1(storeRoot.resolve(`${path2}/categories`), { kind: "array" });
|
|
308969
|
+
if (dtype === "v2:object" || dtype === "|O") {
|
|
308970
|
+
categoriesValues = await this.getFlatArrDecompressed(`${path2}/categories`);
|
|
308727
308971
|
}
|
|
308728
|
-
codesPath =
|
|
308972
|
+
codesPath = `${path2}/codes`;
|
|
308973
|
+
} else if (encodingType === "string-array") {
|
|
308974
|
+
return this.getFlatArrDecompressed(path2);
|
|
308729
308975
|
} else {
|
|
308730
|
-
const { dtype } = await open$1(storeRoot.resolve(
|
|
308731
|
-
if (dtype === "v2:object") {
|
|
308976
|
+
const { dtype } = await open$1(storeRoot.resolve(path2), { kind: "array" });
|
|
308977
|
+
if (dtype === "v2:object" || dtype === "|O") {
|
|
308732
308978
|
return this.getFlatArrDecompressed(path2);
|
|
308733
308979
|
}
|
|
308734
308980
|
}
|
|
@@ -308801,7 +309047,7 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308801
309047
|
if (this.obsIndex) {
|
|
308802
309048
|
return this.obsIndex;
|
|
308803
309049
|
}
|
|
308804
|
-
this.obsIndex = this.getJson("obs/.zattrs").then(({ _index }) => this.
|
|
309050
|
+
this.obsIndex = this.getJson("obs/.zattrs").then(({ _index }) => this._loadColumn(`/obs/${_index}`));
|
|
308805
309051
|
return this.obsIndex;
|
|
308806
309052
|
}
|
|
308807
309053
|
/**
|
|
@@ -308812,7 +309058,7 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308812
309058
|
*/
|
|
308813
309059
|
loadDataFrameIndex(path2 = void 0) {
|
|
308814
309060
|
const dfPath = path2 ? dirname(path2) : "";
|
|
308815
|
-
return this.getJson(`${dfPath}/.zattrs`).then(({ _index }) => this.
|
|
309061
|
+
return this.getJson(`${dfPath}/.zattrs`).then(({ _index }) => this._loadColumn(`${dfPath.length > 0 ? "/" : ""}${dfPath}/${_index}`));
|
|
308816
309062
|
}
|
|
308817
309063
|
/**
|
|
308818
309064
|
* Class method for loading the var index.
|
|
@@ -308823,7 +309069,7 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308823
309069
|
if (this.varIndex) {
|
|
308824
309070
|
return this.varIndex;
|
|
308825
309071
|
}
|
|
308826
|
-
this.varIndex = this.getJson("var/.zattrs").then(({ _index }) => this.
|
|
309072
|
+
this.varIndex = this.getJson("var/.zattrs").then(({ _index }) => this._loadColumn(`/var/${_index}`));
|
|
308827
309073
|
return this.varIndex;
|
|
308828
309074
|
}
|
|
308829
309075
|
/**
|
|
@@ -309613,6 +309859,11 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
309613
309859
|
}
|
|
309614
309860
|
}
|
|
309615
309861
|
class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
309862
|
+
constructor(dataSource, params2) {
|
|
309863
|
+
super(dataSource, params2);
|
|
309864
|
+
this.region = null;
|
|
309865
|
+
this.tablePath = null;
|
|
309866
|
+
}
|
|
309616
309867
|
loadObsIndices() {
|
|
309617
309868
|
const { options } = this;
|
|
309618
309869
|
const obsIndexPromises = options.obsSets?.map(({ path: path2 }) => path2).map((pathOrPaths) => {
|
|
@@ -309644,7 +309895,7 @@ class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
309644
309895
|
if (!this.cachedResult) {
|
|
309645
309896
|
const { options } = this;
|
|
309646
309897
|
this.cachedResult = Promise.all([
|
|
309647
|
-
this.dataSource.loadObsIndex(),
|
|
309898
|
+
this.dataSource.loadObsIndex(this.tablePath),
|
|
309648
309899
|
this.loadObsIndices(),
|
|
309649
309900
|
this.loadCellSetIds(),
|
|
309650
309901
|
this.loadCellSetScores()
|
|
@@ -309968,11 +310219,17 @@ let FeatureStatsAnndataLoader$1 = class FeatureStatsAnndataLoader extends Abstra
|
|
|
309968
310219
|
const rawSampleSetSelection = sampleSetSelection;
|
|
309969
310220
|
if (sampleSetSelection) {
|
|
309970
310221
|
if (sampleSetSelection.length !== 2) {
|
|
309971
|
-
|
|
310222
|
+
if (getDebugMode()) {
|
|
310223
|
+
return Promise.reject(new Error("Expected exactly two sample sets for volcano plot."));
|
|
310224
|
+
}
|
|
310225
|
+
return null;
|
|
309972
310226
|
}
|
|
309973
310227
|
}
|
|
309974
310228
|
if (!obsSetSelection) {
|
|
309975
|
-
|
|
310229
|
+
if (getDebugMode()) {
|
|
310230
|
+
return Promise.reject(new Error("Expected obsSetSelection to be present."));
|
|
310231
|
+
}
|
|
310232
|
+
return null;
|
|
309976
310233
|
}
|
|
309977
310234
|
const metadata2 = await this.loadMetadata();
|
|
309978
310235
|
const matchingComparisons = [];
|
|
@@ -310045,9 +310302,21 @@ class FeatureStatsAnndataLoader2 extends AbstractTwoStepLoader {
|
|
|
310045
310302
|
this.loadFeatureSetTerms(dfPath),
|
|
310046
310303
|
this.loadSignificances(dfPath)
|
|
310047
310304
|
]);
|
|
310305
|
+
const cleanName = (s2) => {
|
|
310306
|
+
if (s2.includes("R-HSA-")) {
|
|
310307
|
+
return s2.substring(0, s2.indexOf("R-HSA-") - 1);
|
|
310308
|
+
}
|
|
310309
|
+
return s2;
|
|
310310
|
+
};
|
|
310311
|
+
const cleanTerm = (s2) => {
|
|
310312
|
+
if (s2.includes("R-HSA-")) {
|
|
310313
|
+
return `REACTOME:${s2.substring(s2.indexOf("R-HSA-"))}`;
|
|
310314
|
+
}
|
|
310315
|
+
return s2;
|
|
310316
|
+
};
|
|
310048
310317
|
return {
|
|
310049
|
-
featureSetName,
|
|
310050
|
-
featureSetTerm,
|
|
310318
|
+
featureSetName: featureSetName.map((s2) => cleanName(s2)),
|
|
310319
|
+
featureSetTerm: featureSetTerm.map((s2) => cleanTerm(s2)),
|
|
310051
310320
|
featureSetSignificance
|
|
310052
310321
|
};
|
|
310053
310322
|
}
|
|
@@ -310076,17 +310345,23 @@ class FeatureStatsAnndataLoader2 extends AbstractTwoStepLoader {
|
|
|
310076
310345
|
* @returns {Promise<LoaderResult<FeatureStatsData>>}
|
|
310077
310346
|
*/
|
|
310078
310347
|
async loadMulti(volcanoOptions) {
|
|
310079
|
-
const { analysisType: targetAnalysisType = "pertpy_hypergeometric" } = this.options;
|
|
310348
|
+
const { analysisType: targetAnalysisType = "pertpy_hypergeometric", featureSetLibrary: targetFeatureSetLibrary = "Reactome_2022" } = this.options;
|
|
310080
310349
|
const { sampleSetSelection, obsSetSelection } = volcanoOptions || {};
|
|
310081
310350
|
const rawObsSetSelection = obsSetSelection;
|
|
310082
310351
|
const rawSampleSetSelection = sampleSetSelection;
|
|
310083
310352
|
if (sampleSetSelection) {
|
|
310084
310353
|
if (sampleSetSelection.length !== 2) {
|
|
310085
|
-
|
|
310354
|
+
if (getDebugMode()) {
|
|
310355
|
+
return Promise.reject(new Error("Expected exactly two sample sets for volcano plot."));
|
|
310356
|
+
}
|
|
310357
|
+
return null;
|
|
310086
310358
|
}
|
|
310087
310359
|
}
|
|
310088
310360
|
if (!obsSetSelection) {
|
|
310089
|
-
|
|
310361
|
+
if (getDebugMode()) {
|
|
310362
|
+
return Promise.reject(new Error("Expected obsSetSelection to be present."));
|
|
310363
|
+
}
|
|
310364
|
+
return null;
|
|
310090
310365
|
}
|
|
310091
310366
|
const metadata2 = await this.loadMetadata();
|
|
310092
310367
|
const matchingComparisons = [];
|
|
@@ -310095,11 +310370,11 @@ class FeatureStatsAnndataLoader2 extends AbstractTwoStepLoader {
|
|
|
310095
310370
|
results.forEach((resultObject) => {
|
|
310096
310371
|
const {
|
|
310097
310372
|
analysis_type,
|
|
310098
|
-
|
|
310373
|
+
analysis_params,
|
|
310099
310374
|
coordination_values
|
|
310100
310375
|
// path,
|
|
310101
310376
|
} = resultObject;
|
|
310102
|
-
if (analysis_type === targetAnalysisType) {
|
|
310377
|
+
if (analysis_type === targetAnalysisType && analysis_params?.pertpy_hypergeometric?.enrichr_library_name === targetFeatureSetLibrary) {
|
|
310103
310378
|
if (sampleSetSelection) {
|
|
310104
310379
|
rawObsSetSelection.forEach((obsSetPath2) => {
|
|
310105
310380
|
if (isEqual$5([obsSetPath2], coordination_values.obsSetFilter)) {
|
|
@@ -310172,10 +310447,6 @@ class ObsSetStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
310172
310447
|
}
|
|
310173
310448
|
return values3.data;
|
|
310174
310449
|
}
|
|
310175
|
-
async loadCovariate(dfPath) {
|
|
310176
|
-
const { covariateColumn } = this.options;
|
|
310177
|
-
return this.dataSource._loadColumn(`${dfPath}/${covariateColumn}`);
|
|
310178
|
-
}
|
|
310179
310450
|
async loadObsSetNames(dfPath) {
|
|
310180
310451
|
const { indexColumn } = this.options;
|
|
310181
310452
|
if (indexColumn) {
|
|
@@ -310189,28 +310460,23 @@ class ObsSetStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
310189
310460
|
obsSetFoldChange,
|
|
310190
310461
|
interceptExpectedSample,
|
|
310191
310462
|
effectExpectedSample,
|
|
310192
|
-
isCredibleEffect
|
|
310463
|
+
isCredibleEffect
|
|
310193
310464
|
// TODO: rather than passing this down,
|
|
310194
310465
|
// do the fold change direction swapping in the loader
|
|
310195
310466
|
// (as opposed to in the view).
|
|
310196
|
-
// TODO: also, see https://github.com/keller-mark/compasce/issues/30
|
|
310197
|
-
// which would allow not loading this column altogether.
|
|
310198
|
-
covariate
|
|
310199
310467
|
] = await Promise.all([
|
|
310200
310468
|
this.loadObsSetNames(dfPath),
|
|
310201
310469
|
this.loadFoldChanges(dfPath),
|
|
310202
310470
|
this.loadInterceptValues(dfPath),
|
|
310203
310471
|
this.loadEffectValues(dfPath),
|
|
310204
|
-
this.loadIsCredible(dfPath)
|
|
310205
|
-
this.loadCovariate(dfPath)
|
|
310472
|
+
this.loadIsCredible(dfPath)
|
|
310206
310473
|
]);
|
|
310207
310474
|
return {
|
|
310208
310475
|
obsSetId,
|
|
310209
310476
|
obsSetFoldChange,
|
|
310210
310477
|
interceptExpectedSample,
|
|
310211
310478
|
effectExpectedSample,
|
|
310212
|
-
isCredibleEffect
|
|
310213
|
-
covariate
|
|
310479
|
+
isCredibleEffect
|
|
310214
310480
|
};
|
|
310215
310481
|
}
|
|
310216
310482
|
/**
|
|
@@ -310243,10 +310509,16 @@ class ObsSetStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
310243
310509
|
const rawObsSetSelection = obsSetSelection;
|
|
310244
310510
|
const rawSampleSetSelection = sampleSetSelection;
|
|
310245
310511
|
if (!sampleSetSelection || sampleSetSelection?.length !== 2) {
|
|
310246
|
-
|
|
310512
|
+
if (getDebugMode()) {
|
|
310513
|
+
return Promise.reject(new Error("Expected exactly two sample sets for cell type composition analysis plot."));
|
|
310514
|
+
}
|
|
310515
|
+
return null;
|
|
310247
310516
|
}
|
|
310248
310517
|
if (!obsSetSelection) {
|
|
310249
|
-
|
|
310518
|
+
if (getDebugMode()) {
|
|
310519
|
+
return Promise.reject(new Error("Expected obsSetSelection to be present."));
|
|
310520
|
+
}
|
|
310521
|
+
return null;
|
|
310250
310522
|
}
|
|
310251
310523
|
const metadata2 = await this.loadMetadata();
|
|
310252
310524
|
const rawObsSetGroups = Array.from(new Set(rawObsSetSelection.map((setPath) => setPath?.[0])));
|
|
@@ -310950,18 +311222,19 @@ class SpatialDataObsSetsLoader extends ObsSetsAnndataLoader {
|
|
|
310950
311222
|
constructor(dataSource, params2) {
|
|
310951
311223
|
super(dataSource, params2);
|
|
310952
311224
|
this.region = this.options.region;
|
|
311225
|
+
this.tablePath = this.options.tablePath;
|
|
310953
311226
|
}
|
|
310954
311227
|
}
|
|
310955
|
-
const pluralRegex = /^tables\/([^/]*)
|
|
310956
|
-
const singularRegex = /^table\/([^/]*)
|
|
311228
|
+
const pluralRegex = /^tables\/([^/]*)(\/?)(.*)$/;
|
|
311229
|
+
const singularRegex = /^table\/([^/]*)(\/?)(.*)$/;
|
|
310957
311230
|
function getTablePrefix(arrPath) {
|
|
310958
311231
|
if (arrPath) {
|
|
310959
311232
|
const pluralMatches = arrPath.match(pluralRegex);
|
|
310960
|
-
if (pluralMatches && pluralMatches.length
|
|
311233
|
+
if (pluralMatches && pluralMatches.length >= 3) {
|
|
310961
311234
|
return `tables/${pluralMatches[1]}/`;
|
|
310962
311235
|
}
|
|
310963
311236
|
const singularMatches = arrPath.match(singularRegex);
|
|
310964
|
-
if (singularMatches && singularMatches.length
|
|
311237
|
+
if (singularMatches && singularMatches.length >= 3) {
|
|
310965
311238
|
return `table/${singularMatches[1]}/`;
|
|
310966
311239
|
}
|
|
310967
311240
|
}
|
|
@@ -363544,7 +363817,7 @@ function loadPathwayNodes() {
|
|
|
363544
363817
|
kgId: d.id,
|
|
363545
363818
|
label: d.pathway,
|
|
363546
363819
|
// For reactome
|
|
363547
|
-
term: `
|
|
363820
|
+
term: `REACTOME:${d.acc}`,
|
|
363548
363821
|
// For reactome
|
|
363549
363822
|
// label: d.ontology_label, // For GO_BP
|
|
363550
363823
|
// term: d.acc, // For GO_BP
|
|
@@ -363610,7 +363883,10 @@ async function loadPathwayToGeneEdges() {
|
|
|
363610
363883
|
}));
|
|
363611
363884
|
});
|
|
363612
363885
|
}
|
|
363613
|
-
async function transformFeature({ queryClient },
|
|
363886
|
+
async function transformFeature({ queryClient }, nodeOrig, targetModality) {
|
|
363887
|
+
const node2 = {
|
|
363888
|
+
...nodeOrig
|
|
363889
|
+
};
|
|
363614
363890
|
if (targetModality === node2.nodeType) {
|
|
363615
363891
|
return [node2];
|
|
363616
363892
|
}
|
|
@@ -363626,6 +363902,19 @@ async function transformFeature({ queryClient }, node2, targetModality) {
|
|
|
363626
363902
|
staleTime: Infinity,
|
|
363627
363903
|
queryFn: loadPathwayToGeneEdges
|
|
363628
363904
|
});
|
|
363905
|
+
if (!node2.kgId) {
|
|
363906
|
+
const pathwayNodes = await queryClient.fetchQuery({
|
|
363907
|
+
queryKey: ["pathwayNodes"],
|
|
363908
|
+
staleTime: Infinity,
|
|
363909
|
+
queryFn: loadPathwayNodes
|
|
363910
|
+
});
|
|
363911
|
+
const foundId = pathwayNodes.find((n3) => n3.term === node2.term)?.kgId;
|
|
363912
|
+
if (foundId) {
|
|
363913
|
+
node2.kgId = foundId;
|
|
363914
|
+
} else {
|
|
363915
|
+
console.warn("Could not find matching pathway node based on term.");
|
|
363916
|
+
}
|
|
363917
|
+
}
|
|
363629
363918
|
const matchingEdges = pathwayGeneEdges.filter((d) => d.source === node2.kgId);
|
|
363630
363919
|
const matchingGeneIds = matchingEdges.map((d) => d.target);
|
|
363631
363920
|
const matchingGenes = geneNodes.filter((d) => matchingGeneIds.includes(d.kgId));
|
|
@@ -364455,6 +364744,17 @@ const baseCoordinationTypes = [
|
|
|
364455
364744
|
new PluginCoordinationType(CoordinationType$2.FEATURE_FILTER, null, z.array(z.string()).nullable()),
|
|
364456
364745
|
new PluginCoordinationType(CoordinationType$2.FEATURE_HIGHLIGHT, null, z.string().nullable()),
|
|
364457
364746
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SELECTION, null, z.array(z.string()).nullable()),
|
|
364747
|
+
new PluginCoordinationType(CoordinationType$2.FEATURE_AGGREGATION_STRATEGY, null, z.union([
|
|
364748
|
+
z.enum([
|
|
364749
|
+
"first",
|
|
364750
|
+
"last",
|
|
364751
|
+
"mean",
|
|
364752
|
+
"sum",
|
|
364753
|
+
"difference"
|
|
364754
|
+
]),
|
|
364755
|
+
// An index of a featureSelection array element.
|
|
364756
|
+
z.number()
|
|
364757
|
+
]).nullable()),
|
|
364458
364758
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SET_SELECTION, null, z.array(obsSetPath).nullable()),
|
|
364459
364759
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SELECTION_MODE, null, z.enum(["featureSelection", "featureSetSelection"]).nullable()),
|
|
364460
364760
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SET_FILTER, null, z.array(obsSetPath).nullable()),
|