@vitessce/vit-s 2.0.3-beta.0 → 2.0.3

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 (184) hide show
  1. package/dist/index.mjs +84801 -0
  2. package/{dist → dist-tsc}/index.js +2 -2
  3. package/package.json +7 -7
  4. package/src/CallbackPublisher.js +81 -0
  5. package/src/LoadingIndicator.js +34 -0
  6. package/src/TitleInfo.js +240 -0
  7. package/src/VitS.js +180 -0
  8. package/src/VitessceGrid.js +110 -0
  9. package/src/VitessceGrid.test.jsx +48 -0
  10. package/src/Warning.js +62 -0
  11. package/{dist → src}/classNames.js +0 -0
  12. package/src/component-registry.js +21 -0
  13. package/src/data/AbstractLoader.js +46 -0
  14. package/{dist → src}/data/AbstractTwoStepLoader.js +5 -4
  15. package/src/data/LoaderResult.js +8 -0
  16. package/{dist → src}/data/index.js +0 -0
  17. package/src/data/loader-registry.js +19 -0
  18. package/src/data-hook-utils.js +197 -0
  19. package/src/data-hooks.js +354 -0
  20. package/src/errors/AbstractLoaderError.js +14 -0
  21. package/src/errors/DataSourceFetchError.js +15 -0
  22. package/src/errors/DatasetNotFoundError.js +23 -0
  23. package/src/errors/LoaderNotFoundError.js +24 -0
  24. package/src/errors/LoaderValidationError.js +23 -0
  25. package/src/errors/OptionsValidationError.js +25 -0
  26. package/{dist → src}/errors/index.js +0 -0
  27. package/src/file-options-schemas-legacy.js +139 -0
  28. package/src/file-options-schemas-legacy.test.js +138 -0
  29. package/src/file-options-schemas.js +327 -0
  30. package/src/file-options-schemas.test.js +26 -0
  31. package/src/hooks.js +252 -0
  32. package/src/index.js +101 -0
  33. package/src/joint-file-types-legacy.js +298 -0
  34. package/src/joint-file-types-legacy.test.js +412 -0
  35. package/src/joint-file-types.js +171 -0
  36. package/src/joint-file-types.test.js +144 -0
  37. package/{dist/schemas.js → src/json-schemas.js} +6 -1
  38. package/{dist → src}/plugins.js +102 -70
  39. package/src/plugins.test.fixtures.js +78 -0
  40. package/src/plugins.test.js +42 -0
  41. package/src/schemas/config-0.1.0.schema.json +85 -0
  42. package/src/schemas/config-1.0.0.schema.json +733 -0
  43. package/src/schemas/config-1.0.1.schema.json +909 -0
  44. package/src/schemas/config-1.0.10.schema.json +969 -0
  45. package/src/schemas/config-1.0.11.schema.json +990 -0
  46. package/src/schemas/config-1.0.12.schema.json +997 -0
  47. package/src/schemas/config-1.0.13.schema.json +1013 -0
  48. package/src/schemas/config-1.0.14.schema.json +1048 -0
  49. package/src/schemas/config-1.0.15.schema.json +1048 -0
  50. package/src/schemas/config-1.0.16.schema.json +1069 -0
  51. package/src/schemas/config-1.0.16.schema.test.js +32 -0
  52. package/src/schemas/config-1.0.2.schema.json +911 -0
  53. package/src/schemas/config-1.0.3.schema.json +911 -0
  54. package/src/schemas/config-1.0.4.schema.json +949 -0
  55. package/src/schemas/config-1.0.5.schema.json +949 -0
  56. package/src/schemas/config-1.0.6.schema.json +950 -0
  57. package/src/schemas/config-1.0.7.schema.json +950 -0
  58. package/src/schemas/config-1.0.8.schema.json +966 -0
  59. package/src/schemas/config-1.0.9.schema.json +965 -0
  60. package/src/schemas/fixtures/cellSets.good.json +16 -0
  61. package/src/schemas/fixtures/config-1.0.1.bad.json +1 -0
  62. package/src/schemas/fixtures/config-1.0.1.bad.message.json +11 -0
  63. package/src/schemas/fixtures/config-1.0.1.good.json +37 -0
  64. package/src/schemas/fixtures/config-1.0.2.bad.json +1 -0
  65. package/src/schemas/fixtures/config-1.0.2.bad.message.json +11 -0
  66. package/src/schemas/fixtures/config-1.0.2.good.json +38 -0
  67. package/src/schemas/fixtures/config-1.0.3.bad.json +1 -0
  68. package/src/schemas/fixtures/config-1.0.3.bad.message.json +11 -0
  69. package/src/schemas/fixtures/config-1.0.3.good.json +38 -0
  70. package/src/schemas/fixtures/obsSets.bad.json +1 -0
  71. package/src/schemas/fixtures/obsSets.bad.message.json +11 -0
  72. package/src/schemas/fixtures/obsSets.good.json +16 -0
  73. package/src/schemas/fixtures/obsSetsTabular.bad.json +1 -0
  74. package/src/schemas/fixtures/obsSetsTabular.bad.message.json +11 -0
  75. package/src/schemas/fixtures/obsSetsTabular.good.json +26 -0
  76. package/src/schemas/fixtures/raster.bad.json +1 -0
  77. package/src/schemas/fixtures/raster.bad.message.json +11 -0
  78. package/src/schemas/fixtures/raster.good.json +39 -0
  79. package/src/schemas/obsSets.schema.js +195 -0
  80. package/src/schemas/obsSetsTabular.schema.js +39 -0
  81. package/src/schemas/raster.schema.js +121 -0
  82. package/src/schemas/schema-schema.sh +34 -0
  83. package/{dist → src}/schemas/schema.test-old.js +0 -1
  84. package/src/shared-mui/components.js +79 -0
  85. package/src/shared-mui/container.js +212 -0
  86. package/src/shared-mui/styles.js +110 -0
  87. package/src/shared-plot-options/CellColorEncodingOption.js +43 -0
  88. package/src/shared-plot-options/OptionSelect.js +19 -0
  89. package/src/shared-plot-options/OptionsContainer.js +26 -0
  90. package/{dist → src}/shared-plot-options/index.js +0 -0
  91. package/src/shared-plot-options/styles.js +49 -0
  92. package/src/state/hooks.js +633 -0
  93. package/src/view-config-upgraders.js +628 -0
  94. package/src/view-config-utils.js +315 -0
  95. package/src/view-config-utils.test.fixtures.js +893 -0
  96. package/src/view-config-utils.test.js +95 -0
  97. package/src/view-config-versions.js +68 -0
  98. package/src/vitessce-grid-layout/VitessceGridLayout.js +158 -0
  99. package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +56 -0
  100. package/{dist → src}/vitessce-grid-layout/index.js +0 -0
  101. package/src/vitessce-grid-layout/layout-utils.js +76 -0
  102. package/src/vitessce-grid-layout/layout-utils.test.js +167 -0
  103. package/src/vitessce-grid-utils.js +160 -0
  104. package/dist/CallbackPublisher.js +0 -68
  105. package/dist/LoadingIndicator.js +0 -27
  106. package/dist/TitleInfo.js +0 -151
  107. package/dist/VitS.js +0 -117
  108. package/dist/Vitessce.integration.test.js +0 -36
  109. package/dist/Vitessce.js +0 -101
  110. package/dist/VitessceGrid.js +0 -59
  111. package/dist/VitessceGrid.test.js +0 -36
  112. package/dist/Warning.js +0 -45
  113. package/dist/component-registry.js +0 -16
  114. package/dist/data/AbstractLoader.js +0 -35
  115. package/dist/data/LoaderResult.js +0 -7
  116. package/dist/data/loader-registry.js +0 -15
  117. package/dist/data-hook-utils.js +0 -175
  118. package/dist/data-hooks.js +0 -241
  119. package/dist/errors/AbstractLoaderError.js +0 -13
  120. package/dist/errors/DataSourceFetchError.js +0 -13
  121. package/dist/errors/DatasetNotFoundError.js +0 -17
  122. package/dist/errors/LoaderNotFoundError.js +0 -17
  123. package/dist/errors/LoaderValidationError.js +0 -15
  124. package/dist/errors/OptionsValidationError.js +0 -15
  125. package/dist/export-utils.js +0 -70
  126. package/dist/export-utils.test.js +0 -66
  127. package/dist/file-options-schemas-legacy.js +0 -136
  128. package/dist/file-options-schemas-legacy.test.js +0 -126
  129. package/dist/file-options-schemas.js +0 -322
  130. package/dist/file-options-schemas.test.js +0 -23
  131. package/dist/hooks.js +0 -215
  132. package/dist/joint-file-types-legacy.js +0 -278
  133. package/dist/joint-file-types-legacy.test.js +0 -400
  134. package/dist/joint-file-types.js +0 -148
  135. package/dist/joint-file-types.test.js +0 -139
  136. package/dist/loader-registry.js +0 -98
  137. package/dist/plugins.test.fixtures.js +0 -76
  138. package/dist/plugins.test.js +0 -30
  139. package/dist/schemas/PrettyJsonSchema.js +0 -34
  140. package/dist/schemas/config-0.1.0.schema.json +0 -84
  141. package/dist/schemas/config-1.0.0.schema.json +0 -733
  142. package/dist/schemas/config-1.0.1.schema.json +0 -909
  143. package/dist/schemas/config-1.0.10.schema.json +0 -969
  144. package/dist/schemas/config-1.0.11.schema.json +0 -990
  145. package/dist/schemas/config-1.0.12.schema.json +0 -997
  146. package/dist/schemas/config-1.0.13.schema.json +0 -1013
  147. package/dist/schemas/config-1.0.14.schema.json +0 -1048
  148. package/dist/schemas/config-1.0.15.schema.json +0 -1048
  149. package/dist/schemas/config-1.0.15.schema.test.js +0 -22
  150. package/dist/schemas/config-1.0.16.schema.json +0 -1109
  151. package/dist/schemas/config-1.0.16.schema.test.js +0 -22
  152. package/dist/schemas/config-1.0.2.schema.json +0 -910
  153. package/dist/schemas/config-1.0.3.schema.json +0 -910
  154. package/dist/schemas/config-1.0.4.schema.json +0 -949
  155. package/dist/schemas/config-1.0.5.schema.json +0 -949
  156. package/dist/schemas/config-1.0.6.schema.json +0 -949
  157. package/dist/schemas/config-1.0.7.schema.json +0 -949
  158. package/dist/schemas/config-1.0.8.schema.json +0 -965
  159. package/dist/schemas/config-1.0.9.schema.json +0 -965
  160. package/dist/schemas/obs-sets-tabular.schema.js +0 -37
  161. package/dist/schemas/obs-sets.schema.js +0 -194
  162. package/dist/schemas/obsSets.schema.js +0 -195
  163. package/dist/schemas/obsSetsTabular.schema.js +0 -38
  164. package/dist/schemas/raster.schema.js +0 -120
  165. package/dist/schemas/schema.test.js +0 -46
  166. package/dist/schemas-extra.js +0 -3
  167. package/dist/shared-mui/components.js +0 -35
  168. package/dist/shared-mui/container.js +0 -211
  169. package/dist/shared-mui/styles.js +0 -107
  170. package/dist/shared-plot-options/CellColorEncodingOption.js +0 -18
  171. package/dist/shared-plot-options/OptionSelect.js +0 -12
  172. package/dist/shared-plot-options/OptionsContainer.js +0 -12
  173. package/dist/shared-plot-options/styles.js +0 -48
  174. package/dist/state/hooks.js +0 -549
  175. package/dist/view-config-upgraders.js +0 -525
  176. package/dist/view-config-utils.js +0 -286
  177. package/dist/view-config-utils.test.fixtures.js +0 -765
  178. package/dist/view-config-utils.test.js +0 -66
  179. package/dist/view-config-versions.js +0 -47
  180. package/dist/vitessce-grid-layout/VitessceGridLayout.js +0 -95
  181. package/dist/vitessce-grid-layout/VitessceGridLayout.test.js +0 -40
  182. package/dist/vitessce-grid-layout/layout-utils.js +0 -60
  183. package/dist/vitessce-grid-layout/layout-utils.test.js +0 -146
  184. package/dist/vitessce-grid-utils.js +0 -140
@@ -1,278 +0,0 @@
1
- import { FileType } from '@vitessce/constants-internal';
2
- import { validateOptions, emptySchema, } from './file-options-schemas';
3
- import { cellsJsonSchema, anndataCellsZarrSchema, anndataCellSetsZarrSchema, anndataExpressionMatrixZarrSchema, } from './file-options-schemas-legacy';
4
- export function expandMoleculesJson(fileDef) {
5
- validateOptions(emptySchema, fileDef.options);
6
- const baseFileDef = {
7
- ...fileDef,
8
- coordinationValues: {
9
- obsType: fileDef.coordinationValues?.obsType || 'molecule',
10
- },
11
- };
12
- delete baseFileDef.type;
13
- return [
14
- {
15
- ...baseFileDef,
16
- fileType: FileType.OBS_LOCATIONS_MOLECULES_JSON,
17
- },
18
- {
19
- ...baseFileDef,
20
- fileType: FileType.OBS_LABELS_MOLECULES_JSON,
21
- },
22
- ];
23
- }
24
- export function expandExpressionMatrixZarr(fileDef) {
25
- validateOptions(emptySchema, fileDef.options);
26
- const baseFileDef = {
27
- ...fileDef,
28
- coordinationValues: {
29
- obsType: fileDef.coordinationValues?.obsType || 'cell',
30
- featureType: fileDef.coordinationValues?.featureType || 'gene',
31
- featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
32
- },
33
- };
34
- delete baseFileDef.type;
35
- return [
36
- {
37
- ...baseFileDef,
38
- fileType: FileType.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR,
39
- },
40
- ];
41
- }
42
- export function expandRasterJson(fileDef) {
43
- // Validation already happens in the RasterJsonLoader.
44
- const baseFileDef = { ...fileDef };
45
- delete baseFileDef.type;
46
- return [
47
- {
48
- ...baseFileDef,
49
- fileType: FileType.IMAGE_RASTER_JSON,
50
- },
51
- {
52
- ...baseFileDef,
53
- fileType: FileType.OBS_SEGMENTATIONS_RASTER_JSON,
54
- coordinationValues: {
55
- obsType: baseFileDef.coordinationValues?.obsType || 'cell',
56
- },
57
- },
58
- ];
59
- }
60
- export function expandRasterOmeZarr(fileDef) {
61
- validateOptions(emptySchema, fileDef.options);
62
- const baseFileDef = { ...fileDef };
63
- delete baseFileDef.type;
64
- return [
65
- {
66
- ...baseFileDef,
67
- fileType: FileType.IMAGE_OME_ZARR,
68
- },
69
- ];
70
- }
71
- export function expandCellSetsJson(fileDef) {
72
- validateOptions(emptySchema, fileDef.options);
73
- const baseFileDef = { ...fileDef };
74
- delete baseFileDef.type;
75
- return [
76
- {
77
- ...baseFileDef,
78
- fileType: FileType.OBS_SETS_CELL_SETS_JSON,
79
- coordinationValues: {
80
- obsType: baseFileDef.coordinationValues?.obsType || 'cell',
81
- },
82
- },
83
- ];
84
- }
85
- export function expandCellsJson(fileDef) {
86
- validateOptions(cellsJsonSchema, fileDef.options);
87
- const baseFileDef = {
88
- ...fileDef,
89
- coordinationValues: {
90
- obsType: fileDef.coordinationValues?.obsType || 'cell',
91
- featureType: fileDef.coordinationValues?.featureType || 'gene',
92
- },
93
- };
94
- delete baseFileDef.type;
95
- delete baseFileDef.options;
96
- return [
97
- {
98
- ...baseFileDef,
99
- fileType: FileType.OBS_SEGMENTATIONS_CELLS_JSON,
100
- coordinationValues: {
101
- obsType: baseFileDef.coordinationValues.obsType,
102
- },
103
- },
104
- {
105
- ...baseFileDef,
106
- fileType: FileType.OBS_LOCATIONS_CELLS_JSON,
107
- coordinationValues: {
108
- obsType: baseFileDef.coordinationValues.obsType,
109
- },
110
- },
111
- ...(fileDef.options?.embeddingTypes ? fileDef.options.embeddingTypes.map(et => ({
112
- ...baseFileDef,
113
- fileType: FileType.OBS_EMBEDDING_CELLS_JSON,
114
- coordinationValues: {
115
- obsType: baseFileDef.coordinationValues.obsType,
116
- embeddingType: et,
117
- },
118
- })) : []),
119
- ...(fileDef.options?.obsLabelsTypes ? fileDef.options.obsLabelsTypes.map(key => ({
120
- ...baseFileDef,
121
- fileType: FileType.OBS_LABELS_CELLS_JSON,
122
- coordinationValues: {
123
- obsType: baseFileDef.coordinationValues.obsType,
124
- obsLabelsType: key,
125
- },
126
- })) : []),
127
- ];
128
- }
129
- export function expandClustersJson(fileDef) {
130
- validateOptions(emptySchema, fileDef.options);
131
- const baseFileDef = {
132
- ...fileDef,
133
- coordinationValues: {
134
- obsType: fileDef.coordinationValues?.obsType || 'cell',
135
- featureType: fileDef.coordinationValues?.featureType || 'gene',
136
- featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
137
- },
138
- };
139
- delete baseFileDef.type;
140
- return [
141
- {
142
- ...baseFileDef,
143
- fileType: FileType.OBS_FEATURE_MATRIX_CLUSTERS_JSON,
144
- },
145
- ];
146
- }
147
- export function expandGenesJson(fileDef) {
148
- validateOptions(emptySchema, fileDef.options);
149
- const baseFileDef = {
150
- ...fileDef,
151
- coordinationValues: {
152
- obsType: fileDef.coordinationValues?.obsType || 'cell',
153
- featureType: fileDef.coordinationValues?.featureType || 'gene',
154
- featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
155
- },
156
- };
157
- delete baseFileDef.type;
158
- return [
159
- {
160
- ...baseFileDef,
161
- fileType: FileType.OBS_FEATURE_MATRIX_GENES_JSON,
162
- },
163
- ];
164
- }
165
- function getAnndataBaseFileDef(fileDef) {
166
- return {
167
- url: fileDef.url,
168
- requestInit: fileDef.requestInit,
169
- coordinationValues: {
170
- ...fileDef.coordinationValues,
171
- obsType: fileDef.coordinationValues?.obsType || 'cell',
172
- featureType: fileDef.coordinationValues?.featureType || 'gene',
173
- featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
174
- },
175
- };
176
- }
177
- export function expandAnndataCellsZarr(fileDef) {
178
- validateOptions(anndataCellsZarrSchema, fileDef.options);
179
- const baseFileDef = getAnndataBaseFileDef(fileDef);
180
- const { options = {} } = fileDef;
181
- const embeddingTypes = options.mappings ? Object.keys(options.mappings) : [];
182
- const obsLabelsTypes = options.factors ? options.factors : [];
183
- return [
184
- ...(options.poly ? [{
185
- ...baseFileDef,
186
- fileType: FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR,
187
- options: {
188
- path: options.poly,
189
- },
190
- coordinationValues: {
191
- obsType: baseFileDef.coordinationValues.obsType,
192
- },
193
- }] : []),
194
- ...(options.xy ? [{
195
- ...baseFileDef,
196
- fileType: FileType.OBS_LOCATIONS_ANNDATA_ZARR,
197
- options: {
198
- path: options.xy,
199
- },
200
- coordinationValues: {
201
- obsType: baseFileDef.coordinationValues.obsType,
202
- },
203
- }] : []),
204
- ...embeddingTypes.map(et => ({
205
- ...baseFileDef,
206
- fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
207
- options: {
208
- path: options.mappings[et].key,
209
- dims: options.mappings[et].dims,
210
- },
211
- coordinationValues: {
212
- obsType: baseFileDef.coordinationValues.obsType,
213
- embeddingType: et,
214
- },
215
- })),
216
- ...obsLabelsTypes.map(olt => ({
217
- ...baseFileDef,
218
- fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
219
- options: {
220
- path: olt,
221
- },
222
- coordinationValues: {
223
- obsType: baseFileDef.coordinationValues.obsType,
224
- obsLabelsType: olt.split('/').at(-1),
225
- },
226
- })),
227
- ];
228
- }
229
- export function expandAnndataCellSetsZarr(fileDef) {
230
- validateOptions(anndataCellSetsZarrSchema, fileDef.options);
231
- const baseFileDef = getAnndataBaseFileDef(fileDef);
232
- const { options = [] } = fileDef;
233
- return [
234
- {
235
- ...baseFileDef,
236
- fileType: FileType.OBS_SETS_ANNDATA_ZARR,
237
- options: options.map(option => ({
238
- name: option.groupName,
239
- path: option.setName,
240
- scorePath: option.scoreName,
241
- })),
242
- coordinationValues: {
243
- obsType: baseFileDef.coordinationValues.obsType,
244
- },
245
- },
246
- ];
247
- }
248
- export function expandAnndataExpressionMatrixZarr(fileDef) {
249
- validateOptions(anndataExpressionMatrixZarrSchema, fileDef.options);
250
- const baseFileDef = getAnndataBaseFileDef(fileDef);
251
- const { options = {} } = fileDef;
252
- return [
253
- ...(options.geneAlias ? [{
254
- ...baseFileDef,
255
- fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
256
- options: {
257
- path: options.geneAlias,
258
- },
259
- coordinationValues: {
260
- featureType: baseFileDef.coordinationValues.featureType,
261
- },
262
- }] : []),
263
- {
264
- ...baseFileDef,
265
- fileType: FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR,
266
- options: {
267
- path: options.matrix,
268
- featureFilterPath: options.geneFilter,
269
- initialFeatureFilterPath: options.matrixGeneFilter,
270
- },
271
- coordinationValues: {
272
- obsType: baseFileDef.coordinationValues.obsType,
273
- featureType: baseFileDef.coordinationValues.featureType,
274
- featureValueType: baseFileDef.coordinationValues.featureValueType,
275
- },
276
- },
277
- ];
278
- }
@@ -1,400 +0,0 @@
1
- import { expandExpressionMatrixZarr, expandRasterJson, expandRasterOmeZarr, expandGenesJson, expandClustersJson, expandCellsJson, expandMoleculesJson, expandAnndataCellsZarr, expandAnndataCellSetsZarr, expandAnndataExpressionMatrixZarr, } from './joint-file-types-legacy';
2
- describe('src/app/joint-file-types-legacy.js', () => {
3
- describe('expandExpressionMatrixZarr', () => {
4
- it('expands expression-matrix.zarr', () => {
5
- expect(expandExpressionMatrixZarr({
6
- fileType: 'expression-matrix.zarr',
7
- url: 'http://localhost:8000/expression-matrix.zarr',
8
- })).toEqual([
9
- {
10
- fileType: 'obsFeatureMatrix.expression-matrix.zarr',
11
- url: 'http://localhost:8000/expression-matrix.zarr',
12
- coordinationValues: {
13
- obsType: 'cell',
14
- featureType: 'gene',
15
- featureValueType: 'expression',
16
- },
17
- },
18
- ]);
19
- });
20
- });
21
- describe('expandRasterJson', () => {
22
- it('expands raster.json', () => {
23
- expect(expandRasterJson({
24
- fileType: 'raster.json',
25
- url: 'http://localhost:8000/raster.json',
26
- })).toEqual([
27
- {
28
- fileType: 'image.raster.json',
29
- url: 'http://localhost:8000/raster.json',
30
- },
31
- {
32
- fileType: 'obsSegmentations.raster.json',
33
- url: 'http://localhost:8000/raster.json',
34
- coordinationValues: {
35
- obsType: 'cell',
36
- },
37
- },
38
- ]);
39
- });
40
- });
41
- describe('expandRasterOmeZarr', () => {
42
- it('expands raster.ome-zarr', () => {
43
- expect(expandRasterOmeZarr({
44
- fileType: 'raster.ome-zarr',
45
- url: 'http://localhost:8000/raster.zarr',
46
- })).toEqual([
47
- {
48
- fileType: 'image.ome-zarr',
49
- url: 'http://localhost:8000/raster.zarr',
50
- },
51
- ]);
52
- });
53
- });
54
- describe('expandClustersJson', () => {
55
- it('expands clusters.json', () => {
56
- expect(expandClustersJson({
57
- fileType: 'clusters.json',
58
- url: 'http://localhost:8000/clusters.json',
59
- })).toEqual([
60
- {
61
- fileType: 'obsFeatureMatrix.clusters.json',
62
- url: 'http://localhost:8000/clusters.json',
63
- coordinationValues: {
64
- obsType: 'cell',
65
- featureType: 'gene',
66
- featureValueType: 'expression',
67
- },
68
- },
69
- ]);
70
- });
71
- });
72
- describe('expandGenesJson', () => {
73
- it('expands', () => {
74
- expect(expandGenesJson({
75
- fileType: 'genes.json',
76
- url: 'http://localhost:8000/genes.json',
77
- })).toEqual([
78
- {
79
- fileType: 'obsFeatureMatrix.genes.json',
80
- url: 'http://localhost:8000/genes.json',
81
- coordinationValues: {
82
- obsType: 'cell',
83
- featureType: 'gene',
84
- featureValueType: 'expression',
85
- },
86
- },
87
- ]);
88
- });
89
- });
90
- describe('expandMoleculesJson', () => {
91
- it('expands when there are no options', () => {
92
- expect(expandMoleculesJson({
93
- fileType: 'molecules.json',
94
- url: 'http://localhost:8000/molecules.json',
95
- })).toEqual([
96
- {
97
- fileType: 'obsLocations.molecules.json',
98
- url: 'http://localhost:8000/molecules.json',
99
- coordinationValues: {
100
- obsType: 'molecule',
101
- },
102
- },
103
- {
104
- fileType: 'obsLabels.molecules.json',
105
- url: 'http://localhost:8000/molecules.json',
106
- coordinationValues: {
107
- obsType: 'molecule',
108
- },
109
- },
110
- ]);
111
- });
112
- });
113
- describe('expandCellsJson', () => {
114
- it('expands when there are no options', () => {
115
- expect(expandCellsJson({
116
- fileType: 'cells.json',
117
- url: 'http://localhost:8000/cells.json',
118
- })).toEqual([
119
- {
120
- fileType: 'obsSegmentations.cells.json',
121
- url: 'http://localhost:8000/cells.json',
122
- coordinationValues: {
123
- obsType: 'cell',
124
- },
125
- },
126
- {
127
- fileType: 'obsLocations.cells.json',
128
- url: 'http://localhost:8000/cells.json',
129
- coordinationValues: {
130
- obsType: 'cell',
131
- },
132
- },
133
- ]);
134
- });
135
- it('expands when there is an array of embedding types', () => {
136
- expect(expandCellsJson({
137
- fileType: 'cells.json',
138
- url: 'http://localhost:8000/cells.json',
139
- options: {
140
- embeddingTypes: ['UMAP', 't-SNE'],
141
- obsLabelsTypes: ['cluster', 'subcluster'],
142
- },
143
- })).toEqual([
144
- {
145
- fileType: 'obsSegmentations.cells.json',
146
- url: 'http://localhost:8000/cells.json',
147
- coordinationValues: {
148
- obsType: 'cell',
149
- },
150
- },
151
- {
152
- fileType: 'obsLocations.cells.json',
153
- url: 'http://localhost:8000/cells.json',
154
- coordinationValues: {
155
- obsType: 'cell',
156
- },
157
- },
158
- {
159
- fileType: 'obsEmbedding.cells.json',
160
- url: 'http://localhost:8000/cells.json',
161
- coordinationValues: {
162
- obsType: 'cell',
163
- embeddingType: 'UMAP',
164
- },
165
- },
166
- {
167
- fileType: 'obsEmbedding.cells.json',
168
- url: 'http://localhost:8000/cells.json',
169
- coordinationValues: {
170
- obsType: 'cell',
171
- embeddingType: 't-SNE',
172
- },
173
- },
174
- {
175
- fileType: 'obsLabels.cells.json',
176
- url: 'http://localhost:8000/cells.json',
177
- coordinationValues: {
178
- obsType: 'cell',
179
- obsLabelsType: 'cluster',
180
- },
181
- },
182
- {
183
- fileType: 'obsLabels.cells.json',
184
- url: 'http://localhost:8000/cells.json',
185
- coordinationValues: {
186
- obsType: 'cell',
187
- obsLabelsType: 'subcluster',
188
- },
189
- },
190
- ]);
191
- });
192
- });
193
- // cells
194
- describe('expandAnndataCellsZarr', () => {
195
- it('fails to expand when there are no options', () => {
196
- expect(() => expandAnndataCellsZarr({
197
- fileType: 'anndata-cells.zarr',
198
- url: 'http://localhost:8000/anndata.zarr',
199
- })).toThrow();
200
- });
201
- it('expands when there are lots of options', () => {
202
- expect(expandAnndataCellsZarr({
203
- fileType: 'anndata-cells.zarr',
204
- url: 'http://localhost:8000/anndata.zarr',
205
- options: {
206
- mappings: {
207
- 't-SNE': {
208
- key: 'obsm/tsne',
209
- },
210
- PCA: {
211
- dims: [2, 3],
212
- key: 'obsm/pca',
213
- },
214
- },
215
- xy: 'obsm/locations',
216
- poly: 'obsm/segmentations',
217
- factors: [
218
- 'obs/cluster',
219
- 'obs/subcluster',
220
- ],
221
- },
222
- })).toEqual([
223
- {
224
- fileType: 'obsSegmentations.anndata.zarr',
225
- url: 'http://localhost:8000/anndata.zarr',
226
- options: {
227
- path: 'obsm/segmentations',
228
- },
229
- coordinationValues: {
230
- obsType: 'cell',
231
- },
232
- },
233
- {
234
- fileType: 'obsLocations.anndata.zarr',
235
- url: 'http://localhost:8000/anndata.zarr',
236
- options: {
237
- path: 'obsm/locations',
238
- },
239
- coordinationValues: {
240
- obsType: 'cell',
241
- },
242
- },
243
- {
244
- fileType: 'obsEmbedding.anndata.zarr',
245
- url: 'http://localhost:8000/anndata.zarr',
246
- options: {
247
- path: 'obsm/tsne',
248
- },
249
- coordinationValues: {
250
- obsType: 'cell',
251
- embeddingType: 't-SNE',
252
- },
253
- },
254
- {
255
- fileType: 'obsEmbedding.anndata.zarr',
256
- url: 'http://localhost:8000/anndata.zarr',
257
- options: {
258
- path: 'obsm/pca',
259
- dims: [2, 3],
260
- },
261
- coordinationValues: {
262
- obsType: 'cell',
263
- embeddingType: 'PCA',
264
- },
265
- },
266
- {
267
- fileType: 'obsLabels.anndata.zarr',
268
- url: 'http://localhost:8000/anndata.zarr',
269
- options: {
270
- path: 'obs/cluster',
271
- },
272
- coordinationValues: {
273
- obsType: 'cell',
274
- obsLabelsType: 'cluster',
275
- },
276
- },
277
- {
278
- fileType: 'obsLabels.anndata.zarr',
279
- url: 'http://localhost:8000/anndata.zarr',
280
- options: {
281
- path: 'obs/subcluster',
282
- },
283
- coordinationValues: {
284
- obsType: 'cell',
285
- obsLabelsType: 'subcluster',
286
- },
287
- },
288
- ]);
289
- });
290
- });
291
- // cell sets
292
- describe('expandAnndataCellSetsZarr', () => {
293
- it('expands both flat and hierarchical cell sets', () => {
294
- expect(expandAnndataCellSetsZarr({
295
- fileType: 'anndata-cell-sets.zarr',
296
- url: 'http://localhost:8000/anndata.zarr',
297
- options: [
298
- {
299
- groupName: 'Leiden clustering',
300
- setName: 'obs/leiden',
301
- },
302
- {
303
- groupName: 'Predicted cell types',
304
- setName: 'obs/pred_types',
305
- scoreName: 'obs/pred_scores',
306
- },
307
- {
308
- groupName: 'Cell type annotations',
309
- setName: ['obs/l1', 'obs/l2', 'obs/l3'],
310
- },
311
- ],
312
- })).toEqual([
313
- {
314
- fileType: 'obsSets.anndata.zarr',
315
- url: 'http://localhost:8000/anndata.zarr',
316
- options: [
317
- {
318
- name: 'Leiden clustering',
319
- path: 'obs/leiden',
320
- },
321
- {
322
- name: 'Predicted cell types',
323
- path: 'obs/pred_types',
324
- scorePath: 'obs/pred_scores',
325
- },
326
- {
327
- name: 'Cell type annotations',
328
- path: ['obs/l1', 'obs/l2', 'obs/l3'],
329
- },
330
- ],
331
- coordinationValues: {
332
- obsType: 'cell',
333
- },
334
- },
335
- ]);
336
- });
337
- // expression-matrix
338
- describe('expandAnndataExpressionMatrixZarr', () => {
339
- it('expands when there are no options', () => {
340
- expect(expandAnndataExpressionMatrixZarr({
341
- fileType: 'anndata-expression-matrix.zarr',
342
- url: 'http://localhost:8000/anndata.zarr',
343
- options: {
344
- matrix: 'X',
345
- },
346
- })).toEqual([
347
- {
348
- fileType: 'obsFeatureMatrix.anndata.zarr',
349
- url: 'http://localhost:8000/anndata.zarr',
350
- options: {
351
- path: 'X',
352
- },
353
- coordinationValues: {
354
- obsType: 'cell',
355
- featureType: 'gene',
356
- featureValueType: 'expression',
357
- },
358
- },
359
- ]);
360
- });
361
- it('expands when there are lots of options', () => {
362
- expect(expandAnndataExpressionMatrixZarr({
363
- fileType: 'anndata-expression-matrix.zarr',
364
- url: 'http://localhost:8000/anndata.zarr',
365
- options: {
366
- matrix: 'obsm/hvg_subset',
367
- geneAlias: 'var/gene_symbol',
368
- geneFilter: 'var/in_hvg_subset',
369
- matrixGeneFilter: 'var/highly_variable',
370
- },
371
- })).toEqual([
372
- {
373
- fileType: 'featureLabels.anndata.zarr',
374
- url: 'http://localhost:8000/anndata.zarr',
375
- options: {
376
- path: 'var/gene_symbol',
377
- },
378
- coordinationValues: {
379
- featureType: 'gene',
380
- },
381
- },
382
- {
383
- fileType: 'obsFeatureMatrix.anndata.zarr',
384
- url: 'http://localhost:8000/anndata.zarr',
385
- options: {
386
- path: 'obsm/hvg_subset',
387
- featureFilterPath: 'var/in_hvg_subset',
388
- initialFeatureFilterPath: 'var/highly_variable',
389
- },
390
- coordinationValues: {
391
- obsType: 'cell',
392
- featureType: 'gene',
393
- featureValueType: 'expression',
394
- },
395
- },
396
- ]);
397
- });
398
- });
399
- });
400
- });