@vitessce/all 2.0.3 → 3.0.1

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 (49) hide show
  1. package/dist/{deflate.8ace1ac4.mjs → deflate-475a23c9.js} +2 -2
  2. package/dist/hglib-76c1b0ad.js +138925 -0
  3. package/dist/{index.7dac8670.mjs → index-f48f3f08.js} +66958 -52713
  4. package/dist/index.js +12 -0
  5. package/dist/{jpeg.c8011e3a.mjs → jpeg-7f0b1b2c.js} +1 -1
  6. package/dist/{lerc.ccda5eb2.mjs → lerc-f7557585.js} +76 -5
  7. package/dist/{lzw.39876143.mjs → lzw-4d26ee71.js} +1 -1
  8. package/dist/{packbits.9e95d117.mjs → packbits-08efb7ce.js} +1 -1
  9. package/dist/{pako.esm.4b234125.mjs → pako.esm-68f84e2a.js} +97 -15
  10. package/dist/{raw.0279d74b.mjs → raw-3c2d82ff.js} +1 -1
  11. package/dist/{webimage.5ac7ce95.mjs → webimage-a7dde8d2.js} +1 -1
  12. package/dist-tsc/Vitessce.d.ts +2 -0
  13. package/dist-tsc/Vitessce.d.ts.map +1 -0
  14. package/dist-tsc/Vitessce.js +45 -0
  15. package/dist-tsc/base-plugins.d.ts +854 -0
  16. package/dist-tsc/base-plugins.d.ts.map +1 -0
  17. package/dist-tsc/base-plugins.js +191 -0
  18. package/dist-tsc/index.d.ts +4 -0
  19. package/dist-tsc/index.d.ts.map +1 -0
  20. package/dist-tsc/index.js +3 -2
  21. package/dist-tsc/joint-file-types-legacy.d.ts +226 -0
  22. package/dist-tsc/joint-file-types-legacy.d.ts.map +1 -0
  23. package/dist-tsc/joint-file-types-legacy.js +266 -0
  24. package/dist-tsc/joint-file-types-legacy.test.d.ts +2 -0
  25. package/dist-tsc/joint-file-types-legacy.test.d.ts.map +1 -0
  26. package/dist-tsc/joint-file-types-legacy.test.js +401 -0
  27. package/dist-tsc/joint-file-types.d.ts +4 -0
  28. package/dist-tsc/joint-file-types.d.ts.map +1 -0
  29. package/dist-tsc/joint-file-types.js +127 -0
  30. package/dist-tsc/joint-file-types.test.d.ts +2 -0
  31. package/dist-tsc/joint-file-types.test.d.ts.map +1 -0
  32. package/dist-tsc/joint-file-types.test.js +128 -0
  33. package/dist-tsc/latest-config-schema.test.d.ts +2 -0
  34. package/dist-tsc/latest-config-schema.test.d.ts.map +1 -0
  35. package/dist-tsc/latest-config-schema.test.js +19 -0
  36. package/package.json +37 -21
  37. package/src/Vitessce.tsx +79 -0
  38. package/src/base-plugins.ts +362 -0
  39. package/src/index.ts +8 -0
  40. package/src/joint-file-types-legacy.test.ts +413 -0
  41. package/src/joint-file-types-legacy.ts +284 -0
  42. package/src/joint-file-types.test.ts +132 -0
  43. package/src/joint-file-types.ts +142 -0
  44. package/src/latest-config-schema.test.ts +26 -0
  45. package/src/missing-types.d.ts +1 -0
  46. package/dist/hglib.1f1ea875.mjs +0 -130303
  47. package/dist/index.mjs +0 -11
  48. package/src/index.js +0 -7
  49. package/src/setup.js +0 -143
@@ -0,0 +1,413 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import {
3
+ expandExpressionMatrixZarr,
4
+ expandRasterJson,
5
+ expandRasterOmeZarr,
6
+ expandGenesJson,
7
+ expandClustersJson,
8
+ expandCellsJson,
9
+ expandMoleculesJson,
10
+ expandAnndataCellsZarr,
11
+ expandAnndataCellSetsZarr,
12
+ expandAnndataExpressionMatrixZarr,
13
+ } from './joint-file-types-legacy.js';
14
+
15
+ describe('src/app/joint-file-types-legacy.js', () => {
16
+ describe('expandExpressionMatrixZarr', () => {
17
+ it('expands expression-matrix.zarr', () => {
18
+ expect(expandExpressionMatrixZarr({
19
+ fileType: 'expression-matrix.zarr',
20
+ url: 'http://localhost:8000/expression-matrix.zarr',
21
+ })).toEqual([
22
+ {
23
+ fileType: 'obsFeatureMatrix.expression-matrix.zarr',
24
+ url: 'http://localhost:8000/expression-matrix.zarr',
25
+ coordinationValues: {
26
+ obsType: 'cell',
27
+ featureType: 'gene',
28
+ featureValueType: 'expression',
29
+ },
30
+ },
31
+ ]);
32
+ });
33
+ });
34
+ describe('expandRasterJson', () => {
35
+ it('expands raster.json', () => {
36
+ expect(expandRasterJson({
37
+ fileType: 'raster.json',
38
+ url: 'http://localhost:8000/raster.json',
39
+ })).toEqual([
40
+ {
41
+ fileType: 'image.raster.json',
42
+ url: 'http://localhost:8000/raster.json',
43
+ },
44
+ {
45
+ fileType: 'obsSegmentations.raster.json',
46
+ url: 'http://localhost:8000/raster.json',
47
+ coordinationValues: {
48
+ obsType: 'cell',
49
+ },
50
+ },
51
+ ]);
52
+ });
53
+ });
54
+ describe('expandRasterOmeZarr', () => {
55
+ it('expands raster.ome-zarr', () => {
56
+ expect(expandRasterOmeZarr({
57
+ fileType: 'raster.ome-zarr',
58
+ url: 'http://localhost:8000/raster.zarr',
59
+ })).toEqual([
60
+ {
61
+ fileType: 'image.ome-zarr',
62
+ url: 'http://localhost:8000/raster.zarr',
63
+ },
64
+ ]);
65
+ });
66
+ });
67
+ describe('expandClustersJson', () => {
68
+ it('expands clusters.json', () => {
69
+ expect(expandClustersJson({
70
+ fileType: 'clusters.json',
71
+ url: 'http://localhost:8000/clusters.json',
72
+ })).toEqual([
73
+ {
74
+ fileType: 'obsFeatureMatrix.clusters.json',
75
+ url: 'http://localhost:8000/clusters.json',
76
+ coordinationValues: {
77
+ obsType: 'cell',
78
+ featureType: 'gene',
79
+ featureValueType: 'expression',
80
+ },
81
+ },
82
+ ]);
83
+ });
84
+ });
85
+ describe('expandGenesJson', () => {
86
+ it('expands', () => {
87
+ expect(expandGenesJson({
88
+ fileType: 'genes.json',
89
+ url: 'http://localhost:8000/genes.json',
90
+ })).toEqual([
91
+ {
92
+ fileType: 'obsFeatureMatrix.genes.json',
93
+ url: 'http://localhost:8000/genes.json',
94
+ coordinationValues: {
95
+ obsType: 'cell',
96
+ featureType: 'gene',
97
+ featureValueType: 'expression',
98
+ },
99
+ },
100
+ ]);
101
+ });
102
+ });
103
+ describe('expandMoleculesJson', () => {
104
+ it('expands when there are no options', () => {
105
+ expect(expandMoleculesJson({
106
+ fileType: 'molecules.json',
107
+ url: 'http://localhost:8000/molecules.json',
108
+ })).toEqual([
109
+ {
110
+ fileType: 'obsLocations.molecules.json',
111
+ url: 'http://localhost:8000/molecules.json',
112
+ coordinationValues: {
113
+ obsType: 'molecule',
114
+ },
115
+ },
116
+ {
117
+ fileType: 'obsLabels.molecules.json',
118
+ url: 'http://localhost:8000/molecules.json',
119
+ coordinationValues: {
120
+ obsType: 'molecule',
121
+ },
122
+ },
123
+ ]);
124
+ });
125
+ });
126
+ describe('expandCellsJson', () => {
127
+ it('expands when there are no options', () => {
128
+ expect(expandCellsJson({
129
+ fileType: 'cells.json',
130
+ url: 'http://localhost:8000/cells.json',
131
+ })).toEqual([
132
+ {
133
+ fileType: 'obsSegmentations.cells.json',
134
+ url: 'http://localhost:8000/cells.json',
135
+ coordinationValues: {
136
+ obsType: 'cell',
137
+ },
138
+ },
139
+ {
140
+ fileType: 'obsLocations.cells.json',
141
+ url: 'http://localhost:8000/cells.json',
142
+ coordinationValues: {
143
+ obsType: 'cell',
144
+ },
145
+ },
146
+ ]);
147
+ });
148
+ it('expands when there is an array of embedding types', () => {
149
+ expect(expandCellsJson({
150
+ fileType: 'cells.json',
151
+ url: 'http://localhost:8000/cells.json',
152
+ options: {
153
+ embeddingTypes: ['UMAP', 't-SNE'],
154
+ obsLabelsTypes: ['cluster', 'subcluster'],
155
+ },
156
+ })).toEqual([
157
+ {
158
+ fileType: 'obsSegmentations.cells.json',
159
+ url: 'http://localhost:8000/cells.json',
160
+ coordinationValues: {
161
+ obsType: 'cell',
162
+ },
163
+ },
164
+ {
165
+ fileType: 'obsLocations.cells.json',
166
+ url: 'http://localhost:8000/cells.json',
167
+ coordinationValues: {
168
+ obsType: 'cell',
169
+ },
170
+ },
171
+ {
172
+ fileType: 'obsEmbedding.cells.json',
173
+ url: 'http://localhost:8000/cells.json',
174
+ coordinationValues: {
175
+ obsType: 'cell',
176
+ embeddingType: 'UMAP',
177
+ },
178
+ },
179
+ {
180
+ fileType: 'obsEmbedding.cells.json',
181
+ url: 'http://localhost:8000/cells.json',
182
+ coordinationValues: {
183
+ obsType: 'cell',
184
+ embeddingType: 't-SNE',
185
+ },
186
+ },
187
+ {
188
+ fileType: 'obsLabels.cells.json',
189
+ url: 'http://localhost:8000/cells.json',
190
+ coordinationValues: {
191
+ obsType: 'cell',
192
+ obsLabelsType: 'cluster',
193
+ },
194
+ },
195
+ {
196
+ fileType: 'obsLabels.cells.json',
197
+ url: 'http://localhost:8000/cells.json',
198
+ coordinationValues: {
199
+ obsType: 'cell',
200
+ obsLabelsType: 'subcluster',
201
+ },
202
+ },
203
+ ]);
204
+ });
205
+ });
206
+ // cells
207
+ describe('expandAnndataCellsZarr', () => {
208
+ it('fails to expand when there are no options', () => {
209
+ expect(expandAnndataCellsZarr({
210
+ fileType: 'anndata-cells.zarr',
211
+ url: 'http://localhost:8000/anndata.zarr',
212
+ })).toEqual([]);
213
+ });
214
+ it('expands when there are lots of options', () => {
215
+ expect(expandAnndataCellsZarr({
216
+ fileType: 'anndata-cells.zarr',
217
+ url: 'http://localhost:8000/anndata.zarr',
218
+ options: {
219
+ mappings: {
220
+ 't-SNE': {
221
+ key: 'obsm/tsne',
222
+ },
223
+ PCA: {
224
+ dims: [2, 3],
225
+ key: 'obsm/pca',
226
+ },
227
+ },
228
+ xy: 'obsm/locations',
229
+ poly: 'obsm/segmentations',
230
+ factors: [
231
+ 'obs/cluster',
232
+ 'obs/subcluster',
233
+ ],
234
+ },
235
+ })).toEqual([
236
+ {
237
+ fileType: 'obsSegmentations.anndata.zarr',
238
+ url: 'http://localhost:8000/anndata.zarr',
239
+ options: {
240
+ path: 'obsm/segmentations',
241
+ },
242
+ coordinationValues: {
243
+ obsType: 'cell',
244
+ },
245
+ },
246
+ {
247
+ fileType: 'obsLocations.anndata.zarr',
248
+ url: 'http://localhost:8000/anndata.zarr',
249
+ options: {
250
+ path: 'obsm/locations',
251
+ },
252
+ coordinationValues: {
253
+ obsType: 'cell',
254
+ },
255
+ },
256
+ {
257
+ fileType: 'obsEmbedding.anndata.zarr',
258
+ url: 'http://localhost:8000/anndata.zarr',
259
+ options: {
260
+ path: 'obsm/tsne',
261
+ },
262
+ coordinationValues: {
263
+ obsType: 'cell',
264
+ embeddingType: 't-SNE',
265
+ },
266
+ },
267
+ {
268
+ fileType: 'obsEmbedding.anndata.zarr',
269
+ url: 'http://localhost:8000/anndata.zarr',
270
+ options: {
271
+ path: 'obsm/pca',
272
+ dims: [2, 3],
273
+ },
274
+ coordinationValues: {
275
+ obsType: 'cell',
276
+ embeddingType: 'PCA',
277
+ },
278
+ },
279
+ {
280
+ fileType: 'obsLabels.anndata.zarr',
281
+ url: 'http://localhost:8000/anndata.zarr',
282
+ options: {
283
+ path: 'obs/cluster',
284
+ },
285
+ coordinationValues: {
286
+ obsType: 'cell',
287
+ obsLabelsType: 'cluster',
288
+ },
289
+ },
290
+ {
291
+ fileType: 'obsLabels.anndata.zarr',
292
+ url: 'http://localhost:8000/anndata.zarr',
293
+ options: {
294
+ path: 'obs/subcluster',
295
+ },
296
+ coordinationValues: {
297
+ obsType: 'cell',
298
+ obsLabelsType: 'subcluster',
299
+ },
300
+ },
301
+ ]);
302
+ });
303
+ });
304
+ // cell sets
305
+ describe('expandAnndataCellSetsZarr', () => {
306
+ it('expands both flat and hierarchical cell sets', () => {
307
+ expect(expandAnndataCellSetsZarr({
308
+ fileType: 'anndata-cell-sets.zarr',
309
+ url: 'http://localhost:8000/anndata.zarr',
310
+ options: [
311
+ {
312
+ groupName: 'Leiden clustering',
313
+ setName: 'obs/leiden',
314
+ },
315
+ {
316
+ groupName: 'Predicted cell types',
317
+ setName: 'obs/pred_types',
318
+ scoreName: 'obs/pred_scores',
319
+ },
320
+ {
321
+ groupName: 'Cell type annotations',
322
+ setName: ['obs/l1', 'obs/l2', 'obs/l3'],
323
+ },
324
+ ],
325
+ })).toEqual([
326
+ {
327
+ fileType: 'obsSets.anndata.zarr',
328
+ url: 'http://localhost:8000/anndata.zarr',
329
+ options: [
330
+ {
331
+ name: 'Leiden clustering',
332
+ path: 'obs/leiden',
333
+ },
334
+ {
335
+ name: 'Predicted cell types',
336
+ path: 'obs/pred_types',
337
+ scorePath: 'obs/pred_scores',
338
+ },
339
+ {
340
+ name: 'Cell type annotations',
341
+ path: ['obs/l1', 'obs/l2', 'obs/l3'],
342
+ },
343
+ ],
344
+ coordinationValues: {
345
+ obsType: 'cell',
346
+ },
347
+ },
348
+ ]);
349
+ });
350
+ // expression-matrix
351
+ describe('expandAnndataExpressionMatrixZarr', () => {
352
+ it('expands when there are no options', () => {
353
+ expect(expandAnndataExpressionMatrixZarr({
354
+ fileType: 'anndata-expression-matrix.zarr',
355
+ url: 'http://localhost:8000/anndata.zarr',
356
+ options: {
357
+ matrix: 'X',
358
+ },
359
+ })).toEqual([
360
+ {
361
+ fileType: 'obsFeatureMatrix.anndata.zarr',
362
+ url: 'http://localhost:8000/anndata.zarr',
363
+ options: {
364
+ path: 'X',
365
+ },
366
+ coordinationValues: {
367
+ obsType: 'cell',
368
+ featureType: 'gene',
369
+ featureValueType: 'expression',
370
+ },
371
+ },
372
+ ]);
373
+ });
374
+ it('expands when there are lots of options', () => {
375
+ expect(expandAnndataExpressionMatrixZarr({
376
+ fileType: 'anndata-expression-matrix.zarr',
377
+ url: 'http://localhost:8000/anndata.zarr',
378
+ options: {
379
+ matrix: 'obsm/hvg_subset',
380
+ geneAlias: 'var/gene_symbol',
381
+ geneFilter: 'var/in_hvg_subset',
382
+ matrixGeneFilter: 'var/highly_variable',
383
+ },
384
+ })).toEqual([
385
+ {
386
+ fileType: 'featureLabels.anndata.zarr',
387
+ url: 'http://localhost:8000/anndata.zarr',
388
+ options: {
389
+ path: 'var/gene_symbol',
390
+ },
391
+ coordinationValues: {
392
+ featureType: 'gene',
393
+ },
394
+ },
395
+ {
396
+ fileType: 'obsFeatureMatrix.anndata.zarr',
397
+ url: 'http://localhost:8000/anndata.zarr',
398
+ options: {
399
+ path: 'obsm/hvg_subset',
400
+ featureFilterPath: 'var/in_hvg_subset',
401
+ initialFeatureFilterPath: 'var/highly_variable',
402
+ },
403
+ coordinationValues: {
404
+ obsType: 'cell',
405
+ featureType: 'gene',
406
+ featureValueType: 'expression',
407
+ },
408
+ },
409
+ ]);
410
+ });
411
+ });
412
+ });
413
+ });
@@ -0,0 +1,284 @@
1
+ import type { z } from 'zod';
2
+ import type { latestFileDefSchema } from '@vitessce/schemas';
3
+ import { FileType } from '@vitessce/constants-internal';
4
+
5
+ type legacyFileDefSchema = z.infer<typeof latestFileDefSchema> & {
6
+ type?: string;
7
+ };
8
+
9
+ export function expandMoleculesJson(fileDef: legacyFileDefSchema) {
10
+ const baseFileDef = {
11
+ ...fileDef,
12
+ coordinationValues: {
13
+ obsType: fileDef.coordinationValues?.obsType || 'molecule',
14
+ },
15
+ };
16
+ delete baseFileDef.type;
17
+ return [
18
+ {
19
+ ...baseFileDef,
20
+ fileType: FileType.OBS_LOCATIONS_MOLECULES_JSON,
21
+ },
22
+ {
23
+ ...baseFileDef,
24
+ fileType: FileType.OBS_LABELS_MOLECULES_JSON,
25
+ },
26
+ ];
27
+ }
28
+
29
+ export function expandExpressionMatrixZarr(fileDef: legacyFileDefSchema) {
30
+ const baseFileDef = {
31
+ ...fileDef,
32
+ coordinationValues: {
33
+ obsType: fileDef.coordinationValues?.obsType || 'cell',
34
+ featureType: fileDef.coordinationValues?.featureType || 'gene',
35
+ featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
36
+ },
37
+ };
38
+ delete baseFileDef.type;
39
+ return [
40
+ {
41
+ ...baseFileDef,
42
+ fileType: FileType.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR,
43
+ },
44
+ ];
45
+ }
46
+
47
+ export function expandRasterJson(fileDef: legacyFileDefSchema) {
48
+ // Validation already happens in the RasterJsonLoader.
49
+ const baseFileDef = { ...fileDef };
50
+ delete baseFileDef.type;
51
+ return [
52
+ {
53
+ ...baseFileDef,
54
+ fileType: FileType.IMAGE_RASTER_JSON,
55
+ },
56
+ {
57
+ ...baseFileDef,
58
+ fileType: FileType.OBS_SEGMENTATIONS_RASTER_JSON,
59
+ coordinationValues: {
60
+ obsType: baseFileDef.coordinationValues?.obsType || 'cell',
61
+ },
62
+ },
63
+ ];
64
+ }
65
+
66
+ export function expandRasterOmeZarr(fileDef: legacyFileDefSchema) {
67
+ const baseFileDef = { ...fileDef };
68
+ delete baseFileDef.type;
69
+ return [
70
+ {
71
+ ...baseFileDef,
72
+ fileType: FileType.IMAGE_OME_ZARR,
73
+ },
74
+ ];
75
+ }
76
+
77
+ export function expandCellSetsJson(fileDef: legacyFileDefSchema) {
78
+ const baseFileDef = { ...fileDef };
79
+ delete baseFileDef.type;
80
+ return [
81
+ {
82
+ ...baseFileDef,
83
+ fileType: FileType.OBS_SETS_CELL_SETS_JSON,
84
+ coordinationValues: {
85
+ obsType: baseFileDef.coordinationValues?.obsType || 'cell',
86
+ },
87
+ },
88
+ ];
89
+ }
90
+
91
+ export function expandCellsJson(fileDef: legacyFileDefSchema) {
92
+ const baseFileDef = {
93
+ ...fileDef,
94
+ coordinationValues: {
95
+ obsType: fileDef.coordinationValues?.obsType || 'cell',
96
+ featureType: fileDef.coordinationValues?.featureType || 'gene',
97
+ },
98
+ };
99
+ delete baseFileDef.type;
100
+ delete baseFileDef.options;
101
+ return [
102
+ {
103
+ ...baseFileDef,
104
+ fileType: FileType.OBS_SEGMENTATIONS_CELLS_JSON,
105
+ coordinationValues: {
106
+ obsType: baseFileDef.coordinationValues.obsType,
107
+ },
108
+ },
109
+ {
110
+ ...baseFileDef,
111
+ fileType: FileType.OBS_LOCATIONS_CELLS_JSON,
112
+ coordinationValues: {
113
+ obsType: baseFileDef.coordinationValues.obsType,
114
+ },
115
+ },
116
+ ...(fileDef.options?.embeddingTypes ? fileDef.options.embeddingTypes.map((et: string) => ({
117
+ ...baseFileDef,
118
+ fileType: FileType.OBS_EMBEDDING_CELLS_JSON,
119
+ coordinationValues: {
120
+ obsType: baseFileDef.coordinationValues.obsType,
121
+ embeddingType: et,
122
+ },
123
+ })) : []),
124
+ ...(fileDef.options?.obsLabelsTypes ? fileDef.options.obsLabelsTypes.map((key: string) => ({
125
+ ...baseFileDef,
126
+ fileType: FileType.OBS_LABELS_CELLS_JSON,
127
+ coordinationValues: {
128
+ obsType: baseFileDef.coordinationValues.obsType,
129
+ obsLabelsType: key,
130
+ },
131
+ })) : []),
132
+ ];
133
+ }
134
+
135
+ export function expandClustersJson(fileDef: legacyFileDefSchema) {
136
+ const baseFileDef = {
137
+ ...fileDef,
138
+ coordinationValues: {
139
+ obsType: fileDef.coordinationValues?.obsType || 'cell',
140
+ featureType: fileDef.coordinationValues?.featureType || 'gene',
141
+ featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
142
+ },
143
+ };
144
+ delete baseFileDef.type;
145
+ return [
146
+ {
147
+ ...baseFileDef,
148
+ fileType: FileType.OBS_FEATURE_MATRIX_CLUSTERS_JSON,
149
+ },
150
+ ];
151
+ }
152
+
153
+ export function expandGenesJson(fileDef: legacyFileDefSchema) {
154
+ const baseFileDef = {
155
+ ...fileDef,
156
+ coordinationValues: {
157
+ obsType: fileDef.coordinationValues?.obsType || 'cell',
158
+ featureType: fileDef.coordinationValues?.featureType || 'gene',
159
+ featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
160
+ },
161
+ };
162
+ delete baseFileDef.type;
163
+ return [
164
+ {
165
+ ...baseFileDef,
166
+ fileType: FileType.OBS_FEATURE_MATRIX_GENES_JSON,
167
+ },
168
+ ];
169
+ }
170
+
171
+ function getAnndataBaseFileDef(fileDef: legacyFileDefSchema) {
172
+ return {
173
+ url: fileDef.url,
174
+ requestInit: fileDef.requestInit,
175
+ coordinationValues: {
176
+ ...fileDef.coordinationValues,
177
+ obsType: fileDef.coordinationValues?.obsType || 'cell',
178
+ featureType: fileDef.coordinationValues?.featureType || 'gene',
179
+ featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
180
+ },
181
+ };
182
+ }
183
+
184
+ export function expandAnndataCellsZarr(fileDef: legacyFileDefSchema) {
185
+ const baseFileDef = getAnndataBaseFileDef(fileDef);
186
+ const { options = {} } = fileDef;
187
+ const embeddingTypes = options.mappings ? Object.keys(options.mappings) : [];
188
+ const obsLabelsTypes = options.factors ? options.factors : [];
189
+ return [
190
+ ...(options.poly ? [{
191
+ ...baseFileDef,
192
+ fileType: FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR,
193
+ options: {
194
+ path: options.poly,
195
+ },
196
+ coordinationValues: {
197
+ obsType: baseFileDef.coordinationValues.obsType,
198
+ },
199
+ }] : []),
200
+ ...(options.xy ? [{
201
+ ...baseFileDef,
202
+ fileType: FileType.OBS_LOCATIONS_ANNDATA_ZARR,
203
+ options: {
204
+ path: options.xy,
205
+ },
206
+ coordinationValues: {
207
+ obsType: baseFileDef.coordinationValues.obsType,
208
+ },
209
+ }] : []),
210
+ ...embeddingTypes.map(et => ({
211
+ ...baseFileDef,
212
+ fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
213
+ options: {
214
+ path: options.mappings[et].key,
215
+ dims: options.mappings[et].dims,
216
+ },
217
+ coordinationValues: {
218
+ obsType: baseFileDef.coordinationValues.obsType,
219
+ embeddingType: et,
220
+ },
221
+ })),
222
+ ...obsLabelsTypes.map((olt: string) => ({
223
+ ...baseFileDef,
224
+ fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
225
+ options: {
226
+ path: olt,
227
+ },
228
+ coordinationValues: {
229
+ obsType: baseFileDef.coordinationValues.obsType,
230
+ obsLabelsType: olt.split('/').at(-1),
231
+ },
232
+ })),
233
+ ];
234
+ }
235
+
236
+ export function expandAnndataCellSetsZarr(fileDef: legacyFileDefSchema) {
237
+ const baseFileDef = getAnndataBaseFileDef(fileDef);
238
+ const { options = [] } = fileDef;
239
+ return [
240
+ {
241
+ ...baseFileDef,
242
+ fileType: FileType.OBS_SETS_ANNDATA_ZARR,
243
+ options: options.map((option: any) => ({
244
+ name: option.groupName,
245
+ path: option.setName,
246
+ scorePath: option.scoreName,
247
+ })),
248
+ coordinationValues: {
249
+ obsType: baseFileDef.coordinationValues.obsType,
250
+ },
251
+ },
252
+ ];
253
+ }
254
+
255
+ export function expandAnndataExpressionMatrixZarr(fileDef: legacyFileDefSchema) {
256
+ const baseFileDef = getAnndataBaseFileDef(fileDef);
257
+ const { options = {} } = fileDef;
258
+ return [
259
+ ...(options.geneAlias ? [{
260
+ ...baseFileDef,
261
+ fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
262
+ options: {
263
+ path: options.geneAlias,
264
+ },
265
+ coordinationValues: {
266
+ featureType: baseFileDef.coordinationValues.featureType,
267
+ },
268
+ }] : []),
269
+ {
270
+ ...baseFileDef,
271
+ fileType: FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR,
272
+ options: {
273
+ path: options.matrix,
274
+ featureFilterPath: options.geneFilter,
275
+ initialFeatureFilterPath: options.matrixGeneFilter,
276
+ },
277
+ coordinationValues: {
278
+ obsType: baseFileDef.coordinationValues.obsType,
279
+ featureType: baseFileDef.coordinationValues.featureType,
280
+ featureValueType: baseFileDef.coordinationValues.featureValueType,
281
+ },
282
+ },
283
+ ];
284
+ }