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