@vitessce/config 2.0.3-beta.0 → 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.
- package/dist/index.js +15914 -1
- package/dist-tsc/VitessceAutoConfig.d.ts +2 -0
- package/dist-tsc/VitessceAutoConfig.d.ts.map +1 -0
- package/dist-tsc/VitessceAutoConfig.js +323 -0
- package/dist-tsc/VitessceAutoConfig.test.d.ts +2 -0
- package/dist-tsc/VitessceAutoConfig.test.d.ts.map +1 -0
- package/dist-tsc/VitessceAutoConfig.test.js +442 -0
- package/dist-tsc/VitessceConfig.d.ts +257 -0
- package/dist-tsc/VitessceConfig.d.ts.map +1 -0
- package/dist-tsc/VitessceConfig.test.d.ts +2 -0
- package/dist-tsc/VitessceConfig.test.d.ts.map +1 -0
- package/{dist → dist-tsc}/VitessceConfig.test.js +1 -1
- package/dist-tsc/index.d.ts +3 -0
- package/dist-tsc/index.d.ts.map +1 -0
- package/dist-tsc/index.js +2 -0
- package/dist-tsc/utils.d.ts +12 -0
- package/dist-tsc/utils.d.ts.map +1 -0
- package/package.json +15 -6
- package/src/VitessceAutoConfig.js +382 -0
- package/src/VitessceAutoConfig.test.js +465 -0
- package/src/VitessceConfig.js +502 -0
- package/src/VitessceConfig.test.js +490 -0
- package/src/index.js +2 -0
- package/src/utils.js +48 -0
- /package/{dist → dist-tsc}/VitessceConfig.js +0 -0
- /package/{dist → dist-tsc}/utils.js +0 -0
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
import { generateConfigs } from './VitessceAutoConfig.js';
|
|
2
|
+
describe('src/VitessceAutoConfig.js', () => {
|
|
3
|
+
it('generates config for OME-TIFF file correctly', async () => {
|
|
4
|
+
const urls = ['somefile.ome.tif'];
|
|
5
|
+
const expectedName = urls[0].split('/').at(-1);
|
|
6
|
+
const expectedConfig = {
|
|
7
|
+
version: '1.0.15',
|
|
8
|
+
name: 'An automatically generated config. Adjust values and add layout components if needed.',
|
|
9
|
+
description: 'Populate with text relevant to this visualisation.',
|
|
10
|
+
datasets: [
|
|
11
|
+
{
|
|
12
|
+
uid: 'A',
|
|
13
|
+
name: expectedName,
|
|
14
|
+
files: [
|
|
15
|
+
{
|
|
16
|
+
fileType: 'raster.json',
|
|
17
|
+
options: {
|
|
18
|
+
images: [
|
|
19
|
+
{
|
|
20
|
+
metadata: {
|
|
21
|
+
isBitmask: false,
|
|
22
|
+
},
|
|
23
|
+
name: expectedName,
|
|
24
|
+
type: 'ome-tiff',
|
|
25
|
+
url: urls[0],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
schemaVersion: '0.0.2',
|
|
29
|
+
usePhysicalSizeScaling: false,
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
coordinationSpace: {
|
|
36
|
+
dataset: {
|
|
37
|
+
A: 'A',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
layout: [
|
|
41
|
+
{
|
|
42
|
+
component: 'description',
|
|
43
|
+
coordinationScopes: {
|
|
44
|
+
dataset: 'A',
|
|
45
|
+
},
|
|
46
|
+
x: 0,
|
|
47
|
+
y: 0,
|
|
48
|
+
w: 6,
|
|
49
|
+
h: 6,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
component: 'spatial',
|
|
53
|
+
coordinationScopes: {
|
|
54
|
+
dataset: 'A',
|
|
55
|
+
},
|
|
56
|
+
x: 6,
|
|
57
|
+
y: 0,
|
|
58
|
+
w: 6,
|
|
59
|
+
h: 6,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
component: 'layerController',
|
|
63
|
+
coordinationScopes: {
|
|
64
|
+
dataset: 'A',
|
|
65
|
+
},
|
|
66
|
+
x: 0,
|
|
67
|
+
y: 6,
|
|
68
|
+
w: 6,
|
|
69
|
+
h: 6,
|
|
70
|
+
props: {
|
|
71
|
+
disable3d: [],
|
|
72
|
+
disableChannelsIfRgbDetected: true,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
],
|
|
76
|
+
initStrategy: 'auto',
|
|
77
|
+
};
|
|
78
|
+
const config = await generateConfigs(urls);
|
|
79
|
+
expect(config).toEqual(expectedConfig);
|
|
80
|
+
});
|
|
81
|
+
it('generates config for OME-ZARR file correctly', async () => {
|
|
82
|
+
const urls = ['anotherfile.ome.zarr'];
|
|
83
|
+
const expectedName = urls[0].split('/').at(-1);
|
|
84
|
+
const expectedConfig = {
|
|
85
|
+
version: '1.0.15',
|
|
86
|
+
name: 'An automatically generated config. Adjust values and add layout components if needed.',
|
|
87
|
+
description: 'Populate with text relevant to this visualisation.',
|
|
88
|
+
datasets: [
|
|
89
|
+
{
|
|
90
|
+
uid: 'A',
|
|
91
|
+
name: expectedName,
|
|
92
|
+
files: [
|
|
93
|
+
{
|
|
94
|
+
url: urls[0],
|
|
95
|
+
fileType: 'raster.ome-zarr',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
coordinationSpace: {
|
|
101
|
+
dataset: {
|
|
102
|
+
A: 'A',
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
layout: [
|
|
106
|
+
{
|
|
107
|
+
component: 'description',
|
|
108
|
+
coordinationScopes: {
|
|
109
|
+
dataset: 'A',
|
|
110
|
+
},
|
|
111
|
+
x: 0,
|
|
112
|
+
y: 0,
|
|
113
|
+
w: 6,
|
|
114
|
+
h: 6,
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
component: 'spatial',
|
|
118
|
+
coordinationScopes: {
|
|
119
|
+
dataset: 'A',
|
|
120
|
+
},
|
|
121
|
+
x: 6,
|
|
122
|
+
y: 0,
|
|
123
|
+
w: 6,
|
|
124
|
+
h: 6,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
component: 'layerController',
|
|
128
|
+
coordinationScopes: {
|
|
129
|
+
dataset: 'A',
|
|
130
|
+
},
|
|
131
|
+
x: 0,
|
|
132
|
+
y: 6,
|
|
133
|
+
w: 6,
|
|
134
|
+
h: 6,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
component: 'status',
|
|
138
|
+
coordinationScopes: {
|
|
139
|
+
dataset: 'A',
|
|
140
|
+
},
|
|
141
|
+
x: 6,
|
|
142
|
+
y: 6,
|
|
143
|
+
w: 6,
|
|
144
|
+
h: 6,
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
initStrategy: 'auto',
|
|
148
|
+
};
|
|
149
|
+
const config = await generateConfigs(urls);
|
|
150
|
+
expect(config).toEqual(expectedConfig);
|
|
151
|
+
});
|
|
152
|
+
it('generates config for Anndata-ZARR file correctly', async () => {
|
|
153
|
+
const urls = ['http://localhost:51204/@fixtures/zarr/partials/.anndata.zarr'];
|
|
154
|
+
const expectedName = urls[0].split('/').at(-1);
|
|
155
|
+
const expectedConfig = {
|
|
156
|
+
version: '1.0.15',
|
|
157
|
+
name: 'An automatically generated config. Adjust values and add layout components if needed.',
|
|
158
|
+
description: 'Populate with text relevant to this visualisation.',
|
|
159
|
+
datasets: [
|
|
160
|
+
{
|
|
161
|
+
uid: 'A',
|
|
162
|
+
name: expectedName,
|
|
163
|
+
files: [
|
|
164
|
+
{
|
|
165
|
+
url: urls[0],
|
|
166
|
+
fileType: 'anndata.zarr',
|
|
167
|
+
coordinationValues: {
|
|
168
|
+
obsType: 'cell',
|
|
169
|
+
featureType: 'gene',
|
|
170
|
+
featureValueType: 'expression',
|
|
171
|
+
},
|
|
172
|
+
options: {
|
|
173
|
+
obsEmbedding: [
|
|
174
|
+
{
|
|
175
|
+
path: 'obsm/X_umap',
|
|
176
|
+
embeddingType: 'UMAP',
|
|
177
|
+
},
|
|
178
|
+
],
|
|
179
|
+
obsFeatureMatrix: {
|
|
180
|
+
path: 'X',
|
|
181
|
+
},
|
|
182
|
+
obsSets: [
|
|
183
|
+
{
|
|
184
|
+
name: 'Cell Type',
|
|
185
|
+
path: [
|
|
186
|
+
'obs/cell_type',
|
|
187
|
+
'obs/disease',
|
|
188
|
+
'obs/leiden',
|
|
189
|
+
'obs/organism',
|
|
190
|
+
'obs/self_reported_ethnicity',
|
|
191
|
+
'obs/sex',
|
|
192
|
+
'obs/tissue'
|
|
193
|
+
],
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
},
|
|
200
|
+
],
|
|
201
|
+
coordinationSpace: {
|
|
202
|
+
dataset: {
|
|
203
|
+
A: 'A',
|
|
204
|
+
},
|
|
205
|
+
embeddingType: {
|
|
206
|
+
A: 'UMAP',
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
layout: [
|
|
210
|
+
{
|
|
211
|
+
component: 'obsSets',
|
|
212
|
+
coordinationScopes: {
|
|
213
|
+
dataset: 'A',
|
|
214
|
+
},
|
|
215
|
+
x: 0,
|
|
216
|
+
y: 0,
|
|
217
|
+
w: 6,
|
|
218
|
+
h: 6,
|
|
219
|
+
},
|
|
220
|
+
{
|
|
221
|
+
component: 'scatterplot',
|
|
222
|
+
coordinationScopes: {
|
|
223
|
+
dataset: 'A',
|
|
224
|
+
embeddingType: 'A',
|
|
225
|
+
},
|
|
226
|
+
x: 6,
|
|
227
|
+
y: 0,
|
|
228
|
+
w: 6,
|
|
229
|
+
h: 6,
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
component: 'heatmap',
|
|
233
|
+
coordinationScopes: {
|
|
234
|
+
dataset: 'A',
|
|
235
|
+
},
|
|
236
|
+
x: 0,
|
|
237
|
+
y: 6,
|
|
238
|
+
w: 6,
|
|
239
|
+
h: 6,
|
|
240
|
+
props: {
|
|
241
|
+
transpose: true,
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
component: 'featureList',
|
|
246
|
+
coordinationScopes: {
|
|
247
|
+
dataset: 'A',
|
|
248
|
+
},
|
|
249
|
+
x: 6,
|
|
250
|
+
y: 6,
|
|
251
|
+
w: 6,
|
|
252
|
+
h: 6,
|
|
253
|
+
},
|
|
254
|
+
],
|
|
255
|
+
initStrategy: 'auto',
|
|
256
|
+
};
|
|
257
|
+
const config = await generateConfigs(urls);
|
|
258
|
+
expect(config).toEqual(expectedConfig);
|
|
259
|
+
});
|
|
260
|
+
it('generates empty config for Anndata-ZARR file with empty .zmetadata', async () => {
|
|
261
|
+
const urls = ['http://localhost:51204/@fixtures/zarr/partials/emptymeta.h5ad.zarr'];
|
|
262
|
+
const expectedName = urls[0].split('/').at(-1);
|
|
263
|
+
const expectedConfig = {
|
|
264
|
+
version: '1.0.15',
|
|
265
|
+
name: 'An automatically generated config. Adjust values and add layout components if needed.',
|
|
266
|
+
description: 'Populate with text relevant to this visualisation.',
|
|
267
|
+
datasets: [
|
|
268
|
+
{
|
|
269
|
+
uid: 'A',
|
|
270
|
+
name: expectedName,
|
|
271
|
+
files: [
|
|
272
|
+
{
|
|
273
|
+
url: urls[0],
|
|
274
|
+
fileType: 'anndata.zarr',
|
|
275
|
+
coordinationValues: {
|
|
276
|
+
obsType: 'cell',
|
|
277
|
+
featureType: 'gene',
|
|
278
|
+
featureValueType: 'expression',
|
|
279
|
+
},
|
|
280
|
+
options: {
|
|
281
|
+
obsEmbedding: [],
|
|
282
|
+
obsFeatureMatrix: {
|
|
283
|
+
path: 'X',
|
|
284
|
+
},
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
coordinationSpace: {
|
|
291
|
+
dataset: {
|
|
292
|
+
A: 'A',
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
layout: [],
|
|
296
|
+
initStrategy: 'auto',
|
|
297
|
+
};
|
|
298
|
+
const config = await generateConfigs(urls);
|
|
299
|
+
expect(config).toEqual(expectedConfig);
|
|
300
|
+
});
|
|
301
|
+
it('raises an error for Anndata-ZARR file with misconfigured .zmetadata', async () => {
|
|
302
|
+
const urls = ['http://localhost:51204/@fixtures/zarr/partials/invalidmeta.adata.zarr'];
|
|
303
|
+
await generateConfigs(urls).catch(e => expect(e.message).toContain('Could not generate config: .zmetadata file is not valid.'));
|
|
304
|
+
});
|
|
305
|
+
it('generates config for multiple files correctly', async () => {
|
|
306
|
+
const urls = ['somefile.ome.tif', 'anoterfile.ome.zarr'];
|
|
307
|
+
const expectedNames = [urls[0].split('/').at(-1), urls[1].split('/').at(-1)];
|
|
308
|
+
const expectedConfig = {
|
|
309
|
+
version: '1.0.15',
|
|
310
|
+
name: 'An automatically generated config. Adjust values and add layout components if needed.',
|
|
311
|
+
description: 'Populate with text relevant to this visualisation.',
|
|
312
|
+
datasets: [
|
|
313
|
+
{
|
|
314
|
+
uid: 'A',
|
|
315
|
+
name: expectedNames[0],
|
|
316
|
+
files: [
|
|
317
|
+
{
|
|
318
|
+
fileType: 'raster.json',
|
|
319
|
+
options: {
|
|
320
|
+
images: [
|
|
321
|
+
{
|
|
322
|
+
metadata: {
|
|
323
|
+
isBitmask: false,
|
|
324
|
+
},
|
|
325
|
+
name: expectedNames[0],
|
|
326
|
+
type: 'ome-tiff',
|
|
327
|
+
url: urls[0],
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
schemaVersion: '0.0.2',
|
|
331
|
+
usePhysicalSizeScaling: false,
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
],
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
uid: 'B',
|
|
338
|
+
name: expectedNames[1],
|
|
339
|
+
files: [
|
|
340
|
+
{
|
|
341
|
+
url: urls[1],
|
|
342
|
+
fileType: 'raster.ome-zarr',
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
coordinationSpace: {
|
|
348
|
+
dataset: {
|
|
349
|
+
A: 'A',
|
|
350
|
+
B: 'B',
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
layout: [
|
|
354
|
+
{
|
|
355
|
+
component: 'description',
|
|
356
|
+
coordinationScopes: {
|
|
357
|
+
dataset: 'A',
|
|
358
|
+
},
|
|
359
|
+
x: 0,
|
|
360
|
+
y: 0,
|
|
361
|
+
w: 4,
|
|
362
|
+
h: 4,
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
component: 'spatial',
|
|
366
|
+
coordinationScopes: {
|
|
367
|
+
dataset: 'A',
|
|
368
|
+
},
|
|
369
|
+
x: 4,
|
|
370
|
+
y: 0,
|
|
371
|
+
w: 4,
|
|
372
|
+
h: 4,
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
component: 'layerController',
|
|
376
|
+
coordinationScopes: {
|
|
377
|
+
dataset: 'A',
|
|
378
|
+
},
|
|
379
|
+
x: 8,
|
|
380
|
+
y: 0,
|
|
381
|
+
w: 4,
|
|
382
|
+
h: 4,
|
|
383
|
+
props: {
|
|
384
|
+
disable3d: [],
|
|
385
|
+
disableChannelsIfRgbDetected: true,
|
|
386
|
+
},
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
component: 'description',
|
|
390
|
+
coordinationScopes: {
|
|
391
|
+
dataset: 'B',
|
|
392
|
+
},
|
|
393
|
+
x: 0,
|
|
394
|
+
y: 4,
|
|
395
|
+
w: 4,
|
|
396
|
+
h: 4,
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
component: 'spatial',
|
|
400
|
+
coordinationScopes: {
|
|
401
|
+
dataset: 'B',
|
|
402
|
+
},
|
|
403
|
+
x: 4,
|
|
404
|
+
y: 4,
|
|
405
|
+
w: 4,
|
|
406
|
+
h: 4,
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
component: 'layerController',
|
|
410
|
+
coordinationScopes: {
|
|
411
|
+
dataset: 'B',
|
|
412
|
+
},
|
|
413
|
+
x: 8,
|
|
414
|
+
y: 4,
|
|
415
|
+
w: 4,
|
|
416
|
+
h: 4,
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
component: 'status',
|
|
420
|
+
coordinationScopes: {
|
|
421
|
+
dataset: 'B',
|
|
422
|
+
},
|
|
423
|
+
x: 0,
|
|
424
|
+
y: 8,
|
|
425
|
+
w: 4,
|
|
426
|
+
h: 4,
|
|
427
|
+
},
|
|
428
|
+
],
|
|
429
|
+
initStrategy: 'auto',
|
|
430
|
+
};
|
|
431
|
+
const config = await generateConfigs(urls);
|
|
432
|
+
expect(config).toEqual(expectedConfig);
|
|
433
|
+
});
|
|
434
|
+
it('raises an Error when .zmetadata file not present in folder', async () => {
|
|
435
|
+
const urls = ['http://localhost:51204/@fixtures/zarr/partials/invalid.adata.zarr'];
|
|
436
|
+
await generateConfigs(urls).catch(e => expect(e.message).toContain('Could not generate config. File .zmetadata not found in supplied file URL'));
|
|
437
|
+
});
|
|
438
|
+
it('raises an error when URL with unsupported file format is passed', async () => {
|
|
439
|
+
const urls = ['http://localhost:51204/@fixtures/zarr/anndata-0.7/somefile.zarr'];
|
|
440
|
+
await generateConfigs(urls).catch(e => expect(e.message).toContain('This file type is not supported.'));
|
|
441
|
+
});
|
|
442
|
+
});
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A helper function to create a horizontal concatenation of views.
|
|
3
|
+
* @param {...(VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat)} views A
|
|
4
|
+
* variable number of views or view concatenations.
|
|
5
|
+
* @returns {VitessceConfigViewHConcat} A new horizontal view concatenation instance.
|
|
6
|
+
*/
|
|
7
|
+
export function hconcat(...views: (VitessceConfigView | VitessceConfigViewHConcat | VitessceConfigViewVConcat)[]): VitessceConfigViewHConcat;
|
|
8
|
+
/**
|
|
9
|
+
* A helper function to create a vertical concatenation of views.
|
|
10
|
+
* @param {...(VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat)} views A
|
|
11
|
+
* variable number of views or view concatenations.
|
|
12
|
+
* @returns {VitessceConfigViewVConcat} A new vertical view concatenation instance.
|
|
13
|
+
*/
|
|
14
|
+
export function vconcat(...views: (VitessceConfigView | VitessceConfigViewHConcat | VitessceConfigViewVConcat)[]): VitessceConfigViewVConcat;
|
|
15
|
+
/**
|
|
16
|
+
* Class representing a file within a Vitessce config dataset.
|
|
17
|
+
*/
|
|
18
|
+
export class VitessceConfigDatasetFile {
|
|
19
|
+
/**
|
|
20
|
+
* Construct a new file definition instance.
|
|
21
|
+
* @param {string} url The URL to the file.
|
|
22
|
+
* @param {string} dataType The type of data contained in the file.
|
|
23
|
+
* @param {string} fileType The file type.
|
|
24
|
+
* @param {object|array|null} options An optional object or array
|
|
25
|
+
* which may provide additional parameters to the loader class
|
|
26
|
+
* corresponding to the specified fileType.
|
|
27
|
+
*/
|
|
28
|
+
constructor(url: string, fileType: string, coordinationValues: any, options: object | array | null);
|
|
29
|
+
file: {
|
|
30
|
+
options?: any;
|
|
31
|
+
coordinationValues?: any;
|
|
32
|
+
url: string;
|
|
33
|
+
fileType: string;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @returns {object} This dataset file as a JSON object.
|
|
37
|
+
*/
|
|
38
|
+
toJSON(): object;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Class representing a dataset within a Vitessce config.
|
|
42
|
+
*/
|
|
43
|
+
export class VitessceConfigDataset {
|
|
44
|
+
/**
|
|
45
|
+
* Construct a new dataset definition instance.
|
|
46
|
+
* @param {string} uid The unique ID for the dataset.
|
|
47
|
+
* @param {string} name The name of the dataset.
|
|
48
|
+
* @param {string} description A description for the dataset.
|
|
49
|
+
*/
|
|
50
|
+
constructor(uid: string, name: string, description: string);
|
|
51
|
+
dataset: {
|
|
52
|
+
uid: string;
|
|
53
|
+
name: string;
|
|
54
|
+
description: string;
|
|
55
|
+
files: never[];
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* Add a file definition to the dataset.
|
|
59
|
+
* @param {object} params An object with named arguments.
|
|
60
|
+
* @param {string|undefined} params.url The URL to the file.
|
|
61
|
+
* @param {string} params.fileType The file type.
|
|
62
|
+
* @param {object|undefined} params.coordinationValues The coordination values.
|
|
63
|
+
* @param {object|array|undefined} params.options An optional object or array
|
|
64
|
+
* which may provide additional parameters to the loader class
|
|
65
|
+
* corresponding to the specified fileType.
|
|
66
|
+
* @returns {VitessceConfigDataset} This, to allow chaining.
|
|
67
|
+
*/
|
|
68
|
+
addFile(params: {
|
|
69
|
+
url: string | undefined;
|
|
70
|
+
fileType: string;
|
|
71
|
+
coordinationValues: object | undefined;
|
|
72
|
+
options: object | array | undefined;
|
|
73
|
+
}, ...args: any[]): VitessceConfigDataset;
|
|
74
|
+
/**
|
|
75
|
+
* @returns {object} This dataset as a JSON object.
|
|
76
|
+
*/
|
|
77
|
+
toJSON(): object;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Class representing a view within a Vitessce layout.
|
|
81
|
+
*/
|
|
82
|
+
export class VitessceConfigView {
|
|
83
|
+
/**
|
|
84
|
+
* Construct a new view instance.
|
|
85
|
+
* @param {string} component The name of the Vitessce component type.
|
|
86
|
+
* @param {object} coordinationScopes A mapping from coordination type
|
|
87
|
+
* names to coordination scope names.
|
|
88
|
+
* @param {number} x The x-coordinate of the view in the layout.
|
|
89
|
+
* @param {number} y The y-coordinate of the view in the layout.
|
|
90
|
+
* @param {number} w The width of the view in the layout.
|
|
91
|
+
* @param {number} h The height of the view in the layout.
|
|
92
|
+
*/
|
|
93
|
+
constructor(component: string, coordinationScopes: object, x: number, y: number, w: number, h: number);
|
|
94
|
+
view: {
|
|
95
|
+
component: string;
|
|
96
|
+
coordinationScopes: object;
|
|
97
|
+
x: number;
|
|
98
|
+
y: number;
|
|
99
|
+
w: number;
|
|
100
|
+
h: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Attach coordination scopes to this view.
|
|
104
|
+
* @param {...VitessceConfigCoordinationScope} args A variable number of
|
|
105
|
+
* coordination scope instances.
|
|
106
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
107
|
+
*/
|
|
108
|
+
useCoordination(...args: VitessceConfigCoordinationScope[]): VitessceConfigView;
|
|
109
|
+
/**
|
|
110
|
+
* Set the x, y, w, h values for this view.
|
|
111
|
+
* @param {number} x The x-coordinate of the view in the layout.
|
|
112
|
+
* @param {number} y The y-coordinate of the view in the layout.
|
|
113
|
+
* @param {number} w The width of the view in the layout.
|
|
114
|
+
* @param {number} h The height of the view in the layout.
|
|
115
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
116
|
+
*/
|
|
117
|
+
setXYWH(x: number, y: number, w: number, h: number): VitessceConfigView;
|
|
118
|
+
/**
|
|
119
|
+
* Set props for this view.
|
|
120
|
+
* @returns {VitessceConfigView} This, to allow chaining.
|
|
121
|
+
*/
|
|
122
|
+
setProps(props: any): VitessceConfigView;
|
|
123
|
+
/**
|
|
124
|
+
* @returns {object} This view as a JSON object.
|
|
125
|
+
*/
|
|
126
|
+
toJSON(): object;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Class representing a horizontal concatenation of views.
|
|
130
|
+
*/
|
|
131
|
+
export class VitessceConfigViewHConcat {
|
|
132
|
+
constructor(views: any);
|
|
133
|
+
views: any;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Class representing a vertical concatenation of views.
|
|
137
|
+
*/
|
|
138
|
+
export class VitessceConfigViewVConcat {
|
|
139
|
+
constructor(views: any);
|
|
140
|
+
views: any;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Class representing a coordination scope in the coordination space.
|
|
144
|
+
*/
|
|
145
|
+
export class VitessceConfigCoordinationScope {
|
|
146
|
+
/**
|
|
147
|
+
* Construct a new coordination scope instance.
|
|
148
|
+
* @param {string} cType The coordination type for this coordination scope.
|
|
149
|
+
* @param {string} cScope The name of the coordination scope.
|
|
150
|
+
*/
|
|
151
|
+
constructor(cType: string, cScope: string);
|
|
152
|
+
cType: string;
|
|
153
|
+
cScope: string;
|
|
154
|
+
cValue: any;
|
|
155
|
+
/**
|
|
156
|
+
* Set the coordination value of the coordination scope.
|
|
157
|
+
* @param {any} cValue The value to set.
|
|
158
|
+
* @returns {VitessceConfigCoordinationScope} This, to allow chaining.
|
|
159
|
+
*/
|
|
160
|
+
setValue(cValue: any): VitessceConfigCoordinationScope;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Class representing a Vitessce view config.
|
|
164
|
+
*/
|
|
165
|
+
export class VitessceConfig {
|
|
166
|
+
/**
|
|
167
|
+
* Create a VitessceConfig instance from an existing view config, to enable
|
|
168
|
+
* manipulation with the JavaScript API.
|
|
169
|
+
* @param {object} config An existing Vitessce view config as a JSON object.
|
|
170
|
+
* @returns {VitessceConfig} A new config instance, with values set to match
|
|
171
|
+
* the config parameter.
|
|
172
|
+
*/
|
|
173
|
+
static fromJSON(config: object): VitessceConfig;
|
|
174
|
+
/**
|
|
175
|
+
* Construct a new view config instance.
|
|
176
|
+
* @param {object} params An object with named arguments.
|
|
177
|
+
* @param {string} params.schemaVersion The view config schema version. Required.
|
|
178
|
+
* @param {string} params.name A name for the config. Optional.
|
|
179
|
+
* @param {string|undefined} params.description A description for the config. Optional.
|
|
180
|
+
*/
|
|
181
|
+
constructor(params: {
|
|
182
|
+
schemaVersion: string;
|
|
183
|
+
name: string;
|
|
184
|
+
description: string | undefined;
|
|
185
|
+
}, ...args: any[]);
|
|
186
|
+
config: {
|
|
187
|
+
version: string;
|
|
188
|
+
name: string;
|
|
189
|
+
description: any;
|
|
190
|
+
datasets: never[];
|
|
191
|
+
coordinationSpace: {};
|
|
192
|
+
layout: never[];
|
|
193
|
+
initStrategy: string;
|
|
194
|
+
};
|
|
195
|
+
/**
|
|
196
|
+
* Add a new dataset to the config.
|
|
197
|
+
* @param {string} name A name for the dataset. Optional.
|
|
198
|
+
* @param {string} description A description for the dataset. Optional.
|
|
199
|
+
* @param {object} options Extra parameters to be used internally. Optional.
|
|
200
|
+
* @param {string} options.uid Override the automatically-generated dataset ID.
|
|
201
|
+
* Intended for internal usage by the VitessceConfig.fromJSON code.
|
|
202
|
+
* @returns {VitessceConfigDataset} A new dataset instance.
|
|
203
|
+
*/
|
|
204
|
+
addDataset(name?: string, description?: string, options?: {
|
|
205
|
+
uid: string;
|
|
206
|
+
}): VitessceConfigDataset;
|
|
207
|
+
/**
|
|
208
|
+
* Add a new view to the config.
|
|
209
|
+
* @param {VitessceConfigDataset} dataset The dataset instance which defines the data
|
|
210
|
+
* that will be displayed in the view.
|
|
211
|
+
* @param {string} component A component name, such as "scatterplot" or "spatial".
|
|
212
|
+
* @param {object} options Extra options for the component.
|
|
213
|
+
* @param {number} options.x The x-coordinate for the view in the grid layout.
|
|
214
|
+
* @param {number} options.y The y-coordinate for the view in the grid layout.
|
|
215
|
+
* @param {number} options.w The width for the view in the grid layout.
|
|
216
|
+
* @param {number} options.h The height for the view in the grid layout.
|
|
217
|
+
* @param {number} options.mapping A convenience parameter for setting the EMBEDDING_TYPE
|
|
218
|
+
* coordination value. Only applicable if the component is "scatterplot".
|
|
219
|
+
* @returns {VitessceConfigView} A new view instance.
|
|
220
|
+
*/
|
|
221
|
+
addView(dataset: VitessceConfigDataset, component: string, options: {
|
|
222
|
+
x: number;
|
|
223
|
+
y: number;
|
|
224
|
+
w: number;
|
|
225
|
+
h: number;
|
|
226
|
+
mapping: number;
|
|
227
|
+
}): VitessceConfigView;
|
|
228
|
+
/**
|
|
229
|
+
* Get an array of new coordination scope instances corresponding to coordination types
|
|
230
|
+
* of interest.
|
|
231
|
+
* @param {...string} args A variable number of coordination type names.
|
|
232
|
+
* @returns {VitessceConfigCoordinationScope[]} An array of coordination scope instances.
|
|
233
|
+
*/
|
|
234
|
+
addCoordination(...args: string[]): VitessceConfigCoordinationScope[];
|
|
235
|
+
/**
|
|
236
|
+
* A convenience function for setting up new coordination scopes across a set of views.
|
|
237
|
+
* @param {VitessceConfigView[]} views An array of view objects to link together.
|
|
238
|
+
* @param {string[]} cTypes The coordination types on which to coordinate the views.
|
|
239
|
+
* @param {any[]} cValues Initial values corresponding to each coordination type.
|
|
240
|
+
* Should have the same length as the cTypes array. Optional.
|
|
241
|
+
* @returns {VitessceConfig} This, to allow chaining.
|
|
242
|
+
*/
|
|
243
|
+
linkViews(views: VitessceConfigView[], cTypes: string[], cValues?: any[]): VitessceConfig;
|
|
244
|
+
/**
|
|
245
|
+
* Set the layout of views.
|
|
246
|
+
* @param {VitessceConfigView|VitessceConfigViewHConcat|VitessceConfigViewVConcat} viewConcat A
|
|
247
|
+
* view or a concatenation of views.
|
|
248
|
+
* @returns {VitessceConfig} This, to allow chaining.
|
|
249
|
+
*/
|
|
250
|
+
layout(viewConcat: VitessceConfigView | VitessceConfigViewHConcat | VitessceConfigViewVConcat): VitessceConfig;
|
|
251
|
+
/**
|
|
252
|
+
* Convert this instance to a JSON object that can be passed to the Vitessce component.
|
|
253
|
+
* @returns {object} The view config as a JSON object.
|
|
254
|
+
*/
|
|
255
|
+
toJSON(): object;
|
|
256
|
+
}
|
|
257
|
+
//# sourceMappingURL=VitessceConfig.d.ts.map
|