@vitessce/csv 4.0.7 → 4.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +184 -10
  2. package/package.json +6 -6
package/dist/index.js CHANGED
@@ -1085,7 +1085,9 @@ const ViewType$1 = {
1085
1085
  DUAL_SCATTERPLOT: "dualScatterplot",
1086
1086
  TREEMAP: "treemap",
1087
1087
  SAMPLE_SET_PAIR_MANAGER: "sampleSetPairManager",
1088
- FEATURE_STATS_TABLE: "featureStatsTable"
1088
+ FEATURE_STATS_TABLE: "featureStatsTable",
1089
+ SINGLE_OBS_SET_SELECTOR: "singleObsSetSelector",
1090
+ ANNOTATION_CONTROLLER: "annotationController"
1089
1091
  };
1090
1092
  const DataType$1 = {
1091
1093
  OBS_LABELS: "obsLabels",
@@ -1106,7 +1108,8 @@ const DataType$1 = {
1106
1108
  COMPARISON_METADATA: "comparisonMetadata",
1107
1109
  FEATURE_STATS: "featureStats",
1108
1110
  FEATURE_SET_STATS: "featureSetStats",
1109
- OBS_SET_STATS: "obsSetStats"
1111
+ OBS_SET_STATS: "obsSetStats",
1112
+ ANNOTATION_STORY: "annotationStory"
1110
1113
  };
1111
1114
  const FileType$1 = {
1112
1115
  // Joint file types
@@ -1128,6 +1131,7 @@ const FileType$1 = {
1128
1131
  OBS_SETS_CSV: "obsSets.csv",
1129
1132
  OBS_SETS_JSON: "obsSets.json",
1130
1133
  SAMPLE_SETS_CSV: "sampleSets.csv",
1134
+ ANNOTATION_STORY_JSON: "annotationStory.json",
1131
1135
  // OME-Zarr
1132
1136
  IMAGE_OME_ZARR: "image.ome-zarr",
1133
1137
  OBS_SEGMENTATIONS_OME_ZARR: "obsSegmentations.ome-zarr",
@@ -1412,7 +1416,15 @@ const CoordinationType$1 = {
1412
1416
  FEATURE_POINT_FOLD_CHANGE_THRESHOLD: "featurePointFoldChangeThreshold",
1413
1417
  FEATURE_LABEL_FOLD_CHANGE_THRESHOLD: "featureLabelFoldChangeThreshold",
1414
1418
  // Treemap
1415
- HIERARCHY_LEVELS: "hierarchyLevels"
1419
+ HIERARCHY_LEVELS: "hierarchyLevels",
1420
+ // Annotation frames
1421
+ ANNOTATION_STORY: "annotationStory",
1422
+ ANNOTATION_FRAME_INDEX: "annotationFrameIndex",
1423
+ ANNOTATION_SHAPES: "annotationShapes",
1424
+ ANNOTATION_OVERLAY_VISIBLE: "annotationOverlayVisible",
1425
+ ANNOTATION_TRANSITION_DURATION: "annotationTransitionDuration",
1426
+ ANNOTATION_SEMANTIC_ZOOM: "annotationSemanticZoom",
1427
+ ANNOTATION_EDITABLE: "annotationEditable"
1416
1428
  };
1417
1429
  ({
1418
1430
  // For new file types
@@ -1428,6 +1440,7 @@ const CoordinationType$1 = {
1428
1440
  [FileType$1.OBS_SEGMENTATIONS_JSON]: DataType$1.OBS_SEGMENTATIONS,
1429
1441
  [FileType$1.OBS_SETS_CSV]: DataType$1.OBS_SETS,
1430
1442
  [FileType$1.OBS_SETS_JSON]: DataType$1.OBS_SETS,
1443
+ [FileType$1.ANNOTATION_STORY_JSON]: DataType$1.ANNOTATION_STORY,
1431
1444
  [FileType$1.IMAGE_OME_ZARR]: DataType$1.IMAGE,
1432
1445
  [FileType$1.OBS_SEGMENTATIONS_OME_ZARR]: DataType$1.OBS_SEGMENTATIONS,
1433
1446
  [FileType$1.OBS_FEATURE_MATRIX_ANNDATA_ZARR]: DataType$1.OBS_FEATURE_MATRIX,
@@ -1550,7 +1563,8 @@ const CoordinationType$1 = {
1550
1563
  [DataType$1.OBS_SET_STATS]: [
1551
1564
  CoordinationType$1.OBS_TYPE
1552
1565
  // TODO: should sampleType, obsSetSelection, and/or sampleSetSelection be used here?
1553
- ]
1566
+ ],
1567
+ [DataType$1.ANNOTATION_STORY]: []
1554
1568
  });
1555
1569
  ({
1556
1570
  // For AnnData:
@@ -1683,7 +1697,9 @@ const CoordinationType$1 = {
1683
1697
  CoordinationType$1.SPATIAL_TARGET_Z,
1684
1698
  CoordinationType$1.SPATIAL_AXIS_FIXED,
1685
1699
  CoordinationType$1.SPATIAL_ORBIT_AXIS,
1686
- CoordinationType$1.FEATURE_AGGREGATION_STRATEGY
1700
+ CoordinationType$1.FEATURE_AGGREGATION_STRATEGY,
1701
+ // Annotation shapes are specific to a view's coordinate system.
1702
+ CoordinationType$1.ANNOTATION_SHAPES
1687
1703
  ];
1688
1704
  ({
1689
1705
  [ViewType$1.NEUROGLANCER]: [
@@ -1775,7 +1791,14 @@ const CoordinationType$1 = {
1775
1791
  CoordinationType$1.EMBEDDING_CONTOURS_FILLED,
1776
1792
  CoordinationType$1.EMBEDDING_CONTOUR_PERCENTILES,
1777
1793
  CoordinationType$1.CONTOUR_COLOR_ENCODING,
1778
- CoordinationType$1.CONTOUR_COLOR
1794
+ CoordinationType$1.CONTOUR_COLOR,
1795
+ CoordinationType$1.ANNOTATION_STORY,
1796
+ CoordinationType$1.ANNOTATION_SHAPES,
1797
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
1798
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
1799
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
1800
+ CoordinationType$1.ANNOTATION_EDITABLE,
1801
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
1779
1802
  ],
1780
1803
  [ViewType$1.DUAL_SCATTERPLOT]: [
1781
1804
  CoordinationType$1.DATASET,
@@ -1891,7 +1914,14 @@ const CoordinationType$1 = {
1891
1914
  CoordinationType$1.ADDITIONAL_OBS_SETS,
1892
1915
  CoordinationType$1.MOLECULE_HIGHLIGHT,
1893
1916
  CoordinationType$1.TOOLTIPS_VISIBLE,
1894
- CoordinationType$1.PHOTOMETRIC_INTERPRETATION
1917
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
1918
+ CoordinationType$1.ANNOTATION_STORY,
1919
+ CoordinationType$1.ANNOTATION_SHAPES,
1920
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
1921
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
1922
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
1923
+ CoordinationType$1.ANNOTATION_EDITABLE,
1924
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
1895
1925
  ],
1896
1926
  [ViewType$1.SPATIAL_BETA]: [
1897
1927
  CoordinationType$1.META_COORDINATION_SCOPES,
@@ -1969,7 +1999,27 @@ const CoordinationType$1 = {
1969
1999
  CoordinationType$1.SPATIAL_CHANNEL_LABELS_ORIENTATION,
1970
2000
  CoordinationType$1.SPATIAL_CHANNEL_LABEL_SIZE,
1971
2001
  CoordinationType$1.SPATIAL_CHANNELS_SORT_ORDER,
1972
- CoordinationType$1.PHOTOMETRIC_INTERPRETATION
2002
+ CoordinationType$1.PHOTOMETRIC_INTERPRETATION,
2003
+ CoordinationType$1.ANNOTATION_STORY,
2004
+ CoordinationType$1.ANNOTATION_SHAPES,
2005
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
2006
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
2007
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
2008
+ CoordinationType$1.ANNOTATION_EDITABLE,
2009
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
2010
+ ],
2011
+ [ViewType$1.ANNOTATION_CONTROLLER]: [
2012
+ CoordinationType$1.DATASET,
2013
+ CoordinationType$1.ANNOTATION_STORY,
2014
+ CoordinationType$1.ANNOTATION_FRAME_INDEX,
2015
+ CoordinationType$1.ANNOTATION_OVERLAY_VISIBLE,
2016
+ CoordinationType$1.ANNOTATION_TRANSITION_DURATION,
2017
+ CoordinationType$1.ANNOTATION_EDITABLE,
2018
+ CoordinationType$1.ANNOTATION_SEMANTIC_ZOOM
2019
+ // Note: the annotation controller also needs to read the coordination state
2020
+ // of all other views/coordination types via the full config.
2021
+ // Note: we get/set the CoordinationType.ANNOTATION_SHAPES from the full config,
2022
+ // as this info is view-specific rather than global to the story.
1973
2023
  ],
1974
2024
  [ViewType$1.HEATMAP]: [
1975
2025
  CoordinationType$1.DATASET,
@@ -2279,6 +2329,11 @@ const CoordinationType$1 = {
2279
2329
  CoordinationType$1.FEATURE_POINT_FOLD_CHANGE_THRESHOLD,
2280
2330
  CoordinationType$1.FEATURE_LABEL_FOLD_CHANGE_THRESHOLD
2281
2331
  ],
2332
+ [ViewType$1.SINGLE_OBS_SET_SELECTOR]: [
2333
+ CoordinationType$1.OBS_TYPE,
2334
+ CoordinationType$1.OBS_SET_COLOR,
2335
+ CoordinationType$1.OBS_SET_SELECTION
2336
+ ],
2282
2337
  [ViewType$1.OBS_SET_COMPOSITION_BAR_PLOT]: [
2283
2338
  CoordinationType$1.DATASET,
2284
2339
  CoordinationType$1.OBS_TYPE,
@@ -8403,7 +8458,7 @@ const latestFileDefSchema = z.object({
8403
8458
  options: fileOptionsSchema.optional(),
8404
8459
  requestInit: requestInit.optional(),
8405
8460
  // New: file def can have coordinationValues.
8406
- coordinationValues: z.record(z.string()).optional()
8461
+ coordinationValues: z.record(z.any()).optional()
8407
8462
  });
8408
8463
  const datasetsSchema1_0_13 = z.array(z.object({
8409
8464
  uid: z.string(),
@@ -8434,7 +8489,8 @@ const configSchema1_0_16 = configSchema1_0_13.extend({
8434
8489
  h: z.number().int().optional(),
8435
8490
  // Updates coordinationScopes and coordinationScopesBy
8436
8491
  coordinationScopes: componentCoordinationScopes.optional(),
8437
- coordinationScopesBy: componentCoordinationScopesBy.optional()
8492
+ coordinationScopesBy: componentCoordinationScopesBy.optional(),
8493
+ coordinationValues: z.record(z.any()).optional()
8438
8494
  }))
8439
8495
  });
8440
8496
  const configSchema1_0_17 = configSchema1_0_16.extend({
@@ -11519,6 +11575,124 @@ z.object({
11519
11575
  radius: z.number(),
11520
11576
  opacity: z.number()
11521
11577
  });
11578
+ const shapeBaseObj = z.object({
11579
+ uid: z.string(),
11580
+ text: z.string().optional(),
11581
+ strokeColor: z.array(z.number()).length(3).optional(),
11582
+ strokeWidth: z.number().optional(),
11583
+ // SVG-style dash pattern, e.g. "10 5" or "10 20 30 10". "none" or omitted = solid.
11584
+ strokeDashArray: z.string().optional(),
11585
+ visible: z.boolean().optional()
11586
+ // TODO: define unit modes for x and y axes
11587
+ // ("pixels" vs "normalized" vs "physical" etc.)
11588
+ // TODO: a coordinate system identifier (e.g., "DeckGL" for now,
11589
+ // but a coordinate system from OME-NGFF/SpatialData eventually?)
11590
+ });
11591
+ const rectangleShapeObj = shapeBaseObj.extend({
11592
+ type: z.literal("rectangle"),
11593
+ // OME-XML field names verbatim (upper-left origin)
11594
+ x: z.number(),
11595
+ y: z.number(),
11596
+ width: z.number(),
11597
+ height: z.number(),
11598
+ fillColor: z.array(z.number()).length(3).optional(),
11599
+ fillOpacity: z.number().optional()
11600
+ });
11601
+ const lineShapeObj = shapeBaseObj.extend({
11602
+ type: z.literal("line"),
11603
+ // OME-XML field names verbatim
11604
+ x1: z.number(),
11605
+ y1: z.number(),
11606
+ x2: z.number(),
11607
+ y2: z.number(),
11608
+ markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
11609
+ markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional(),
11610
+ textPosition: z.enum(["start", "middle", "end"]).optional(),
11611
+ textBufferPx: z.number().optional()
11612
+ });
11613
+ const ellipseShapeObj = shapeBaseObj.extend({
11614
+ type: z.literal("ellipse"),
11615
+ // OME-XML field names verbatim (centre point + radii)
11616
+ x1: z.number(),
11617
+ y1: z.number(),
11618
+ radiusX: z.number(),
11619
+ radiusY: z.number(),
11620
+ fillColor: z.array(z.number()).length(3).optional(),
11621
+ fillOpacity: z.number().optional()
11622
+ });
11623
+ const polygonShapeObj = shapeBaseObj.extend({
11624
+ type: z.literal("polygon"),
11625
+ // OME-XML: array of [x, y] coordinate pairs, closed automatically
11626
+ points: z.array(z.tuple([z.number(), z.number()])),
11627
+ fillColor: z.array(z.number()).length(3).optional(),
11628
+ fillOpacity: z.number().optional()
11629
+ });
11630
+ const polylineShapeObj = shapeBaseObj.extend({
11631
+ type: z.literal("polyline"),
11632
+ // OME-XML: array of [x, y] coordinate pairs, open (not closed)
11633
+ points: z.array(z.tuple([z.number(), z.number()])),
11634
+ markerStart: z.enum(["Arrow", "Tick"]).nullable().optional(),
11635
+ markerEnd: z.enum(["Arrow", "Tick"]).nullable().optional()
11636
+ });
11637
+ const annotationShapeObj = z.discriminatedUnion("type", [
11638
+ rectangleShapeObj,
11639
+ lineShapeObj,
11640
+ ellipseShapeObj,
11641
+ polygonShapeObj,
11642
+ polylineShapeObj
11643
+ ]);
11644
+ z.array(annotationShapeObj);
11645
+ const annotationFrameObj = z.object({
11646
+ uid: z.string(),
11647
+ title: z.string().optional(),
11648
+ description: z.string().optional(),
11649
+ descriptionType: z.enum(["text", "markdown"]).optional(),
11650
+ // A frame can define per-view: coordinationValues
11651
+ // (if the view's state should not be coordinated with other views)
11652
+ // or per-view coordinationScopes/coordinationScopesBy
11653
+ // (if at this frame, the view should be coordinated with other views).
11654
+ // We can also define a frame-level coordination space,
11655
+ // which will be merged with the global coordination space.
11656
+ // TODO: datasets
11657
+ // TODO: coordinationSpace
11658
+ layout: z.array(
11659
+ // Note: for now, we will infer view objects which have a uid
11660
+ // that is present in the global layout, and do NOT have x/y/w/h defined,
11661
+ // to mean that in this frame, the layout and set of views is unchanged
11662
+ // from the global layout.
11663
+ // This will allow each frame to omit the full list of views from the layout,
11664
+ // and only specify the views whose coordination state is changing in this frame.
11665
+ // If a frame includes a view with a uid that is not present
11666
+ // in the global layout, then that view will be added to the layout at this frame.
11667
+ // This frame should also define x/y/w/h for all views,
11668
+ // since it will otherwise be ambiguous how to layout the updated set of views
11669
+ // for this frame.
11670
+ z.object({
11671
+ // The view UID. If this view uid is not present in the global layout,
11672
+ // it will be added to the layout at this frame,
11673
+ // and will need to have its coordination values initialized to their defaults
11674
+ // for any that were not fully specified.
11675
+ uid: z.string(),
11676
+ coordinationValues: z.record(
11677
+ z.string(),
11678
+ // The coordination type name, e.g. "embeddingType"
11679
+ z.any()
11680
+ ).optional()
11681
+ // TODO: support coordinationScopes/coordinationScopesBy for per-view coordination
11682
+ // at this frame.
11683
+ // TODO: view x/y/w/h once we support view layout changes per-frame.
11684
+ })
11685
+ ).optional()
11686
+ });
11687
+ z.object({
11688
+ // TODO: schema version for the story schema?
11689
+ // Same as current Vitessce schema version?
11690
+ uid: z.string(),
11691
+ title: z.string().optional(),
11692
+ description: z.string().optional(),
11693
+ descriptionType: z.enum(["text", "markdown"]).optional(),
11694
+ frames: z.array(annotationFrameObj)
11695
+ });
11522
11696
  const SETS_DATATYPE_OBS = "obs";
11523
11697
  const HIERARCHICAL_SCHEMAS = {
11524
11698
  latestVersion: "0.1.3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/csv",
3
- "version": "4.0.7",
3
+ "version": "4.0.9",
4
4
  "author": "HIDIVE Lab at HMS",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -18,11 +18,11 @@
18
18
  "dependencies": {
19
19
  "d3-array": "^2.4.0",
20
20
  "d3-dsv": "^1.1.1",
21
- "@vitessce/sets-utils": "4.0.7",
22
- "@vitessce/error": "4.0.7",
23
- "@vitessce/abstract": "4.0.7",
24
- "@vitessce/constants-internal": "4.0.7",
25
- "@vitessce/config": "4.0.7"
21
+ "@vitessce/constants-internal": "4.0.9",
22
+ "@vitessce/sets-utils": "4.0.9",
23
+ "@vitessce/abstract": "4.0.9",
24
+ "@vitessce/error": "4.0.9",
25
+ "@vitessce/config": "4.0.9"
26
26
  },
27
27
  "scripts": {
28
28
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",