@vitessce/vit-s 2.0.2 → 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.
- package/dist/index.mjs +84801 -0
- package/{dist → dist-tsc}/index.js +2 -2
- package/package.json +7 -7
- package/src/CallbackPublisher.js +81 -0
- package/src/LoadingIndicator.js +34 -0
- package/src/TitleInfo.js +240 -0
- package/src/VitS.js +180 -0
- package/src/VitessceGrid.js +110 -0
- package/src/VitessceGrid.test.jsx +48 -0
- package/src/Warning.js +62 -0
- package/{dist → src}/classNames.js +0 -0
- package/src/component-registry.js +21 -0
- package/src/data/AbstractLoader.js +46 -0
- package/{dist → src}/data/AbstractTwoStepLoader.js +5 -4
- package/src/data/LoaderResult.js +8 -0
- package/{dist → src}/data/index.js +0 -0
- package/src/data/loader-registry.js +19 -0
- package/src/data-hook-utils.js +197 -0
- package/src/data-hooks.js +354 -0
- package/src/errors/AbstractLoaderError.js +14 -0
- package/src/errors/DataSourceFetchError.js +15 -0
- package/src/errors/DatasetNotFoundError.js +23 -0
- package/src/errors/LoaderNotFoundError.js +24 -0
- package/src/errors/LoaderValidationError.js +23 -0
- package/src/errors/OptionsValidationError.js +25 -0
- package/{dist → src}/errors/index.js +0 -0
- package/src/file-options-schemas-legacy.js +139 -0
- package/src/file-options-schemas-legacy.test.js +138 -0
- package/src/file-options-schemas.js +327 -0
- package/src/file-options-schemas.test.js +26 -0
- package/src/hooks.js +252 -0
- package/src/index.js +101 -0
- package/src/joint-file-types-legacy.js +298 -0
- package/src/joint-file-types-legacy.test.js +412 -0
- package/src/joint-file-types.js +171 -0
- package/src/joint-file-types.test.js +144 -0
- package/{dist/schemas.js → src/json-schemas.js} +6 -1
- package/{dist → src}/plugins.js +102 -70
- package/src/plugins.test.fixtures.js +78 -0
- package/src/plugins.test.js +42 -0
- package/src/schemas/config-0.1.0.schema.json +85 -0
- package/src/schemas/config-1.0.0.schema.json +733 -0
- package/src/schemas/config-1.0.1.schema.json +909 -0
- package/src/schemas/config-1.0.10.schema.json +969 -0
- package/src/schemas/config-1.0.11.schema.json +990 -0
- package/src/schemas/config-1.0.12.schema.json +997 -0
- package/src/schemas/config-1.0.13.schema.json +1013 -0
- package/src/schemas/config-1.0.14.schema.json +1048 -0
- package/src/schemas/config-1.0.15.schema.json +1048 -0
- package/src/schemas/config-1.0.16.schema.json +1069 -0
- package/src/schemas/config-1.0.16.schema.test.js +32 -0
- package/src/schemas/config-1.0.2.schema.json +911 -0
- package/src/schemas/config-1.0.3.schema.json +911 -0
- package/src/schemas/config-1.0.4.schema.json +949 -0
- package/src/schemas/config-1.0.5.schema.json +949 -0
- package/src/schemas/config-1.0.6.schema.json +950 -0
- package/src/schemas/config-1.0.7.schema.json +950 -0
- package/src/schemas/config-1.0.8.schema.json +966 -0
- package/src/schemas/config-1.0.9.schema.json +965 -0
- package/src/schemas/fixtures/cellSets.good.json +16 -0
- package/src/schemas/fixtures/config-1.0.1.bad.json +1 -0
- package/src/schemas/fixtures/config-1.0.1.bad.message.json +11 -0
- package/src/schemas/fixtures/config-1.0.1.good.json +37 -0
- package/src/schemas/fixtures/config-1.0.2.bad.json +1 -0
- package/src/schemas/fixtures/config-1.0.2.bad.message.json +11 -0
- package/src/schemas/fixtures/config-1.0.2.good.json +38 -0
- package/src/schemas/fixtures/config-1.0.3.bad.json +1 -0
- package/src/schemas/fixtures/config-1.0.3.bad.message.json +11 -0
- package/src/schemas/fixtures/config-1.0.3.good.json +38 -0
- package/src/schemas/fixtures/obsSets.bad.json +1 -0
- package/src/schemas/fixtures/obsSets.bad.message.json +11 -0
- package/src/schemas/fixtures/obsSets.good.json +16 -0
- package/src/schemas/fixtures/obsSetsTabular.bad.json +1 -0
- package/src/schemas/fixtures/obsSetsTabular.bad.message.json +11 -0
- package/src/schemas/fixtures/obsSetsTabular.good.json +26 -0
- package/src/schemas/fixtures/raster.bad.json +1 -0
- package/src/schemas/fixtures/raster.bad.message.json +11 -0
- package/src/schemas/fixtures/raster.good.json +39 -0
- package/src/schemas/obsSets.schema.js +195 -0
- package/src/schemas/obsSetsTabular.schema.js +39 -0
- package/src/schemas/raster.schema.js +121 -0
- package/src/schemas/schema-schema.sh +34 -0
- package/{dist → src}/schemas/schema.test-old.js +0 -1
- package/src/shared-mui/components.js +79 -0
- package/src/shared-mui/container.js +212 -0
- package/src/shared-mui/styles.js +110 -0
- package/src/shared-plot-options/CellColorEncodingOption.js +43 -0
- package/src/shared-plot-options/OptionSelect.js +19 -0
- package/src/shared-plot-options/OptionsContainer.js +26 -0
- package/{dist → src}/shared-plot-options/index.js +0 -0
- package/src/shared-plot-options/styles.js +49 -0
- package/src/state/hooks.js +633 -0
- package/src/view-config-upgraders.js +628 -0
- package/src/view-config-utils.js +315 -0
- package/src/view-config-utils.test.fixtures.js +893 -0
- package/src/view-config-utils.test.js +95 -0
- package/src/view-config-versions.js +68 -0
- package/src/vitessce-grid-layout/VitessceGridLayout.js +158 -0
- package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +56 -0
- package/{dist → src}/vitessce-grid-layout/index.js +0 -0
- package/src/vitessce-grid-layout/layout-utils.js +76 -0
- package/src/vitessce-grid-layout/layout-utils.test.js +167 -0
- package/src/vitessce-grid-utils.js +160 -0
- package/dist/CallbackPublisher.js +0 -68
- package/dist/LoadingIndicator.js +0 -27
- package/dist/TitleInfo.js +0 -151
- package/dist/VitS.js +0 -112
- package/dist/VitessceGrid.js +0 -59
- package/dist/VitessceGrid.test.js +0 -36
- package/dist/Warning.js +0 -45
- package/dist/component-registry.js +0 -16
- package/dist/data/AbstractLoader.js +0 -35
- package/dist/data/LoaderResult.js +0 -7
- package/dist/data/loader-registry.js +0 -15
- package/dist/data-hook-utils.js +0 -175
- package/dist/data-hooks.js +0 -241
- package/dist/errors/AbstractLoaderError.js +0 -13
- package/dist/errors/DataSourceFetchError.js +0 -13
- package/dist/errors/DatasetNotFoundError.js +0 -17
- package/dist/errors/LoaderNotFoundError.js +0 -17
- package/dist/errors/LoaderValidationError.js +0 -15
- package/dist/errors/OptionsValidationError.js +0 -15
- package/dist/file-options-schemas-legacy.js +0 -136
- package/dist/file-options-schemas-legacy.test.js +0 -126
- package/dist/file-options-schemas.js +0 -322
- package/dist/file-options-schemas.test.js +0 -23
- package/dist/hooks.js +0 -215
- package/dist/joint-file-types-legacy.js +0 -278
- package/dist/joint-file-types-legacy.test.js +0 -400
- package/dist/joint-file-types.js +0 -148
- package/dist/joint-file-types.test.js +0 -139
- package/dist/plugins.test.fixtures.js +0 -76
- package/dist/plugins.test.js +0 -30
- package/dist/schemas/config-0.1.0.schema.json +0 -84
- package/dist/schemas/config-1.0.0.schema.json +0 -733
- package/dist/schemas/config-1.0.1.schema.json +0 -909
- package/dist/schemas/config-1.0.10.schema.json +0 -969
- package/dist/schemas/config-1.0.11.schema.json +0 -990
- package/dist/schemas/config-1.0.12.schema.json +0 -997
- package/dist/schemas/config-1.0.13.schema.json +0 -1013
- package/dist/schemas/config-1.0.14.schema.json +0 -1048
- package/dist/schemas/config-1.0.15.schema.json +0 -1048
- package/dist/schemas/config-1.0.15.schema.test.js +0 -22
- package/dist/schemas/config-1.0.2.schema.json +0 -910
- package/dist/schemas/config-1.0.3.schema.json +0 -910
- package/dist/schemas/config-1.0.4.schema.json +0 -949
- package/dist/schemas/config-1.0.5.schema.json +0 -949
- package/dist/schemas/config-1.0.6.schema.json +0 -949
- package/dist/schemas/config-1.0.7.schema.json +0 -949
- package/dist/schemas/config-1.0.8.schema.json +0 -965
- package/dist/schemas/config-1.0.9.schema.json +0 -965
- package/dist/schemas/obsSets.schema.js +0 -195
- package/dist/schemas/obsSetsTabular.schema.js +0 -38
- package/dist/schemas/raster.schema.js +0 -120
- package/dist/shared-mui/components.js +0 -35
- package/dist/shared-mui/container.js +0 -211
- package/dist/shared-mui/styles.js +0 -73
- package/dist/shared-plot-options/CellColorEncodingOption.js +0 -18
- package/dist/shared-plot-options/OptionSelect.js +0 -12
- package/dist/shared-plot-options/OptionsContainer.js +0 -12
- package/dist/shared-plot-options/styles.js +0 -48
- package/dist/state/hooks.js +0 -549
- package/dist/view-config-upgraders.js +0 -525
- package/dist/view-config-utils.js +0 -286
- package/dist/view-config-utils.test.fixtures.js +0 -765
- package/dist/view-config-utils.test.js +0 -66
- package/dist/view-config-versions.js +0 -47
- package/dist/vitessce-grid-layout/VitessceGridLayout.js +0 -95
- package/dist/vitessce-grid-layout/VitessceGridLayout.test.js +0 -40
- package/dist/vitessce-grid-layout/layout-utils.js +0 -60
- package/dist/vitessce-grid-layout/layout-utils.test.js +0 -146
- package/dist/vitessce-grid-utils.js +0 -140
|
@@ -0,0 +1,412 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { FileType } from '@vitessce/constants-internal';
|
|
2
|
+
import {
|
|
3
|
+
validateOptions,
|
|
4
|
+
anndataZarrSchema,
|
|
5
|
+
} from './file-options-schemas';
|
|
6
|
+
import {
|
|
7
|
+
expandMoleculesJson,
|
|
8
|
+
expandExpressionMatrixZarr,
|
|
9
|
+
expandRasterJson,
|
|
10
|
+
expandRasterOmeZarr,
|
|
11
|
+
expandCellSetsJson,
|
|
12
|
+
expandCellsJson,
|
|
13
|
+
expandClustersJson,
|
|
14
|
+
expandGenesJson,
|
|
15
|
+
expandAnndataCellsZarr,
|
|
16
|
+
expandAnndataCellSetsZarr,
|
|
17
|
+
expandAnndataExpressionMatrixZarr,
|
|
18
|
+
} from './joint-file-types-legacy';
|
|
19
|
+
|
|
20
|
+
export function expandAnndataZarr(fileDef) {
|
|
21
|
+
validateOptions(anndataZarrSchema, fileDef.options);
|
|
22
|
+
const baseFileDef = {
|
|
23
|
+
url: fileDef.url,
|
|
24
|
+
requestInit: fileDef.requestInit,
|
|
25
|
+
coordinationValues: {
|
|
26
|
+
...fileDef.coordinationValues,
|
|
27
|
+
obsType: fileDef.coordinationValues?.obsType || 'cell',
|
|
28
|
+
featureType: fileDef.coordinationValues?.featureType || 'gene',
|
|
29
|
+
featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
const { options = {} } = fileDef;
|
|
33
|
+
return [
|
|
34
|
+
// obsFeatureMatrix
|
|
35
|
+
...(options.obsFeatureMatrix ? [{
|
|
36
|
+
...baseFileDef,
|
|
37
|
+
fileType: FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR,
|
|
38
|
+
options: options.obsFeatureMatrix,
|
|
39
|
+
coordinationValues: {
|
|
40
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
41
|
+
featureType: baseFileDef.coordinationValues.featureType,
|
|
42
|
+
featureValueType: baseFileDef.coordinationValues.featureValueType,
|
|
43
|
+
},
|
|
44
|
+
}] : []),
|
|
45
|
+
// obsSets
|
|
46
|
+
...(options.obsSets ? [{
|
|
47
|
+
...baseFileDef,
|
|
48
|
+
fileType: FileType.OBS_SETS_ANNDATA_ZARR,
|
|
49
|
+
options: options.obsSets,
|
|
50
|
+
coordinationValues: {
|
|
51
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
52
|
+
},
|
|
53
|
+
}] : []),
|
|
54
|
+
// obsLocations
|
|
55
|
+
...(options.obsLocations ? [{
|
|
56
|
+
...baseFileDef,
|
|
57
|
+
fileType: FileType.OBS_LOCATIONS_ANNDATA_ZARR,
|
|
58
|
+
options: options.obsLocations,
|
|
59
|
+
coordinationValues: {
|
|
60
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
61
|
+
},
|
|
62
|
+
}] : []),
|
|
63
|
+
// obsSegmentations
|
|
64
|
+
...(options.obsSegmentations ? [{
|
|
65
|
+
...baseFileDef,
|
|
66
|
+
fileType: FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR,
|
|
67
|
+
options: options.obsSegmentations,
|
|
68
|
+
coordinationValues: {
|
|
69
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
70
|
+
},
|
|
71
|
+
}] : []),
|
|
72
|
+
// obsEmbedding
|
|
73
|
+
// eslint-disable-next-line no-nested-ternary
|
|
74
|
+
...(options.obsEmbedding ? (
|
|
75
|
+
Array.isArray(options.obsEmbedding) ? options.obsEmbedding.map(oe => ({
|
|
76
|
+
// obsEmbedding was an array, process each element.
|
|
77
|
+
...baseFileDef,
|
|
78
|
+
fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
|
|
79
|
+
options: {
|
|
80
|
+
path: oe.path,
|
|
81
|
+
dims: oe.dims,
|
|
82
|
+
},
|
|
83
|
+
coordinationValues: {
|
|
84
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
85
|
+
// Move embedding type property out of options and into coordinationValues.
|
|
86
|
+
embeddingType: oe.embeddingType,
|
|
87
|
+
},
|
|
88
|
+
})) : [{
|
|
89
|
+
// obsEmbedding was an object.
|
|
90
|
+
...baseFileDef,
|
|
91
|
+
fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
|
|
92
|
+
options: options.obsEmbedding,
|
|
93
|
+
coordinationValues: {
|
|
94
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
95
|
+
embeddingType: baseFileDef.coordinationValues.embeddingType,
|
|
96
|
+
},
|
|
97
|
+
}]
|
|
98
|
+
) : []),
|
|
99
|
+
// obsLabels
|
|
100
|
+
// eslint-disable-next-line no-nested-ternary
|
|
101
|
+
...(options.obsLabels ? (
|
|
102
|
+
Array.isArray(options.obsLabels) ? options.obsLabels.map(ol => ({
|
|
103
|
+
// obsLabels was an array, process each element.
|
|
104
|
+
...baseFileDef,
|
|
105
|
+
fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
|
|
106
|
+
options: {
|
|
107
|
+
path: ol.path,
|
|
108
|
+
},
|
|
109
|
+
coordinationValues: {
|
|
110
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
111
|
+
// Move obsLabels type property out of options and into coordinationValues.
|
|
112
|
+
obsLabelsType: ol.obsLabelsType,
|
|
113
|
+
},
|
|
114
|
+
})) : [{
|
|
115
|
+
// obsLabels was an object.
|
|
116
|
+
...baseFileDef,
|
|
117
|
+
fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
|
|
118
|
+
options: options.obsLabels,
|
|
119
|
+
coordinationValues: {
|
|
120
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
|
121
|
+
obsLabelsType: baseFileDef.coordinationValues.obsLabelsType,
|
|
122
|
+
},
|
|
123
|
+
}]
|
|
124
|
+
) : []),
|
|
125
|
+
// featureLabels
|
|
126
|
+
// eslint-disable-next-line no-nested-ternary
|
|
127
|
+
...(options.featureLabels ? (
|
|
128
|
+
Array.isArray(options.featureLabels) ? options.featureLabels.map(fl => ({
|
|
129
|
+
// featureLabels was an array, process each element.
|
|
130
|
+
...baseFileDef,
|
|
131
|
+
fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
|
|
132
|
+
options: {
|
|
133
|
+
path: fl.path,
|
|
134
|
+
},
|
|
135
|
+
coordinationValues: {
|
|
136
|
+
featureType: baseFileDef.coordinationValues.featureType,
|
|
137
|
+
// Move featureLabels type property out of options and into coordinationValues.
|
|
138
|
+
featureLabelsType: fl.featureLabelsType,
|
|
139
|
+
},
|
|
140
|
+
})) : [{
|
|
141
|
+
// featureLabels was an object.
|
|
142
|
+
...baseFileDef,
|
|
143
|
+
fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
|
|
144
|
+
options: options.featureLabels,
|
|
145
|
+
coordinationValues: {
|
|
146
|
+
featureType: baseFileDef.coordinationValues.featureType,
|
|
147
|
+
featureLabelsType: baseFileDef.coordinationValues.featureLabelsType,
|
|
148
|
+
},
|
|
149
|
+
}]
|
|
150
|
+
) : []),
|
|
151
|
+
];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Built-in joint file type
|
|
156
|
+
* expansion functions.
|
|
157
|
+
*/
|
|
158
|
+
export const JOINT_FILE_TYPES = {
|
|
159
|
+
[FileType.ANNDATA_ZARR]: expandAnndataZarr,
|
|
160
|
+
[FileType.ANNDATA_CELLS_ZARR]: expandAnndataCellsZarr,
|
|
161
|
+
[FileType.ANNDATA_CELL_SETS_ZARR]: expandAnndataCellSetsZarr,
|
|
162
|
+
[FileType.ANNDATA_EXPRESSION_MATRIX_ZARR]: expandAnndataExpressionMatrixZarr,
|
|
163
|
+
[FileType.EXPRESSION_MATRIX_ZARR]: expandExpressionMatrixZarr,
|
|
164
|
+
[FileType.RASTER_JSON]: expandRasterJson,
|
|
165
|
+
[FileType.RASTER_OME_ZARR]: expandRasterOmeZarr,
|
|
166
|
+
[FileType.CELL_SETS_JSON]: expandCellSetsJson,
|
|
167
|
+
[FileType.CLUSTERS_JSON]: expandClustersJson,
|
|
168
|
+
[FileType.GENES_JSON]: expandGenesJson,
|
|
169
|
+
[FileType.CELLS_JSON]: expandCellsJson,
|
|
170
|
+
[FileType.MOLECULES_JSON]: expandMoleculesJson,
|
|
171
|
+
};
|