@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
@@ -0,0 +1,138 @@
1
+ import {
2
+ expandExpressionMatrixZarr,
3
+ expandRasterOmeZarr,
4
+ expandGenesJson,
5
+ expandCellsJson,
6
+ expandCellSetsJson,
7
+ expandMoleculesJson,
8
+ expandAnndataCellsZarr,
9
+ expandAnndataCellSetsZarr,
10
+ expandAnndataExpressionMatrixZarr,
11
+ expandClustersJson,
12
+ } from './joint-file-types-legacy';
13
+
14
+ describe('src/app/file-options-schemas-legacy.js', () => {
15
+ describe('Options validation for joint file type expansion functions', () => {
16
+ it('cells.json with extra options fails validation', () => {
17
+ expect(() => expandCellsJson({
18
+ fileType: 'cells.json',
19
+ url: 'http://localhost:8000/cells.json',
20
+ options: {
21
+ badKey: 'test',
22
+ embeddingTypes: ['UMAP', 't-SNE'],
23
+ obsLabelsTypes: ['cluster', 'subcluster'],
24
+ },
25
+ })).toThrow();
26
+ });
27
+ it('molecules.json with any options fails validation', () => {
28
+ expect(() => expandMoleculesJson({
29
+ fileType: 'molecules.json',
30
+ url: 'http://localhost:8000/molecules.json',
31
+ options: {},
32
+ })).toThrow();
33
+ });
34
+ it('expression-matrix.zarr with any options fails validation', () => {
35
+ expect(() => expandExpressionMatrixZarr({
36
+ fileType: 'expression-matrix.zarr',
37
+ url: 'http://localhost:8000/expression-matrix.zarr',
38
+ options: {},
39
+ })).toThrow();
40
+ });
41
+ it('raster.ome-zarr with any options fails validation', () => {
42
+ expect(() => expandRasterOmeZarr({
43
+ fileType: 'raster.ome-zarr',
44
+ url: 'http://localhost:8000/raster.ome-zarr',
45
+ options: {},
46
+ })).toThrow();
47
+ });
48
+ it('cell-sets.json with any options fails validation', () => {
49
+ expect(() => expandCellSetsJson({
50
+ fileType: 'cell-sets.json',
51
+ url: 'http://localhost:8000/cell-sets.json',
52
+ options: {},
53
+ })).toThrow();
54
+ });
55
+ it('clusters.json with any options fails validation', () => {
56
+ expect(() => expandClustersJson({
57
+ fileType: 'clusters.json',
58
+ url: 'http://localhost:8000/clusters.json',
59
+ options: {},
60
+ })).toThrow();
61
+ });
62
+ it('genes.json with any options fails validation', () => {
63
+ expect(() => expandGenesJson({
64
+ fileType: 'genes.json',
65
+ url: 'http://localhost:8000/genes.json',
66
+ options: {},
67
+ })).toThrow();
68
+ });
69
+ it('anndata-cells.zarr with extra options fails validation', () => {
70
+ expect(() => expandAnndataCellsZarr({
71
+ fileType: 'anndata-cells.zarr',
72
+ url: 'http://localhost:8000/anndata-cells.zarr',
73
+ options: {
74
+ poly: 'obsm/poly',
75
+ xy: 'obsm/xy',
76
+ bad: 'bad',
77
+ },
78
+ })).toThrow();
79
+ });
80
+ it('anndata-cells.zarr with invalid options fails validation', () => {
81
+ expect(() => expandAnndataCellsZarr({
82
+ fileType: 'anndata-cells.zarr',
83
+ url: 'http://localhost:8000/anndata-cells.zarr',
84
+ options: {
85
+ poly: 'obsm/poly',
86
+ xy: 'obsm/xy',
87
+ mappings: {
88
+ UMAP: ['bad'],
89
+ },
90
+ },
91
+ })).toThrow();
92
+ });
93
+ it('anndata-cell-sets.zarr with invalid options fails validation', () => {
94
+ expect(() => expandAnndataCellSetsZarr({
95
+ fileType: 'anndata-cell-sets.zarr',
96
+ url: 'http://localhost:8000/anndata-cell-sets.zarr',
97
+ options: {},
98
+ })).toThrow();
99
+ });
100
+ it('anndata-cell-sets.zarr with extra options fails validation', () => {
101
+ expect(() => expandAnndataCellSetsZarr({
102
+ fileType: 'anndata-cell-sets.zarr',
103
+ url: 'http://localhost:8000/anndata-cell-sets.zarr',
104
+ options: [
105
+ {
106
+ groupName: 'Cell Type Annotations',
107
+ setName: 'obs/cell_type',
108
+ scoreName: 'obs/score',
109
+ bad: 'bad',
110
+ },
111
+ ],
112
+ })).toThrow();
113
+ });
114
+ it('anndata-expression-matrix.zarr with invalid options fails validation', () => {
115
+ expect(() => expandAnndataExpressionMatrixZarr({
116
+ fileType: 'anndata-expression-matrix.zarr',
117
+ url: 'http://localhost:8000/anndata-expression-matrix.zarr',
118
+ options: {
119
+ matrix: 'good',
120
+ geneAlias: 1,
121
+ },
122
+ })).toThrow();
123
+ });
124
+ it('anndata-expression-matrix.zarr with extra options fails validation', () => {
125
+ expect(() => expandAnndataExpressionMatrixZarr({
126
+ fileType: 'anndata-expression-matrix.zarr',
127
+ url: 'http://localhost:8000/anndata-expression-matrix.zarr',
128
+ options: {
129
+ matrix: 'good',
130
+ geneAlias: 'good',
131
+ geneFilter: 'good',
132
+ matrixGeneFilter: 'good',
133
+ bad: 'bad',
134
+ },
135
+ })).toThrow();
136
+ });
137
+ });
138
+ });
@@ -0,0 +1,327 @@
1
+ import Ajv from 'ajv';
2
+
3
+ export function validateOptions(optionsSchema, options) {
4
+ const validate = new Ajv().compile(optionsSchema);
5
+ const valid = validate(options || null);
6
+ if (!valid) {
7
+ console.warn(JSON.stringify(validate.errors, null, 2));
8
+ throw new Error(`File definition options failed schema validation (${optionsSchema.title})`);
9
+ }
10
+ return true;
11
+ }
12
+
13
+ export const emptySchema = {
14
+ $schema: 'http://json-schema.org/draft-07/schema#',
15
+ $id: 'https://github.com/vitessce/vitessce/#empty-options',
16
+ title: 'Empty options',
17
+ oneOf: [
18
+ { type: 'null' },
19
+ ],
20
+ };
21
+
22
+ const sharedDefinitions = {
23
+ annDataObs: {
24
+ type: 'object',
25
+ additionalProperties: false,
26
+ required: ['path'],
27
+ properties: {
28
+ path: { type: 'string' },
29
+ },
30
+ },
31
+ annDataObsm: {
32
+ type: 'object',
33
+ additionalProperties: false,
34
+ required: ['path'],
35
+ properties: {
36
+ path: { type: 'string' },
37
+ dims: {
38
+ type: 'array',
39
+ description: 'Which indices of the obsm object to take for a scatterplot, allowing for, for example, different PCs from obsm/X_pca',
40
+ items: { type: 'number' },
41
+ },
42
+ },
43
+ },
44
+ annDataConvenienceObsLabelsItem: {
45
+ type: 'object',
46
+ additionalProperties: false,
47
+ required: ['path', 'obsLabelsType'],
48
+ properties: {
49
+ path: { type: 'string' },
50
+ obsLabelsType: { type: 'string' },
51
+ },
52
+ },
53
+ annDataConvenienceFeatureLabelsItem: {
54
+ type: 'object',
55
+ additionalProperties: false,
56
+ required: ['path', 'featureLabelsType'],
57
+ properties: {
58
+ path: { type: 'string' },
59
+ featureLabelsType: { type: 'string' },
60
+ },
61
+ },
62
+ annDataConvenienceObsEmbeddingItem: {
63
+ type: 'object',
64
+ additionalProperties: false,
65
+ required: ['path', 'embeddingType'],
66
+ properties: {
67
+ path: { type: 'string' },
68
+ dims: {
69
+ type: 'array',
70
+ description: 'Which indices of the obsm object to take for a scatterplot, allowing for, for example, different PCs from obsm/X_pca',
71
+ items: { type: 'number' },
72
+ },
73
+ embeddingType: { type: 'string' },
74
+ },
75
+ },
76
+ annDataObsLabels: { $ref: '#/definitions/annDataObs' },
77
+ annDataFeatureLabels: { $ref: '#/definitions/annDataObs' },
78
+ annDataObsFeatureMatrix: {
79
+ type: 'object',
80
+ description: 'Options for the obsFeatureMatrix.anndata.zarr file type.',
81
+ additionalProperties: false,
82
+ required: ['path'],
83
+ properties: {
84
+ path: { type: 'string' },
85
+ featureFilterPath: {
86
+ type: 'string',
87
+ description: 'If the feature index should be filtered, put a boolean column here (analogous to the previous geneFilter option). e.g., var/in_obsm_X_small_matrix',
88
+ },
89
+ initialFeatureFilterPath: {
90
+ type: 'string',
91
+ description: 'If only a subset of the matrix should be loaded initially, put a boolean column along the feature axis here (analogous to the previous matrixGeneFilter option). e.g., var/highly_variable',
92
+ },
93
+ },
94
+ },
95
+ annDataObsSets: {
96
+ type: 'array',
97
+ description: 'Options for the obsSets.anndata.zarr file type.',
98
+ items: {
99
+ type: 'object',
100
+ additionalProperties: false,
101
+ required: ['name', 'path'],
102
+ properties: {
103
+ name: {
104
+ type: 'string',
105
+ description: "The display name for the set, like 'Cell Type' or 'Louvain.'",
106
+ },
107
+ path: {
108
+ oneOf: [
109
+ {
110
+ type: 'string',
111
+ description: "The location in the AnnData store for the set, like 'obs/louvain' or 'obs/celltype.'",
112
+ },
113
+ {
114
+ type: 'array',
115
+ items: { type: 'string' },
116
+ description: 'An array of locations in the AnnData store for a hierarchy of set names, from coarse to fine levels.',
117
+ },
118
+ ],
119
+ },
120
+ scorePath: {
121
+ oneOf: [
122
+ {
123
+ type: 'string',
124
+ description: "The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'",
125
+ },
126
+ ],
127
+ },
128
+ },
129
+ },
130
+ },
131
+ annDataObsLocations: { $ref: '#/definitions/annDataObsm' },
132
+ annDataObsEmbedding: { $ref: '#/definitions/annDataObsm' },
133
+ annDataObsSegmentations: { $ref: '#/definitions/annDataObs' },
134
+ };
135
+
136
+ /**
137
+ * Options schemas for atomic file types.
138
+ */
139
+ // AnnData
140
+ export const obsEmbeddingAnndataSchema = {
141
+ $schema: 'http://json-schema.org/draft-07/schema#',
142
+ $id: 'https://github.com/vitessce/vitessce/#obsEmbedding-anndata-zarr-options',
143
+ title: 'obsEmbedding.anndata.zarr options',
144
+ definitions: sharedDefinitions,
145
+ $ref: '#/definitions/annDataObsEmbedding',
146
+ };
147
+ export const obsLocationsAnndataSchema = {
148
+ $schema: 'http://json-schema.org/draft-07/schema#',
149
+ $id: 'https://github.com/vitessce/vitessce/#obsLocations-anndata-zarr-options',
150
+ title: 'obsLocations.anndata.zarr options',
151
+ definitions: sharedDefinitions,
152
+ $ref: '#/definitions/annDataObsLocations',
153
+ };
154
+ export const obsSegmentationsAnndataSchema = {
155
+ $schema: 'http://json-schema.org/draft-07/schema#',
156
+ $id: 'https://github.com/vitessce/vitessce/#obsSegmentations-anndata-zarr-options',
157
+ title: 'obsSegmentations.anndata.zarr options',
158
+ definitions: sharedDefinitions,
159
+ $ref: '#/definitions/annDataObsSegmentations',
160
+ };
161
+ export const obsSetsAnndataSchema = {
162
+ $schema: 'http://json-schema.org/draft-07/schema#',
163
+ $id: 'https://github.com/vitessce/vitessce/#obsSets-anndata-zarr-options',
164
+ title: 'obsSets.anndata.zarr options',
165
+ definitions: sharedDefinitions,
166
+ $ref: '#/definitions/annDataObsSets',
167
+ };
168
+ export const obsFeatureMatrixAnndataSchema = {
169
+ $schema: 'http://json-schema.org/draft-07/schema#',
170
+ $id: 'https://github.com/vitessce/vitessce/#obsFeatureMatrix-anndata-zarr-options',
171
+ title: 'obsFeatureMatrix.anndata.zarr options',
172
+ definitions: sharedDefinitions,
173
+ $ref: '#/definitions/annDataObsFeatureMatrix',
174
+ };
175
+ export const obsLabelsAnndataSchema = {
176
+ $schema: 'http://json-schema.org/draft-07/schema#',
177
+ $id: 'https://github.com/vitessce/vitessce/#obsLabels-anndata-zarr-options',
178
+ title: 'obsLabels.anndata.zarr options',
179
+ definitions: sharedDefinitions,
180
+ $ref: '#/definitions/annDataObsLabels',
181
+ };
182
+ export const featureLabelsAnndataSchema = {
183
+ $schema: 'http://json-schema.org/draft-07/schema#',
184
+ $id: 'https://github.com/vitessce/vitessce/#featureLabels-anndata-zarr-options',
185
+ title: 'featureLabels.anndata.zarr options',
186
+ definitions: sharedDefinitions,
187
+ $ref: '#/definitions/annDataFeatureLabels',
188
+ };
189
+ // CSV
190
+ export const obsEmbeddingCsvSchema = {
191
+ $schema: 'http://json-schema.org/draft-07/schema#',
192
+ $id: 'https://github.com/vitessce/vitessce/#obsEmbedding-csv-options',
193
+ title: 'obsEmbedding.csv options',
194
+ type: 'object',
195
+ required: ['obsIndex', 'obsEmbedding'],
196
+ properties: {
197
+ obsIndex: { type: 'string' },
198
+ obsEmbedding: {
199
+ type: 'array',
200
+ items: { type: 'string' },
201
+ minItems: 2,
202
+ maxItems: 2,
203
+ },
204
+ },
205
+ };
206
+ export const obsLocationsCsvSchema = {
207
+ $schema: 'http://json-schema.org/draft-07/schema#',
208
+ $id: 'https://github.com/vitessce/vitessce/#obsLocations-csv-options',
209
+ title: 'obsLocations.csv options',
210
+ type: 'object',
211
+ required: ['obsIndex', 'obsLocations'],
212
+ properties: {
213
+ obsIndex: { type: 'string' },
214
+ obsLocations: {
215
+ type: 'array',
216
+ items: { type: 'string' },
217
+ minItems: 2,
218
+ maxItems: 2,
219
+ },
220
+ },
221
+ };
222
+ export const obsLabelsCsvSchema = {
223
+ $schema: 'http://json-schema.org/draft-07/schema#',
224
+ $id: 'https://github.com/vitessce/vitessce/#obsLabels-csv-options',
225
+ title: 'obsLabels.csv options',
226
+ type: 'object',
227
+ required: ['obsIndex', 'obsLabels'],
228
+ properties: {
229
+ obsIndex: { type: 'string' },
230
+ obsLabels: { type: 'string' },
231
+ },
232
+ };
233
+ export const featureLabelsCsvSchema = {
234
+ $schema: 'http://json-schema.org/draft-07/schema#',
235
+ $id: 'https://github.com/vitessce/vitessce/#featureLabels-csv-options',
236
+ title: 'featureLabels.csv options',
237
+ type: 'object',
238
+ required: ['featureIndex', 'featureLabels'],
239
+ properties: {
240
+ featureIndex: { type: 'string' },
241
+ featureLabels: { type: 'string' },
242
+ },
243
+ };
244
+ export const obsSetsCsvSchema = {
245
+ $schema: 'http://json-schema.org/draft-07/schema#',
246
+ $id: 'https://github.com/vitessce/vitessce/#obsLabels-csv-options',
247
+ title: 'obsLabels.csv options',
248
+ type: 'object',
249
+ additionalProperties: false,
250
+ required: ['obsIndex', 'obsSets'],
251
+ properties: {
252
+ obsIndex: { type: 'string' },
253
+ obsSets: {
254
+ type: 'array',
255
+ items: {
256
+ type: 'object',
257
+ additionalProperties: false,
258
+ required: ['name', 'column'],
259
+ properties: {
260
+ name: {
261
+ type: 'string',
262
+ description: "The display name for the set, like 'Cell Type' or 'Louvain'",
263
+ },
264
+ column: {
265
+ oneOf: [
266
+ {
267
+ type: 'string',
268
+ description: "The column for the set, like 'cell_type'",
269
+ },
270
+ {
271
+ type: 'array',
272
+ items: { type: 'string' },
273
+ description: 'An array of columns for a hierarchy of set names, from coarse to fine levels.',
274
+ },
275
+ ],
276
+ },
277
+ scoreColumn: {
278
+ oneOf: [
279
+ {
280
+ type: 'string',
281
+ description: "The column for the set confidence scores, like 'celltype_prediction_score'",
282
+ },
283
+ ],
284
+ },
285
+ },
286
+ },
287
+ },
288
+ },
289
+ };
290
+
291
+ /**
292
+ * Options schemas for joint file types.
293
+ */
294
+ export const anndataZarrSchema = {
295
+ $schema: 'http://json-schema.org/draft-07/schema#',
296
+ $id: 'https://github.com/vitessce/vitessce/#anndata-zarr-options',
297
+ title: 'anndata.zarr options',
298
+ definitions: sharedDefinitions,
299
+ type: 'object',
300
+ minProperties: 1,
301
+ additionalProperties: false,
302
+ required: [],
303
+ properties: {
304
+ obsLabels: {
305
+ oneOf: [
306
+ { $ref: '#/definitions/annDataObsLabels' },
307
+ { type: 'array', items: { $ref: '#/definitions/annDataConvenienceObsLabelsItem' } },
308
+ ],
309
+ },
310
+ featureLabels: {
311
+ oneOf: [
312
+ { $ref: '#/definitions/annDataFeatureLabels' },
313
+ { type: 'array', items: { $ref: '#/definitions/annDataConvenienceFeatureLabelsItem' } },
314
+ ],
315
+ },
316
+ obsFeatureMatrix: { $ref: '#/definitions/annDataObsFeatureMatrix' },
317
+ obsSets: { $ref: '#/definitions/annDataObsSets' },
318
+ obsLocations: { $ref: '#/definitions/annDataObsLocations' },
319
+ obsSegmentations: { $ref: '#/definitions/annDataObsSegmentations' },
320
+ obsEmbedding: {
321
+ oneOf: [
322
+ { $ref: '#/definitions/annDataObsEmbedding' },
323
+ { type: 'array', items: { $ref: '#/definitions/annDataConvenienceObsEmbeddingItem' } },
324
+ ],
325
+ },
326
+ },
327
+ };
@@ -0,0 +1,26 @@
1
+ import {
2
+ expandAnndataZarr,
3
+ } from './joint-file-types';
4
+
5
+ describe('src/app/file-options-schemas.js', () => {
6
+ describe('Options validation for joint file type expansion functions', () => {
7
+ it('anndata.zarr with invalid options fails validation', () => {
8
+ expect(() => expandAnndataZarr({
9
+ fileType: 'anndata.zarr',
10
+ url: 'http://localhost:8000/anndata.zarr',
11
+ options: {
12
+ obsFeatureMatrix: 1,
13
+ },
14
+ })).toThrow();
15
+ });
16
+ it('anndata.zarr with extra options fails validation', () => {
17
+ expect(() => expandAnndataZarr({
18
+ fileType: 'anndata.zarr',
19
+ url: 'http://localhost:8000/anndata.zarr',
20
+ options: {
21
+ bad: 'bad',
22
+ },
23
+ })).toThrow();
24
+ });
25
+ });
26
+ });