@vitessce/dev 3.5.10 → 3.5.12
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-b57ef85f.js} +1 -1
- package/dist/{higlass-c5004fea.js → higlass-bd3bb438.js} +1 -1
- package/dist/{index-5fa58d34.js → index-4f10e6bc.js} +556 -231
- package/dist/{index-800e8a7d.js → index-f9b7fcdb.js} +2 -2
- package/dist/{index-f1a9e799.js → index-fed4c7c6.js} +1 -1
- package/dist/index.js +1 -1
- package/dist/{jpeg-2fa62753.js → jpeg-2c38fd60.js} +1 -1
- package/dist/{lerc-49d3fc18.js → lerc-bfc1a927.js} +1 -1
- package/dist/{lzw-664d7a22.js → lzw-c11a1966.js} +1 -1
- package/dist/{packbits-7bd305e5.js → packbits-05dadc65.js} +1 -1
- package/dist/{raw-7abf6614.js → raw-085aef44.js} +1 -1
- package/dist/{troika-three-text.esm-39d94b6d.js → troika-three-text.esm-9db53f4c.js} +1 -1
- package/dist/{webimage-8c8572cd.js → webimage-184e90fa.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,10 +746,12 @@ 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,
|
|
748
|
-
CoordinationType$2.TOOLTIPS_VISIBLE
|
|
753
|
+
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
754
|
+
CoordinationType$2.PHOTOMETRIC_INTERPRETATION
|
|
749
755
|
],
|
|
750
756
|
[ViewType$2.SPATIAL_BETA]: [
|
|
751
757
|
CoordinationType$2.META_COORDINATION_SCOPES,
|
|
@@ -779,6 +785,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
779
785
|
CoordinationType$2.FEATURE_SELECTION,
|
|
780
786
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
781
787
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
788
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
782
789
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
783
790
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
784
791
|
CoordinationType$2.MOLECULE_HIGHLIGHT,
|
|
@@ -817,7 +824,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
817
824
|
CoordinationType$2.LEGEND_VISIBLE,
|
|
818
825
|
CoordinationType$2.SPATIAL_CHANNEL_LABELS_VISIBLE,
|
|
819
826
|
CoordinationType$2.SPATIAL_CHANNEL_LABELS_ORIENTATION,
|
|
820
|
-
CoordinationType$2.SPATIAL_CHANNEL_LABEL_SIZE
|
|
827
|
+
CoordinationType$2.SPATIAL_CHANNEL_LABEL_SIZE,
|
|
828
|
+
CoordinationType$2.PHOTOMETRIC_INTERPRETATION
|
|
821
829
|
],
|
|
822
830
|
[ViewType$2.HEATMAP]: [
|
|
823
831
|
CoordinationType$2.DATASET,
|
|
@@ -892,6 +900,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
892
900
|
CoordinationType$2.FEATURE_SELECTION,
|
|
893
901
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM,
|
|
894
902
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
903
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
895
904
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
896
905
|
CoordinationType$2.OBS_SET_FILTER,
|
|
897
906
|
CoordinationType$2.OBS_SET_HIGHLIGHT,
|
|
@@ -907,6 +916,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
907
916
|
CoordinationType$2.FEATURE_TYPE,
|
|
908
917
|
CoordinationType$2.FEATURE_VALUE_TYPE,
|
|
909
918
|
CoordinationType$2.FEATURE_SELECTION,
|
|
919
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
910
920
|
CoordinationType$2.ADDITIONAL_OBS_SETS,
|
|
911
921
|
CoordinationType$2.OBS_SET_COLOR,
|
|
912
922
|
CoordinationType$2.OBS_COLOR_ENCODING,
|
|
@@ -930,7 +940,8 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
930
940
|
CoordinationType$2.SPATIAL_ROTATION_Y,
|
|
931
941
|
CoordinationType$2.SPATIAL_ROTATION_Z,
|
|
932
942
|
CoordinationType$2.SPATIAL_ROTATION_ORBIT,
|
|
933
|
-
CoordinationType$2.SPATIAL_ORBIT_AXIS
|
|
943
|
+
CoordinationType$2.SPATIAL_ORBIT_AXIS,
|
|
944
|
+
CoordinationType$2.PHOTOMETRIC_INTERPRETATION
|
|
934
945
|
],
|
|
935
946
|
[ViewType$2.LAYER_CONTROLLER_BETA]: [
|
|
936
947
|
CoordinationType$2.META_COORDINATION_SCOPES,
|
|
@@ -985,6 +996,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
985
996
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
986
997
|
CoordinationType$2.FEATURE_VALUE_COLORMAP_RANGE,
|
|
987
998
|
CoordinationType$2.FEATURE_SELECTION,
|
|
999
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
988
1000
|
CoordinationType$2.TOOLTIPS_VISIBLE,
|
|
989
1001
|
CoordinationType$2.TOOLTIP_CROSSHAIRS_VISIBLE,
|
|
990
1002
|
CoordinationType$2.LEGEND_VISIBLE,
|
|
@@ -1025,6 +1037,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1025
1037
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
1026
1038
|
CoordinationType$2.FEATURE_VALUE_POSITIVITY_THRESHOLD,
|
|
1027
1039
|
CoordinationType$2.FEATURE_VALUE_COLORMAP,
|
|
1040
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
1028
1041
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
1029
1042
|
CoordinationType$2.OBS_SET_FILTER,
|
|
1030
1043
|
CoordinationType$2.OBS_SET_HIGHLIGHT,
|
|
@@ -1053,6 +1066,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1053
1066
|
CoordinationType$2.FEATURE_SELECTION,
|
|
1054
1067
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM,
|
|
1055
1068
|
CoordinationType$2.FEATURE_VALUE_TRANSFORM_COEFFICIENT,
|
|
1069
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
1056
1070
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
1057
1071
|
CoordinationType$2.OBS_SET_HIGHLIGHT,
|
|
1058
1072
|
CoordinationType$2.OBS_HIGHLIGHT,
|
|
@@ -1157,6 +1171,7 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1157
1171
|
CoordinationType$2.OBS_TYPE,
|
|
1158
1172
|
CoordinationType$2.SAMPLE_TYPE,
|
|
1159
1173
|
CoordinationType$2.FEATURE_SELECTION,
|
|
1174
|
+
CoordinationType$2.FEATURE_AGGREGATION_STRATEGY,
|
|
1160
1175
|
CoordinationType$2.SAMPLE_SET_SELECTION,
|
|
1161
1176
|
CoordinationType$2.SAMPLE_SET_FILTER,
|
|
1162
1177
|
CoordinationType$2.OBS_SET_SELECTION,
|
|
@@ -1197,10 +1212,10 @@ const COMPONENT_COORDINATION_TYPES = {
|
|
|
1197
1212
|
]
|
|
1198
1213
|
};
|
|
1199
1214
|
const note = "This file is autogenerated by .changeset/post-changelog.mjs.";
|
|
1200
|
-
const version$6 = "3.5.
|
|
1201
|
-
const date$5 = "2025-
|
|
1215
|
+
const version$6 = "3.5.12";
|
|
1216
|
+
const date$5 = "2025-05-14";
|
|
1202
1217
|
const branch = "changeset-release/main";
|
|
1203
|
-
const hash$1 = "
|
|
1218
|
+
const hash$1 = "a2f10645";
|
|
1204
1219
|
const META_VERSION = {
|
|
1205
1220
|
note,
|
|
1206
1221
|
version: version$6,
|
|
@@ -39148,6 +39163,7 @@ const annDataFeatureSetStats = z.object({
|
|
|
39148
39163
|
termColumn: z.string().optional(),
|
|
39149
39164
|
pValueColumn: z.string(),
|
|
39150
39165
|
pValueAdjusted: z.boolean().optional(),
|
|
39166
|
+
featureSetLibrary: z.string().optional().describe("Optionally, provide a feature set library name. By default, Reactome_2022."),
|
|
39151
39167
|
analysisType: z.string().optional().describe("Optionally, provide an analysis_type name. By default, pertpy_hypergeometric.")
|
|
39152
39168
|
});
|
|
39153
39169
|
const annDataObsSetStats = z.object({
|
|
@@ -39158,7 +39174,6 @@ const annDataObsSetStats = z.object({
|
|
|
39158
39174
|
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
39175
|
foldChangeTransformation: z.enum(["log2"]).optional(),
|
|
39160
39176
|
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
39177
|
analysisType: z.string().optional().describe("Optionally, provide an analysis_type name. By default, sccoda_df.")
|
|
39163
39178
|
});
|
|
39164
39179
|
const annDataObsLabels = annDataObs;
|
|
@@ -68453,7 +68468,7 @@ function getCellColors(params2) {
|
|
|
68453
68468
|
}
|
|
68454
68469
|
return /* @__PURE__ */ new Map();
|
|
68455
68470
|
}
|
|
68456
|
-
function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, obsIndex, mergedCellSets, cellSetSelection, arraysToStratify) {
|
|
68471
|
+
function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, obsIndex, mergedCellSets, cellSetSelection, arraysToStratify, featureAggregationStrategy) {
|
|
68457
68472
|
const result = new InternMap$1([], JSON.stringify);
|
|
68458
68473
|
const hasSampleSetSelection = Array.isArray(sampleSetSelection) && sampleSetSelection.length > 0;
|
|
68459
68474
|
const hasCellSetSelection = Array.isArray(cellSetSelection) && cellSetSelection.length > 0;
|
|
@@ -68463,9 +68478,13 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68463
68478
|
if (arrKeys.includes("obsIndex") || arrKeys.includes("i")) {
|
|
68464
68479
|
throw new Error('The keys "obsIndex" and "i" are reserved for internal use.');
|
|
68465
68480
|
}
|
|
68466
|
-
if (Object.
|
|
68467
|
-
|
|
68468
|
-
|
|
68481
|
+
if (Object.entries(arraysToStratify).some(([arrKey, arr]) => {
|
|
68482
|
+
if (arrKey === "featureValue") {
|
|
68483
|
+
return arr.some((a2) => a2.length !== obsIndex.length);
|
|
68484
|
+
}
|
|
68485
|
+
return arr.length !== obsIndex.length;
|
|
68486
|
+
}))
|
|
68487
|
+
;
|
|
68469
68488
|
const sampleSetInfo = sampleSets && sampleSetSelection ? treeToObsIdsBySetNames(sampleSets, sampleSetSelection) : null;
|
|
68470
68489
|
const cellSetInfo = mergedCellSets && cellSetSelection ? treeToObsIdsBySetNames(mergedCellSets, cellSetSelection) : null;
|
|
68471
68490
|
cellSetKeys.forEach((cellSetKey) => {
|
|
@@ -68494,6 +68513,7 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68494
68513
|
});
|
|
68495
68514
|
const sampleIdToSetMap = sampleSets && sampleSetSelection ? treeToSelectedSetMap(sampleSets, sampleSetSelection) : null;
|
|
68496
68515
|
const cellIdToSetMap = mergedCellSets && cellSetSelection ? treeToSelectedSetMap(mergedCellSets, cellSetSelection) : null;
|
|
68516
|
+
let cellCount = 0;
|
|
68497
68517
|
for (let i2 = 0; i2 < obsIndex.length; i2 += 1) {
|
|
68498
68518
|
const obsId = obsIndex[i2];
|
|
68499
68519
|
const cellSet = cellIdToSetMap?.get(obsId) || null;
|
|
@@ -68504,10 +68524,28 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68504
68524
|
}
|
|
68505
68525
|
const insertionIndex = result.get(cellSet).get(sampleSet).get("i");
|
|
68506
68526
|
arrKeys.forEach((arrKey) => {
|
|
68507
|
-
|
|
68527
|
+
let value2;
|
|
68528
|
+
if (arrKey === "featureValue") {
|
|
68529
|
+
if (featureAggregationStrategy === "first") {
|
|
68530
|
+
value2 = arraysToStratify[arrKey][0][i2];
|
|
68531
|
+
} else if (featureAggregationStrategy === "last") {
|
|
68532
|
+
value2 = arraysToStratify[arrKey].at(-1)[i2];
|
|
68533
|
+
} else if (typeof featureAggregationStrategy === "number") {
|
|
68534
|
+
const j = featureAggregationStrategy;
|
|
68535
|
+
value2 = arraysToStratify[arrKey][j][i2];
|
|
68536
|
+
} else if (featureAggregationStrategy === "sum" || featureAggregationStrategy === "mean") {
|
|
68537
|
+
value2 = arraysToStratify[arrKey].reduce((a2, h2) => a2 + h2[i2], 0);
|
|
68538
|
+
if (featureAggregationStrategy === "mean") {
|
|
68539
|
+
value2 /= arraysToStratify[arrKey].length;
|
|
68540
|
+
}
|
|
68541
|
+
}
|
|
68542
|
+
} else {
|
|
68543
|
+
value2 = arraysToStratify[arrKey][i2];
|
|
68544
|
+
}
|
|
68508
68545
|
result.get(cellSet).get(sampleSet).get(arrKey)[insertionIndex] = value2;
|
|
68509
68546
|
});
|
|
68510
68547
|
result.get(cellSet).get(sampleSet).set("i", insertionIndex + 1);
|
|
68548
|
+
cellCount += 1;
|
|
68511
68549
|
}
|
|
68512
68550
|
cellSetKeys.forEach((cellSetKey) => {
|
|
68513
68551
|
sampleSetKeys.forEach((sampleSetKey) => {
|
|
@@ -68518,7 +68556,7 @@ function stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetS
|
|
|
68518
68556
|
result.get(cellSetKey).get(sampleSetKey).delete("i");
|
|
68519
68557
|
});
|
|
68520
68558
|
});
|
|
68521
|
-
return result;
|
|
68559
|
+
return [result, cellCount];
|
|
68522
68560
|
}
|
|
68523
68561
|
function stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, mergedCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient) {
|
|
68524
68562
|
const result = new InternMap$1([], JSON.stringify);
|
|
@@ -68561,12 +68599,38 @@ function stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, exp
|
|
|
68561
68599
|
}
|
|
68562
68600
|
return [null, null];
|
|
68563
68601
|
}
|
|
68564
|
-
function aggregateStratifiedExpressionData(stratifiedResult, geneSelection) {
|
|
68602
|
+
function aggregateStratifiedExpressionData(stratifiedResult, geneSelection, featureAggregationStrategy) {
|
|
68565
68603
|
const result = new InternMap$1([], JSON.stringify);
|
|
68566
68604
|
Array.from(stratifiedResult.entries()).forEach(([cellSetKey, firstLevelInternMap]) => {
|
|
68567
68605
|
result.set(cellSetKey, new InternMap$1([], JSON.stringify));
|
|
68568
68606
|
Array.from(firstLevelInternMap.entries()).forEach(([sampleSetKey, secondLevelInternMap]) => {
|
|
68569
|
-
|
|
68607
|
+
let values3;
|
|
68608
|
+
if (featureAggregationStrategy === "first") {
|
|
68609
|
+
values3 = secondLevelInternMap.get(geneSelection[0]);
|
|
68610
|
+
} else if (featureAggregationStrategy === "last") {
|
|
68611
|
+
values3 = secondLevelInternMap.get(geneSelection.at(-1));
|
|
68612
|
+
} else if (typeof featureAggregationStrategy === "number") {
|
|
68613
|
+
const i2 = featureAggregationStrategy;
|
|
68614
|
+
if (i2 >= 0 && i2 < geneSelection.length) {
|
|
68615
|
+
values3 = secondLevelInternMap.get(geneSelection[i2]);
|
|
68616
|
+
} else {
|
|
68617
|
+
throw new Error("Feature index used for featureAggregationStrategy is invalid.");
|
|
68618
|
+
}
|
|
68619
|
+
} else if (featureAggregationStrategy === "sum" || featureAggregationStrategy === "mean") {
|
|
68620
|
+
const subarrays = geneSelection.map((geneId) => secondLevelInternMap.get(geneId));
|
|
68621
|
+
values3 = subarrays.reduce((acc, curr) => acc.map((val, idx) => val + curr[idx]));
|
|
68622
|
+
if (featureAggregationStrategy === "mean") {
|
|
68623
|
+
const N2 = geneSelection.length;
|
|
68624
|
+
values3 = values3.map((val) => val / N2);
|
|
68625
|
+
}
|
|
68626
|
+
} else if (featureAggregationStrategy === "difference") {
|
|
68627
|
+
if (geneSelection.length === 2) {
|
|
68628
|
+
const subarrays = geneSelection.map((geneId) => secondLevelInternMap.get(geneId));
|
|
68629
|
+
values3 = subarrays.reduce((acc, curr) => acc.map((val, idx) => val - curr[idx]));
|
|
68630
|
+
} else {
|
|
68631
|
+
throw new Error("Expected exactly two selected features when featureAggregationStrategy is difference.");
|
|
68632
|
+
}
|
|
68633
|
+
}
|
|
68570
68634
|
result.get(cellSetKey).set(sampleSetKey, values3);
|
|
68571
68635
|
});
|
|
68572
68636
|
});
|
|
@@ -68855,10 +68919,10 @@ var _objectKeysInternal = function(object2, names) {
|
|
|
68855
68919
|
return result;
|
|
68856
68920
|
};
|
|
68857
68921
|
var _enumBugKeys = "constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",");
|
|
68858
|
-
var $keys$
|
|
68922
|
+
var $keys$2 = _objectKeysInternal;
|
|
68859
68923
|
var enumBugKeys$1 = _enumBugKeys;
|
|
68860
68924
|
var _objectKeys$1 = Object.keys || function keys(O) {
|
|
68861
|
-
return $keys$
|
|
68925
|
+
return $keys$2(O, enumBugKeys$1);
|
|
68862
68926
|
};
|
|
68863
68927
|
var _objectGops = {};
|
|
68864
68928
|
_objectGops.f = Object.getOwnPropertySymbols;
|
|
@@ -69309,20 +69373,13 @@ var _isArray = Array.isArray || function isArray2(arg) {
|
|
|
69309
69373
|
};
|
|
69310
69374
|
var _objectGopnExt = {};
|
|
69311
69375
|
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
|
-
}
|
|
69376
|
+
var $keys$1 = _objectKeysInternal;
|
|
69377
|
+
var hiddenKeys = _enumBugKeys.concat("length", "prototype");
|
|
69378
|
+
_objectGopn.f = Object.getOwnPropertyNames || function getOwnPropertyNames2(O) {
|
|
69379
|
+
return $keys$1(O, hiddenKeys);
|
|
69380
|
+
};
|
|
69324
69381
|
var toIObject$2 = _toIobject;
|
|
69325
|
-
var gOPN$1 =
|
|
69382
|
+
var gOPN$1 = _objectGopn.f;
|
|
69326
69383
|
var toString$4 = {}.toString;
|
|
69327
69384
|
var windowNames = typeof window == "object" && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
|
|
69328
69385
|
var getWindowNames = function(it2) {
|
|
@@ -69332,7 +69389,7 @@ var getWindowNames = function(it2) {
|
|
|
69332
69389
|
return windowNames.slice();
|
|
69333
69390
|
}
|
|
69334
69391
|
};
|
|
69335
|
-
_objectGopnExt.f = function
|
|
69392
|
+
_objectGopnExt.f = function getOwnPropertyNames3(it2) {
|
|
69336
69393
|
return windowNames && toString$4.call(it2) == "[object Window]" ? getWindowNames(it2) : gOPN$1(toIObject$2(it2));
|
|
69337
69394
|
};
|
|
69338
69395
|
var _objectGopd = {};
|
|
@@ -69471,7 +69528,7 @@ var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor3(it2, key2) {
|
|
|
69471
69528
|
D2.enumerable = true;
|
|
69472
69529
|
return D2;
|
|
69473
69530
|
};
|
|
69474
|
-
var $getOwnPropertyNames = function
|
|
69531
|
+
var $getOwnPropertyNames = function getOwnPropertyNames4(it2) {
|
|
69475
69532
|
var names = gOPN(toIObject(it2));
|
|
69476
69533
|
var result = [];
|
|
69477
69534
|
var i2 = 0;
|
|
@@ -69515,7 +69572,7 @@ if (!USE_NATIVE) {
|
|
|
69515
69572
|
});
|
|
69516
69573
|
$GOPD.f = $getOwnPropertyDescriptor;
|
|
69517
69574
|
$DP.f = $defineProperty;
|
|
69518
|
-
|
|
69575
|
+
_objectGopn.f = gOPNExt.f = $getOwnPropertyNames;
|
|
69519
69576
|
_objectPie.f = $propertyIsEnumerable;
|
|
69520
69577
|
$GOPS.f = $getOwnPropertySymbols;
|
|
69521
69578
|
if (DESCRIPTORS && !_library) {
|
|
@@ -189124,8 +189181,15 @@ class SelectionLayer extends CompositeLayer {
|
|
|
189124
189181
|
if (!nodePolygonContainsSelectedPolygon && !nodePolygonWithinSelectedPolygon && !nodePolygonOverlapsSelectedPolgyon) {
|
|
189125
189182
|
return true;
|
|
189126
189183
|
}
|
|
189127
|
-
if (node2.data
|
|
189128
|
-
|
|
189184
|
+
if (node2.data) {
|
|
189185
|
+
let current2 = node2;
|
|
189186
|
+
while (current2) {
|
|
189187
|
+
const pointCoords = [].slice.call(getObsCoords(current2.data));
|
|
189188
|
+
if (booleanPointInPolygon$1(point$a(pointCoords), selectedPolygon)) {
|
|
189189
|
+
pickingInfos.push(current2.data);
|
|
189190
|
+
}
|
|
189191
|
+
current2 = current2.next;
|
|
189192
|
+
}
|
|
189129
189193
|
}
|
|
189130
189194
|
return false;
|
|
189131
189195
|
});
|
|
@@ -191018,16 +191082,16 @@ async function getDecoder(fileDirectory) {
|
|
|
191018
191082
|
const Decoder = await importFn();
|
|
191019
191083
|
return new Decoder(fileDirectory);
|
|
191020
191084
|
}
|
|
191021
|
-
addDecoder([void 0, 1], () => import("./raw-
|
|
191022
|
-
addDecoder(5, () => import("./lzw-
|
|
191085
|
+
addDecoder([void 0, 1], () => import("./raw-085aef44.js").then((m2) => m2.default));
|
|
191086
|
+
addDecoder(5, () => import("./lzw-c11a1966.js").then((m2) => m2.default));
|
|
191023
191087
|
addDecoder(6, () => {
|
|
191024
191088
|
throw new Error("old style JPEG compression is not supported.");
|
|
191025
191089
|
});
|
|
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-
|
|
191090
|
+
addDecoder(7, () => import("./jpeg-2c38fd60.js").then((m2) => m2.default));
|
|
191091
|
+
addDecoder([8, 32946], () => import("./deflate-b57ef85f.js").then((m2) => m2.default));
|
|
191092
|
+
addDecoder(32773, () => import("./packbits-05dadc65.js").then((m2) => m2.default));
|
|
191093
|
+
addDecoder(34887, () => import("./lerc-bfc1a927.js").then((m2) => m2.default));
|
|
191094
|
+
addDecoder(50001, () => import("./webimage-184e90fa.js").then((m2) => m2.default));
|
|
191031
191095
|
function copyNewSize(array2, width2, height2, samplesPerPixel = 1) {
|
|
191032
191096
|
return new (Object.getPrototypeOf(array2)).constructor(width2 * height2 * samplesPerPixel);
|
|
191033
191097
|
}
|
|
@@ -205433,7 +205497,7 @@ const getPosition = (object2, { index: index2, data: data2, target: target2 }) =
|
|
|
205433
205497
|
target2[2] = POINT_LAYER_Z_INDEX;
|
|
205434
205498
|
return target2;
|
|
205435
205499
|
};
|
|
205436
|
-
const contourGetWeight = (object2, { index: index2, data: data2 }) => data2.src.featureValues[index2];
|
|
205500
|
+
const contourGetWeight = (object2, { index: index2, data: data2 }) => data2.src.featureValues?.[index2];
|
|
205437
205501
|
const contourGetPosition = (object2, { index: index2, data: data2, target: target2 }) => {
|
|
205438
205502
|
target2[0] = data2.src.embeddingX[index2];
|
|
205439
205503
|
target2[1] = -data2.src.embeddingY[index2];
|
|
@@ -205726,6 +205790,16 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
205726
205790
|
const { obsEmbeddingIndex, obsEmbedding } = this.props;
|
|
205727
205791
|
super.viewInfoDidUpdate(obsEmbeddingIndex, obsEmbedding, makeFlippedGetObsCoords);
|
|
205728
205792
|
}
|
|
205793
|
+
componentWillUnmount() {
|
|
205794
|
+
delete this.cellsQuadTree;
|
|
205795
|
+
delete this.cellsLayer;
|
|
205796
|
+
delete this.cellsData;
|
|
205797
|
+
delete this.stratifiedData;
|
|
205798
|
+
delete this.cellSetsForceSimulation;
|
|
205799
|
+
delete this.cellSetsLabelPrevZoom;
|
|
205800
|
+
delete this.cellSetsLayers;
|
|
205801
|
+
delete this.contourLayers;
|
|
205802
|
+
}
|
|
205729
205803
|
/**
|
|
205730
205804
|
* Here, asynchronously check whether props have
|
|
205731
205805
|
* updated which require re-computing memoized variables,
|
|
@@ -205806,8 +205880,9 @@ class Scatterplot extends AbstractSpatialOrScatterplot {
|
|
|
205806
205880
|
}
|
|
205807
205881
|
const ScatterplotWrapper = forwardRef((props, deckRef) => jsxRuntimeExports.jsx(Scatterplot, { ...props, deckRef }));
|
|
205808
205882
|
ScatterplotWrapper.displayName = "ScatterplotWrapper";
|
|
205883
|
+
const FEATURE_AGGREGATION_STRATEGIES$1 = ["first", "last", "sum", "mean"];
|
|
205809
205884
|
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;
|
|
205885
|
+
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
205886
|
const scatterplotOptionsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
205812
205887
|
const observationsLabelNice = capitalize$2(observationsLabel);
|
|
205813
205888
|
const classes = useStyles$u();
|
|
@@ -205858,6 +205933,9 @@ function ScatterplotOptions(props) {
|
|
|
205858
205933
|
setContourPercentiles(values3);
|
|
205859
205934
|
}
|
|
205860
205935
|
const handlePercentilesChangeDebounced = useCallback(debounce$3(handlePercentilesChange, 5, { trailing: true }), [handlePercentilesChange]);
|
|
205936
|
+
function handleFeatureAggregationStrategyChange(event2) {
|
|
205937
|
+
setFeatureAggregationStrategy(event2.target.value);
|
|
205938
|
+
}
|
|
205861
205939
|
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
205940
|
"aria-label": "Show or hide set labels",
|
|
205863
205941
|
id: `scatterplot-set-labels-visible-${scatterplotOptionsId}`
|
|
@@ -205899,7 +205977,9 @@ function ScatterplotOptions(props) {
|
|
|
205899
205977
|
id: `scatterplot-contours-filled-${scatterplotOptionsId}`
|
|
205900
205978
|
} }) })] }), 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
205979
|
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 }) })] })
|
|
205980
|
+
}, 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: {
|
|
205981
|
+
id: `feature-aggregation-strategy-${scatterplotOptionsId}`
|
|
205982
|
+
}, children: FEATURE_AGGREGATION_STRATEGIES$1.map((opt) => jsxRuntimeExports.jsx("option", { value: opt, children: capitalize$2(opt) }, opt)) }) })] }) : null] });
|
|
205903
205983
|
}
|
|
205904
205984
|
const styles$1 = makeStyles((theme) => ({
|
|
205905
205985
|
tooltipAnchor: {
|
|
@@ -210366,8 +210446,50 @@ const titleHeight = 10;
|
|
|
210366
210446
|
const rectHeight = 8;
|
|
210367
210447
|
const rectMarginY = 2;
|
|
210368
210448
|
const rectMarginX = 2;
|
|
210449
|
+
function combineExtents(extents, featureAggregationStrategy) {
|
|
210450
|
+
if (Array.isArray(extents)) {
|
|
210451
|
+
if (featureAggregationStrategy === "first") {
|
|
210452
|
+
return extents[0];
|
|
210453
|
+
}
|
|
210454
|
+
if (featureAggregationStrategy === "last") {
|
|
210455
|
+
return extents.at(-1);
|
|
210456
|
+
}
|
|
210457
|
+
if (typeof featureAggregationStrategy === "number") {
|
|
210458
|
+
const i2 = featureAggregationStrategy;
|
|
210459
|
+
return extents[i2];
|
|
210460
|
+
}
|
|
210461
|
+
if (featureAggregationStrategy === "sum") {
|
|
210462
|
+
return extents.reduce((a2, h2) => [a2[0] + h2[0], a2[1] + h2[1]]);
|
|
210463
|
+
}
|
|
210464
|
+
if (featureAggregationStrategy === "mean") {
|
|
210465
|
+
return extents.reduce((a2, h2) => [a2[0] + h2[0], a2[1] + h2[1]]).map((v2) => v2 / extents.length);
|
|
210466
|
+
}
|
|
210467
|
+
}
|
|
210468
|
+
return null;
|
|
210469
|
+
}
|
|
210470
|
+
function combineMissings(missings, featureAggregationStrategy) {
|
|
210471
|
+
if (Array.isArray(missings)) {
|
|
210472
|
+
if (featureAggregationStrategy === "first") {
|
|
210473
|
+
return missings[0];
|
|
210474
|
+
}
|
|
210475
|
+
if (featureAggregationStrategy === "last") {
|
|
210476
|
+
return missings.at(-1);
|
|
210477
|
+
}
|
|
210478
|
+
if (typeof featureAggregationStrategy === "number") {
|
|
210479
|
+
const i2 = featureAggregationStrategy;
|
|
210480
|
+
return missings[i2];
|
|
210481
|
+
}
|
|
210482
|
+
if (featureAggregationStrategy === "sum") {
|
|
210483
|
+
return missings.reduce((a2, h2) => a2 + h2, 0);
|
|
210484
|
+
}
|
|
210485
|
+
if (featureAggregationStrategy === "mean") {
|
|
210486
|
+
return missings.reduce((a2, h2) => a2 + h2 / missings.length, 0);
|
|
210487
|
+
}
|
|
210488
|
+
}
|
|
210489
|
+
return null;
|
|
210490
|
+
}
|
|
210369
210491
|
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;
|
|
210492
|
+
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
210493
|
const svgRef = useRef();
|
|
210372
210494
|
const classes = useStyles$p();
|
|
210373
210495
|
const isDarkTheme = theme === "dark";
|
|
@@ -210376,9 +210498,9 @@ function Legend(props) {
|
|
|
210376
210498
|
const layerColor = Array.isArray(spatialLayerColor) && spatialLayerColor.length === 3 ? spatialLayerColor : getDefaultColor(theme);
|
|
210377
210499
|
const channelColor = Array.isArray(spatialChannelColor) && spatialChannelColor.length === 3 ? spatialChannelColor : getDefaultColor(theme);
|
|
210378
210500
|
const staticColor = obsColorEncoding === "spatialChannelColor" ? channelColor : layerColor;
|
|
210379
|
-
const visible = visibleProp && (!considerSelections || obsColorEncoding === "geneSelection" && featureSelection && Array.isArray(featureSelection) && featureSelection.length
|
|
210501
|
+
const visible = visibleProp && (!considerSelections || obsColorEncoding === "geneSelection" && featureSelection && Array.isArray(featureSelection) && featureSelection.length >= 1 || isSetColor && obsSetSelection?.length > 0 && obsSetColor?.length > 0 || isStaticColor);
|
|
210380
210502
|
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);
|
|
210503
|
+
const dynamicHeight = isSetColor && obsSetSelection ? levelZeroNames.length * titleHeight + obsSetSelection?.length * (rectHeight + rectMarginY) : height2 + (!pointsVisible && contoursVisible ? 25 : 0);
|
|
210382
210504
|
useEffect(() => {
|
|
210383
210505
|
const domElement = svgRef.current;
|
|
210384
210506
|
const foregroundColor = highContrast ? "black" : isDarkTheme ? "white" : "black";
|
|
@@ -210387,7 +210509,7 @@ function Legend(props) {
|
|
|
210387
210509
|
svg2.attr("width", width2).attr("height", dynamicHeight);
|
|
210388
210510
|
const g2 = svg2.append("g").attr("width", width2).attr("height", dynamicHeight);
|
|
210389
210511
|
if (!considerSelections || obsColorEncoding === "geneSelection") {
|
|
210390
|
-
const [xMin, xMax] = extent2 || [0, 1];
|
|
210512
|
+
const [xMin, xMax] = combineExtents(extent2, featureAggregationStrategy) || [0, 1];
|
|
210391
210513
|
if (featureValueColormap && pointsVisible) {
|
|
210392
210514
|
const xlinkHref = getXlinkHref(featureValueColormap);
|
|
210393
210515
|
g2.append("image").attr("x", 0).attr("y", titleHeight).attr("width", width2).attr("height", rectHeight).attr("preserveAspectRatio", "none").attr("href", xlinkHref);
|
|
@@ -210450,8 +210572,19 @@ function Legend(props) {
|
|
|
210450
210572
|
});
|
|
210451
210573
|
});
|
|
210452
210574
|
}
|
|
210453
|
-
const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? featureLabelsMap?.get(
|
|
210454
|
-
|
|
210575
|
+
const featureSelectionLabelRaw = featureSelection && featureSelection.length >= 1 && !isStaticColor ? featureSelection.map((geneName) => featureLabelsMap?.get(geneName) || featureLabelsMap?.get(cleanFeatureId(geneName)) || geneName) : null;
|
|
210576
|
+
let featureSelectionLabelRawStr = "";
|
|
210577
|
+
if (featureAggregationStrategy === "first") {
|
|
210578
|
+
featureSelectionLabelRawStr = featureSelectionLabelRaw?.[0];
|
|
210579
|
+
} else if (featureAggregationStrategy === "last") {
|
|
210580
|
+
featureSelectionLabelRawStr = featureSelectionLabelRaw?.at(-1);
|
|
210581
|
+
} else if (featureAggregationStrategy === "sum") {
|
|
210582
|
+
featureSelectionLabelRawStr = "Sum of features";
|
|
210583
|
+
} else if (featureAggregationStrategy === "mean") {
|
|
210584
|
+
featureSelectionLabelRawStr = "Mean of features";
|
|
210585
|
+
}
|
|
210586
|
+
const combinedMissing = combineMissings(missing, featureAggregationStrategy);
|
|
210587
|
+
const featureSelectionLabel = combinedMissing ? `${featureSelectionLabelRawStr} (${Math.round(combinedMissing * 100)}% NaN)` : featureSelectionLabelRawStr;
|
|
210455
210588
|
const obsLabel = capitalize$2(obsType);
|
|
210456
210589
|
const featureLabel = considerSelections ? featureSelectionLabel || capitalize$2(featureValueType) : capitalize$2(featureValueType);
|
|
210457
210590
|
const mainLabel = showObsLabel ? obsLabel : featureLabel;
|
|
@@ -210485,7 +210618,8 @@ function Legend(props) {
|
|
|
210485
210618
|
contourThresholds,
|
|
210486
210619
|
contoursFilled,
|
|
210487
210620
|
contoursVisible,
|
|
210488
|
-
pointsVisible
|
|
210621
|
+
pointsVisible,
|
|
210622
|
+
featureAggregationStrategy
|
|
210489
210623
|
]);
|
|
210490
210624
|
return jsxRuntimeExports.jsx("div", { className: clsx(classes.legend, {
|
|
210491
210625
|
[classes.legendRelative]: positionRelative,
|
|
@@ -210643,6 +210777,7 @@ function ChannelNamesLegend(props) {
|
|
|
210643
210777
|
}) : null });
|
|
210644
210778
|
}
|
|
210645
210779
|
const DEFAULT_CONTOUR_PERCENTILES = [0.09, 0.9, 0.99];
|
|
210780
|
+
const DEFAULT_FEATURE_AGGREGATION_STRATEGY$1 = "first";
|
|
210646
210781
|
function EmbeddingScatterplotSubscriber(props) {
|
|
210647
210782
|
const {
|
|
210648
210783
|
uuid,
|
|
@@ -210662,10 +210797,11 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210662
210797
|
const loaders = useLoaders();
|
|
210663
210798
|
const setComponentHover = useSetComponentHover();
|
|
210664
210799
|
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);
|
|
210800
|
+
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
210801
|
const { embeddingZoom: initialZoom, embeddingTargetX: initialTargetX, embeddingTargetY: initialTargetY } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SCATTERPLOT], coordinationScopes);
|
|
210667
210802
|
const observationsLabel = observationsLabelOverride || obsType;
|
|
210668
210803
|
const sampleSetSelection = sampleSetSelectionFromProps || sampleSetSelectionFromCoordination;
|
|
210804
|
+
const featureAggregationStrategyToUse = featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY$1;
|
|
210669
210805
|
const [width2, height2, deckRef] = useDeckCanvasSize();
|
|
210670
210806
|
const title2 = titleOverride || `Scatterplot (${mapping})`;
|
|
210671
210807
|
const [obsLabelsTypes, obsLabelsData] = useMultiObsLabels(coordinationScopes, obsType, loaders, dataset);
|
|
@@ -210764,7 +210900,7 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210764
210900
|
return [null, null, null, null, null];
|
|
210765
210901
|
}, [obsEmbedding]);
|
|
210766
210902
|
useEffect(() => {
|
|
210767
|
-
if (xRange && yRange) {
|
|
210903
|
+
if (xRange && yRange && width2 && height2) {
|
|
210768
210904
|
const pointSizeDevicePixels = getPointSizeDevicePixels(window.devicePixelRatio, zoom2, xRange, yRange, width2, height2);
|
|
210769
210905
|
setDynamicCellRadius(pointSizeDevicePixels);
|
|
210770
210906
|
const nextCellOpacityScale = getPointOpacity(zoom2, xRange, yRange, width2, height2, numCells, averageFillDensity);
|
|
@@ -210833,6 +210969,9 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210833
210969
|
originalViewState.target[1]
|
|
210834
210970
|
];
|
|
210835
210971
|
const scaleFactor = 2 ** originalViewState.zoom;
|
|
210972
|
+
if (!(typeof scaleFactor === "number" && typeof center2[0] === "number" && typeof center2[1] === "number") || Number.isNaN(scaleFactor)) {
|
|
210973
|
+
return null;
|
|
210974
|
+
}
|
|
210836
210975
|
const radius2 = Math.min(width2, height2) / 2 / scaleFactor;
|
|
210837
210976
|
const numPoints = 96;
|
|
210838
210977
|
const options = { steps: numPoints, units: "degrees" };
|
|
@@ -210877,17 +211016,16 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210877
211016
|
}
|
|
210878
211017
|
return null;
|
|
210879
211018
|
}, [sampleEdges]);
|
|
210880
|
-
const stratifiedData = useMemo(() => {
|
|
211019
|
+
const [stratifiedData, stratifiedDataCount] = useMemo(() => {
|
|
210881
211020
|
if (alignedEmbeddingData?.data) {
|
|
210882
|
-
const result = stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, alignedEmbeddingIndex, mergedCellSets, cellSetSelection, {
|
|
211021
|
+
const [result, cellCountResult] = stratifyArrays(sampleEdges, sampleIdToObsIdsMap, sampleSets, sampleSetSelection, alignedEmbeddingIndex, mergedCellSets, cellSetSelection, {
|
|
210883
211022
|
obsEmbeddingX: alignedEmbeddingData.data[0],
|
|
210884
211023
|
obsEmbeddingY: alignedEmbeddingData.data[1],
|
|
210885
|
-
|
|
210886
|
-
|
|
210887
|
-
|
|
210888
|
-
return result;
|
|
211024
|
+
...uint8ExpressionData?.[0] ? { featureValue: uint8ExpressionData } : {}
|
|
211025
|
+
}, featureAggregationStrategyToUse);
|
|
211026
|
+
return [result, cellCountResult];
|
|
210889
211027
|
}
|
|
210890
|
-
return null;
|
|
211028
|
+
return [null, null];
|
|
210891
211029
|
}, [
|
|
210892
211030
|
alignedEmbeddingIndex,
|
|
210893
211031
|
alignedEmbeddingData,
|
|
@@ -210897,7 +211035,8 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210897
211035
|
sampleSets,
|
|
210898
211036
|
sampleSetSelection,
|
|
210899
211037
|
cellSetSelection,
|
|
210900
|
-
mergedCellSets
|
|
211038
|
+
mergedCellSets,
|
|
211039
|
+
featureAggregationStrategyToUse
|
|
210901
211040
|
]);
|
|
210902
211041
|
const setViewState = ({ zoom: newZoom, target: target2 }) => {
|
|
210903
211042
|
setZoom(newZoom);
|
|
@@ -210905,7 +211044,8 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210905
211044
|
setTargetY(target2[1]);
|
|
210906
211045
|
setTargetZ(target2[2] || 0);
|
|
210907
211046
|
};
|
|
210908
|
-
|
|
211047
|
+
const cellCountToUse = embeddingPointsVisible ? cellsCount : stratifiedDataCount ?? cellsCount;
|
|
211048
|
+
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
211049
|
ref: deckRef,
|
|
210910
211050
|
uuid,
|
|
210911
211051
|
theme,
|
|
@@ -210951,7 +211091,7 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210951
211091
|
embeddingContoursVisible,
|
|
210952
211092
|
circleInfo,
|
|
210953
211093
|
featureSelection: geneSelection
|
|
210954
|
-
}), tooltipsVisible && jsxRuntimeExports.jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo: getObsInfo2, featureType, featureLabelsMap }), jsxRuntimeExports.jsx(Legend, {
|
|
211094
|
+
}), tooltipsVisible && width2 && height2 ? jsxRuntimeExports.jsx(ScatterplotTooltipSubscriber, { parentUuid: uuid, obsHighlight: cellHighlight, width: width2, height: height2, getObsInfo: getObsInfo2, featureType, featureLabelsMap }) : null, jsxRuntimeExports.jsx(Legend, {
|
|
210955
211095
|
visible: true,
|
|
210956
211096
|
theme,
|
|
210957
211097
|
featureType,
|
|
@@ -210962,14 +211102,15 @@ function EmbeddingScatterplotSubscriber(props) {
|
|
|
210962
211102
|
featureValueColormap: geneExpressionColormap,
|
|
210963
211103
|
featureValueColormapRange: geneExpressionColormapRange,
|
|
210964
211104
|
obsSetSelection: cellSetSelection,
|
|
210965
|
-
extent: expressionExtents
|
|
210966
|
-
missing: expressionMissing
|
|
211105
|
+
extent: expressionExtents,
|
|
211106
|
+
missing: expressionMissing,
|
|
210967
211107
|
// Contour percentile legend
|
|
210968
211108
|
pointsVisible: embeddingPointsVisible,
|
|
210969
211109
|
contoursVisible: embeddingContoursVisible,
|
|
210970
211110
|
contoursFilled: embeddingContoursFilled,
|
|
210971
211111
|
contourPercentiles: contourPercentiles || DEFAULT_CONTOUR_PERCENTILES,
|
|
210972
|
-
contourThresholds
|
|
211112
|
+
contourThresholds,
|
|
211113
|
+
featureAggregationStrategy: featureAggregationStrategyToUse
|
|
210973
211114
|
})] });
|
|
210974
211115
|
}
|
|
210975
211116
|
function DualEmbeddingScatterplotSubscriber(props) {
|
|
@@ -226400,9 +226541,6 @@ function physicalSizeToMatrix(xSize, ySize, zSize, xUnit, yUnit, zUnit) {
|
|
|
226400
226541
|
sizes.push(unit$1(`${zSize} ${zUnit}`.replace("µ", "u")));
|
|
226401
226542
|
}
|
|
226402
226543
|
const scale2 = sizes.map((i2) => divide(i2, unit$1("1 um")));
|
|
226403
|
-
if (!sizes[0].equals(sizes[1])) {
|
|
226404
|
-
scale2[1] = divide(sizes[1], sizes[0]);
|
|
226405
|
-
}
|
|
226406
226544
|
if (!scale2[2]) {
|
|
226407
226545
|
scale2[2] = 1;
|
|
226408
226546
|
}
|
|
@@ -229885,6 +230023,7 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
229885
230023
|
return null;
|
|
229886
230024
|
}
|
|
229887
230025
|
createRasterLayer(rawLayerDef, loader2, i2) {
|
|
230026
|
+
const { photometricInterpretation } = this.props;
|
|
229888
230027
|
const layerDef = {
|
|
229889
230028
|
...rawLayerDef,
|
|
229890
230029
|
channels: rawLayerDef.channels.filter((channel) => channel.selection && channel.color && channel.slider)
|
|
@@ -229963,6 +230102,23 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
229963
230102
|
if (isInterleaved$1((Array.isArray(data2) ? data2[0] : data2).shape)) {
|
|
229964
230103
|
rgbInterleavedProps.visible = layerDef.visible;
|
|
229965
230104
|
}
|
|
230105
|
+
const rgbProps = photometricInterpretation === "RGB" ? {
|
|
230106
|
+
colors: [
|
|
230107
|
+
[255, 0, 0],
|
|
230108
|
+
[0, 255, 0],
|
|
230109
|
+
[0, 0, 255]
|
|
230110
|
+
],
|
|
230111
|
+
contrastLimits: [
|
|
230112
|
+
[0, 255],
|
|
230113
|
+
[0, 255],
|
|
230114
|
+
[0, 255]
|
|
230115
|
+
],
|
|
230116
|
+
channelsVisible: [
|
|
230117
|
+
true,
|
|
230118
|
+
true,
|
|
230119
|
+
true
|
|
230120
|
+
]
|
|
230121
|
+
} : {};
|
|
229966
230122
|
return new Layer2({
|
|
229967
230123
|
loader: layerLoader,
|
|
229968
230124
|
id: `${layerDef.use3d ? "volume" : "image"}-layer-${layerDef.index}-${i2}`,
|
|
@@ -229984,7 +230140,8 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
229984
230140
|
onViewportLoad: layerProps.callback,
|
|
229985
230141
|
excludeBackground: layerProps.excludeBackground,
|
|
229986
230142
|
extensions,
|
|
229987
|
-
...rgbInterleavedProps
|
|
230143
|
+
...rgbInterleavedProps,
|
|
230144
|
+
...rgbProps
|
|
229988
230145
|
});
|
|
229989
230146
|
}
|
|
229990
230147
|
use3d() {
|
|
@@ -230202,7 +230359,8 @@ let Spatial$1 = class Spatial extends AbstractSpatialOrScatterplot {
|
|
|
230202
230359
|
"geneExpressionColormapRange",
|
|
230203
230360
|
"expressionData",
|
|
230204
230361
|
"imageLayerCallbacks",
|
|
230205
|
-
"geneExpressionColormap"
|
|
230362
|
+
"geneExpressionColormap",
|
|
230363
|
+
"photometricInterpretation"
|
|
230206
230364
|
].some(shallowDiff)) {
|
|
230207
230365
|
this.onUpdateImages();
|
|
230208
230366
|
forceUpdate = true;
|
|
@@ -230301,7 +230459,7 @@ function SpatialSubscriber$1(props) {
|
|
|
230301
230459
|
const loaders = useLoaders();
|
|
230302
230460
|
const setComponentHover = useSetComponentHover();
|
|
230303
230461
|
const setComponentViewInfo = useSetComponentViewInfo(uuid);
|
|
230304
|
-
const [{ dataset, obsType, featureType, featureValueType, spatialZoom: zoom2, spatialTargetX: targetX2, spatialTargetY: targetY2, spatialTargetZ: targetZ, spatialRotationX: rotationX, spatialRotationY: rotationY, spatialRotationZ: rotationZ, spatialRotationOrbit: rotationOrbit, spatialOrbitAxis: orbitAxis, spatialImageLayer: imageLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, spatialNeighborhoodLayer: neighborhoodsLayer, obsFilter: cellFilter, obsHighlight: cellHighlight, moleculeHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, spatialAxisFixed, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible }, { setSpatialZoom: setZoom, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialOrbitAxis: setOrbitAxis, setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialNeighborhoodLayer: setNeighborhoodsLayer, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setMoleculeHighlight, setSpatialAxisFixed, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SPATIAL], coordinationScopes);
|
|
230462
|
+
const [{ dataset, obsType, featureType, featureValueType, spatialZoom: zoom2, spatialTargetX: targetX2, spatialTargetY: targetY2, spatialTargetZ: targetZ, spatialRotationX: rotationX, spatialRotationY: rotationY, spatialRotationZ: rotationZ, spatialRotationOrbit: rotationOrbit, spatialOrbitAxis: orbitAxis, spatialImageLayer: imageLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, spatialNeighborhoodLayer: neighborhoodsLayer, obsFilter: cellFilter, obsHighlight: cellHighlight, moleculeHighlight, featureSelection: geneSelection, obsSetSelection: cellSetSelection, obsSetColor: cellSetColor, obsColorEncoding: cellColorEncoding, additionalObsSets: additionalCellSets, spatialAxisFixed, featureValueColormap: geneExpressionColormap, featureValueColormapRange: geneExpressionColormapRange, tooltipsVisible, photometricInterpretation: photometricInterpretationFromCoordination }, { setSpatialZoom: setZoom, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialOrbitAxis: setOrbitAxis, setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialNeighborhoodLayer: setNeighborhoodsLayer, setObsFilter: setCellFilter, setObsSetSelection: setCellSetSelection, setObsHighlight: setCellHighlight, setObsSetColor: setCellSetColor, setObsColorEncoding: setCellColorEncoding, setAdditionalObsSets: setAdditionalCellSets, setMoleculeHighlight, setSpatialAxisFixed, setFeatureValueColormap: setGeneExpressionColormap, setFeatureValueColormapRange: setGeneExpressionColormapRange, setTooltipsVisible }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SPATIAL], coordinationScopes);
|
|
230305
230463
|
const { spatialZoom: initialZoom, spatialTargetX: initialTargetX, spatialTargetY: initialTargetY, spatialTargetZ: initialTargetZ } = useInitialCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.SPATIAL], coordinationScopes);
|
|
230306
230464
|
const observationsLabel = observationsLabelOverride || obsType;
|
|
230307
230465
|
const [{ imageLayerCallbacks, segmentationLayerCallbacks }] = useAuxiliaryCoordination(COMPONENT_COORDINATION_TYPES.layerController, coordinationScopes);
|
|
@@ -230321,10 +230479,11 @@ function SpatialSubscriber$1(props) {
|
|
|
230321
230479
|
const [expressionData, loadedFeatureSelection, featureSelectionStatus] = useFeatureSelection(loaders, dataset, false, geneSelection, { obsType, featureType, featureValueType });
|
|
230322
230480
|
const [{ obsIndex: matrixObsIndex }, matrixIndicesStatus, matrixIndicesUrls] = useObsFeatureMatrixIndices(loaders, dataset, false, { obsType, featureType, featureValueType });
|
|
230323
230481
|
const [{ image: image2 }, imageStatus, imageUrls] = useImageData(loaders, dataset, false, { setSpatialImageLayer: setRasterLayers }, { spatialImageLayer: imageLayers }, {});
|
|
230324
|
-
const { loaders: imageLayerLoaders = [], meta: meta2 = [] } = image2 || {};
|
|
230482
|
+
const { loaders: imageLayerLoaders = [], meta: meta2 = [], instance: instance2 } = image2 || {};
|
|
230325
230483
|
const [neighborhoods, neighborhoodsStatus, neighborhoodsUrls] = useNeighborhoodsData(loaders, dataset, false, { setSpatialNeighborhoodLayer: setNeighborhoodsLayer }, { spatialNeighborhoodLayer: neighborhoodsLayer });
|
|
230326
230484
|
const [{ featureLabelsMap: featureLabelsMapOrig }, featureLabelsStatus, featureLabelsUrls] = useFeatureLabelsData(loaders, dataset, false, {}, {}, { featureType });
|
|
230327
230485
|
const [featureLabelsMap, expandedFeatureLabelsStatus] = useExpandedFeatureLabelsMap(featureType, featureLabelsMapOrig, { stripCuriePrefixes: true });
|
|
230486
|
+
const photometricInterpretation = photometricInterpretationFromCoordination ?? instance2?.getPhotometricInterpretation();
|
|
230328
230487
|
const isReady = useReady([
|
|
230329
230488
|
obsLocationsStatus,
|
|
230330
230489
|
obsLabelsStatus,
|
|
@@ -230574,7 +230733,7 @@ function SpatialSubscriber$1(props) {
|
|
|
230574
230733
|
orbitAxis
|
|
230575
230734
|
}, setViewState, originalViewState, imageLayerDefs: imageLayers, obsSegmentationsLayerDefs: cellsLayer, obsLocationsLayerDefs: moleculesLayer, neighborhoodLayerDefs: neighborhoodsLayer, obsLocationsIndex, obsSegmentationsIndex, obsLocations, obsLocationsLabels, obsLocationsFeatureIndex, hasSegmentations: hasSegmentationsData, obsSegmentations, obsSegmentationsType, obsCentroids, obsCentroidsIndex, cellFilter, cellSelection, cellHighlight, cellColors, neighborhoods, imageLayerLoaders: resolutionFilteredImageLayerLoaders, setCellFilter, setCellSelection: setCellSelectionProp, setCellHighlight, setHoverInfo, setMoleculeHighlight, setComponentHover: () => {
|
|
230576
230735
|
setComponentHover(uuid);
|
|
230577
|
-
}, updateViewInfo: setComponentViewInfo, imageLayerCallbacks, segmentationLayerCallbacks, spatialAxisFixed, geneExpressionColormap, geneExpressionColormapRange, expressionData: shiftedExpressionDataForBitmask, cellColorEncoding, getExpressionValue, theme, useFullResolutionImage }), tooltipsVisible && jsxRuntimeExports.jsx(SpatialTooltipSubscriber$1, { parentUuid: uuid, obsHighlight: cellHighlight || moleculeHighlight, width: width2, height: height2, getObsInfo: getTooltipObsInfo, useHoverInfoForTooltip, hoverData, hoverCoord, hoverMode, getObsIdFromHoverData, featureType, featureLabelsMap }), jsxRuntimeExports.jsx(Legend, {
|
|
230736
|
+
}, updateViewInfo: setComponentViewInfo, imageLayerCallbacks, segmentationLayerCallbacks, spatialAxisFixed, geneExpressionColormap, geneExpressionColormapRange, expressionData: shiftedExpressionDataForBitmask, cellColorEncoding, getExpressionValue, theme, useFullResolutionImage, photometricInterpretation }), tooltipsVisible && jsxRuntimeExports.jsx(SpatialTooltipSubscriber$1, { parentUuid: uuid, obsHighlight: cellHighlight || moleculeHighlight, width: width2, height: height2, getObsInfo: getTooltipObsInfo, useHoverInfoForTooltip, hoverData, hoverCoord, hoverMode, getObsIdFromHoverData, featureType, featureLabelsMap }), jsxRuntimeExports.jsx(Legend, {
|
|
230578
230737
|
visible: true,
|
|
230579
230738
|
// Fix to dark theme due to black background of spatial plot.
|
|
230580
230739
|
theme: "dark",
|
|
@@ -231932,7 +232091,7 @@ class ErrorBoundary2 extends React__default.Component {
|
|
|
231932
232091
|
}
|
|
231933
232092
|
}
|
|
231934
232093
|
const LazySpatialThree = React__default.lazy(async () => {
|
|
231935
|
-
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-
|
|
232094
|
+
const { SpatialWrapper: SpatialWrapper2 } = await import("./index-f9b7fcdb.js");
|
|
231936
232095
|
return { default: SpatialWrapper2 };
|
|
231937
232096
|
});
|
|
231938
232097
|
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 }) }) }) }));
|
|
@@ -238426,7 +238585,7 @@ const buttonStyles = {
|
|
|
238426
238585
|
fontWeight: 400
|
|
238427
238586
|
};
|
|
238428
238587
|
function LayerController$1(props) {
|
|
238429
|
-
const { layer, name: name2, loader: loader2, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth,
|
|
238588
|
+
const { layer, name: name2, loader: loader2, theme, handleLayerRemove, handleLayerChange, shouldShowTransparentColor, shouldShowDomain, shouldShowColormap, ChannelController, setViewState, disable3d, setImageLayerCallback, setAreLayerChannelsLoading, areLayerChannelsLoading, disabled, spatialHeight, spatialWidth, photometricInterpretation, shouldShowRemoveLayerButton } = props;
|
|
238430
238589
|
const { colormap, opacity: opacity2, channels: channels2, transparentColor, renderingMode, xSlice, ySlice, zSlice, resolution, use3d, modelMatrix: modelMatrix2 } = layer;
|
|
238431
238590
|
const channelRef = useRef(channels2);
|
|
238432
238591
|
useEffect(() => {
|
|
@@ -238641,7 +238800,7 @@ function LayerController$1(props) {
|
|
|
238641
238800
|
handleColormapChange: setColormap,
|
|
238642
238801
|
handleGlobalChannelsSelectionChange,
|
|
238643
238802
|
handleTransparentColorChange: setTransparentColor,
|
|
238644
|
-
disableChannelsIfRgbDetected:
|
|
238803
|
+
disableChannelsIfRgbDetected: photometricInterpretation === "RGB",
|
|
238645
238804
|
handleDomainChange,
|
|
238646
238805
|
shouldShowTransparentColor,
|
|
238647
238806
|
shouldShowDomain,
|
|
@@ -238657,7 +238816,7 @@ function LayerController$1(props) {
|
|
|
238657
238816
|
spatialHeight,
|
|
238658
238817
|
spatialWidth,
|
|
238659
238818
|
modelMatrix: modelMatrix2
|
|
238660
|
-
}),
|
|
238819
|
+
}), photometricInterpretation === "RGB" ? null : channelControllers, photometricInterpretation === "RGB" ? null : jsxRuntimeExports.jsx(Button$1, { disabled: channels2.length === MAX_CHANNELS$1, onClick: handleChannelAdd, fullWidth: true, variant: "outlined", style: buttonStyles, startIcon: jsxRuntimeExports.jsx(AddIcon, {}), size: "small", children: "Add Channel" })] });
|
|
238661
238820
|
return jsxRuntimeExports.jsxs(Accordion$1, { className: controllerSectionClasses.layerControllerRoot, onChange: (e3, expanded) => !disabled && setIsExpanded(expanded && e3?.target?.attributes?.role?.value === "presentation"), TransitionProps: { enter: false }, expanded: !disabled && isExpanded, id: `layer-controls-accordion-${layerControlsId}`, children: [jsxRuntimeExports.jsx(AccordionSummary$1, { classes: {
|
|
238662
238821
|
root: accordionClasses.accordionSummaryRoot,
|
|
238663
238822
|
content: accordionClasses.content,
|
|
@@ -238731,6 +238890,7 @@ const LayerControllerMemoized = React__default.memo(forwardRef((props, ref2) =>
|
|
|
238731
238890
|
setAreLoadingImageChannels,
|
|
238732
238891
|
handleRasterLayerChange,
|
|
238733
238892
|
handleRasterLayerRemove,
|
|
238893
|
+
photometricInterpretation,
|
|
238734
238894
|
obsSegmentationsType,
|
|
238735
238895
|
segmentationLayerLoaders,
|
|
238736
238896
|
segmentationLayerMeta,
|
|
@@ -238852,6 +239012,7 @@ const LayerControllerMemoized = React__default.memo(forwardRef((props, ref2) =>
|
|
|
238852
239012
|
disable3d: globalDisable3d || (disable3d || []).indexOf(layerMeta.name) >= 0 || typeof layerIs3DIndex === "number" && layerIs3DIndex !== -1 && layerIs3DIndex !== i2,
|
|
238853
239013
|
disabled: typeof layerIs3DIndex === "number" && layerIs3DIndex !== -1 && layerIs3DIndex !== i2,
|
|
238854
239014
|
disableChannelsIfRgbDetected,
|
|
239015
|
+
photometricInterpretation,
|
|
238855
239016
|
imageLayerCallbacks,
|
|
238856
239017
|
setImageLayerCallback,
|
|
238857
239018
|
setViewState: ({ zoom: newZoom, target: target2, rotationX: newRotationX, rotationOrbit: newRotationOrbit }) => {
|
|
@@ -238875,7 +239036,7 @@ const LayerControllerMemoized = React__default.memo(forwardRef((props, ref2) =>
|
|
|
238875
239036
|
function LayerControllerSubscriber$1(props) {
|
|
238876
239037
|
const { coordinationScopes, closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Spatial Layers", disable3d, globalDisable3d, disableChannelsIfRgbDetected, enableLayerButtonsWithOneLayer, helpText = ViewHelpMapping.LAYER_CONTROLLER } = props;
|
|
238877
239038
|
const loaders = useLoaders();
|
|
238878
|
-
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.LAYER_CONTROLLER], coordinationScopes);
|
|
239039
|
+
const [{ dataset, obsType, spatialImageLayer: rasterLayers, spatialSegmentationLayer: cellsLayer, spatialPointLayer: moleculesLayer, photometricInterpretation: photometricInterpretationFromCoordination }, { setSpatialImageLayer: setRasterLayers, setSpatialSegmentationLayer: setCellsLayer, setSpatialPointLayer: setMoleculesLayer, setSpatialTargetX: setTargetX, setSpatialTargetY: setTargetY, setSpatialTargetZ: setTargetZ, setSpatialRotationX: setRotationX, setSpatialRotationOrbit: setRotationOrbit, setSpatialZoom: setZoom }] = useCoordination(COMPONENT_COORDINATION_TYPES[ViewType$2.LAYER_CONTROLLER], coordinationScopes);
|
|
238879
239040
|
const [{ imageLayerCallbacks, areLoadingImageChannels, segmentationLayerCallbacks, areLoadingSegmentationChannels }, { setImageLayerCallbacks, setAreLoadingImageChannels, setSegmentationLayerCallbacks, setAreLoadingSegmentationChannels }] = useAuxiliaryCoordination(COMPONENT_COORDINATION_TYPES.layerController, coordinationScopes);
|
|
238880
239041
|
const [spatialLayout] = useComponentLayout("spatial", ["spatialImageLayer"], coordinationScopes);
|
|
238881
239042
|
const layerControllerRef = useRef();
|
|
@@ -238884,12 +239045,13 @@ function LayerControllerSubscriber$1(props) {
|
|
|
238884
239045
|
const [obsLocationsData, obsLocationsStatus] = useObsLocationsData(loaders, dataset, false, { setSpatialPointLayer: setMoleculesLayer }, { spatialPointLayer: moleculesLayer }, {});
|
|
238885
239046
|
const [{ obsSegmentations, obsSegmentationsType }, obsSegmentationsStatus] = useObsSegmentationsData(loaders, dataset, false, { setSpatialSegmentationLayer: setCellsLayer }, { spatialSegmentationLayer: cellsLayer }, {});
|
|
238886
239047
|
const [{ image: image2 }, imageStatus] = useImageData(loaders, dataset, false, { setSpatialImageLayer: setRasterLayers }, { spatialImageLayer: rasterLayers }, {});
|
|
238887
|
-
const { loaders: imageLayerLoaders, meta: imageLayerMeta } = image2 || {};
|
|
239048
|
+
const { loaders: imageLayerLoaders, meta: imageLayerMeta, instance: instance2 } = image2 || {};
|
|
238888
239049
|
const isReady = useReady([
|
|
238889
239050
|
obsLocationsStatus,
|
|
238890
239051
|
obsSegmentationsStatus,
|
|
238891
239052
|
imageStatus
|
|
238892
239053
|
]);
|
|
239054
|
+
const photometricInterpretation = photometricInterpretationFromCoordination ?? instance2?.getPhotometricInterpretation();
|
|
238893
239055
|
const segmentationLayerLoaders = obsSegmentations && obsSegmentationsType === "bitmask" ? obsSegmentations.loaders : null;
|
|
238894
239056
|
const segmentationLayerMeta = obsSegmentations && obsSegmentationsType === "bitmask" ? obsSegmentations.meta : null;
|
|
238895
239057
|
const handleImageAdd = useCallback(async (index2) => {
|
|
@@ -238950,6 +239112,7 @@ function LayerControllerSubscriber$1(props) {
|
|
|
238950
239112
|
setAreLoadingImageChannels,
|
|
238951
239113
|
handleRasterLayerChange,
|
|
238952
239114
|
handleRasterLayerRemove,
|
|
239115
|
+
photometricInterpretation,
|
|
238953
239116
|
obsSegmentationsType,
|
|
238954
239117
|
segmentationLayerLoaders,
|
|
238955
239118
|
segmentationLayerMeta,
|
|
@@ -241531,7 +241694,7 @@ const useStyles$6 = makeStyles((theme) => ({
|
|
|
241531
241694
|
}));
|
|
241532
241695
|
register({ dataFetcher: ZarrMultivecDataFetcher_default, config: ZarrMultivecDataFetcher_default.config }, { pluginType: "dataFetcher" });
|
|
241533
241696
|
const LazyHiGlassComponent = React__default.lazy(async () => {
|
|
241534
|
-
const { HiGlassComponent } = await import("./higlass-
|
|
241697
|
+
const { HiGlassComponent } = await import("./higlass-bd3bb438.js");
|
|
241535
241698
|
return { default: HiGlassComponent };
|
|
241536
241699
|
});
|
|
241537
241700
|
const HG_SIZE = 800;
|
|
@@ -244478,7 +244641,7 @@ const useStyles$5 = makeStyles(() => ({
|
|
|
244478
244641
|
}
|
|
244479
244642
|
}));
|
|
244480
244643
|
const LazyReactNeuroglancer = React__default.lazy(async () => {
|
|
244481
|
-
const ReactNeuroglancer = await import("./index-
|
|
244644
|
+
const ReactNeuroglancer = await import("./index-fed4c7c6.js").then((n3) => n3.i);
|
|
244482
244645
|
return ReactNeuroglancer;
|
|
244483
244646
|
});
|
|
244484
244647
|
function createWorker() {
|
|
@@ -244501,16 +244664,20 @@ function NeuroglancerSubscriber(props) {
|
|
|
244501
244664
|
const { closeButtonVisible, downloadButtonVisible, removeGridComponent, theme, title: title2 = "Neuroglancer", viewerState: viewerStateInitial = null, helpText = ViewHelpMapping.NEUROGLANCER } = props;
|
|
244502
244665
|
return jsxRuntimeExports.jsx(TitleInfo, { title: title2, helpText, isSpatial: true, theme, closeButtonVisible, downloadButtonVisible, removeGridComponent, isReady: true, children: viewerStateInitial && jsxRuntimeExports.jsx(Neuroglancer, { viewerState: viewerStateInitial }) });
|
|
244503
244666
|
}
|
|
244667
|
+
const FEATURE_AGGREGATION_STRATEGIES = ["first", "last", "sum", "mean"];
|
|
244504
244668
|
function CellSetExpressionPlotOptions(props) {
|
|
244505
|
-
const { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions, featureValuePositivityThreshold, setFeatureValuePositivityThreshold, featureValueColormap, setFeatureValueColormap } = props;
|
|
244669
|
+
const { featureValueTransform, setFeatureValueTransform, featureValueTransformCoefficient, setFeatureValueTransformCoefficient, transformOptions, featureValuePositivityThreshold, setFeatureValuePositivityThreshold, featureValueColormap, setFeatureValueColormap, featureAggregationStrategy, setFeatureAggregationStrategy } = props;
|
|
244506
244670
|
const cellSetExpressionPlotOptionsId = $bdb11010cef70236$export$f680877a34711e37();
|
|
244507
244671
|
const classes = useStyles$u();
|
|
244508
244672
|
function handleFeatureValueColormapChange(event2) {
|
|
244509
244673
|
setFeatureValueColormap(event2.target.value);
|
|
244510
244674
|
}
|
|
244511
|
-
|
|
244675
|
+
function handleTransformChange(event2) {
|
|
244512
244676
|
setFeatureValueTransform(event2.target.value === "" ? null : event2.target.value);
|
|
244513
|
-
}
|
|
244677
|
+
}
|
|
244678
|
+
function handleFeatureAggregationStrategyChange(event2) {
|
|
244679
|
+
setFeatureAggregationStrategy(event2.target.value);
|
|
244680
|
+
}
|
|
244514
244681
|
function handlePositivityThresholdChange(event2, value2) {
|
|
244515
244682
|
setFeatureValuePositivityThreshold(value2);
|
|
244516
244683
|
}
|
|
@@ -244532,7 +244699,9 @@ function CellSetExpressionPlotOptions(props) {
|
|
|
244532
244699
|
id: `cellset-expression-transform-select-${cellSetExpressionPlotOptionsId}`
|
|
244533
244700
|
}, 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
244701
|
shrink: true
|
|
244535
|
-
}, id: `cellset-expression-transform-coeff-${cellSetExpressionPlotOptionsId}` }) })] }),
|
|
244702
|
+
}, 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: {
|
|
244703
|
+
id: `feature-aggregation-strategy-${cellSetExpressionPlotOptionsId}`
|
|
244704
|
+
}, 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
244705
|
}
|
|
244537
244706
|
function bandSpace$1(count2, paddingInner2, paddingOuter2) {
|
|
244538
244707
|
var space2 = count2 - paddingInner2 + paddingOuter2 * 2;
|
|
@@ -249673,12 +249842,35 @@ function histogramStratifiedExpressionData(summarizedResult, binCount, yMinProp)
|
|
|
249673
249842
|
// d3.scaleLinear without a range set
|
|
249674
249843
|
};
|
|
249675
249844
|
}
|
|
249676
|
-
|
|
249845
|
+
const DEFAULT_FEATURE_AGGREGATION_STRATEGY = "first";
|
|
249846
|
+
function featureSummary(geneSelection, featureAggregationStrategy) {
|
|
249847
|
+
if (featureAggregationStrategy === "first") {
|
|
249848
|
+
return geneSelection?.[0];
|
|
249849
|
+
}
|
|
249850
|
+
if (featureAggregationStrategy === "last") {
|
|
249851
|
+
return geneSelection?.at(-1);
|
|
249852
|
+
}
|
|
249853
|
+
if (typeof featureAggregationStrategy === "number") {
|
|
249854
|
+
const i2 = featureAggregationStrategy;
|
|
249855
|
+
return geneSelection?.[i2];
|
|
249856
|
+
}
|
|
249857
|
+
if (featureAggregationStrategy === "sum") {
|
|
249858
|
+
return geneSelection?.join(" + ");
|
|
249859
|
+
}
|
|
249860
|
+
if (featureAggregationStrategy === "mean") {
|
|
249861
|
+
return `Mean of ${geneSelection?.join(", ")}`;
|
|
249862
|
+
}
|
|
249863
|
+
if (featureAggregationStrategy === "difference") {
|
|
249864
|
+
return geneSelection?.join(" - ");
|
|
249865
|
+
}
|
|
249866
|
+
return "";
|
|
249867
|
+
}
|
|
249868
|
+
function useExpressionByCellSet(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, theme, yMinProp, featureAggregationStrategy) {
|
|
249677
249869
|
const mergedCellSets = useMemo(() => mergeObsSets(cellSets, additionalCellSets), [cellSets, additionalCellSets]);
|
|
249678
249870
|
const [expressionArr, expressionMax] = useMemo(() => {
|
|
249679
249871
|
const [stratifiedData, exprMax] = stratifyExpressionData(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, mergedCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient);
|
|
249680
249872
|
if (stratifiedData) {
|
|
249681
|
-
const aggregateData = aggregateStratifiedExpressionData(stratifiedData, geneSelection);
|
|
249873
|
+
const aggregateData = aggregateStratifiedExpressionData(stratifiedData, geneSelection, featureAggregationStrategy);
|
|
249682
249874
|
const summarizedData = summarizeStratifiedExpressionData(aggregateData, true);
|
|
249683
249875
|
const histogramData = histogramStratifiedExpressionData(summarizedData, 16, yMinProp);
|
|
249684
249876
|
return [histogramData, exprMax];
|
|
@@ -249697,7 +249889,8 @@ function useExpressionByCellSet(sampleEdges, sampleSets, sampleSetSelection, exp
|
|
|
249697
249889
|
yMinProp,
|
|
249698
249890
|
sampleEdges,
|
|
249699
249891
|
sampleSets,
|
|
249700
|
-
sampleSetSelection
|
|
249892
|
+
sampleSetSelection,
|
|
249893
|
+
featureAggregationStrategy
|
|
249701
249894
|
]);
|
|
249702
249895
|
const setArr = useMemo(() => mergedCellSets && cellSetSelection && cellSetColor ? treeToSetSizesBySetNames(mergedCellSets, cellSetSelection, cellSetSelection, cellSetColor, theme) : [], [mergedCellSets, cellSetSelection, cellSetColor, theme]);
|
|
249703
249896
|
return [expressionArr, setArr, expressionMax];
|
|
@@ -249706,7 +249899,7 @@ function CellSetExpressionPlotSubscriber(props) {
|
|
|
249706
249899
|
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
249900
|
const classes = useStyles$4();
|
|
249708
249901
|
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);
|
|
249902
|
+
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
249903
|
const [width2, height2, containerRef] = useGridItemSize();
|
|
249711
249904
|
const transformOptions = VALUE_TRANSFORM_OPTIONS;
|
|
249712
249905
|
const [expressionData, loadedFeatureSelection, featureSelectionStatus] = useFeatureSelection(loaders, dataset, false, geneSelection, { obsType, featureType, featureValueType });
|
|
@@ -249732,11 +249925,18 @@ function CellSetExpressionPlotSubscriber(props) {
|
|
|
249732
249925
|
sampleSetsUrls,
|
|
249733
249926
|
sampleEdgesUrls
|
|
249734
249927
|
]);
|
|
249735
|
-
const
|
|
249736
|
-
const
|
|
249928
|
+
const featureAggregationStrategyToUse = featureAggregationStrategy ?? DEFAULT_FEATURE_AGGREGATION_STRATEGY;
|
|
249929
|
+
const [histogramData, setArr, exprMax] = useExpressionByCellSet(sampleEdges, sampleSets, sampleSetSelection, expressionData, obsIndex, cellSets, additionalCellSets, geneSelection, cellSetSelection, cellSetColor, featureValueTransform, featureValueTransformCoefficient, theme, yMin, featureAggregationStrategyToUse);
|
|
249930
|
+
const featureSuffix = useMemo(() => {
|
|
249931
|
+
const cleanedGeneSelection = geneSelection?.map((geneName) => featureLabelsMap?.get(geneName) || featureLabelsMap?.get(cleanFeatureId(geneName)) || geneName);
|
|
249932
|
+
if (Array.isArray(cleanedGeneSelection)) {
|
|
249933
|
+
return featureSummary(cleanedGeneSelection, featureAggregationStrategyToUse);
|
|
249934
|
+
}
|
|
249935
|
+
return null;
|
|
249936
|
+
}, [geneSelection, featureAggregationStrategyToUse]);
|
|
249737
249937
|
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, "."] }) }) });
|
|
249938
|
+
const titleSuffix = featureSuffix ? ` (${featureSuffix})` : "";
|
|
249939
|
+
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
249940
|
}
|
|
249741
249941
|
/*! *****************************************************************************
|
|
249742
249942
|
Copyright (c) Microsoft Corporation.
|
|
@@ -301717,7 +301917,26 @@ function ExpressionHistogramSubscriber(props) {
|
|
|
301717
301917
|
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
301918
|
}
|
|
301719
301919
|
function DotPlot(props) {
|
|
301720
|
-
const {
|
|
301920
|
+
const {
|
|
301921
|
+
isStratified,
|
|
301922
|
+
transpose: transpose2,
|
|
301923
|
+
data: rawData,
|
|
301924
|
+
theme,
|
|
301925
|
+
width: width2,
|
|
301926
|
+
height: height2,
|
|
301927
|
+
marginRight,
|
|
301928
|
+
marginBottom,
|
|
301929
|
+
obsType,
|
|
301930
|
+
sampleType,
|
|
301931
|
+
keyLength = 36,
|
|
301932
|
+
featureType,
|
|
301933
|
+
featureValueType,
|
|
301934
|
+
featureValueTransformName,
|
|
301935
|
+
// TODO: re-enable featureValueColormap coordination
|
|
301936
|
+
// featureValueColormap,
|
|
301937
|
+
obsSetSelection,
|
|
301938
|
+
obsSetColor
|
|
301939
|
+
} = props;
|
|
301721
301940
|
const vegaContainerRef = useRef();
|
|
301722
301941
|
const data2 = rawData.map((d) => ({
|
|
301723
301942
|
...d,
|
|
@@ -301775,7 +301994,8 @@ function DotPlot(props) {
|
|
|
301775
301994
|
type: "quantitative",
|
|
301776
301995
|
title: meanTransform,
|
|
301777
301996
|
scale: {
|
|
301778
|
-
scheme: featureValueColormap
|
|
301997
|
+
// scheme: featureValueColormap,
|
|
301998
|
+
scheme: "greys"
|
|
301779
301999
|
},
|
|
301780
302000
|
legend: {
|
|
301781
302001
|
direction: "horizontal",
|
|
@@ -302268,8 +302488,6 @@ function TreemapSubscriber(props) {
|
|
|
302268
302488
|
]);
|
|
302269
302489
|
const mergedObsSets = useMemo(() => mergeObsSets(obsSets, additionalObsSets), [obsSets, additionalObsSets]);
|
|
302270
302490
|
const mergedSampleSets = useMemo(() => mergeObsSets(sampleSets, null), [sampleSets]);
|
|
302271
|
-
const obsCount = obsIndex?.length || 0;
|
|
302272
|
-
const sampleCount = sampleIndex?.length || 0;
|
|
302273
302491
|
const [obsCounts, sampleCounts] = useMemo(() => {
|
|
302274
302492
|
const obsResult = new InternMap$1([], JSON.stringify);
|
|
302275
302493
|
const sampleResult = new InternMap$1([], JSON.stringify);
|
|
@@ -302288,7 +302506,7 @@ function TreemapSubscriber(props) {
|
|
|
302288
302506
|
const sampleSetSize = sampleSetSizes?.find((d) => isEqual$5(d.setNamePath, sampleSetKey))?.size;
|
|
302289
302507
|
sampleResult.set(sampleSetKey, sampleSetSize || 0);
|
|
302290
302508
|
});
|
|
302291
|
-
if (mergedObsSets && obsSetSelection) {
|
|
302509
|
+
if (mergedObsSets && obsSetSelection && obsIndex) {
|
|
302292
302510
|
const sampleIdToSetMap = sampleSets && sampleSetSelection ? treeToSelectedSetMap(sampleSets, sampleSetSelection) : null;
|
|
302293
302511
|
const cellIdToSetMap = treeToSelectedSetMap(mergedObsSets, obsSetSelection);
|
|
302294
302512
|
for (let i2 = 0; i2 < obsIndex.length; i2 += 1) {
|
|
@@ -302316,13 +302534,20 @@ function TreemapSubscriber(props) {
|
|
|
302316
302534
|
mergedObsSets,
|
|
302317
302535
|
obsSetSelection,
|
|
302318
302536
|
mergedSampleSets,
|
|
302319
|
-
sampleSetSelection
|
|
302537
|
+
sampleSetSelection,
|
|
302538
|
+
obsIndex
|
|
302320
302539
|
// TODO: consider filtering-related coordination values
|
|
302321
302540
|
]);
|
|
302541
|
+
const totalObsCount = obsIndex?.length || 0;
|
|
302542
|
+
const totalSampleCount = sampleIndex?.length || 0;
|
|
302543
|
+
const selectedObsCount = obsCounts.reduce((a2, h2) => a2 + h2.value, 0);
|
|
302544
|
+
const selectedSampleCount = sampleCounts.reduce((a2, h2) => a2 + h2.value, 0);
|
|
302545
|
+
const unselectedObsCount = totalObsCount - selectedObsCount;
|
|
302546
|
+
const unselectedSampleCount = totalSampleCount - selectedSampleCount;
|
|
302322
302547
|
const onNodeClick = useCallback((obsSetPath2) => {
|
|
302323
302548
|
setObsSetSelection([obsSetPath2]);
|
|
302324
302549
|
}, [setObsSetSelection]);
|
|
302325
|
-
return jsxRuntimeExports.
|
|
302550
|
+
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
302551
|
}
|
|
302327
302552
|
function VolcanoPlot(props) {
|
|
302328
302553
|
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 +302703,10 @@ function VolcanoPlotSubscriber(props) {
|
|
|
302478
302703
|
}, [setFeatureSelection]);
|
|
302479
302704
|
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
302705
|
}
|
|
302706
|
+
const MAX_BAR_SIZE = 40;
|
|
302481
302707
|
function CellSetCompositionBarPlot(props) {
|
|
302482
|
-
const { data: data2, theme, width: width2, height:
|
|
302708
|
+
const { data: data2, theme, width: width2, height: heightProp, marginRight = 200, marginBottom = 60, keyLength = 36, obsType, onBarSelect, obsSetsColumnNameMappingReversed, sampleSetsColumnNameMappingReversed, sampleSetSelection, obsSetSelection, obsSetColor, sampleSetColor } = props;
|
|
302709
|
+
const height2 = Array.isArray(obsSetSelection) && (heightProp - marginBottom) / obsSetSelection.length >= MAX_BAR_SIZE ? MAX_BAR_SIZE * obsSetSelection.length + marginBottom : heightProp;
|
|
302483
302710
|
const [obsSetColorScale, sampleSetColorScale] = useMemo(() => [
|
|
302484
302711
|
getColorScale(obsSetSelection, obsSetColor, theme),
|
|
302485
302712
|
getColorScale(sampleSetSelection, sampleSetColor, theme)
|
|
@@ -302488,16 +302715,15 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302488
302715
|
if (Array.isArray(data2) && data2.length === 1) {
|
|
302489
302716
|
const { df, metadata: metadata2 } = data2[0];
|
|
302490
302717
|
const referenceCellType = metadata2?.analysis_params?.reference_cell_type;
|
|
302718
|
+
const covariateValue = metadata2?.analysis_params?.covariate_value;
|
|
302491
302719
|
const coordinationValues = metadata2?.coordination_values;
|
|
302492
302720
|
const obsSetColumnName = coordinationValues?.obsSetSelection?.[0]?.[0];
|
|
302493
302721
|
const obsSetGroupName = obsSetsColumnNameMappingReversed?.[obsSetColumnName];
|
|
302494
302722
|
const sampleSetColumnName = coordinationValues?.sampleSetFilter?.[0]?.[0];
|
|
302495
302723
|
const sampleSetGroupName = sampleSetsColumnNameMappingReversed?.[sampleSetColumnName];
|
|
302496
|
-
const
|
|
302497
|
-
const firstCovariateValue = df.covariate?.[0]?.substring(covariatePrefix.length);
|
|
302498
|
-
const firstCovariateSetPath = [sampleSetGroupName, firstCovariateValue];
|
|
302724
|
+
const covariateSetPath = [sampleSetGroupName, covariateValue];
|
|
302499
302725
|
let shouldSwapFoldChangeDirection = false;
|
|
302500
|
-
if (isEqual$5(
|
|
302726
|
+
if (isEqual$5(covariateSetPath, sampleSetSelection[0])) {
|
|
302501
302727
|
shouldSwapFoldChangeDirection = true;
|
|
302502
302728
|
}
|
|
302503
302729
|
return df.obsSetId.map((obsSetId, i2) => {
|
|
@@ -302554,6 +302780,22 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302554
302780
|
domain: [true, false],
|
|
302555
302781
|
range: [2, 0.5]
|
|
302556
302782
|
};
|
|
302783
|
+
const xExtent = useMemo(() => {
|
|
302784
|
+
if (computedData) {
|
|
302785
|
+
const [min2, max2] = extent$2(computedData.map((d) => d.logFoldChange));
|
|
302786
|
+
const buffer2 = 1.05;
|
|
302787
|
+
const minAbs = Math.abs(min2) * buffer2;
|
|
302788
|
+
const maxAbs = Math.abs(max2) * buffer2;
|
|
302789
|
+
if (minAbs > maxAbs) {
|
|
302790
|
+
return [-minAbs, minAbs];
|
|
302791
|
+
}
|
|
302792
|
+
return [-maxAbs, maxAbs];
|
|
302793
|
+
}
|
|
302794
|
+
return void 0;
|
|
302795
|
+
}, [computedData]);
|
|
302796
|
+
const xScale = {
|
|
302797
|
+
domain: xExtent
|
|
302798
|
+
};
|
|
302557
302799
|
const spec = {
|
|
302558
302800
|
mark: { type: "bar", stroke: "black", cursor: "pointer" },
|
|
302559
302801
|
params: [
|
|
@@ -302588,7 +302830,8 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302588
302830
|
// TODO: support using intercept+effect here based on user-selected options?
|
|
302589
302831
|
field: "logFoldChange",
|
|
302590
302832
|
type: "quantitative",
|
|
302591
|
-
title: "Log fold-change"
|
|
302833
|
+
title: "Log fold-change",
|
|
302834
|
+
scale: xScale
|
|
302592
302835
|
},
|
|
302593
302836
|
color: {
|
|
302594
302837
|
field: "key",
|
|
@@ -302604,7 +302847,8 @@ function CellSetCompositionBarPlot(props) {
|
|
|
302604
302847
|
strokeWidth: {
|
|
302605
302848
|
field: "isReferenceSet",
|
|
302606
302849
|
type: "nominal",
|
|
302607
|
-
scale: strokeWidthScale
|
|
302850
|
+
scale: strokeWidthScale,
|
|
302851
|
+
legend: null
|
|
302608
302852
|
},
|
|
302609
302853
|
tooltip: {
|
|
302610
302854
|
field: "effectExpectedSample",
|
|
@@ -302663,7 +302907,7 @@ function CellSetCompositionBarPlotSubscriber(props) {
|
|
|
302663
302907
|
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
302908
|
}
|
|
302665
302909
|
function FeatureSetEnrichmentBarPlot(props) {
|
|
302666
|
-
const { data: data2, theme, width: width2, height: height2, marginRight =
|
|
302910
|
+
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
302911
|
const [obsSetColorScale, sampleSetColorScale] = useMemo(() => [
|
|
302668
302912
|
getColorScale(obsSetSelection, obsSetColor, theme),
|
|
302669
302913
|
getColorScale(sampleSetSelection, sampleSetColor, theme)
|
|
@@ -302708,7 +302952,7 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302708
302952
|
}
|
|
302709
302953
|
return [...a2, h2];
|
|
302710
302954
|
}, []);
|
|
302711
|
-
const MAX_ROWS =
|
|
302955
|
+
const MAX_ROWS = 50;
|
|
302712
302956
|
result = result.slice(0, MAX_ROWS);
|
|
302713
302957
|
return result;
|
|
302714
302958
|
}
|
|
@@ -302739,7 +302983,7 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302739
302983
|
select: {
|
|
302740
302984
|
type: "point",
|
|
302741
302985
|
on: "click[event.shiftKey === false]",
|
|
302742
|
-
fields: ["name"],
|
|
302986
|
+
fields: ["name", "term"],
|
|
302743
302987
|
empty: "none"
|
|
302744
302988
|
}
|
|
302745
302989
|
},
|
|
@@ -302748,7 +302992,7 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302748
302992
|
select: {
|
|
302749
302993
|
type: "point",
|
|
302750
302994
|
on: "click[event.shiftKey]",
|
|
302751
|
-
fields: ["name"],
|
|
302995
|
+
fields: ["name", "term"],
|
|
302752
302996
|
empty: "none"
|
|
302753
302997
|
}
|
|
302754
302998
|
}
|
|
@@ -302796,9 +303040,9 @@ function FeatureSetEnrichmentBarPlot(props) {
|
|
|
302796
303040
|
};
|
|
302797
303041
|
const handleSignal = (name2, value2) => {
|
|
302798
303042
|
if (name2 === "bar_select") {
|
|
302799
|
-
onBarSelect(value2.
|
|
303043
|
+
onBarSelect(value2.name?.[0], value2.term?.[0]);
|
|
302800
303044
|
} else if (name2 === "shift_bar_select") {
|
|
302801
|
-
onBarSelect(value2.
|
|
303045
|
+
onBarSelect(value2.name, value2.term, true);
|
|
302802
303046
|
}
|
|
302803
303047
|
};
|
|
302804
303048
|
const signalListeners = { bar_select: handleSignal, shift_bar_select: handleSignal };
|
|
@@ -302816,7 +303060,7 @@ function FeatureSetEnrichmentBarPlotSubscriber(props) {
|
|
|
302816
303060
|
const { coordinationScopes, removeGridComponent, theme, helpText = ViewHelpMapping.FEATURE_SET_ENRICHMENT_BAR_PLOT } = props;
|
|
302817
303061
|
const classes = useStyles$4();
|
|
302818
303062
|
const loaders = useLoaders();
|
|
302819
|
-
useAsyncFunction(AsyncFunctionType.TRANSFORM_FEATURE);
|
|
303063
|
+
const transformFeature2 = useAsyncFunction(AsyncFunctionType.TRANSFORM_FEATURE);
|
|
302820
303064
|
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
303065
|
const [width2, height2, containerRef] = useGridItemSize();
|
|
302822
303066
|
const obsSetsLoader = useMatchingLoader(loaders, dataset, DataType$4.OBS_SETS, { obsType });
|
|
@@ -302839,6 +303083,11 @@ function FeatureSetEnrichmentBarPlotSubscriber(props) {
|
|
|
302839
303083
|
featureSetStatsStatus
|
|
302840
303084
|
]);
|
|
302841
303085
|
const onBarSelect = useCallback(async (featureSetName, featureSetTerm, isShiftDown = false) => {
|
|
303086
|
+
const kgNode = { nodeType: "pathway", term: featureSetTerm };
|
|
303087
|
+
const targetFeatureType = featureType;
|
|
303088
|
+
const targetsInPathway = await transformFeature2(kgNode, targetFeatureType);
|
|
303089
|
+
const featureIds = targetsInPathway.filter((d, i2) => i2 < 10).map((d) => d.label);
|
|
303090
|
+
setFeatureSelection(featureIds);
|
|
302842
303091
|
}, [setFeatureSelection]);
|
|
302843
303092
|
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
303093
|
}
|
|
@@ -308416,79 +308665,88 @@ class MoleculesJsonAsObsLocationsLoader extends JsonLoader {
|
|
|
308416
308665
|
}
|
|
308417
308666
|
}
|
|
308418
308667
|
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
|
-
});
|
|
308668
|
+
try {
|
|
308669
|
+
const { type: type3, url, metadata: metadata2, requestInit: requestInit2 } = imageData;
|
|
308670
|
+
switch (type3) {
|
|
308671
|
+
case "zarr": {
|
|
308672
|
+
const { dimensions, isPyramid, transform: transform4 } = metadata2 || {};
|
|
308673
|
+
const labels2 = dimensions.map((d) => d.field);
|
|
308674
|
+
let source2;
|
|
308675
|
+
const root2 = await zarrOpenRoot(url, null, { requestInit: requestInit2 });
|
|
308676
|
+
if (isPyramid) {
|
|
308677
|
+
const metadataUrl = `${url}${url.slice(-1) === "/" ? "" : "/"}.zmetadata`;
|
|
308678
|
+
const response = await fetch(metadataUrl);
|
|
308679
|
+
if (!response.ok)
|
|
308680
|
+
throw new Error(`Failed to fetch metadata: ${response.status}`);
|
|
308681
|
+
const { metadata: zarrMetadata } = await response.json();
|
|
308682
|
+
const paths = Object.keys(zarrMetadata).filter((metaKey) => metaKey.includes(".zarray")).map((arrMetaKeys) => arrMetaKeys.slice(0, -7));
|
|
308683
|
+
const data2 = await Promise.all(paths.map((path2) => open$1(root2.resolve(path2), { kind: "array" })));
|
|
308684
|
+
const tileSize = guessTileSize(data2[0]);
|
|
308685
|
+
source2 = data2.map((d) => new ZarritaPixelSource(createZarrArrayAdapter(d), labels2, tileSize));
|
|
308451
308686
|
} else {
|
|
308452
|
-
|
|
308687
|
+
const data2 = await open$1(root2, { kind: "array" });
|
|
308688
|
+
source2 = new ZarritaPixelSource(createZarrArrayAdapter(data2), labels2);
|
|
308453
308689
|
}
|
|
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
|
-
}
|
|
308690
|
+
return {
|
|
308691
|
+
data: source2,
|
|
308692
|
+
metadata: { dimensions, transform: transform4 },
|
|
308693
|
+
channels: (dimensions.find((d) => d.field === "channel") || dimensions[0]).values
|
|
308694
|
+
};
|
|
308695
|
+
}
|
|
308696
|
+
case "ome-tiff": {
|
|
308697
|
+
let loader2;
|
|
308698
|
+
if (metadata2?.omeTiffOffsetsUrl) {
|
|
308699
|
+
try {
|
|
308700
|
+
const res = await fetch(metadata2.omeTiffOffsetsUrl, requestInit2 || {});
|
|
308701
|
+
if (!res.ok)
|
|
308702
|
+
throw new Error(`Offsets not found: ${res.status} from ${res.url}`);
|
|
308703
|
+
const offsets2 = await res.json();
|
|
308704
|
+
loader2 = await loadOmeTiff(url, {
|
|
308705
|
+
offsets: offsets2,
|
|
308706
|
+
headers: requestInit2?.headers
|
|
308707
|
+
});
|
|
308708
|
+
} catch (err2) {
|
|
308709
|
+
log$f.error("Error loading OME-TIFF offsets:", err2);
|
|
308710
|
+
throw err2;
|
|
308484
308711
|
}
|
|
308485
|
-
}
|
|
308486
|
-
|
|
308487
|
-
|
|
308488
|
-
|
|
308489
|
-
|
|
308490
|
-
|
|
308712
|
+
} else {
|
|
308713
|
+
loader2 = await loadOmeTiff(url, { headers: requestInit2?.headers });
|
|
308714
|
+
}
|
|
308715
|
+
const { Pixels: { Channels } } = loader2.metadata;
|
|
308716
|
+
const channels2 = Array.isArray(Channels) ? Channels.map((channel, i2) => channel.Name || `Channel ${i2}`) : [Channels.Name || `Channel ${0}`];
|
|
308717
|
+
return { ...loader2, channels: channels2 };
|
|
308718
|
+
}
|
|
308719
|
+
case "ome-zarr": {
|
|
308720
|
+
const { coordinateTransformations: coordinateTransformationsFromOptions } = metadata2 || {};
|
|
308721
|
+
const root2 = await zarrOpenRoot(url, null, { requestInit: requestInit2 });
|
|
308722
|
+
const loader2 = await loadOmeZarr(root2);
|
|
308723
|
+
const { metadata: loaderMetadata } = loader2;
|
|
308724
|
+
const { omero, multiscales } = loaderMetadata;
|
|
308725
|
+
if (!Array.isArray(multiscales) || multiscales.length === 0) {
|
|
308726
|
+
throw new Error("Multiscales array must exist and have at least one element");
|
|
308727
|
+
}
|
|
308728
|
+
const { coordinateTransformations } = multiscales[0];
|
|
308729
|
+
const axes = getNgffAxes(multiscales[0].axes);
|
|
308730
|
+
const transformMatrixFromOptions = coordinateTransformationsToMatrix(coordinateTransformationsFromOptions, axes);
|
|
308731
|
+
const transformMatrixFromFile = coordinateTransformationsToMatrix(coordinateTransformations, axes);
|
|
308732
|
+
const transformMatrix = transformMatrixFromFile.multiplyLeft(transformMatrixFromOptions);
|
|
308733
|
+
const { channels: channels2, name: omeroName } = omero;
|
|
308734
|
+
return {
|
|
308735
|
+
name: omeroName || "Image",
|
|
308736
|
+
channels: channels2.map((c2, i2) => c2.label || `Channel ${i2}`),
|
|
308737
|
+
...transformMatrix ? { metadata: { transform: { matrix: transformMatrix } } } : {},
|
|
308738
|
+
...loader2
|
|
308739
|
+
};
|
|
308740
|
+
}
|
|
308741
|
+
default: {
|
|
308742
|
+
const errorMessage = `Image type (${type3}) is not supported`;
|
|
308743
|
+
log$f.error(errorMessage);
|
|
308744
|
+
throw new Error(errorMessage);
|
|
308745
|
+
}
|
|
308491
308746
|
}
|
|
308747
|
+
} catch (error2) {
|
|
308748
|
+
log$f.error("Error in initLoader:", error2);
|
|
308749
|
+
throw error2;
|
|
308492
308750
|
}
|
|
308493
308751
|
}
|
|
308494
308752
|
class RasterLoader extends JsonLoader {
|
|
@@ -308639,6 +308897,15 @@ function basename(path2) {
|
|
|
308639
308897
|
}
|
|
308640
308898
|
return result;
|
|
308641
308899
|
}
|
|
308900
|
+
function prependSlash(path2) {
|
|
308901
|
+
if (typeof path2 === "string" && path2.length >= 1) {
|
|
308902
|
+
if (path2.charAt(0) === "/") {
|
|
308903
|
+
return path2;
|
|
308904
|
+
}
|
|
308905
|
+
return `/${path2}`;
|
|
308906
|
+
}
|
|
308907
|
+
return path2;
|
|
308908
|
+
}
|
|
308642
308909
|
class AnnDataSource extends ZarrDataSource {
|
|
308643
308910
|
/**
|
|
308644
308911
|
*
|
|
@@ -308706,29 +308973,33 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308706
308973
|
}
|
|
308707
308974
|
/**
|
|
308708
308975
|
*
|
|
308709
|
-
* @param {string}
|
|
308976
|
+
* @param {string} pathOrig
|
|
308710
308977
|
* @returns
|
|
308711
308978
|
*/
|
|
308712
|
-
async _loadColumn(
|
|
308979
|
+
async _loadColumn(pathOrig) {
|
|
308713
308980
|
const { storeRoot } = this;
|
|
308714
|
-
const
|
|
308981
|
+
const path2 = prependSlash(pathOrig);
|
|
308982
|
+
const prefixOrig = dirname(path2);
|
|
308983
|
+
const prefix2 = prependSlash(prefixOrig);
|
|
308715
308984
|
const { categories, "encoding-type": encodingType } = await this.getJson(`${path2}/.zattrs`);
|
|
308716
308985
|
let categoriesValues;
|
|
308717
308986
|
let codesPath;
|
|
308718
308987
|
if (categories) {
|
|
308719
|
-
const { dtype } = await open$1(storeRoot.resolve(
|
|
308720
|
-
if (dtype === "v2:object") {
|
|
308721
|
-
categoriesValues = await this.getFlatArrDecompressed(
|
|
308988
|
+
const { dtype } = await open$1(storeRoot.resolve(`${prefix2}/${categories}`), { kind: "array" });
|
|
308989
|
+
if (dtype === "v2:object" || dtype === "|O") {
|
|
308990
|
+
categoriesValues = await this.getFlatArrDecompressed(`${prefix2}/${categories}`);
|
|
308722
308991
|
}
|
|
308723
308992
|
} else if (encodingType === "categorical") {
|
|
308724
|
-
const { dtype } = await open$1(storeRoot.resolve(
|
|
308725
|
-
if (dtype === "v2:object") {
|
|
308726
|
-
categoriesValues = await this.getFlatArrDecompressed(
|
|
308993
|
+
const { dtype } = await open$1(storeRoot.resolve(`${path2}/categories`), { kind: "array" });
|
|
308994
|
+
if (dtype === "v2:object" || dtype === "|O") {
|
|
308995
|
+
categoriesValues = await this.getFlatArrDecompressed(`${path2}/categories`);
|
|
308727
308996
|
}
|
|
308728
|
-
codesPath =
|
|
308997
|
+
codesPath = `${path2}/codes`;
|
|
308998
|
+
} else if (encodingType === "string-array") {
|
|
308999
|
+
return this.getFlatArrDecompressed(path2);
|
|
308729
309000
|
} else {
|
|
308730
|
-
const { dtype } = await open$1(storeRoot.resolve(
|
|
308731
|
-
if (dtype === "v2:object") {
|
|
309001
|
+
const { dtype } = await open$1(storeRoot.resolve(path2), { kind: "array" });
|
|
309002
|
+
if (dtype === "v2:object" || dtype === "|O") {
|
|
308732
309003
|
return this.getFlatArrDecompressed(path2);
|
|
308733
309004
|
}
|
|
308734
309005
|
}
|
|
@@ -308801,7 +309072,7 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308801
309072
|
if (this.obsIndex) {
|
|
308802
309073
|
return this.obsIndex;
|
|
308803
309074
|
}
|
|
308804
|
-
this.obsIndex = this.getJson("obs/.zattrs").then(({ _index }) => this.
|
|
309075
|
+
this.obsIndex = this.getJson("obs/.zattrs").then(({ _index }) => this._loadColumn(`/obs/${_index}`));
|
|
308805
309076
|
return this.obsIndex;
|
|
308806
309077
|
}
|
|
308807
309078
|
/**
|
|
@@ -308812,7 +309083,7 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308812
309083
|
*/
|
|
308813
309084
|
loadDataFrameIndex(path2 = void 0) {
|
|
308814
309085
|
const dfPath = path2 ? dirname(path2) : "";
|
|
308815
|
-
return this.getJson(`${dfPath}/.zattrs`).then(({ _index }) => this.
|
|
309086
|
+
return this.getJson(`${dfPath}/.zattrs`).then(({ _index }) => this._loadColumn(`${dfPath.length > 0 ? "/" : ""}${dfPath}/${_index}`));
|
|
308816
309087
|
}
|
|
308817
309088
|
/**
|
|
308818
309089
|
* Class method for loading the var index.
|
|
@@ -308823,7 +309094,7 @@ class AnnDataSource extends ZarrDataSource {
|
|
|
308823
309094
|
if (this.varIndex) {
|
|
308824
309095
|
return this.varIndex;
|
|
308825
309096
|
}
|
|
308826
|
-
this.varIndex = this.getJson("var/.zattrs").then(({ _index }) => this.
|
|
309097
|
+
this.varIndex = this.getJson("var/.zattrs").then(({ _index }) => this._loadColumn(`/var/${_index}`));
|
|
308827
309098
|
return this.varIndex;
|
|
308828
309099
|
}
|
|
308829
309100
|
/**
|
|
@@ -309613,6 +309884,11 @@ class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
309613
309884
|
}
|
|
309614
309885
|
}
|
|
309615
309886
|
class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
309887
|
+
constructor(dataSource, params2) {
|
|
309888
|
+
super(dataSource, params2);
|
|
309889
|
+
this.region = null;
|
|
309890
|
+
this.tablePath = null;
|
|
309891
|
+
}
|
|
309616
309892
|
loadObsIndices() {
|
|
309617
309893
|
const { options } = this;
|
|
309618
309894
|
const obsIndexPromises = options.obsSets?.map(({ path: path2 }) => path2).map((pathOrPaths) => {
|
|
@@ -309644,7 +309920,7 @@ class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
309644
309920
|
if (!this.cachedResult) {
|
|
309645
309921
|
const { options } = this;
|
|
309646
309922
|
this.cachedResult = Promise.all([
|
|
309647
|
-
this.dataSource.loadObsIndex(),
|
|
309923
|
+
this.dataSource.loadObsIndex(this.tablePath),
|
|
309648
309924
|
this.loadObsIndices(),
|
|
309649
309925
|
this.loadCellSetIds(),
|
|
309650
309926
|
this.loadCellSetScores()
|
|
@@ -309968,11 +310244,17 @@ let FeatureStatsAnndataLoader$1 = class FeatureStatsAnndataLoader extends Abstra
|
|
|
309968
310244
|
const rawSampleSetSelection = sampleSetSelection;
|
|
309969
310245
|
if (sampleSetSelection) {
|
|
309970
310246
|
if (sampleSetSelection.length !== 2) {
|
|
309971
|
-
|
|
310247
|
+
if (getDebugMode()) {
|
|
310248
|
+
return Promise.reject(new Error("Expected exactly two sample sets for volcano plot."));
|
|
310249
|
+
}
|
|
310250
|
+
return null;
|
|
309972
310251
|
}
|
|
309973
310252
|
}
|
|
309974
310253
|
if (!obsSetSelection) {
|
|
309975
|
-
|
|
310254
|
+
if (getDebugMode()) {
|
|
310255
|
+
return Promise.reject(new Error("Expected obsSetSelection to be present."));
|
|
310256
|
+
}
|
|
310257
|
+
return null;
|
|
309976
310258
|
}
|
|
309977
310259
|
const metadata2 = await this.loadMetadata();
|
|
309978
310260
|
const matchingComparisons = [];
|
|
@@ -310045,9 +310327,21 @@ class FeatureStatsAnndataLoader2 extends AbstractTwoStepLoader {
|
|
|
310045
310327
|
this.loadFeatureSetTerms(dfPath),
|
|
310046
310328
|
this.loadSignificances(dfPath)
|
|
310047
310329
|
]);
|
|
310330
|
+
const cleanName = (s2) => {
|
|
310331
|
+
if (s2.includes("R-HSA-")) {
|
|
310332
|
+
return s2.substring(0, s2.indexOf("R-HSA-") - 1);
|
|
310333
|
+
}
|
|
310334
|
+
return s2;
|
|
310335
|
+
};
|
|
310336
|
+
const cleanTerm = (s2) => {
|
|
310337
|
+
if (s2.includes("R-HSA-")) {
|
|
310338
|
+
return `REACTOME:${s2.substring(s2.indexOf("R-HSA-"))}`;
|
|
310339
|
+
}
|
|
310340
|
+
return s2;
|
|
310341
|
+
};
|
|
310048
310342
|
return {
|
|
310049
|
-
featureSetName,
|
|
310050
|
-
featureSetTerm,
|
|
310343
|
+
featureSetName: featureSetName.map((s2) => cleanName(s2)),
|
|
310344
|
+
featureSetTerm: featureSetTerm.map((s2) => cleanTerm(s2)),
|
|
310051
310345
|
featureSetSignificance
|
|
310052
310346
|
};
|
|
310053
310347
|
}
|
|
@@ -310076,17 +310370,23 @@ class FeatureStatsAnndataLoader2 extends AbstractTwoStepLoader {
|
|
|
310076
310370
|
* @returns {Promise<LoaderResult<FeatureStatsData>>}
|
|
310077
310371
|
*/
|
|
310078
310372
|
async loadMulti(volcanoOptions) {
|
|
310079
|
-
const { analysisType: targetAnalysisType = "pertpy_hypergeometric" } = this.options;
|
|
310373
|
+
const { analysisType: targetAnalysisType = "pertpy_hypergeometric", featureSetLibrary: targetFeatureSetLibrary = "Reactome_2022" } = this.options;
|
|
310080
310374
|
const { sampleSetSelection, obsSetSelection } = volcanoOptions || {};
|
|
310081
310375
|
const rawObsSetSelection = obsSetSelection;
|
|
310082
310376
|
const rawSampleSetSelection = sampleSetSelection;
|
|
310083
310377
|
if (sampleSetSelection) {
|
|
310084
310378
|
if (sampleSetSelection.length !== 2) {
|
|
310085
|
-
|
|
310379
|
+
if (getDebugMode()) {
|
|
310380
|
+
return Promise.reject(new Error("Expected exactly two sample sets for volcano plot."));
|
|
310381
|
+
}
|
|
310382
|
+
return null;
|
|
310086
310383
|
}
|
|
310087
310384
|
}
|
|
310088
310385
|
if (!obsSetSelection) {
|
|
310089
|
-
|
|
310386
|
+
if (getDebugMode()) {
|
|
310387
|
+
return Promise.reject(new Error("Expected obsSetSelection to be present."));
|
|
310388
|
+
}
|
|
310389
|
+
return null;
|
|
310090
310390
|
}
|
|
310091
310391
|
const metadata2 = await this.loadMetadata();
|
|
310092
310392
|
const matchingComparisons = [];
|
|
@@ -310095,11 +310395,11 @@ class FeatureStatsAnndataLoader2 extends AbstractTwoStepLoader {
|
|
|
310095
310395
|
results.forEach((resultObject) => {
|
|
310096
310396
|
const {
|
|
310097
310397
|
analysis_type,
|
|
310098
|
-
|
|
310398
|
+
analysis_params,
|
|
310099
310399
|
coordination_values
|
|
310100
310400
|
// path,
|
|
310101
310401
|
} = resultObject;
|
|
310102
|
-
if (analysis_type === targetAnalysisType) {
|
|
310402
|
+
if (analysis_type === targetAnalysisType && analysis_params?.pertpy_hypergeometric?.enrichr_library_name === targetFeatureSetLibrary) {
|
|
310103
310403
|
if (sampleSetSelection) {
|
|
310104
310404
|
rawObsSetSelection.forEach((obsSetPath2) => {
|
|
310105
310405
|
if (isEqual$5([obsSetPath2], coordination_values.obsSetFilter)) {
|
|
@@ -310172,10 +310472,6 @@ class ObsSetStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
310172
310472
|
}
|
|
310173
310473
|
return values3.data;
|
|
310174
310474
|
}
|
|
310175
|
-
async loadCovariate(dfPath) {
|
|
310176
|
-
const { covariateColumn } = this.options;
|
|
310177
|
-
return this.dataSource._loadColumn(`${dfPath}/${covariateColumn}`);
|
|
310178
|
-
}
|
|
310179
310475
|
async loadObsSetNames(dfPath) {
|
|
310180
310476
|
const { indexColumn } = this.options;
|
|
310181
310477
|
if (indexColumn) {
|
|
@@ -310189,28 +310485,23 @@ class ObsSetStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
310189
310485
|
obsSetFoldChange,
|
|
310190
310486
|
interceptExpectedSample,
|
|
310191
310487
|
effectExpectedSample,
|
|
310192
|
-
isCredibleEffect
|
|
310488
|
+
isCredibleEffect
|
|
310193
310489
|
// TODO: rather than passing this down,
|
|
310194
310490
|
// do the fold change direction swapping in the loader
|
|
310195
310491
|
// (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
310492
|
] = await Promise.all([
|
|
310200
310493
|
this.loadObsSetNames(dfPath),
|
|
310201
310494
|
this.loadFoldChanges(dfPath),
|
|
310202
310495
|
this.loadInterceptValues(dfPath),
|
|
310203
310496
|
this.loadEffectValues(dfPath),
|
|
310204
|
-
this.loadIsCredible(dfPath)
|
|
310205
|
-
this.loadCovariate(dfPath)
|
|
310497
|
+
this.loadIsCredible(dfPath)
|
|
310206
310498
|
]);
|
|
310207
310499
|
return {
|
|
310208
310500
|
obsSetId,
|
|
310209
310501
|
obsSetFoldChange,
|
|
310210
310502
|
interceptExpectedSample,
|
|
310211
310503
|
effectExpectedSample,
|
|
310212
|
-
isCredibleEffect
|
|
310213
|
-
covariate
|
|
310504
|
+
isCredibleEffect
|
|
310214
310505
|
};
|
|
310215
310506
|
}
|
|
310216
310507
|
/**
|
|
@@ -310243,10 +310534,16 @@ class ObsSetStatsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
310243
310534
|
const rawObsSetSelection = obsSetSelection;
|
|
310244
310535
|
const rawSampleSetSelection = sampleSetSelection;
|
|
310245
310536
|
if (!sampleSetSelection || sampleSetSelection?.length !== 2) {
|
|
310246
|
-
|
|
310537
|
+
if (getDebugMode()) {
|
|
310538
|
+
return Promise.reject(new Error("Expected exactly two sample sets for cell type composition analysis plot."));
|
|
310539
|
+
}
|
|
310540
|
+
return null;
|
|
310247
310541
|
}
|
|
310248
310542
|
if (!obsSetSelection) {
|
|
310249
|
-
|
|
310543
|
+
if (getDebugMode()) {
|
|
310544
|
+
return Promise.reject(new Error("Expected obsSetSelection to be present."));
|
|
310545
|
+
}
|
|
310546
|
+
return null;
|
|
310250
310547
|
}
|
|
310251
310548
|
const metadata2 = await this.loadMetadata();
|
|
310252
310549
|
const rawObsSetGroups = Array.from(new Set(rawObsSetSelection.map((setPath) => setPath?.[0])));
|
|
@@ -310950,18 +311247,19 @@ class SpatialDataObsSetsLoader extends ObsSetsAnndataLoader {
|
|
|
310950
311247
|
constructor(dataSource, params2) {
|
|
310951
311248
|
super(dataSource, params2);
|
|
310952
311249
|
this.region = this.options.region;
|
|
311250
|
+
this.tablePath = this.options.tablePath;
|
|
310953
311251
|
}
|
|
310954
311252
|
}
|
|
310955
|
-
const pluralRegex = /^tables\/([^/]*)
|
|
310956
|
-
const singularRegex = /^table\/([^/]*)
|
|
311253
|
+
const pluralRegex = /^tables\/([^/]*)(\/?)(.*)$/;
|
|
311254
|
+
const singularRegex = /^table\/([^/]*)(\/?)(.*)$/;
|
|
310957
311255
|
function getTablePrefix(arrPath) {
|
|
310958
311256
|
if (arrPath) {
|
|
310959
311257
|
const pluralMatches = arrPath.match(pluralRegex);
|
|
310960
|
-
if (pluralMatches && pluralMatches.length
|
|
311258
|
+
if (pluralMatches && pluralMatches.length >= 3) {
|
|
310961
311259
|
return `tables/${pluralMatches[1]}/`;
|
|
310962
311260
|
}
|
|
310963
311261
|
const singularMatches = arrPath.match(singularRegex);
|
|
310964
|
-
if (singularMatches && singularMatches.length
|
|
311262
|
+
if (singularMatches && singularMatches.length >= 3) {
|
|
310965
311263
|
return `table/${singularMatches[1]}/`;
|
|
310966
311264
|
}
|
|
310967
311265
|
}
|
|
@@ -363544,7 +363842,7 @@ function loadPathwayNodes() {
|
|
|
363544
363842
|
kgId: d.id,
|
|
363545
363843
|
label: d.pathway,
|
|
363546
363844
|
// For reactome
|
|
363547
|
-
term: `
|
|
363845
|
+
term: `REACTOME:${d.acc}`,
|
|
363548
363846
|
// For reactome
|
|
363549
363847
|
// label: d.ontology_label, // For GO_BP
|
|
363550
363848
|
// term: d.acc, // For GO_BP
|
|
@@ -363610,7 +363908,10 @@ async function loadPathwayToGeneEdges() {
|
|
|
363610
363908
|
}));
|
|
363611
363909
|
});
|
|
363612
363910
|
}
|
|
363613
|
-
async function transformFeature({ queryClient },
|
|
363911
|
+
async function transformFeature({ queryClient }, nodeOrig, targetModality) {
|
|
363912
|
+
const node2 = {
|
|
363913
|
+
...nodeOrig
|
|
363914
|
+
};
|
|
363614
363915
|
if (targetModality === node2.nodeType) {
|
|
363615
363916
|
return [node2];
|
|
363616
363917
|
}
|
|
@@ -363626,6 +363927,19 @@ async function transformFeature({ queryClient }, node2, targetModality) {
|
|
|
363626
363927
|
staleTime: Infinity,
|
|
363627
363928
|
queryFn: loadPathwayToGeneEdges
|
|
363628
363929
|
});
|
|
363930
|
+
if (!node2.kgId) {
|
|
363931
|
+
const pathwayNodes = await queryClient.fetchQuery({
|
|
363932
|
+
queryKey: ["pathwayNodes"],
|
|
363933
|
+
staleTime: Infinity,
|
|
363934
|
+
queryFn: loadPathwayNodes
|
|
363935
|
+
});
|
|
363936
|
+
const foundId = pathwayNodes.find((n3) => n3.term === node2.term)?.kgId;
|
|
363937
|
+
if (foundId) {
|
|
363938
|
+
node2.kgId = foundId;
|
|
363939
|
+
} else {
|
|
363940
|
+
console.warn("Could not find matching pathway node based on term.");
|
|
363941
|
+
}
|
|
363942
|
+
}
|
|
363629
363943
|
const matchingEdges = pathwayGeneEdges.filter((d) => d.source === node2.kgId);
|
|
363630
363944
|
const matchingGeneIds = matchingEdges.map((d) => d.target);
|
|
363631
363945
|
const matchingGenes = geneNodes.filter((d) => matchingGeneIds.includes(d.kgId));
|
|
@@ -364455,6 +364769,17 @@ const baseCoordinationTypes = [
|
|
|
364455
364769
|
new PluginCoordinationType(CoordinationType$2.FEATURE_FILTER, null, z.array(z.string()).nullable()),
|
|
364456
364770
|
new PluginCoordinationType(CoordinationType$2.FEATURE_HIGHLIGHT, null, z.string().nullable()),
|
|
364457
364771
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SELECTION, null, z.array(z.string()).nullable()),
|
|
364772
|
+
new PluginCoordinationType(CoordinationType$2.FEATURE_AGGREGATION_STRATEGY, null, z.union([
|
|
364773
|
+
z.enum([
|
|
364774
|
+
"first",
|
|
364775
|
+
"last",
|
|
364776
|
+
"mean",
|
|
364777
|
+
"sum",
|
|
364778
|
+
"difference"
|
|
364779
|
+
]),
|
|
364780
|
+
// An index of a featureSelection array element.
|
|
364781
|
+
z.number()
|
|
364782
|
+
]).nullable()),
|
|
364458
364783
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SET_SELECTION, null, z.array(obsSetPath).nullable()),
|
|
364459
364784
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SELECTION_MODE, null, z.enum(["featureSelection", "featureSetSelection"]).nullable()),
|
|
364460
364785
|
new PluginCoordinationType(CoordinationType$2.FEATURE_SET_FILTER, null, z.array(obsSetPath).nullable()),
|