@vitessce/all 2.0.3 → 3.0.1
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/{deflate.8ace1ac4.mjs → deflate-475a23c9.js} +2 -2
- package/dist/hglib-76c1b0ad.js +138925 -0
- package/dist/{index.7dac8670.mjs → index-f48f3f08.js} +66958 -52713
- package/dist/index.js +12 -0
- package/dist/{jpeg.c8011e3a.mjs → jpeg-7f0b1b2c.js} +1 -1
- package/dist/{lerc.ccda5eb2.mjs → lerc-f7557585.js} +76 -5
- package/dist/{lzw.39876143.mjs → lzw-4d26ee71.js} +1 -1
- package/dist/{packbits.9e95d117.mjs → packbits-08efb7ce.js} +1 -1
- package/dist/{pako.esm.4b234125.mjs → pako.esm-68f84e2a.js} +97 -15
- package/dist/{raw.0279d74b.mjs → raw-3c2d82ff.js} +1 -1
- package/dist/{webimage.5ac7ce95.mjs → webimage-a7dde8d2.js} +1 -1
- package/dist-tsc/Vitessce.d.ts +2 -0
- package/dist-tsc/Vitessce.d.ts.map +1 -0
- package/dist-tsc/Vitessce.js +45 -0
- package/dist-tsc/base-plugins.d.ts +854 -0
- package/dist-tsc/base-plugins.d.ts.map +1 -0
- package/dist-tsc/base-plugins.js +191 -0
- package/dist-tsc/index.d.ts +4 -0
- package/dist-tsc/index.d.ts.map +1 -0
- package/dist-tsc/index.js +3 -2
- package/dist-tsc/joint-file-types-legacy.d.ts +226 -0
- package/dist-tsc/joint-file-types-legacy.d.ts.map +1 -0
- package/dist-tsc/joint-file-types-legacy.js +266 -0
- package/dist-tsc/joint-file-types-legacy.test.d.ts +2 -0
- package/dist-tsc/joint-file-types-legacy.test.d.ts.map +1 -0
- package/dist-tsc/joint-file-types-legacy.test.js +401 -0
- package/dist-tsc/joint-file-types.d.ts +4 -0
- package/dist-tsc/joint-file-types.d.ts.map +1 -0
- package/dist-tsc/joint-file-types.js +127 -0
- package/dist-tsc/joint-file-types.test.d.ts +2 -0
- package/dist-tsc/joint-file-types.test.d.ts.map +1 -0
- package/dist-tsc/joint-file-types.test.js +128 -0
- package/dist-tsc/latest-config-schema.test.d.ts +2 -0
- package/dist-tsc/latest-config-schema.test.d.ts.map +1 -0
- package/dist-tsc/latest-config-schema.test.js +19 -0
- package/package.json +37 -21
- package/src/Vitessce.tsx +79 -0
- package/src/base-plugins.ts +362 -0
- package/src/index.ts +8 -0
- package/src/joint-file-types-legacy.test.ts +413 -0
- package/src/joint-file-types-legacy.ts +284 -0
- package/src/joint-file-types.test.ts +132 -0
- package/src/joint-file-types.ts +142 -0
- package/src/latest-config-schema.test.ts +26 -0
- package/src/missing-types.d.ts +1 -0
- package/dist/hglib.1f1ea875.mjs +0 -130303
- package/dist/index.mjs +0 -11
- package/src/index.js +0 -7
- package/src/setup.js +0 -143
@@ -0,0 +1,132 @@
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
2
|
+
import {
|
3
|
+
expandAnndataZarr,
|
4
|
+
} from './joint-file-types.js';
|
5
|
+
|
6
|
+
|
7
|
+
describe('src/app/joint-file-types.js', () => {
|
8
|
+
describe('expandAnndataZarr', () => {
|
9
|
+
it('fails to expand when there are no options', () => {
|
10
|
+
expect(expandAnndataZarr({
|
11
|
+
fileType: 'anndata.zarr',
|
12
|
+
url: 'http://localhost:8000/anndata.zarr',
|
13
|
+
})).toEqual([]);
|
14
|
+
});
|
15
|
+
it('expands when there is an obsEmbedding object', () => {
|
16
|
+
expect(expandAnndataZarr({
|
17
|
+
fileType: 'anndata.zarr',
|
18
|
+
url: 'http://localhost:8000/anndata.zarr',
|
19
|
+
options: {
|
20
|
+
obsLabels: {
|
21
|
+
path: 'obs/spot_name',
|
22
|
+
},
|
23
|
+
featureLabels: {
|
24
|
+
path: 'var/gene_symbol',
|
25
|
+
},
|
26
|
+
obsEmbedding: {
|
27
|
+
path: 'obsm/pca',
|
28
|
+
dims: [2, 4],
|
29
|
+
},
|
30
|
+
},
|
31
|
+
coordinationValues: {
|
32
|
+
obsType: 'spot',
|
33
|
+
featureType: 'transcript',
|
34
|
+
obsLabelsType: 'spotName',
|
35
|
+
featureLabelsType: 'geneSymbol',
|
36
|
+
embeddingType: 'PCA',
|
37
|
+
},
|
38
|
+
})).toEqual([
|
39
|
+
{
|
40
|
+
fileType: 'obsEmbedding.anndata.zarr',
|
41
|
+
url: 'http://localhost:8000/anndata.zarr',
|
42
|
+
options: {
|
43
|
+
path: 'obsm/pca',
|
44
|
+
dims: [2, 4],
|
45
|
+
},
|
46
|
+
coordinationValues: {
|
47
|
+
obsType: 'spot',
|
48
|
+
embeddingType: 'PCA',
|
49
|
+
},
|
50
|
+
},
|
51
|
+
{
|
52
|
+
fileType: 'obsLabels.anndata.zarr',
|
53
|
+
url: 'http://localhost:8000/anndata.zarr',
|
54
|
+
options: {
|
55
|
+
path: 'obs/spot_name',
|
56
|
+
},
|
57
|
+
coordinationValues: {
|
58
|
+
obsType: 'spot',
|
59
|
+
obsLabelsType: 'spotName',
|
60
|
+
},
|
61
|
+
},
|
62
|
+
{
|
63
|
+
fileType: 'featureLabels.anndata.zarr',
|
64
|
+
url: 'http://localhost:8000/anndata.zarr',
|
65
|
+
options: {
|
66
|
+
path: 'var/gene_symbol',
|
67
|
+
},
|
68
|
+
coordinationValues: {
|
69
|
+
featureType: 'transcript',
|
70
|
+
featureLabelsType: 'geneSymbol',
|
71
|
+
},
|
72
|
+
},
|
73
|
+
]);
|
74
|
+
});
|
75
|
+
it('expands when there is an obsEmbedding array of objects', () => {
|
76
|
+
expect(expandAnndataZarr({
|
77
|
+
fileType: 'anndata.zarr',
|
78
|
+
url: 'http://localhost:8000/anndata.zarr',
|
79
|
+
options: {
|
80
|
+
obsLocations: {
|
81
|
+
path: 'obsm/xy',
|
82
|
+
},
|
83
|
+
obsEmbedding: [
|
84
|
+
{
|
85
|
+
path: 'obsm/pca',
|
86
|
+
dims: [2, 4],
|
87
|
+
embeddingType: 'PCA',
|
88
|
+
},
|
89
|
+
{
|
90
|
+
path: 'obsm/umap',
|
91
|
+
embeddingType: 'UMAP',
|
92
|
+
},
|
93
|
+
],
|
94
|
+
},
|
95
|
+
})).toEqual([
|
96
|
+
{
|
97
|
+
fileType: 'obsLocations.anndata.zarr',
|
98
|
+
url: 'http://localhost:8000/anndata.zarr',
|
99
|
+
options: {
|
100
|
+
path: 'obsm/xy',
|
101
|
+
},
|
102
|
+
coordinationValues: {
|
103
|
+
obsType: 'cell',
|
104
|
+
},
|
105
|
+
},
|
106
|
+
{
|
107
|
+
fileType: 'obsEmbedding.anndata.zarr',
|
108
|
+
url: 'http://localhost:8000/anndata.zarr',
|
109
|
+
options: {
|
110
|
+
path: 'obsm/pca',
|
111
|
+
dims: [2, 4],
|
112
|
+
},
|
113
|
+
coordinationValues: {
|
114
|
+
obsType: 'cell',
|
115
|
+
embeddingType: 'PCA',
|
116
|
+
},
|
117
|
+
},
|
118
|
+
{
|
119
|
+
fileType: 'obsEmbedding.anndata.zarr',
|
120
|
+
url: 'http://localhost:8000/anndata.zarr',
|
121
|
+
options: {
|
122
|
+
path: 'obsm/umap',
|
123
|
+
},
|
124
|
+
coordinationValues: {
|
125
|
+
obsType: 'cell',
|
126
|
+
embeddingType: 'UMAP',
|
127
|
+
},
|
128
|
+
},
|
129
|
+
]);
|
130
|
+
});
|
131
|
+
});
|
132
|
+
});
|
@@ -0,0 +1,142 @@
|
|
1
|
+
import type { z } from 'zod';
|
2
|
+
import type { latestFileDefSchema } from '@vitessce/schemas';
|
3
|
+
import { FileType } from '@vitessce/constants-internal';
|
4
|
+
|
5
|
+
type BaseFileDef = {
|
6
|
+
url?: string;
|
7
|
+
requestInit?: any;
|
8
|
+
coordinationValues: Record<string, string>;
|
9
|
+
};
|
10
|
+
|
11
|
+
export function expandAnndataZarr(fileDef: z.infer<typeof latestFileDefSchema>) {
|
12
|
+
const baseFileDef: BaseFileDef = {
|
13
|
+
url: fileDef.url,
|
14
|
+
requestInit: fileDef.requestInit,
|
15
|
+
coordinationValues: {
|
16
|
+
...fileDef.coordinationValues,
|
17
|
+
obsType: fileDef.coordinationValues?.obsType || 'cell',
|
18
|
+
featureType: fileDef.coordinationValues?.featureType || 'gene',
|
19
|
+
featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
|
20
|
+
},
|
21
|
+
};
|
22
|
+
const { options = {} } = fileDef;
|
23
|
+
return [
|
24
|
+
// obsFeatureMatrix
|
25
|
+
...(options.obsFeatureMatrix ? [{
|
26
|
+
...baseFileDef,
|
27
|
+
fileType: FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR,
|
28
|
+
options: options.obsFeatureMatrix,
|
29
|
+
coordinationValues: {
|
30
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
31
|
+
featureType: baseFileDef.coordinationValues.featureType,
|
32
|
+
featureValueType: baseFileDef.coordinationValues.featureValueType,
|
33
|
+
},
|
34
|
+
}] : []),
|
35
|
+
// obsSets
|
36
|
+
...(options.obsSets ? [{
|
37
|
+
...baseFileDef,
|
38
|
+
fileType: FileType.OBS_SETS_ANNDATA_ZARR,
|
39
|
+
options: options.obsSets,
|
40
|
+
coordinationValues: {
|
41
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
42
|
+
},
|
43
|
+
}] : []),
|
44
|
+
// obsLocations
|
45
|
+
...(options.obsLocations ? [{
|
46
|
+
...baseFileDef,
|
47
|
+
fileType: FileType.OBS_LOCATIONS_ANNDATA_ZARR,
|
48
|
+
options: options.obsLocations,
|
49
|
+
coordinationValues: {
|
50
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
51
|
+
},
|
52
|
+
}] : []),
|
53
|
+
// obsSegmentations
|
54
|
+
...(options.obsSegmentations ? [{
|
55
|
+
...baseFileDef,
|
56
|
+
fileType: FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR,
|
57
|
+
options: options.obsSegmentations,
|
58
|
+
coordinationValues: {
|
59
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
60
|
+
},
|
61
|
+
}] : []),
|
62
|
+
// obsEmbedding
|
63
|
+
// eslint-disable-next-line no-nested-ternary
|
64
|
+
...(options.obsEmbedding ? (
|
65
|
+
Array.isArray(options.obsEmbedding) ? options.obsEmbedding.map((oe: any) => ({
|
66
|
+
// obsEmbedding was an array, process each element.
|
67
|
+
...baseFileDef,
|
68
|
+
fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
|
69
|
+
options: {
|
70
|
+
path: oe.path,
|
71
|
+
dims: oe.dims,
|
72
|
+
},
|
73
|
+
coordinationValues: {
|
74
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
75
|
+
// Move embedding type property out of options and into coordinationValues.
|
76
|
+
embeddingType: oe.embeddingType,
|
77
|
+
},
|
78
|
+
})) : [{
|
79
|
+
// obsEmbedding was an object.
|
80
|
+
...baseFileDef,
|
81
|
+
fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
|
82
|
+
options: options.obsEmbedding,
|
83
|
+
coordinationValues: {
|
84
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
85
|
+
embeddingType: baseFileDef.coordinationValues.embeddingType,
|
86
|
+
},
|
87
|
+
}]
|
88
|
+
) : []),
|
89
|
+
// obsLabels
|
90
|
+
// eslint-disable-next-line no-nested-ternary
|
91
|
+
...(options.obsLabels ? (
|
92
|
+
Array.isArray(options.obsLabels) ? options.obsLabels.map((ol: any) => ({
|
93
|
+
// obsLabels was an array, process each element.
|
94
|
+
...baseFileDef,
|
95
|
+
fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
|
96
|
+
options: {
|
97
|
+
path: ol.path,
|
98
|
+
},
|
99
|
+
coordinationValues: {
|
100
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
101
|
+
// Move obsLabels type property out of options and into coordinationValues.
|
102
|
+
obsLabelsType: ol.obsLabelsType,
|
103
|
+
},
|
104
|
+
})) : [{
|
105
|
+
// obsLabels was an object.
|
106
|
+
...baseFileDef,
|
107
|
+
fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
|
108
|
+
options: options.obsLabels,
|
109
|
+
coordinationValues: {
|
110
|
+
obsType: baseFileDef.coordinationValues.obsType,
|
111
|
+
obsLabelsType: baseFileDef.coordinationValues.obsLabelsType,
|
112
|
+
},
|
113
|
+
}]
|
114
|
+
) : []),
|
115
|
+
// featureLabels
|
116
|
+
// eslint-disable-next-line no-nested-ternary
|
117
|
+
...(options.featureLabels ? (
|
118
|
+
Array.isArray(options.featureLabels) ? options.featureLabels.map((fl: any) => ({
|
119
|
+
// featureLabels was an array, process each element.
|
120
|
+
...baseFileDef,
|
121
|
+
fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
|
122
|
+
options: {
|
123
|
+
path: fl.path,
|
124
|
+
},
|
125
|
+
coordinationValues: {
|
126
|
+
featureType: baseFileDef.coordinationValues.featureType,
|
127
|
+
// Move featureLabels type property out of options and into coordinationValues.
|
128
|
+
featureLabelsType: fl.featureLabelsType,
|
129
|
+
},
|
130
|
+
})) : [{
|
131
|
+
// featureLabels was an object.
|
132
|
+
...baseFileDef,
|
133
|
+
fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
|
134
|
+
options: options.featureLabels,
|
135
|
+
coordinationValues: {
|
136
|
+
featureType: baseFileDef.coordinationValues.featureType,
|
137
|
+
featureLabelsType: baseFileDef.coordinationValues.featureLabelsType,
|
138
|
+
},
|
139
|
+
}]
|
140
|
+
) : []),
|
141
|
+
];
|
142
|
+
}
|
@@ -0,0 +1,26 @@
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
2
|
+
|
3
|
+
import { CoordinationType } from '@vitessce/constants-internal';
|
4
|
+
import {
|
5
|
+
baseCoordinationTypes,
|
6
|
+
} from './base-plugins.js';
|
7
|
+
|
8
|
+
describe('view config schema', () => {
|
9
|
+
describe('coordination types', () => {
|
10
|
+
it('defines schema for all valid coordination types', () => {
|
11
|
+
const coordinationTypeNamesFromConstants = Object.values(CoordinationType).sort();
|
12
|
+
const coordinationTypeNamesFromBasePlugins = baseCoordinationTypes.map(ct => ct.name).sort();
|
13
|
+
|
14
|
+
expect(coordinationTypeNamesFromConstants)
|
15
|
+
.toEqual(expect.arrayContaining(coordinationTypeNamesFromBasePlugins));
|
16
|
+
});
|
17
|
+
|
18
|
+
it('defines schema for only valid coordination types (does not have extra)', () => {
|
19
|
+
const coordinationTypeNamesFromConstants = Object.values(CoordinationType).sort();
|
20
|
+
const coordinationTypeNamesFromBasePlugins = baseCoordinationTypes.map(ct => ct.name).sort();
|
21
|
+
|
22
|
+
expect(coordinationTypeNamesFromBasePlugins)
|
23
|
+
.toEqual(expect.arrayContaining(coordinationTypeNamesFromConstants));
|
24
|
+
});
|
25
|
+
});
|
26
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
declare module '@vitessce/vit-s';
|