@vitessce/sets-utils 3.1.2 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +87 -5
- package/dist-tsc/cell-set-utils.d.ts +13 -0
- package/dist-tsc/cell-set-utils.d.ts.map +1 -1
- package/dist-tsc/cell-set-utils.js +30 -0
- package/dist-tsc/index.d.ts +1 -1
- package/dist-tsc/index.js +1 -1
- package/package.json +3 -3
- package/src/cell-set-utils.js +31 -0
- package/src/index.js +1 -0
package/dist/index.js
CHANGED
|
@@ -9004,8 +9004,10 @@ const ViewType$1 = {
|
|
|
9004
9004
|
STATUS: "status",
|
|
9005
9005
|
SCATTERPLOT: "scatterplot",
|
|
9006
9006
|
SPATIAL: "spatial",
|
|
9007
|
+
SPATIAL_BETA: "spatialBeta",
|
|
9007
9008
|
HEATMAP: "heatmap",
|
|
9008
9009
|
LAYER_CONTROLLER: "layerController",
|
|
9010
|
+
LAYER_CONTROLLER_BETA: "layerControllerBeta",
|
|
9009
9011
|
GENOMIC_PROFILES: "genomicProfiles",
|
|
9010
9012
|
GATING: "gating",
|
|
9011
9013
|
FEATURE_LIST: "featureList",
|
|
@@ -9017,20 +9019,24 @@ const ViewType$1 = {
|
|
|
9017
9019
|
const DataType$1 = {
|
|
9018
9020
|
OBS_LABELS: "obsLabels",
|
|
9019
9021
|
OBS_EMBEDDING: "obsEmbedding",
|
|
9020
|
-
OBS_LOCATIONS: "obsLocations",
|
|
9021
9022
|
OBS_FEATURE_MATRIX: "obsFeatureMatrix",
|
|
9022
9023
|
OBS_SETS: "obsSets",
|
|
9023
9024
|
FEATURE_LABELS: "featureLabels",
|
|
9024
9025
|
IMAGE: "image",
|
|
9025
9026
|
OBS_SEGMENTATIONS: "obsSegmentations",
|
|
9026
9027
|
NEIGHBORHOODS: "neighborhoods",
|
|
9027
|
-
GENOMIC_PROFILES: "genomic-profiles"
|
|
9028
|
+
GENOMIC_PROFILES: "genomic-profiles",
|
|
9029
|
+
OBS_SPOTS: "obsSpots",
|
|
9030
|
+
OBS_POINTS: "obsPoints",
|
|
9031
|
+
OBS_LOCATIONS: "obsLocations"
|
|
9028
9032
|
};
|
|
9029
9033
|
const FileType$1 = {
|
|
9030
9034
|
// Joint file types
|
|
9031
9035
|
ANNDATA_ZARR: "anndata.zarr",
|
|
9032
9036
|
// Atomic file types
|
|
9033
9037
|
OBS_EMBEDDING_CSV: "obsEmbedding.csv",
|
|
9038
|
+
OBS_SPOTS_CSV: "obsSpots.csv",
|
|
9039
|
+
OBS_POINTS_CSV: "obsPoints.csv",
|
|
9034
9040
|
OBS_LOCATIONS_CSV: "obsLocations.csv",
|
|
9035
9041
|
OBS_LABELS_CSV: "obsLabels.csv",
|
|
9036
9042
|
FEATURE_LABELS_CSV: "featureLabels.csv",
|
|
@@ -9043,6 +9049,8 @@ const FileType$1 = {
|
|
|
9043
9049
|
OBS_FEATURE_MATRIX_ANNDATA_ZARR: "obsFeatureMatrix.anndata.zarr",
|
|
9044
9050
|
OBS_SETS_ANNDATA_ZARR: "obsSets.anndata.zarr",
|
|
9045
9051
|
OBS_EMBEDDING_ANNDATA_ZARR: "obsEmbedding.anndata.zarr",
|
|
9052
|
+
OBS_SPOTS_ANNDATA_ZARR: "obsSpots.anndata.zarr",
|
|
9053
|
+
OBS_POINTS_ANNDATA_ZARR: "obsPoints.anndata.zarr",
|
|
9046
9054
|
OBS_LOCATIONS_ANNDATA_ZARR: "obsLocations.anndata.zarr",
|
|
9047
9055
|
OBS_SEGMENTATIONS_ANNDATA_ZARR: "obsSegmentations.anndata.zarr",
|
|
9048
9056
|
OBS_LABELS_ANNDATA_ZARR: "obsLabels.anndata.zarr",
|
|
@@ -9051,6 +9059,8 @@ const FileType$1 = {
|
|
|
9051
9059
|
OBS_FEATURE_MATRIX_MUDATA_ZARR: "obsFeatureMatrix.mudata.zarr",
|
|
9052
9060
|
OBS_SETS_MUDATA_ZARR: "obsSets.mudata.zarr",
|
|
9053
9061
|
OBS_EMBEDDING_MUDATA_ZARR: "obsEmbedding.mudata.zarr",
|
|
9062
|
+
OBS_SPOTS_MUDATA_ZARR: "obsSpots.mudata.zarr",
|
|
9063
|
+
OBS_POINTS_MUDATA_ZARR: "obsPoints.mudata.zarr",
|
|
9054
9064
|
OBS_LOCATIONS_MUDATA_ZARR: "obsLocations.mudata.zarr",
|
|
9055
9065
|
OBS_SEGMENTATIONS_MUDATA_ZARR: "obsSegmentations.mudata.zarr",
|
|
9056
9066
|
OBS_LABELS_MUDATA_ZARR: "obsLabels.mudata.zarr",
|
|
@@ -9094,10 +9104,8 @@ const FileType$1 = {
|
|
|
9094
9104
|
ANNDATA_EXPRESSION_MATRIX_ZARR: "anndata-expression-matrix.zarr"
|
|
9095
9105
|
};
|
|
9096
9106
|
const CoordinationType$1 = {
|
|
9097
|
-
// Meta coordination scopes
|
|
9098
9107
|
META_COORDINATION_SCOPES: "metaCoordinationScopes",
|
|
9099
9108
|
META_COORDINATION_SCOPES_BY: "metaCoordinationScopesBy",
|
|
9100
|
-
// Other coordination scopes
|
|
9101
9109
|
DATASET: "dataset",
|
|
9102
9110
|
// Entity types
|
|
9103
9111
|
OBS_TYPE: "obsType",
|
|
@@ -9123,6 +9131,7 @@ const CoordinationType$1 = {
|
|
|
9123
9131
|
SPATIAL_TARGET_X: "spatialTargetX",
|
|
9124
9132
|
SPATIAL_TARGET_Y: "spatialTargetY",
|
|
9125
9133
|
SPATIAL_TARGET_Z: "spatialTargetZ",
|
|
9134
|
+
SPATIAL_TARGET_T: "spatialTargetT",
|
|
9126
9135
|
SPATIAL_ROTATION_X: "spatialRotationX",
|
|
9127
9136
|
SPATIAL_ROTATION_Y: "spatialRotationY",
|
|
9128
9137
|
SPATIAL_ROTATION_Z: "spatialRotationZ",
|
|
@@ -9160,7 +9169,46 @@ const CoordinationType$1 = {
|
|
|
9160
9169
|
GATING_FEATURE_SELECTION_X: "gatingFeatureSelectionX",
|
|
9161
9170
|
GATING_FEATURE_SELECTION_Y: "gatingFeatureSelectionY",
|
|
9162
9171
|
FEATURE_VALUE_TRANSFORM_COEFFICIENT: "featureValueTransformCoefficient",
|
|
9163
|
-
TOOLTIPS_VISIBLE: "tooltipsVisible"
|
|
9172
|
+
TOOLTIPS_VISIBLE: "tooltipsVisible",
|
|
9173
|
+
FILE_UID: "fileUid",
|
|
9174
|
+
IMAGE_LAYER: "imageLayer",
|
|
9175
|
+
IMAGE_CHANNEL: "imageChannel",
|
|
9176
|
+
SEGMENTATION_LAYER: "segmentationLayer",
|
|
9177
|
+
SEGMENTATION_CHANNEL: "segmentationChannel",
|
|
9178
|
+
SPATIAL_TARGET_C: "spatialTargetC",
|
|
9179
|
+
SPATIAL_LAYER_VISIBLE: "spatialLayerVisible",
|
|
9180
|
+
SPATIAL_LAYER_OPACITY: "spatialLayerOpacity",
|
|
9181
|
+
SPATIAL_LAYER_COLORMAP: "spatialLayerColormap",
|
|
9182
|
+
SPATIAL_LAYER_TRANSPARENT_COLOR: "spatialLayerTransparentColor",
|
|
9183
|
+
SPATIAL_LAYER_MODEL_MATRIX: "spatialLayerModelMatrix",
|
|
9184
|
+
SPATIAL_SEGMENTATION_FILLED: "spatialSegmentationFilled",
|
|
9185
|
+
SPATIAL_SEGMENTATION_STROKE_WIDTH: "spatialSegmentationStrokeWidth",
|
|
9186
|
+
SPATIAL_CHANNEL_COLOR: "spatialChannelColor",
|
|
9187
|
+
SPATIAL_CHANNEL_VISIBLE: "spatialChannelVisible",
|
|
9188
|
+
SPATIAL_CHANNEL_OPACITY: "spatialChannelOpacity",
|
|
9189
|
+
SPATIAL_CHANNEL_WINDOW: "spatialChannelWindow",
|
|
9190
|
+
PHOTOMETRIC_INTERPRETATION: "photometricInterpretation",
|
|
9191
|
+
// For 3D volume rendering
|
|
9192
|
+
SPATIAL_RENDERING_MODE: "spatialRenderingMode",
|
|
9193
|
+
VOLUMETRIC_RENDERING_ALGORITHM: "volumetricRenderingAlgorithm",
|
|
9194
|
+
SPATIAL_TARGET_RESOLUTION: "spatialTargetResolution",
|
|
9195
|
+
// For clipping plane sliders
|
|
9196
|
+
SPATIAL_SLICE_X: "spatialSliceX",
|
|
9197
|
+
SPATIAL_SLICE_Y: "spatialSliceY",
|
|
9198
|
+
SPATIAL_SLICE_Z: "spatialSliceZ",
|
|
9199
|
+
// For spatial spot and point layers
|
|
9200
|
+
SPOT_LAYER: "spotLayer",
|
|
9201
|
+
POINT_LAYER: "pointLayer",
|
|
9202
|
+
SPATIAL_SPOT_RADIUS: "spatialSpotRadius",
|
|
9203
|
+
SPATIAL_SPOT_FILLED: "spatialSpotFilled",
|
|
9204
|
+
SPATIAL_SPOT_STROKE_WIDTH: "spatialSpotStrokeWidth",
|
|
9205
|
+
SPATIAL_LAYER_COLOR: "spatialLayerColor",
|
|
9206
|
+
PIXEL_HIGHLIGHT: "pixelHighlight",
|
|
9207
|
+
TOOLTIP_CROSSHAIRS_VISIBLE: "tooltipCrosshairsVisible",
|
|
9208
|
+
LEGEND_VISIBLE: "legendVisible",
|
|
9209
|
+
SPATIAL_CHANNEL_LABELS_VISIBLE: "spatialChannelLabelsVisible",
|
|
9210
|
+
SPATIAL_CHANNEL_LABELS_ORIENTATION: "spatialChannelLabelsOrientation",
|
|
9211
|
+
SPATIAL_CHANNEL_LABEL_SIZE: "spatialChannelLabelSize"
|
|
9164
9212
|
};
|
|
9165
9213
|
const ViewType = {
|
|
9166
9214
|
GENES: [
|
|
@@ -9421,6 +9469,8 @@ const annDataObsSets = z.array(z.object({
|
|
|
9421
9469
|
]),
|
|
9422
9470
|
scorePath: z.string().optional().describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'")
|
|
9423
9471
|
}));
|
|
9472
|
+
const annDataObsSpots = annDataObsm;
|
|
9473
|
+
const annDataObsPoints = annDataObsm;
|
|
9424
9474
|
const annDataObsLocations = annDataObsm;
|
|
9425
9475
|
const annDataObsEmbedding = annDataObsm;
|
|
9426
9476
|
const annDataObsSegmentations = annDataObs;
|
|
@@ -9447,10 +9497,21 @@ z.object({
|
|
|
9447
9497
|
z.object({
|
|
9448
9498
|
obsIndex: z.string(),
|
|
9449
9499
|
obsEmbedding: z.array(z.string()).length(2)
|
|
9500
|
+
// TODO: support 3D?
|
|
9501
|
+
});
|
|
9502
|
+
z.object({
|
|
9503
|
+
obsIndex: z.string(),
|
|
9504
|
+
obsSpots: z.array(z.string()).length(2)
|
|
9505
|
+
// TODO: support 3D?
|
|
9506
|
+
});
|
|
9507
|
+
z.object({
|
|
9508
|
+
obsIndex: z.string(),
|
|
9509
|
+
obsPoints: z.array(z.string()).length(3)
|
|
9450
9510
|
});
|
|
9451
9511
|
z.object({
|
|
9452
9512
|
obsIndex: z.string(),
|
|
9453
9513
|
obsLocations: z.array(z.string()).length(2)
|
|
9514
|
+
// TODO: support 3D?
|
|
9454
9515
|
});
|
|
9455
9516
|
z.object({
|
|
9456
9517
|
obsIndex: z.string(),
|
|
@@ -9482,6 +9543,8 @@ z.object({
|
|
|
9482
9543
|
]),
|
|
9483
9544
|
obsFeatureMatrix: annDataObsFeatureMatrix,
|
|
9484
9545
|
obsSets: annDataObsSets,
|
|
9546
|
+
obsSpots: annDataObsSpots,
|
|
9547
|
+
obsPoints: annDataObsPoints,
|
|
9485
9548
|
obsLocations: annDataObsLocations,
|
|
9486
9549
|
obsSegmentations: annDataObsSegmentations,
|
|
9487
9550
|
obsEmbedding: z.union([
|
|
@@ -16551,6 +16614,24 @@ function treeToCellColorsBySetNames(currTree, selectedNamePaths, cellSetColor, t
|
|
|
16551
16614
|
});
|
|
16552
16615
|
return new Map(cellColorsArray);
|
|
16553
16616
|
}
|
|
16617
|
+
function treeToCellSetColorIndicesBySetNames(currTree, selectedNamePaths, cellSetColor) {
|
|
16618
|
+
let cellColorsArray = [];
|
|
16619
|
+
selectedNamePaths == null ? void 0 : selectedNamePaths.forEach((setNamePath) => {
|
|
16620
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
16621
|
+
if (node) {
|
|
16622
|
+
const nodeSet = nodeToSet(node);
|
|
16623
|
+
const nodeColorIndex = cellSetColor == null ? void 0 : cellSetColor.findIndex((d) => isEqual(d.path, setNamePath));
|
|
16624
|
+
cellColorsArray = [
|
|
16625
|
+
...cellColorsArray,
|
|
16626
|
+
...nodeSet.map(([cellId]) => [
|
|
16627
|
+
cellId,
|
|
16628
|
+
nodeColorIndex
|
|
16629
|
+
])
|
|
16630
|
+
];
|
|
16631
|
+
}
|
|
16632
|
+
});
|
|
16633
|
+
return new Map(cellColorsArray);
|
|
16634
|
+
}
|
|
16554
16635
|
function treeToObjectsBySetNames(currTree, selectedNamePaths, setColor, theme) {
|
|
16555
16636
|
var _a;
|
|
16556
16637
|
let cellsArray = [];
|
|
@@ -17048,6 +17129,7 @@ export {
|
|
|
17048
17129
|
treeFindNodeByNamePath,
|
|
17049
17130
|
treeInitialize,
|
|
17050
17131
|
treeToCellColorsBySetNames,
|
|
17132
|
+
treeToCellSetColorIndicesBySetNames,
|
|
17051
17133
|
treeToComplement,
|
|
17052
17134
|
treeToExpectedCheckedLevel,
|
|
17053
17135
|
treeToIntersection,
|
|
@@ -158,6 +158,19 @@ export function nodeToRenderProps(node: object, path: any, cellSetColor: any): o
|
|
|
158
158
|
* and cellColors is an object mapping cellIds to color [r,g,b] arrays.
|
|
159
159
|
*/
|
|
160
160
|
export function treeToCellColorsBySetNames(currTree: object, selectedNamePaths: array, cellSetColor: object[], theme: string): array;
|
|
161
|
+
/**
|
|
162
|
+
* Given a tree with state, get a mapping from cell ID to cell set color index,
|
|
163
|
+
* based on the nodes currently marked as "visible".
|
|
164
|
+
* @param {object} currTree A tree object.
|
|
165
|
+
* @param {array} selectedNamePaths Array of arrays of strings,
|
|
166
|
+
* representing set "paths".
|
|
167
|
+
* @param {object[]} cellSetColor Array of objects with the
|
|
168
|
+
* properties `path` and `color`.
|
|
169
|
+
* @returns {array} Tuple of [cellIds, cellColors]
|
|
170
|
+
* where cellIds is an array of strings,
|
|
171
|
+
* and cellColors is an object mapping cellIds to color [r,g,b] arrays.
|
|
172
|
+
*/
|
|
173
|
+
export function treeToCellSetColorIndicesBySetNames(currTree: object, selectedNamePaths: array, cellSetColor: object[]): array;
|
|
161
174
|
/**
|
|
162
175
|
* Given a tree with state, get an array of
|
|
163
176
|
* objects with cellIds and cellColors,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cell-set-utils.d.ts","sourceRoot":"","sources":["../src/cell-set-utils.js"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH,oCAHW,MAAM,SAWhB;AAED;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,MAAM,CAUlB;AA2BD;;;;;GAKG;AACH,iDAJW,MAAM,kBACN,MAAM,EAAE,GACN,MAAM,GAAC,IAAI,CAUvB;AAED;;;;;;;;;;;GAWG;AACH,oCAVW,MAAM,qFAQJ,MAAM,CAwBlB;AAED;;;;;;;;;;;GAWG;AACH,uCAVW,MAAM,qFAQJ,MAAM,CAyBlB;AAED;;;;;GAKG;AACH,0CAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;GAKG;AACH,2CAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,oCAGJ,MAAM,CASlB;AAED;;;;GAIG;AACH,sCAHW,MAAM,4BAQhB;AAED;;;;GAIG;AACH,6CAHW,MAAM,4BAQhB;AAED;;;;;GAKG;AACH,2CAJW,MAAM,wCAOhB;AAED;;;;;;;;;GASG;AACH,qDAPW,MAAM,SACN,MAAM,6BAEN,OAAO,GACL,MAAM,EAAE,CAgBpB;AAED;;;;GAIG;AACH,qCAHW,MAAM,kBACJ,MAAM,CAQlB;AAED;;;;;;;;;;GAUG;AACH,kDARW,MAAM,YACN,MAAM,8CAGN,MAAM,GACJ,MAAM,CAqBlB;AAED;;;;;GAKG;AACH,wCAJW,MAAM,kBAEJ,MAAM,CAKlB;AAED;;;;GAIG;AACH,yCAHW,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;GAMG;AACH,wCAJW,MAAM,iCACJ,MAAM,CAelB;AAoBD;;;;;;;;;;;;GAYG;AACH,qDAVW,MAAM,0CAGN,MAAM,EAAE,SAER,MAAM,SAyBhB;AAED;;;;;;;;;;;;GAYG;AACH,kDATW,MAAM,sCAGN,MAAM,EAAE,SAER,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED,4JA2CC;AAED;;;;;;;;;;;;;GAaG;AACH,mDAXW,MAAM,2DAIN,MAAM,EAAE,SAER,MAAM,GACJ,MAAM,EAAE,CAuCpB;AAED;;;;;;GAMG;AACH,iCALW,MAAM,uCAGJ,MAAM,CAelB;AAED,mFAgBC;AAED,yEA2BC;AAED,gFA6BC;AAED,uDAeC;AAED,kEA0BC"}
|
|
1
|
+
{"version":3,"file":"cell-set-utils.d.ts","sourceRoot":"","sources":["../src/cell-set-utils.js"],"names":[],"mappings":"AAoBA;;;;;GAKG;AACH,oCAHW,MAAM,SAWhB;AAED;;;;;;GAMG;AACH,uCALW,MAAM,UACN,MAAM,GACJ,MAAM,CAUlB;AAED;;;;;GAKG;AACH,wCAHW,MAAM,GACJ,MAAM,CAUlB;AA2BD;;;;;GAKG;AACH,iDAJW,MAAM,kBACN,MAAM,EAAE,GACN,MAAM,GAAC,IAAI,CAUvB;AAED;;;;;;;;;;;GAWG;AACH,oCAVW,MAAM,qFAQJ,MAAM,CAwBlB;AAED;;;;;;;;;;;GAWG;AACH,uCAVW,MAAM,qFAQJ,MAAM,CAyBlB;AAED;;;;;GAKG;AACH,0CAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;GAKG;AACH,2CAJW,MAAM,YACN,MAAM,GACJ,MAAM,CAOlB;AAED;;;;;;GAMG;AACH,0CALW,MAAM,oCAGJ,MAAM,CASlB;AAED;;;;GAIG;AACH,sCAHW,MAAM,4BAQhB;AAED;;;;GAIG;AACH,6CAHW,MAAM,4BAQhB;AAED;;;;;GAKG;AACH,2CAJW,MAAM,wCAOhB;AAED;;;;;;;;;GASG;AACH,qDAPW,MAAM,SACN,MAAM,6BAEN,OAAO,GACL,MAAM,EAAE,CAgBpB;AAED;;;;GAIG;AACH,qCAHW,MAAM,kBACJ,MAAM,CAQlB;AAED;;;;;;;;;;GAUG;AACH,kDARW,MAAM,YACN,MAAM,8CAGN,MAAM,GACJ,MAAM,CAqBlB;AAED;;;;;GAKG;AACH,wCAJW,MAAM,kBAEJ,MAAM,CAKlB;AAED;;;;GAIG;AACH,yCAHW,MAAM,GACJ,MAAM,CAQlB;AAED;;;;;;GAMG;AACH,wCAJW,MAAM,iCACJ,MAAM,CAelB;AAoBD;;;;;;;;;;;;GAYG;AACH,qDAVW,MAAM,0CAGN,MAAM,EAAE,SAER,MAAM,SAyBhB;AAED;;;;;;;;;;;GAWG;AACH,8DATW,MAAM,0CAGN,MAAM,EAAE,SAuBlB;AAED;;;;;;;;;;;;GAYG;AACH,kDATW,MAAM,sCAGN,MAAM,EAAE,SAER,MAAM,GACJ,MAAM,EAAE,CAsBpB;AAED,4JA2CC;AAED;;;;;;;;;;;;;GAaG;AACH,mDAXW,MAAM,2DAIN,MAAM,EAAE,SAER,MAAM,GACJ,MAAM,EAAE,CAuCpB;AAED;;;;;;GAMG;AACH,iCALW,MAAM,uCAGJ,MAAM,CAelB;AAED,mFAgBC;AAED,yEA2BC;AAED,gFA6BC;AAED,uDAeC;AAED,kEA0BC"}
|
|
@@ -391,6 +391,36 @@ export function treeToCellColorsBySetNames(currTree, selectedNamePaths, cellSetC
|
|
|
391
391
|
});
|
|
392
392
|
return new Map(cellColorsArray);
|
|
393
393
|
}
|
|
394
|
+
/**
|
|
395
|
+
* Given a tree with state, get a mapping from cell ID to cell set color index,
|
|
396
|
+
* based on the nodes currently marked as "visible".
|
|
397
|
+
* @param {object} currTree A tree object.
|
|
398
|
+
* @param {array} selectedNamePaths Array of arrays of strings,
|
|
399
|
+
* representing set "paths".
|
|
400
|
+
* @param {object[]} cellSetColor Array of objects with the
|
|
401
|
+
* properties `path` and `color`.
|
|
402
|
+
* @returns {array} Tuple of [cellIds, cellColors]
|
|
403
|
+
* where cellIds is an array of strings,
|
|
404
|
+
* and cellColors is an object mapping cellIds to color [r,g,b] arrays.
|
|
405
|
+
*/
|
|
406
|
+
export function treeToCellSetColorIndicesBySetNames(currTree, selectedNamePaths, cellSetColor) {
|
|
407
|
+
let cellColorsArray = [];
|
|
408
|
+
selectedNamePaths?.forEach((setNamePath) => {
|
|
409
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
410
|
+
if (node) {
|
|
411
|
+
const nodeSet = nodeToSet(node);
|
|
412
|
+
const nodeColorIndex = cellSetColor?.findIndex(d => isEqual(d.path, setNamePath));
|
|
413
|
+
cellColorsArray = [
|
|
414
|
+
...cellColorsArray,
|
|
415
|
+
...nodeSet.map(([cellId]) => [
|
|
416
|
+
cellId,
|
|
417
|
+
nodeColorIndex,
|
|
418
|
+
]),
|
|
419
|
+
];
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
return new Map(cellColorsArray);
|
|
423
|
+
}
|
|
394
424
|
/**
|
|
395
425
|
* Given a tree with state, get an array of
|
|
396
426
|
* objects with cellIds and cellColors,
|
package/dist-tsc/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { dataToCellSetsTree } from "./CellSetsZarrLoader.js";
|
|
2
|
-
export { treeToCellColorsBySetNames, treeToSetSizesBySetNames, treeToObjectsBySetNames, treeExportLevelZeroNode, treeExportSet, treeToExpectedCheckedLevel, nodeToLevelDescendantNamePaths, treeToIntersection, treeToUnion, treeToComplement, treeFindNodeByNamePath, treesConflict, nodeTransform, nodeAppendChild, nodePrependChild, nodeInsertChild, filterNode, treeInitialize, initializeCellSetColor, nodeToRenderProps, getCellSetPolygons, treeToMembershipMap, nodeToSet } from "./cell-set-utils.js";
|
|
2
|
+
export { treeToCellColorsBySetNames, treeToCellSetColorIndicesBySetNames, treeToSetSizesBySetNames, treeToObjectsBySetNames, treeExportLevelZeroNode, treeExportSet, treeToExpectedCheckedLevel, nodeToLevelDescendantNamePaths, treeToIntersection, treeToUnion, treeToComplement, treeFindNodeByNamePath, treesConflict, nodeTransform, nodeAppendChild, nodePrependChild, nodeInsertChild, filterNode, treeInitialize, initializeCellSetColor, nodeToRenderProps, getCellSetPolygons, treeToMembershipMap, nodeToSet } from "./cell-set-utils.js";
|
|
3
3
|
export { findLongestCommonPath, filterPathsByExpansionAndSelection, findChangedHierarchy } from "./set-path-utils.js";
|
|
4
4
|
export { isEqualOrPrefix, tryRenamePath, PATH_SEP, setObsSelection, mergeObsSets, getNextNumberedNodeName, colorArrayToString, callbackOnKeyPress, getLevelTooltipText, pathToKey, getObsInfoFromDataWithinRange } from "./utils.js";
|
|
5
5
|
export { downloadForUser, handleExportJSON, handleExportTabular, tryUpgradeTreeToLatestSchema, handleImportJSON, handleImportTabular } from "./io.js";
|
package/dist-tsc/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { treeToCellColorsBySetNames, treeToSetSizesBySetNames, treeToObjectsBySetNames, treeExportLevelZeroNode, treeExportSet, treeToExpectedCheckedLevel, nodeToLevelDescendantNamePaths, treeToIntersection, treeToUnion, treeToComplement, treeFindNodeByNamePath, treesConflict, nodeTransform, nodeAppendChild, nodePrependChild, nodeInsertChild, filterNode, treeInitialize, initializeCellSetColor, nodeToRenderProps, getCellSetPolygons, treeToMembershipMap, nodeToSet, } from './cell-set-utils.js';
|
|
1
|
+
export { treeToCellColorsBySetNames, treeToCellSetColorIndicesBySetNames, treeToSetSizesBySetNames, treeToObjectsBySetNames, treeExportLevelZeroNode, treeExportSet, treeToExpectedCheckedLevel, nodeToLevelDescendantNamePaths, treeToIntersection, treeToUnion, treeToComplement, treeFindNodeByNamePath, treesConflict, nodeTransform, nodeAppendChild, nodePrependChild, nodeInsertChild, filterNode, treeInitialize, initializeCellSetColor, nodeToRenderProps, getCellSetPolygons, treeToMembershipMap, nodeToSet, } from './cell-set-utils.js';
|
|
2
2
|
export { findLongestCommonPath, filterPathsByExpansionAndSelection, findChangedHierarchy, } from './set-path-utils.js';
|
|
3
3
|
export { isEqualOrPrefix, tryRenamePath, PATH_SEP, setObsSelection, mergeObsSets, getNextNumberedNodeName, colorArrayToString, callbackOnKeyPress, getLevelTooltipText, pathToKey, getObsInfoFromDataWithinRange, } from './utils.js';
|
|
4
4
|
export { downloadForUser, handleExportJSON, handleExportTabular, tryUpgradeTreeToLatestSchema, handleImportJSON, handleImportTabular, } from './io.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/sets-utils",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"lodash-es": "^4.17.21",
|
|
26
26
|
"tinycolor2": "^1.4.1",
|
|
27
27
|
"uuid": "^9.0.0",
|
|
28
|
-
"@vitessce/schemas": "3.
|
|
29
|
-
"@vitessce/utils": "3.
|
|
28
|
+
"@vitessce/schemas": "3.2.0",
|
|
29
|
+
"@vitessce/utils": "3.2.0"
|
|
30
30
|
},
|
|
31
31
|
"scripts": {
|
|
32
32
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
|
package/src/cell-set-utils.js
CHANGED
|
@@ -424,6 +424,37 @@ export function treeToCellColorsBySetNames(currTree, selectedNamePaths, cellSetC
|
|
|
424
424
|
return new Map(cellColorsArray);
|
|
425
425
|
}
|
|
426
426
|
|
|
427
|
+
/**
|
|
428
|
+
* Given a tree with state, get a mapping from cell ID to cell set color index,
|
|
429
|
+
* based on the nodes currently marked as "visible".
|
|
430
|
+
* @param {object} currTree A tree object.
|
|
431
|
+
* @param {array} selectedNamePaths Array of arrays of strings,
|
|
432
|
+
* representing set "paths".
|
|
433
|
+
* @param {object[]} cellSetColor Array of objects with the
|
|
434
|
+
* properties `path` and `color`.
|
|
435
|
+
* @returns {array} Tuple of [cellIds, cellColors]
|
|
436
|
+
* where cellIds is an array of strings,
|
|
437
|
+
* and cellColors is an object mapping cellIds to color [r,g,b] arrays.
|
|
438
|
+
*/
|
|
439
|
+
export function treeToCellSetColorIndicesBySetNames(currTree, selectedNamePaths, cellSetColor) {
|
|
440
|
+
let cellColorsArray = [];
|
|
441
|
+
selectedNamePaths?.forEach((setNamePath) => {
|
|
442
|
+
const node = treeFindNodeByNamePath(currTree, setNamePath);
|
|
443
|
+
if (node) {
|
|
444
|
+
const nodeSet = nodeToSet(node);
|
|
445
|
+
const nodeColorIndex = cellSetColor?.findIndex(d => isEqual(d.path, setNamePath));
|
|
446
|
+
cellColorsArray = [
|
|
447
|
+
...cellColorsArray,
|
|
448
|
+
...nodeSet.map(([cellId]) => [
|
|
449
|
+
cellId,
|
|
450
|
+
nodeColorIndex,
|
|
451
|
+
]),
|
|
452
|
+
];
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
return new Map(cellColorsArray);
|
|
456
|
+
}
|
|
457
|
+
|
|
427
458
|
/**
|
|
428
459
|
* Given a tree with state, get an array of
|
|
429
460
|
* objects with cellIds and cellColors,
|