@vitessce/constants-internal 2.0.3-beta.0 → 3.0.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.
@@ -0,0 +1,150 @@
1
+ export namespace ViewType {
2
+ const DESCRIPTION: string;
3
+ const STATUS: string;
4
+ const SCATTERPLOT: string;
5
+ const SPATIAL: string;
6
+ const HEATMAP: string;
7
+ const LAYER_CONTROLLER: string;
8
+ const GENOMIC_PROFILES: string;
9
+ const GATING: string;
10
+ const FEATURE_LIST: string;
11
+ const OBS_SETS: string;
12
+ const OBS_SET_SIZES: string;
13
+ const OBS_SET_FEATURE_VALUE_DISTRIBUTION: string;
14
+ const FEATURE_VALUE_HISTOGRAM: string;
15
+ }
16
+ export namespace DataType {
17
+ export const OBS_LABELS: string;
18
+ export const OBS_EMBEDDING: string;
19
+ export const OBS_LOCATIONS: string;
20
+ export const OBS_FEATURE_MATRIX: string;
21
+ const OBS_SETS_1: string;
22
+ export { OBS_SETS_1 as OBS_SETS };
23
+ export const FEATURE_LABELS: string;
24
+ export const IMAGE: string;
25
+ export const OBS_SEGMENTATIONS: string;
26
+ export const NEIGHBORHOODS: string;
27
+ const GENOMIC_PROFILES_1: string;
28
+ export { GENOMIC_PROFILES_1 as GENOMIC_PROFILES };
29
+ }
30
+ export namespace FileType {
31
+ const ANNDATA_ZARR: string;
32
+ const OBS_EMBEDDING_CSV: string;
33
+ const OBS_LOCATIONS_CSV: string;
34
+ const OBS_LABELS_CSV: string;
35
+ const FEATURE_LABELS_CSV: string;
36
+ const OBS_FEATURE_MATRIX_CSV: string;
37
+ const OBS_SEGMENTATIONS_JSON: string;
38
+ const OBS_SETS_CSV: string;
39
+ const OBS_SETS_JSON: string;
40
+ const IMAGE_OME_ZARR: string;
41
+ const OBS_FEATURE_MATRIX_ANNDATA_ZARR: string;
42
+ const OBS_SETS_ANNDATA_ZARR: string;
43
+ const OBS_EMBEDDING_ANNDATA_ZARR: string;
44
+ const OBS_LOCATIONS_ANNDATA_ZARR: string;
45
+ const OBS_SEGMENTATIONS_ANNDATA_ZARR: string;
46
+ const OBS_LABELS_ANNDATA_ZARR: string;
47
+ const FEATURE_LABELS_ANNDATA_ZARR: string;
48
+ const OBS_FEATURE_MATRIX_MUDATA_ZARR: string;
49
+ const OBS_SETS_MUDATA_ZARR: string;
50
+ const OBS_EMBEDDING_MUDATA_ZARR: string;
51
+ const OBS_LOCATIONS_MUDATA_ZARR: string;
52
+ const OBS_SEGMENTATIONS_MUDATA_ZARR: string;
53
+ const OBS_LABELS_MUDATA_ZARR: string;
54
+ const FEATURE_LABELS_MUDATA_ZARR: string;
55
+ const GENOMIC_PROFILES_ZARR: string;
56
+ const NEIGHBORHOODS_JSON: string;
57
+ const IMAGE_OME_TIFF: string;
58
+ const OBS_SEGMENTATIONS_OME_TIFF: string;
59
+ const OBS_EMBEDDING_CELLS_JSON: string;
60
+ const OBS_SEGMENTATIONS_CELLS_JSON: string;
61
+ const OBS_LOCATIONS_CELLS_JSON: string;
62
+ const OBS_LABELS_CELLS_JSON: string;
63
+ const OBS_SETS_CELL_SETS_JSON: string;
64
+ const OBS_FEATURE_MATRIX_GENES_JSON: string;
65
+ const OBS_FEATURE_MATRIX_CLUSTERS_JSON: string;
66
+ const OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR: string;
67
+ const IMAGE_RASTER_JSON: string;
68
+ const OBS_SEGMENTATIONS_RASTER_JSON: string;
69
+ const OBS_LOCATIONS_MOLECULES_JSON: string;
70
+ const OBS_LABELS_MOLECULES_JSON: string;
71
+ const CELLS_JSON: string;
72
+ const CELL_SETS_JSON: string;
73
+ const ANNDATA_CELL_SETS_ZARR: string;
74
+ const ANNDATA_CELLS_ZARR: string;
75
+ const EXPRESSION_MATRIX_ZARR: string;
76
+ const MOLECULES_JSON: string;
77
+ const RASTER_JSON: string;
78
+ const RASTER_OME_ZARR: string;
79
+ const CLUSTERS_JSON: string;
80
+ const GENES_JSON: string;
81
+ const ANNDATA_EXPRESSION_MATRIX_ZARR: string;
82
+ }
83
+ export namespace CoordinationType {
84
+ const DATASET: string;
85
+ const OBS_TYPE: string;
86
+ const FEATURE_TYPE: string;
87
+ const FEATURE_VALUE_TYPE: string;
88
+ const OBS_LABELS_TYPE: string;
89
+ const EMBEDDING_TYPE: string;
90
+ const EMBEDDING_ZOOM: string;
91
+ const EMBEDDING_ROTATION: string;
92
+ const EMBEDDING_TARGET_X: string;
93
+ const EMBEDDING_TARGET_Y: string;
94
+ const EMBEDDING_TARGET_Z: string;
95
+ const EMBEDDING_OBS_SET_POLYGONS_VISIBLE: string;
96
+ const EMBEDDING_OBS_SET_LABELS_VISIBLE: string;
97
+ const EMBEDDING_OBS_SET_LABEL_SIZE: string;
98
+ const EMBEDDING_OBS_RADIUS: string;
99
+ const EMBEDDING_OBS_RADIUS_MODE: string;
100
+ const EMBEDDING_OBS_OPACITY: string;
101
+ const EMBEDDING_OBS_OPACITY_MODE: string;
102
+ const SPATIAL_ZOOM: string;
103
+ const SPATIAL_ROTATION: string;
104
+ const SPATIAL_TARGET_X: string;
105
+ const SPATIAL_TARGET_Y: string;
106
+ const SPATIAL_TARGET_Z: string;
107
+ const SPATIAL_ROTATION_X: string;
108
+ const SPATIAL_ROTATION_Y: string;
109
+ const SPATIAL_ROTATION_Z: string;
110
+ const SPATIAL_ROTATION_ORBIT: string;
111
+ const SPATIAL_ORBIT_AXIS: string;
112
+ const SPATIAL_AXIS_FIXED: string;
113
+ const HEATMAP_ZOOM_X: string;
114
+ const HEATMAP_ZOOM_Y: string;
115
+ const HEATMAP_TARGET_X: string;
116
+ const HEATMAP_TARGET_Y: string;
117
+ const OBS_FILTER: string;
118
+ const OBS_HIGHLIGHT: string;
119
+ const OBS_SET_SELECTION: string;
120
+ const OBS_SET_HIGHLIGHT: string;
121
+ const OBS_SET_EXPANSION: string;
122
+ const OBS_SET_COLOR: string;
123
+ const FEATURE_FILTER: string;
124
+ const FEATURE_HIGHLIGHT: string;
125
+ const FEATURE_SELECTION: string;
126
+ const FEATURE_VALUE_COLORMAP: string;
127
+ const FEATURE_VALUE_TRANSFORM: string;
128
+ const FEATURE_VALUE_COLORMAP_RANGE: string;
129
+ const OBS_COLOR_ENCODING: string;
130
+ const SPATIAL_IMAGE_LAYER: string;
131
+ const SPATIAL_SEGMENTATION_LAYER: string;
132
+ const SPATIAL_POINT_LAYER: string;
133
+ const SPATIAL_NEIGHBORHOOD_LAYER: string;
134
+ const GENOMIC_ZOOM_X: string;
135
+ const GENOMIC_ZOOM_Y: string;
136
+ const GENOMIC_TARGET_X: string;
137
+ const GENOMIC_TARGET_Y: string;
138
+ const ADDITIONAL_OBS_SETS: string;
139
+ const MOLECULE_HIGHLIGHT: string;
140
+ const GATING_FEATURE_SELECTION_X: string;
141
+ const GATING_FEATURE_SELECTION_Y: string;
142
+ const FEATURE_VALUE_TRANSFORM_COEFFICIENT: string;
143
+ const TOOLTIPS_VISIBLE: string;
144
+ }
145
+ export namespace STATUS {
146
+ const LOADING: string;
147
+ const SUCCESS: string;
148
+ const ERROR: string;
149
+ }
150
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.js"],"names":[],"mappings":""}
@@ -43,6 +43,7 @@ export const FileType = {
43
43
  OBS_SETS_CSV: 'obsSets.csv',
44
44
  OBS_SETS_JSON: 'obsSets.json',
45
45
  IMAGE_OME_ZARR: 'image.ome-zarr',
46
+ // AnnData
46
47
  OBS_FEATURE_MATRIX_ANNDATA_ZARR: 'obsFeatureMatrix.anndata.zarr',
47
48
  OBS_SETS_ANNDATA_ZARR: 'obsSets.anndata.zarr',
48
49
  OBS_EMBEDDING_ANNDATA_ZARR: 'obsEmbedding.anndata.zarr',
@@ -50,8 +51,19 @@ export const FileType = {
50
51
  OBS_SEGMENTATIONS_ANNDATA_ZARR: 'obsSegmentations.anndata.zarr',
51
52
  OBS_LABELS_ANNDATA_ZARR: 'obsLabels.anndata.zarr',
52
53
  FEATURE_LABELS_ANNDATA_ZARR: 'featureLabels.anndata.zarr',
54
+ // MuData
55
+ OBS_FEATURE_MATRIX_MUDATA_ZARR: 'obsFeatureMatrix.mudata.zarr',
56
+ OBS_SETS_MUDATA_ZARR: 'obsSets.mudata.zarr',
57
+ OBS_EMBEDDING_MUDATA_ZARR: 'obsEmbedding.mudata.zarr',
58
+ OBS_LOCATIONS_MUDATA_ZARR: 'obsLocations.mudata.zarr',
59
+ OBS_SEGMENTATIONS_MUDATA_ZARR: 'obsSegmentations.mudata.zarr',
60
+ OBS_LABELS_MUDATA_ZARR: 'obsLabels.mudata.zarr',
61
+ FEATURE_LABELS_MUDATA_ZARR: 'featureLabels.mudata.zarr',
53
62
  GENOMIC_PROFILES_ZARR: 'genomic-profiles.zarr',
54
63
  NEIGHBORHOODS_JSON: 'neighborhoods.json',
64
+ // OME-TIFF
65
+ IMAGE_OME_TIFF: 'image.ome-tiff',
66
+ OBS_SEGMENTATIONS_OME_TIFF: 'obsSegmentations.ome-tiff',
55
67
  // New file types to support old file types:
56
68
  // - cells.json
57
69
  OBS_EMBEDDING_CELLS_JSON: 'obsEmbedding.cells.json',
@@ -129,6 +141,7 @@ export const CoordinationType = {
129
141
  OBS_HIGHLIGHT: 'obsHighlight',
130
142
  OBS_SET_SELECTION: 'obsSetSelection',
131
143
  OBS_SET_HIGHLIGHT: 'obsSetHighlight',
144
+ OBS_SET_EXPANSION: 'obsSetExpansion',
132
145
  OBS_SET_COLOR: 'obsSetColor',
133
146
  FEATURE_FILTER: 'featureFilter',
134
147
  FEATURE_HIGHLIGHT: 'featureHighlight',
@@ -151,6 +164,7 @@ export const CoordinationType = {
151
164
  GATING_FEATURE_SELECTION_X: 'gatingFeatureSelectionX',
152
165
  GATING_FEATURE_SELECTION_Y: 'gatingFeatureSelectionY',
153
166
  FEATURE_VALUE_TRANSFORM_COEFFICIENT: 'featureValueTransformCoefficient',
167
+ TOOLTIPS_VISIBLE: 'tooltipsVisible',
154
168
  };
155
169
  export const STATUS = {
156
170
  LOADING: 'loading',
@@ -0,0 +1,14 @@
1
+ export const AUTO_INDEPENDENT_COORDINATION_TYPES: string[];
2
+ /**
3
+ * Mapping from component type to
4
+ * supported coordination object types.
5
+ * This mapping can be used to determine
6
+ * which pieces of state that a component will
7
+ * need to get/set.
8
+ * Keys here are the component registry keys.
9
+ */
10
+ export const COMPONENT_COORDINATION_TYPES: {
11
+ [x: string]: string[];
12
+ higlass: string[];
13
+ };
14
+ //# sourceMappingURL=coordination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coordination.d.ts","sourceRoot":"","sources":["../src/coordination.js"],"names":[],"mappings":"AASA,2DAcE;AAEF;;;;;;;KAOK;AACL;;;EA8OE"}
@@ -1,73 +1,11 @@
1
- import { CoordinationType, ViewType } from './constants';
2
- /**
3
- * Coordination types may have default values,
4
- * which can be defined here, and used by the
5
- * auto initialization strategy.
6
- */
7
- export const DEFAULT_COORDINATION_VALUES = {
8
- [CoordinationType.OBS_TYPE]: 'cell',
9
- [CoordinationType.FEATURE_TYPE]: 'gene',
10
- [CoordinationType.FEATURE_VALUE_TYPE]: 'expression',
11
- [CoordinationType.OBS_LABELS_TYPE]: null,
12
- [CoordinationType.EMBEDDING_ZOOM]: null,
13
- [CoordinationType.EMBEDDING_ROTATION]: 0,
14
- [CoordinationType.EMBEDDING_TARGET_X]: null,
15
- [CoordinationType.EMBEDDING_TARGET_Y]: null,
16
- [CoordinationType.EMBEDDING_TARGET_Z]: 0,
17
- [CoordinationType.EMBEDDING_OBS_SET_POLYGONS_VISIBLE]: false,
18
- [CoordinationType.EMBEDDING_OBS_SET_LABELS_VISIBLE]: false,
19
- [CoordinationType.EMBEDDING_OBS_SET_LABEL_SIZE]: 14,
20
- [CoordinationType.EMBEDDING_OBS_RADIUS]: 1,
21
- [CoordinationType.EMBEDDING_OBS_RADIUS_MODE]: 'auto',
22
- [CoordinationType.EMBEDDING_OBS_OPACITY]: 1,
23
- [CoordinationType.EMBEDDING_OBS_OPACITY_MODE]: 'auto',
24
- [CoordinationType.SPATIAL_ZOOM]: null,
25
- [CoordinationType.SPATIAL_ROTATION]: 0,
26
- [CoordinationType.SPATIAL_TARGET_X]: null,
27
- [CoordinationType.SPATIAL_TARGET_Y]: null,
28
- [CoordinationType.SPATIAL_TARGET_Z]: null,
29
- [CoordinationType.SPATIAL_ROTATION_X]: null,
30
- [CoordinationType.SPATIAL_ROTATION_Y]: null,
31
- [CoordinationType.SPATIAL_ROTATION_Z]: null,
32
- [CoordinationType.SPATIAL_AXIS_FIXED]: false,
33
- [CoordinationType.SPATIAL_ROTATION_ORBIT]: 0,
34
- [CoordinationType.SPATIAL_ORBIT_AXIS]: 'Y',
35
- [CoordinationType.SPATIAL_IMAGE_LAYER]: null,
36
- [CoordinationType.SPATIAL_SEGMENTATION_LAYER]: null,
37
- [CoordinationType.SPATIAL_POINT_LAYER]: null,
38
- [CoordinationType.SPATIAL_NEIGHBORHOOD_LAYER]: null,
39
- [CoordinationType.HEATMAP_ZOOM_X]: 0,
40
- [CoordinationType.HEATMAP_ZOOM_Y]: 0,
41
- [CoordinationType.HEATMAP_TARGET_X]: 0,
42
- [CoordinationType.HEATMAP_TARGET_Y]: 0,
43
- [CoordinationType.FEATURE_VALUE_COLORMAP]: 'plasma',
44
- [CoordinationType.FEATURE_VALUE_COLORMAP_RANGE]: [0.0, 1.0],
45
- [CoordinationType.FEATURE_VALUE_TRANSFORM]: null,
46
- [CoordinationType.FEATURE_VALUE_TRANSFORM_COEFFICIENT]: 1,
47
- [CoordinationType.FEATURE_FILTER]: null,
48
- [CoordinationType.FEATURE_HIGHLIGHT]: null,
49
- [CoordinationType.FEATURE_SELECTION]: null,
50
- [CoordinationType.OBS_FILTER]: null,
51
- [CoordinationType.OBS_HIGHLIGHT]: null,
52
- [CoordinationType.OBS_SET_SELECTION]: null,
53
- [CoordinationType.OBS_SET_HIGHLIGHT]: null,
54
- [CoordinationType.OBS_SET_COLOR]: null,
55
- [CoordinationType.OBS_COLOR_ENCODING]: 'cellSetSelection',
56
- [CoordinationType.GENOMIC_ZOOM_X]: 0,
57
- [CoordinationType.GENOMIC_ZOOM_Y]: 0,
58
- [CoordinationType.GENOMIC_TARGET_X]: 1549999999.5,
59
- [CoordinationType.GENOMIC_TARGET_Y]: 1549999999.5,
60
- [CoordinationType.ADDITIONAL_OBS_SETS]: null,
61
- [CoordinationType.MOLECULE_HIGHLIGHT]: null,
62
- [CoordinationType.GATING_FEATURE_SELECTION_X]: null,
63
- [CoordinationType.GATING_FEATURE_SELECTION_Y]: null,
64
- };
1
+ import { CoordinationType, ViewType } from './constants.js';
65
2
  // The following coordination types should be
66
3
  // initialized to independent scopes when
67
4
  // initialized automatically.
68
5
  // These make the resulting view config
69
6
  // (after auto-initialization) behave
70
7
  // like "legacy" Vitessce (pre-coordination model).
8
+ // TODO: delegate to PluginCoordinationType class
71
9
  export const AUTO_INDEPENDENT_COORDINATION_TYPES = [
72
10
  CoordinationType.HEATMAP_ZOOM_X,
73
11
  CoordinationType.HEATMAP_ZOOM_Y,
@@ -122,6 +60,7 @@ export const COMPONENT_COORDINATION_TYPES = {
122
60
  CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
123
61
  CoordinationType.OBS_COLOR_ENCODING,
124
62
  CoordinationType.ADDITIONAL_OBS_SETS,
63
+ CoordinationType.TOOLTIPS_VISIBLE,
125
64
  ],
126
65
  [ViewType.GATING]: [
127
66
  CoordinationType.DATASET,
@@ -190,6 +129,7 @@ export const COMPONENT_COORDINATION_TYPES = {
190
129
  CoordinationType.OBS_COLOR_ENCODING,
191
130
  CoordinationType.ADDITIONAL_OBS_SETS,
192
131
  CoordinationType.MOLECULE_HIGHLIGHT,
132
+ CoordinationType.TOOLTIPS_VISIBLE,
193
133
  ],
194
134
  [ViewType.HEATMAP]: [
195
135
  CoordinationType.DATASET,
@@ -213,11 +153,13 @@ export const COMPONENT_COORDINATION_TYPES = {
213
153
  CoordinationType.FEATURE_VALUE_COLORMAP_RANGE,
214
154
  CoordinationType.OBS_COLOR_ENCODING,
215
155
  CoordinationType.ADDITIONAL_OBS_SETS,
156
+ CoordinationType.TOOLTIPS_VISIBLE,
216
157
  ],
217
158
  [ViewType.OBS_SETS]: [
218
159
  CoordinationType.DATASET,
219
160
  CoordinationType.OBS_TYPE,
220
161
  CoordinationType.OBS_SET_SELECTION,
162
+ CoordinationType.OBS_SET_EXPANSION,
221
163
  CoordinationType.OBS_SET_HIGHLIGHT,
222
164
  CoordinationType.OBS_SET_COLOR,
223
165
  CoordinationType.OBS_COLOR_ENCODING,
@@ -228,6 +170,7 @@ export const COMPONENT_COORDINATION_TYPES = {
228
170
  CoordinationType.DATASET,
229
171
  CoordinationType.OBS_TYPE,
230
172
  CoordinationType.OBS_SET_SELECTION,
173
+ CoordinationType.OBS_SET_EXPANSION,
231
174
  CoordinationType.OBS_SET_HIGHLIGHT,
232
175
  CoordinationType.OBS_SET_COLOR,
233
176
  CoordinationType.ADDITIONAL_OBS_SETS,
@@ -269,6 +212,10 @@ export const COMPONENT_COORDINATION_TYPES = {
269
212
  CoordinationType.FEATURE_TYPE,
270
213
  CoordinationType.FEATURE_VALUE_TYPE,
271
214
  CoordinationType.FEATURE_SELECTION,
215
+ CoordinationType.ADDITIONAL_OBS_SETS,
216
+ CoordinationType.OBS_SET_COLOR,
217
+ CoordinationType.OBS_COLOR_ENCODING,
218
+ CoordinationType.OBS_SET_SELECTION,
272
219
  ],
273
220
  [ViewType.LAYER_CONTROLLER]: [
274
221
  CoordinationType.DATASET,
@@ -0,0 +1,4 @@
1
+ export { ViewType, DataType, FileType, CoordinationType, STATUS } from "./constants.js";
2
+ export { FILE_TYPE_DATA_TYPE_MAPPING, DATA_TYPE_COORDINATION_VALUE_USAGE } from "./constant-relationships.js";
3
+ export { AUTO_INDEPENDENT_COORDINATION_TYPES, COMPONENT_COORDINATION_TYPES } from "./coordination.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.js"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ export { ViewType, DataType, FileType, CoordinationType, STATUS, } from './constants.js';
2
+ export { FILE_TYPE_DATA_TYPE_MAPPING, DATA_TYPE_COORDINATION_VALUE_USAGE } from './constant-relationships.js';
3
+ export { AUTO_INDEPENDENT_COORDINATION_TYPES, COMPONENT_COORDINATION_TYPES } from './coordination.js';
4
+ export { default as META_VERSION } from './version.json';
@@ -0,0 +1,7 @@
1
+ {
2
+ "note": "This file is regenerated by push-demo.sh.",
3
+ "version": "3.0.0",
4
+ "branch": "release-v3.0.0",
5
+ "date": "2023-06-05",
6
+ "hash": "74d01aab"
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/constants-internal",
3
- "version": "2.0.3-beta.0",
3
+ "version": "3.0.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -8,17 +8,26 @@
8
8
  "url": "git+https://github.com/vitessce/vitessce.git"
9
9
  },
10
10
  "license": "MIT",
11
+ "type": "module",
11
12
  "main": "dist/index.js",
12
13
  "files": [
13
- "dist"
14
+ "src",
15
+ "dist",
16
+ "dist-tsc"
14
17
  ],
15
18
  "devDependencies": {
16
- "vite": "^3.0.0",
19
+ "vite": "^4.3.0",
17
20
  "vitest": "^0.23.4"
18
21
  },
19
22
  "scripts": {
20
- "start": "tsc --watch",
21
- "build": "tsc",
23
+ "bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
22
24
  "test": "pnpm exec vitest --run -r ../../ --dir ."
25
+ },
26
+ "module": "dist/index.js",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist-tsc/index.d.ts",
30
+ "import": "./dist/index.js"
31
+ }
23
32
  }
24
33
  }
@@ -0,0 +1,87 @@
1
+ import { FileType, DataType, CoordinationType } from './constants.js';
2
+
3
+ /**
4
+ * Mapping from file types to data types. Each file type
5
+ * should correspond to one data type. Multiple file types
6
+ * can map onto the same data type.
7
+ */
8
+ export const FILE_TYPE_DATA_TYPE_MAPPING = {
9
+ // For new file types
10
+ [FileType.OBS_EMBEDDING_CSV]: DataType.OBS_EMBEDDING,
11
+ [FileType.OBS_LOCATIONS_CSV]: DataType.OBS_LOCATIONS,
12
+ [FileType.OBS_LABELS_CSV]: DataType.OBS_LABELS,
13
+ [FileType.FEATURE_LABELS_CSV]: DataType.FEATURE_LABELS,
14
+ [FileType.OBS_FEATURE_MATRIX_CSV]: DataType.OBS_FEATURE_MATRIX,
15
+ [FileType.OBS_SEGMENTATIONS_JSON]: DataType.OBS_SEGMENTATIONS,
16
+ [FileType.OBS_SETS_CSV]: DataType.OBS_SETS,
17
+ [FileType.OBS_SETS_JSON]: DataType.OBS_SETS,
18
+ [FileType.IMAGE_OME_ZARR]: DataType.IMAGE,
19
+ [FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR]: DataType.OBS_FEATURE_MATRIX,
20
+ [FileType.OBS_SETS_ANNDATA_ZARR]: DataType.OBS_SETS,
21
+ [FileType.OBS_EMBEDDING_ANNDATA_ZARR]: DataType.OBS_EMBEDDING,
22
+ [FileType.OBS_LOCATIONS_ANNDATA_ZARR]: DataType.OBS_LOCATIONS,
23
+ [FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR]: DataType.OBS_SEGMENTATIONS,
24
+ [FileType.OBS_LABELS_ANNDATA_ZARR]: DataType.OBS_LABELS,
25
+ [FileType.FEATURE_LABELS_ANNDATA_ZARR]: DataType.FEATURE_LABELS,
26
+ [FileType.IMAGE_OME_TIFF]: DataType.IMAGE,
27
+ [FileType.OBS_SEGMENTATIONS_OME_TIFF]: DataType.OBS_SEGMENTATIONS,
28
+ [FileType.OBS_FEATURE_MATRIX_MUDATA_ZARR]: DataType.OBS_FEATURE_MATRIX,
29
+ [FileType.OBS_SETS_MUDATA_ZARR]: DataType.OBS_SETS,
30
+ [FileType.OBS_EMBEDDING_MUDATA_ZARR]: DataType.OBS_EMBEDDING,
31
+ [FileType.OBS_LOCATIONS_MUDATA_ZARR]: DataType.OBS_LOCATIONS,
32
+ [FileType.OBS_SEGMENTATIONS_MUDATA_ZARR]: DataType.OBS_SEGMENTATIONS,
33
+ [FileType.OBS_LABELS_MUDATA_ZARR]: DataType.OBS_LABELS,
34
+ [FileType.FEATURE_LABELS_MUDATA_ZARR]: DataType.FEATURE_LABELS,
35
+ // For new file types to support old file types
36
+ [FileType.OBS_EMBEDDING_CELLS_JSON]: DataType.OBS_EMBEDDING,
37
+ [FileType.OBS_LOCATIONS_CELLS_JSON]: DataType.OBS_LOCATIONS,
38
+ [FileType.OBS_SEGMENTATIONS_CELLS_JSON]: DataType.OBS_SEGMENTATIONS,
39
+ [FileType.OBS_LABELS_CELLS_JSON]: DataType.OBS_LABELS,
40
+ [FileType.OBS_SETS_CELL_SETS_JSON]: DataType.OBS_SETS,
41
+ [FileType.OBS_FEATURE_MATRIX_GENES_JSON]: DataType.OBS_FEATURE_MATRIX,
42
+ [FileType.OBS_FEATURE_MATRIX_CLUSTERS_JSON]: DataType.OBS_FEATURE_MATRIX,
43
+ [FileType.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR]: DataType.OBS_FEATURE_MATRIX,
44
+ [FileType.IMAGE_RASTER_JSON]: DataType.IMAGE,
45
+ [FileType.OBS_SEGMENTATIONS_RASTER_JSON]: DataType.OBS_SEGMENTATIONS,
46
+ [FileType.OBS_LOCATIONS_MOLECULES_JSON]: DataType.OBS_LOCATIONS,
47
+ [FileType.OBS_LABELS_MOLECULES_JSON]: DataType.OBS_LABELS,
48
+ // For old file types
49
+ [FileType.GENOMIC_PROFILES_ZARR]: DataType.GENOMIC_PROFILES,
50
+ [FileType.NEIGHBORHOODS_JSON]: DataType.NEIGHBORHOODS,
51
+ };
52
+
53
+ /**
54
+ * Store a mapping from data types to the coordination types used
55
+ * for matching using the coordinationValues field of file definitions.
56
+ * This enables inferring default values, simplifying view config writing.
57
+ */
58
+ export const DATA_TYPE_COORDINATION_VALUE_USAGE = {
59
+ [DataType.OBS_SEGMENTATIONS]: [
60
+ CoordinationType.OBS_TYPE,
61
+ ],
62
+ [DataType.OBS_EMBEDDING]: [
63
+ CoordinationType.OBS_TYPE,
64
+ CoordinationType.EMBEDDING_TYPE,
65
+ ],
66
+ [DataType.OBS_LOCATIONS]: [
67
+ CoordinationType.OBS_TYPE,
68
+ ],
69
+ [DataType.OBS_LABELS]: [
70
+ CoordinationType.OBS_TYPE,
71
+ CoordinationType.OBS_LABELS_TYPE,
72
+ ],
73
+ [DataType.FEATURE_LABELS]: [
74
+ CoordinationType.FEATURE_TYPE,
75
+ ],
76
+ [DataType.OBS_SETS]: [
77
+ CoordinationType.OBS_TYPE,
78
+ ],
79
+ [DataType.OBS_FEATURE_MATRIX]: [
80
+ CoordinationType.OBS_TYPE,
81
+ CoordinationType.FEATURE_TYPE,
82
+ CoordinationType.FEATURE_VALUE_TYPE,
83
+ ],
84
+ [DataType.GENOMIC_PROFILES]: [],
85
+ [DataType.IMAGE]: [],
86
+ [DataType.NEIGHBORHOODS]: [],
87
+ };
@@ -0,0 +1,14 @@
1
+ import { DataType } from './constants.js';
2
+ import {
3
+ DATA_TYPE_COORDINATION_VALUE_USAGE,
4
+ } from './constant-relationships.js';
5
+
6
+ describe('src/app/constant-relationships.js', () => {
7
+ describe('DataType-to-CoordinationType usage mapping', () => {
8
+ it('every data type is mapped to an array of coordination types', () => {
9
+ const dataTypes = Object.values(DataType).sort();
10
+ const mappedDataTypes = Object.keys(DATA_TYPE_COORDINATION_VALUE_USAGE).sort();
11
+ expect(dataTypes.length).toEqual(mappedDataTypes.length);
12
+ });
13
+ });
14
+ });