@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,148 +0,0 @@
1
- import { FileType } from '@vitessce/constants-internal';
2
- import { validateOptions, anndataZarrSchema, } from './file-options-schemas';
3
- import { expandMoleculesJson, expandExpressionMatrixZarr, expandRasterJson, expandRasterOmeZarr, expandCellSetsJson, expandCellsJson, expandClustersJson, expandGenesJson, expandAnndataCellsZarr, expandAnndataCellSetsZarr, expandAnndataExpressionMatrixZarr, } from './joint-file-types-legacy';
4
- export function expandAnndataZarr(fileDef) {
5
- validateOptions(anndataZarrSchema, fileDef.options);
6
- const baseFileDef = {
7
- url: fileDef.url,
8
- requestInit: fileDef.requestInit,
9
- coordinationValues: {
10
- ...fileDef.coordinationValues,
11
- obsType: fileDef.coordinationValues?.obsType || 'cell',
12
- featureType: fileDef.coordinationValues?.featureType || 'gene',
13
- featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
14
- },
15
- };
16
- const { options = {} } = fileDef;
17
- return [
18
- // obsFeatureMatrix
19
- ...(options.obsFeatureMatrix ? [{
20
- ...baseFileDef,
21
- fileType: FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR,
22
- options: options.obsFeatureMatrix,
23
- coordinationValues: {
24
- obsType: baseFileDef.coordinationValues.obsType,
25
- featureType: baseFileDef.coordinationValues.featureType,
26
- featureValueType: baseFileDef.coordinationValues.featureValueType,
27
- },
28
- }] : []),
29
- // obsSets
30
- ...(options.obsSets ? [{
31
- ...baseFileDef,
32
- fileType: FileType.OBS_SETS_ANNDATA_ZARR,
33
- options: options.obsSets,
34
- coordinationValues: {
35
- obsType: baseFileDef.coordinationValues.obsType,
36
- },
37
- }] : []),
38
- // obsLocations
39
- ...(options.obsLocations ? [{
40
- ...baseFileDef,
41
- fileType: FileType.OBS_LOCATIONS_ANNDATA_ZARR,
42
- options: options.obsLocations,
43
- coordinationValues: {
44
- obsType: baseFileDef.coordinationValues.obsType,
45
- },
46
- }] : []),
47
- // obsSegmentations
48
- ...(options.obsSegmentations ? [{
49
- ...baseFileDef,
50
- fileType: FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR,
51
- options: options.obsSegmentations,
52
- coordinationValues: {
53
- obsType: baseFileDef.coordinationValues.obsType,
54
- },
55
- }] : []),
56
- // obsEmbedding
57
- // eslint-disable-next-line no-nested-ternary
58
- ...(options.obsEmbedding ? (Array.isArray(options.obsEmbedding) ? options.obsEmbedding.map(oe => ({
59
- // obsEmbedding was an array, process each element.
60
- ...baseFileDef,
61
- fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
62
- options: {
63
- path: oe.path,
64
- dims: oe.dims,
65
- },
66
- coordinationValues: {
67
- obsType: baseFileDef.coordinationValues.obsType,
68
- // Move embedding type property out of options and into coordinationValues.
69
- embeddingType: oe.embeddingType,
70
- },
71
- })) : [{
72
- // obsEmbedding was an object.
73
- ...baseFileDef,
74
- fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
75
- options: options.obsEmbedding,
76
- coordinationValues: {
77
- obsType: baseFileDef.coordinationValues.obsType,
78
- embeddingType: baseFileDef.coordinationValues.embeddingType,
79
- },
80
- }]) : []),
81
- // obsLabels
82
- // eslint-disable-next-line no-nested-ternary
83
- ...(options.obsLabels ? (Array.isArray(options.obsLabels) ? options.obsLabels.map(ol => ({
84
- // obsLabels was an array, process each element.
85
- ...baseFileDef,
86
- fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
87
- options: {
88
- path: ol.path,
89
- },
90
- coordinationValues: {
91
- obsType: baseFileDef.coordinationValues.obsType,
92
- // Move obsLabels type property out of options and into coordinationValues.
93
- obsLabelsType: ol.obsLabelsType,
94
- },
95
- })) : [{
96
- // obsLabels was an object.
97
- ...baseFileDef,
98
- fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
99
- options: options.obsLabels,
100
- coordinationValues: {
101
- obsType: baseFileDef.coordinationValues.obsType,
102
- obsLabelsType: baseFileDef.coordinationValues.obsLabelsType,
103
- },
104
- }]) : []),
105
- // featureLabels
106
- // eslint-disable-next-line no-nested-ternary
107
- ...(options.featureLabels ? (Array.isArray(options.featureLabels) ? options.featureLabels.map(fl => ({
108
- // featureLabels was an array, process each element.
109
- ...baseFileDef,
110
- fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
111
- options: {
112
- path: fl.path,
113
- },
114
- coordinationValues: {
115
- featureType: baseFileDef.coordinationValues.featureType,
116
- // Move featureLabels type property out of options and into coordinationValues.
117
- featureLabelsType: fl.featureLabelsType,
118
- },
119
- })) : [{
120
- // featureLabels was an object.
121
- ...baseFileDef,
122
- fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
123
- options: options.featureLabels,
124
- coordinationValues: {
125
- featureType: baseFileDef.coordinationValues.featureType,
126
- featureLabelsType: baseFileDef.coordinationValues.featureLabelsType,
127
- },
128
- }]) : []),
129
- ];
130
- }
131
- /**
132
- * Built-in joint file type
133
- * expansion functions.
134
- */
135
- export const JOINT_FILE_TYPES = {
136
- [FileType.ANNDATA_ZARR]: expandAnndataZarr,
137
- [FileType.ANNDATA_CELLS_ZARR]: expandAnndataCellsZarr,
138
- [FileType.ANNDATA_CELL_SETS_ZARR]: expandAnndataCellSetsZarr,
139
- [FileType.ANNDATA_EXPRESSION_MATRIX_ZARR]: expandAnndataExpressionMatrixZarr,
140
- [FileType.EXPRESSION_MATRIX_ZARR]: expandExpressionMatrixZarr,
141
- [FileType.RASTER_JSON]: expandRasterJson,
142
- [FileType.RASTER_OME_ZARR]: expandRasterOmeZarr,
143
- [FileType.CELL_SETS_JSON]: expandCellSetsJson,
144
- [FileType.CLUSTERS_JSON]: expandClustersJson,
145
- [FileType.GENES_JSON]: expandGenesJson,
146
- [FileType.CELLS_JSON]: expandCellsJson,
147
- [FileType.MOLECULES_JSON]: expandMoleculesJson,
148
- };
@@ -1,139 +0,0 @@
1
- import { FileType, FILE_TYPE_DATA_TYPE_MAPPING } from '@vitessce/constants-internal';
2
- import { JOINT_FILE_TYPES, expandAnndataZarr, } from './joint-file-types';
3
- describe('src/app/joint-file-types.js', () => {
4
- describe('FileType-to-DataType mappings', () => {
5
- it('every file type is mapped to either a data type or a joint file type expansion function', () => {
6
- const fileTypes = Object.values(FileType).sort();
7
- const mappedFileTypes = [
8
- ...Object.keys(FILE_TYPE_DATA_TYPE_MAPPING),
9
- ...Object.keys(JOINT_FILE_TYPES),
10
- ].sort();
11
- expect(fileTypes.length).toEqual(mappedFileTypes.length);
12
- expect(fileTypes).toEqual(mappedFileTypes);
13
- });
14
- });
15
- describe('expandAnndataZarr', () => {
16
- it('fails to expand when there are no options', () => {
17
- expect(() => expandAnndataZarr({
18
- fileType: 'anndata.zarr',
19
- url: 'http://localhost:8000/anndata.zarr',
20
- })).toThrow();
21
- });
22
- it('expands when there is an obsEmbedding object', () => {
23
- expect(expandAnndataZarr({
24
- fileType: 'anndata.zarr',
25
- url: 'http://localhost:8000/anndata.zarr',
26
- options: {
27
- obsLabels: {
28
- path: 'obs/spot_name',
29
- },
30
- featureLabels: {
31
- path: 'var/gene_symbol',
32
- },
33
- obsEmbedding: {
34
- path: 'obsm/pca',
35
- dims: [2, 4],
36
- },
37
- },
38
- coordinationValues: {
39
- obsType: 'spot',
40
- featureType: 'transcript',
41
- obsLabelsType: 'spotName',
42
- featureLabelsType: 'geneSymbol',
43
- embeddingType: 'PCA',
44
- },
45
- })).toEqual([
46
- {
47
- fileType: 'obsEmbedding.anndata.zarr',
48
- url: 'http://localhost:8000/anndata.zarr',
49
- options: {
50
- path: 'obsm/pca',
51
- dims: [2, 4],
52
- },
53
- coordinationValues: {
54
- obsType: 'spot',
55
- embeddingType: 'PCA',
56
- },
57
- },
58
- {
59
- fileType: 'obsLabels.anndata.zarr',
60
- url: 'http://localhost:8000/anndata.zarr',
61
- options: {
62
- path: 'obs/spot_name',
63
- },
64
- coordinationValues: {
65
- obsType: 'spot',
66
- obsLabelsType: 'spotName',
67
- },
68
- },
69
- {
70
- fileType: 'featureLabels.anndata.zarr',
71
- url: 'http://localhost:8000/anndata.zarr',
72
- options: {
73
- path: 'var/gene_symbol',
74
- },
75
- coordinationValues: {
76
- featureType: 'transcript',
77
- featureLabelsType: 'geneSymbol',
78
- },
79
- },
80
- ]);
81
- });
82
- it('expands when there is an obsEmbedding array of objects', () => {
83
- expect(expandAnndataZarr({
84
- fileType: 'anndata.zarr',
85
- url: 'http://localhost:8000/anndata.zarr',
86
- options: {
87
- obsLocations: {
88
- path: 'obsm/xy',
89
- },
90
- obsEmbedding: [
91
- {
92
- path: 'obsm/pca',
93
- dims: [2, 4],
94
- embeddingType: 'PCA',
95
- },
96
- {
97
- path: 'obsm/umap',
98
- embeddingType: 'UMAP',
99
- },
100
- ],
101
- },
102
- })).toEqual([
103
- {
104
- fileType: 'obsLocations.anndata.zarr',
105
- url: 'http://localhost:8000/anndata.zarr',
106
- options: {
107
- path: 'obsm/xy',
108
- },
109
- coordinationValues: {
110
- obsType: 'cell',
111
- },
112
- },
113
- {
114
- fileType: 'obsEmbedding.anndata.zarr',
115
- url: 'http://localhost:8000/anndata.zarr',
116
- options: {
117
- path: 'obsm/pca',
118
- dims: [2, 4],
119
- },
120
- coordinationValues: {
121
- obsType: 'cell',
122
- embeddingType: 'PCA',
123
- },
124
- },
125
- {
126
- fileType: 'obsEmbedding.anndata.zarr',
127
- url: 'http://localhost:8000/anndata.zarr',
128
- options: {
129
- path: 'obsm/umap',
130
- },
131
- coordinationValues: {
132
- obsType: 'cell',
133
- embeddingType: 'UMAP',
134
- },
135
- },
136
- ]);
137
- });
138
- });
139
- });
@@ -1,98 +0,0 @@
1
- import { getLoaderClassesForPluginFileType, } from './plugins';
2
- // TODO(monorepo)
3
- /*
4
- import {
5
- AnnDataSource,
6
- ZarrDataSource,
7
- JsonSource,
8
- CsvSource,
9
- } from './data-sources';
10
- import JsonLoader from './json-loaders/JsonLoader';
11
- import ObsSetsJsonLoader from './json-loaders/ObsSetsJson';
12
- import ObsSegmentationsJsonLoader from './json-loaders/ObsSegmentationsJson';
13
- import OmeZarrLoader from './OmeZarrLoader';
14
- import AnnDataLoaders from './anndata-loaders';
15
- import GenomicProfilesZarrLoader from './GenomicProfilesZarrLoader';
16
- import CellsJsonAsObsLabelsLoader from './legacy-loaders/CellsJsonAsObsLabels';
17
- import CellsJsonAsObsEmbeddingLoader from './legacy-loaders/CellsJsonAsObsEmbedding';
18
- import CellsJsonAsObsSegmentationsLoader from './legacy-loaders/CellsJsonAsObsSegmentations';
19
- import ClustersJsonAsObsFeatureMatrixLoader from './legacy-loaders/ClustersJsonAsObsFeatureMatrix';
20
- import GenesJsonAsObsFeatureMatrixLoader from './legacy-loaders/GenesJsonAsObsFeatureMatrix';
21
- import RasterJsonAsImageLoader from './raster-json-loaders/RasterJsonAsImageLoader';
22
- import RasterJsonAsObsSegmentationsLoader from './raster-json-loaders/RasterJsonAsObsSegmentationsLoader';
23
- import MatrixZarrAsObsFeatureMatrixLoader from './matrix-loaders/MatrixZarrAsObsFeatureMatrix';
24
- import MoleculesJsonAsObsLocationsLoader from './legacy-loaders/MoleculesJsonAsObsLocations';
25
- import MoleculesJsonAsObsLabelsLoader from './legacy-loaders/MoleculesJsonAsObsLabels';
26
- import CellsJsonAsObsLocationsLoader from './legacy-loaders/CellsJsonAsObsLocations';
27
- import ObsEmbeddingCsvLoader from './csv-loaders/ObsEmbeddingCsv';
28
- import ObsLocationsCsvLoader from './csv-loaders/ObsLocationsCsv';
29
- import ObsLabelsCsvLoader from './csv-loaders/ObsLabelsCsv';
30
- import FeatureLabelsCsvLoader from './csv-loaders/FeatureLabelsCsv';
31
- import ObsFeatureMatrixCsvLoader from './csv-loaders/ObsFeatureMatrixCsv';
32
- import ObsSetsCsvLoader from './csv-loaders/ObsSetsCsv';
33
- */
34
- export const fileTypeToLoaderAndSource = {
35
- // TODO(monorepo)
36
- /*
37
- [FileType.OBS_EMBEDDING_CSV]: [CsvSource, ObsEmbeddingCsvLoader],
38
- [FileType.OBS_LOCATIONS_CSV]: [CsvSource, ObsLocationsCsvLoader],
39
- [FileType.OBS_LABELS_CSV]: [CsvSource, ObsLabelsCsvLoader],
40
- [FileType.FEATURE_LABELS_CSV]: [CsvSource, FeatureLabelsCsvLoader],
41
- [FileType.OBS_FEATURE_MATRIX_CSV]: [CsvSource, ObsFeatureMatrixCsvLoader],
42
- [FileType.OBS_SEGMENTATIONS_JSON]: [JsonSource, ObsSegmentationsJsonLoader],
43
- [FileType.OBS_SETS_CSV]: [CsvSource, ObsSetsCsvLoader],
44
- [FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR]: [
45
- AnnDataSource, AnnDataLoaders.ObsFeatureMatrixAnndataLoader,
46
- ],
47
- [FileType.OBS_SETS_ANNDATA_ZARR]: [
48
- AnnDataSource, AnnDataLoaders.ObsSetsAnndataLoader,
49
- ],
50
- [FileType.OBS_EMBEDDING_ANNDATA_ZARR]: [
51
- AnnDataSource, AnnDataLoaders.ObsEmbeddingAnndataLoader,
52
- ],
53
- [FileType.OBS_LOCATIONS_ANNDATA_ZARR]: [
54
- AnnDataSource, AnnDataLoaders.ObsLocationsAnndataLoader,
55
- ],
56
- [FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR]: [
57
- AnnDataSource, AnnDataLoaders.ObsSegmentationsAnndataLoader,
58
- ],
59
- [FileType.OBS_LABELS_ANNDATA_ZARR]: [
60
- AnnDataSource, AnnDataLoaders.ObsLabelsAnndataLoader,
61
- ],
62
- [FileType.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR]: [
63
- ZarrDataSource, MatrixZarrAsObsFeatureMatrixLoader,
64
- ],
65
- [FileType.FEATURE_LABELS_ANNDATA_ZARR]: [
66
- AnnDataSource, AnnDataLoaders.FeatureLabelsAnndataLoader,
67
- ],
68
- [FileType.IMAGE_OME_ZARR]: [ZarrDataSource, OmeZarrLoader],
69
- [FileType.IMAGE_RASTER_JSON]: [JsonSource, RasterJsonAsImageLoader],
70
- [FileType.OBS_SEGMENTATIONS_RASTER_JSON]: [JsonSource, RasterJsonAsObsSegmentationsLoader],
71
- [FileType.OBS_SETS_JSON]: [JsonSource, ObsSetsJsonLoader],
72
- [FileType.OBS_SETS_CELL_SETS_JSON]: [JsonSource, ObsSetsJsonLoader],
73
- [FileType.OBS_FEATURE_MATRIX_CLUSTERS_JSON]: [JsonSource, ClustersJsonAsObsFeatureMatrixLoader],
74
- [FileType.OBS_FEATURE_MATRIX_GENES_JSON]: [JsonSource, GenesJsonAsObsFeatureMatrixLoader],
75
- [FileType.OBS_LABELS_CELLS_JSON]: [JsonSource, CellsJsonAsObsLabelsLoader],
76
- [FileType.OBS_EMBEDDING_CELLS_JSON]: [JsonSource, CellsJsonAsObsEmbeddingLoader],
77
- [FileType.OBS_LOCATIONS_CELLS_JSON]: [JsonSource, CellsJsonAsObsLocationsLoader],
78
- [FileType.OBS_SEGMENTATIONS_CELLS_JSON]: [JsonSource, CellsJsonAsObsSegmentationsLoader],
79
- [FileType.OBS_LOCATIONS_MOLECULES_JSON]: [JsonSource, MoleculesJsonAsObsLocationsLoader],
80
- [FileType.OBS_LABELS_MOLECULES_JSON]: [JsonSource, MoleculesJsonAsObsLabelsLoader],
81
- // Old mappings:
82
- [FileType.NEIGHBORHOODS_JSON]: [JsonSource, JsonLoader],
83
- [FileType.GENOMIC_PROFILES_ZARR]: [ZarrDataSource, GenomicProfilesZarrLoader],
84
- */
85
- };
86
- export function getSourceAndLoaderFromFileType(type) {
87
- if (fileTypeToLoaderAndSource[type]) {
88
- return fileTypeToLoaderAndSource[type];
89
- }
90
- const pluginFileType = getLoaderClassesForPluginFileType(type);
91
- if (pluginFileType) {
92
- return pluginFileType;
93
- }
94
- // Fallback to JSON.
95
- // TODO(monorepo)
96
- // return [JsonSource, JsonLoader];
97
- return [null, null];
98
- }
@@ -1,76 +0,0 @@
1
- export const convenienceFileDefsCollapsed = {
2
- version: '1.0.15',
3
- name: 'My config name',
4
- description: 'My config description',
5
- initStrategy: 'auto',
6
- datasets: [
7
- {
8
- files: [
9
- {
10
- fileType: 'anndata.convenience.zarr',
11
- url: 'http://localhost:8000/my_anndata.zarr',
12
- options: {
13
- cells: {
14
- xy: 'obsm/centroids',
15
- },
16
- cellSets: [
17
- {
18
- groupName: 'Leiden',
19
- setName: 'obs/leiden',
20
- },
21
- ],
22
- },
23
- },
24
- ],
25
- name: 'A',
26
- uid: 'A',
27
- },
28
- ],
29
- layout: [],
30
- };
31
- export function pluginExpandAnnDataConvenience(fileDef) {
32
- return [
33
- {
34
- fileType: 'anndata-cells.zarr',
35
- url: fileDef.url,
36
- options: fileDef.options.cells,
37
- },
38
- {
39
- fileType: 'anndata-cell-sets.zarr',
40
- url: fileDef.url,
41
- options: fileDef.options.cellSets,
42
- },
43
- ];
44
- }
45
- export const convenienceFileDefsExpanded = {
46
- version: '1.0.15',
47
- name: 'My config name',
48
- description: 'My config description',
49
- initStrategy: 'auto',
50
- datasets: [
51
- {
52
- files: [
53
- {
54
- fileType: 'anndata-cells.zarr',
55
- url: 'http://localhost:8000/my_anndata.zarr',
56
- options: {
57
- xy: 'obsm/centroids',
58
- },
59
- },
60
- {
61
- fileType: 'anndata-cell-sets.zarr',
62
- url: 'http://localhost:8000/my_anndata.zarr',
63
- options: [
64
- {
65
- groupName: 'Leiden',
66
- setName: 'obs/leiden',
67
- },
68
- ],
69
- },
70
- ],
71
- name: 'A',
72
- uid: 'A',
73
- },
74
- ],
75
- layout: [],
76
- };
@@ -1,30 +0,0 @@
1
- /* eslint-disable camelcase */
2
- import { registerPluginFileType, registerPluginJointFileType, getFileTypeDataTypeMapping, getJointFileTypes, } from './plugins';
3
- import { convenienceFileDefsCollapsed, convenienceFileDefsExpanded, pluginExpandAnnDataConvenience, } from './plugins.test.fixtures';
4
- import { initialize, } from './view-config-utils';
5
- describe('src/app/plugins.js', () => {
6
- describe('getFileTypeDataTypeMapping', () => {
7
- it('returns the correct data type for built-in file types', () => {
8
- const dataType = getFileTypeDataTypeMapping()['image.raster.json'];
9
- expect(dataType).toEqual('image');
10
- });
11
- it('returns the correct data type for plugin file types', () => {
12
- registerPluginFileType('plugin-cells.json', 'cells', null, null);
13
- const dataType = getFileTypeDataTypeMapping()['plugin-cells.json'];
14
- expect(dataType).toEqual('cells');
15
- });
16
- });
17
- describe('convenience file types', () => {
18
- it('registers plugin convenience file types', () => {
19
- registerPluginJointFileType('anndata.convenience.zarr', pluginExpandAnnDataConvenience);
20
- const expansionFuncs = getJointFileTypes();
21
- expect(Object.keys(expansionFuncs).includes('anndata.convenience.zarr')).toBeTruthy();
22
- expect(typeof expansionFuncs['anndata.convenience.zarr']).toEqual('function');
23
- });
24
- it('uses plugin convenience file types in view config initialization', () => {
25
- registerPluginJointFileType('anndata.convenience.zarr', pluginExpandAnnDataConvenience);
26
- expect(initialize(convenienceFileDefsCollapsed).datasets)
27
- .toEqual(convenienceFileDefsExpanded.datasets);
28
- });
29
- });
30
- });
@@ -1,34 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import yaml from 'js-yaml'; // eslint-disable-line import/no-extraneous-dependencies
4
- // This should only be used by docz, and should not be part of the app build.
5
- function abbreviateType(yamlString) {
6
- return yamlString.replace(/:\s+type: (\w+)/g, ' ($1):');
7
- }
8
- function abbreviateRef(yamlString) {
9
- return yamlString.replace(/:\s+\$ref: '#\/definitions\/(\w+)'/g, ' ($1)');
10
- }
11
- function stripAddProps(yamlString) {
12
- // This should be the default in our schemas, but we don't need it in the docs.
13
- return yamlString.replace(/\s+additionalProperties: false/g, '');
14
- }
15
- function valuesAre(yamlString) {
16
- return yamlString.replace(/patternProperties:\s+\./g, 'Object values are');
17
- }
18
- function hasProperties(yamlString) {
19
- return yamlString.replace(/\.:\s+properties:/g, 'Each value has these properties:');
20
- }
21
- function pretty(title, obj) {
22
- // This is entirely ad-hoc:
23
- // It woks well for our schema, but no assertion that it should work for anyone else.
24
- if (!obj)
25
- return '';
26
- return (_jsxs(_Fragment, { children: [_jsx("h3", { children: title }), _jsx("pre", { children: hasProperties(valuesAre(stripAddProps(abbreviateRef(abbreviateType(yaml.safeDump(obj)))))) })] }));
27
- }
28
- export default function PrettyJsonSchema(props) {
29
- const { children } = props;
30
- const { definitions, patternProperties, properties } = children;
31
- // We could grab the title as well, but when we output an <h2> it is not anchored;
32
- // better to put the section headers in MD.
33
- return (_jsxs("blockquote", { children: [pretty('Definitions', definitions), pretty('Properties', patternProperties), pretty('Properties', properties)] }));
34
- }
@@ -1,84 +0,0 @@
1
- {
2
- "$schema": "http://json-schema.org/draft-07/schema#",
3
- "$id": "https://github.com/vitessce/vitessce/#dataset",
4
- "title": "Vitessce data set",
5
- "type": "object",
6
- "definitions": {
7
- "components": {
8
- "type": "array",
9
- "items": {
10
- "type": "object",
11
- "additionalProperties": false,
12
- "required": ["component", "x", "y"],
13
- "properties": {
14
- "component": { "type": "string" },
15
- "props": { "type": "object" },
16
- "x": { "type": "integer" },
17
- "y": { "type": "integer" },
18
- "w": { "type": "integer" },
19
- "h": { "type": "integer" }
20
- }
21
- }
22
- },
23
- "requestInit": {
24
- "type": "object",
25
- "additionalProperties": false,
26
- "required": [],
27
- "properties": {
28
- "method": {
29
- "type": "string"
30
- },
31
- "headers": {
32
- "type": "object"
33
- },
34
- "body": {
35
- "type": "string"
36
- },
37
- "mode": {
38
- "type": "string"
39
- },
40
- "credentials": {
41
- "type": "string"
42
- },
43
- "cache": {
44
- "type": "string"
45
- },
46
- "redirect": {
47
- "type": "string"
48
- },
49
- "referrer": {
50
- "type": "string"
51
- },
52
- "integrity": {
53
- "type": "string"
54
- }
55
- }
56
- }
57
- },
58
- "additionalProperties": false,
59
- "required": ["version", "name", "layers"],
60
- "properties": {
61
- "name": { "type": "string" },
62
- "public": { "type": "boolean" },
63
- "description": { "type": "string" },
64
- "layers": {
65
- "type": "array",
66
- "items": {
67
- "type": "object",
68
- "additionalProperties": false,
69
- "required": ["name", "type", "fileType", "url"],
70
- "properties": {
71
- "name": { "type": "string" },
72
- "type": { "type": "string" },
73
- "fileType": { "type": "string" },
74
- "url": { "type": "string" },
75
- "requestInit": { "$ref": "#/definitions/requestInit" }
76
- }
77
- }
78
- },
79
- "staticLayout": { "$ref": "#/definitions/components" },
80
- "version": {
81
- "type": "string", "enum": ["0.1.0"]
82
- }
83
- }
84
- }