@vitessce/schemas 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/LICENSE +21 -0
- package/README.md +19 -0
- package/dist/index.js +16360 -0
- package/dist-tsc/file-def-options-legacy.d.ts +72 -0
- package/dist-tsc/file-def-options-legacy.d.ts.map +1 -0
- package/dist-tsc/file-def-options-legacy.js +28 -0
- package/dist-tsc/file-def-options.d.ts +417 -0
- package/dist-tsc/file-def-options.d.ts.map +1 -0
- package/dist-tsc/file-def-options.js +139 -0
- package/dist-tsc/index.d.ts +11 -0
- package/dist-tsc/index.d.ts.map +1 -0
- package/dist-tsc/index.js +10 -0
- package/dist-tsc/previous-config-meta.d.ts +251 -0
- package/dist-tsc/previous-config-meta.d.ts.map +1 -0
- package/dist-tsc/previous-config-meta.js +22 -0
- package/dist-tsc/previous-config-schemas.d.ts +4053 -0
- package/dist-tsc/previous-config-schemas.d.ts.map +1 -0
- package/dist-tsc/previous-config-schemas.js +204 -0
- package/dist-tsc/previous-config-upgraders.d.ts +25 -0
- package/dist-tsc/previous-config-upgraders.d.ts.map +1 -0
- package/dist-tsc/previous-config-upgraders.js +589 -0
- package/dist-tsc/raster-json.d.ts +274 -0
- package/dist-tsc/raster-json.d.ts.map +1 -0
- package/dist-tsc/raster-json.js +36 -0
- package/dist-tsc/schema-builders.d.ts +465 -0
- package/dist-tsc/schema-builders.d.ts.map +1 -0
- package/dist-tsc/schema-builders.js +127 -0
- package/dist-tsc/shared.d.ts +145 -0
- package/dist-tsc/shared.d.ts.map +1 -0
- package/dist-tsc/shared.js +100 -0
- package/dist-tsc/spatial-layers.d.ts +112 -0
- package/dist-tsc/spatial-layers.d.ts.map +1 -0
- package/dist-tsc/spatial-layers.js +81 -0
- package/dist-tsc/view-config-utils.test.d.ts +2 -0
- package/dist-tsc/view-config-utils.test.d.ts.map +1 -0
- package/dist-tsc/view-config-utils.test.fixtures.d.ts +495 -0
- package/dist-tsc/view-config-utils.test.fixtures.d.ts.map +1 -0
- package/dist-tsc/view-config-utils.test.fixtures.js +881 -0
- package/dist-tsc/view-config-utils.test.js +23 -0
- package/dist-tsc/view-config-versions.d.ts +6 -0
- package/dist-tsc/view-config-versions.d.ts.map +1 -0
- package/dist-tsc/view-config-versions.js +78 -0
- package/package.json +49 -0
- package/src/file-def-options-legacy.js +34 -0
- package/src/file-def-options.ts +158 -0
- package/src/index.ts +41 -0
- package/src/missing-types.d.ts +1 -0
- package/src/previous-config-meta.ts +85 -0
- package/src/previous-config-schemas.ts +259 -0
- package/src/previous-config-upgraders.ts +739 -0
- package/src/raster-json.ts +38 -0
- package/src/schema-builders.ts +179 -0
- package/src/shared.ts +158 -0
- package/src/spatial-layers.ts +103 -0
- package/src/view-config-utils.test.fixtures.ts +901 -0
- package/src/view-config-utils.test.ts +39 -0
- package/src/view-config-versions.ts +87 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { upgradeFrom0_1_0, upgradeFrom1_0_0, upgradeFrom1_0_15, } from './previous-config-upgraders.js';
|
|
4
|
+
import { legacyViewConfig0_1_0, upgradedLegacyViewConfig0_1_0, legacyViewConfig1_0_0, upgradedLegacyViewConfig1_0_0, implicitPerDatasetCoordinations, explicitPerDatasetCoordinations, } from './view-config-utils.test.fixtures.js';
|
|
5
|
+
import { upgradeAndParse, } from './view-config-versions.js';
|
|
6
|
+
describe('src/app/view-config-utils.js', () => {
|
|
7
|
+
describe('upgrade', () => {
|
|
8
|
+
it('upgrade view config from v0.1.0 to v1.0.0', () => {
|
|
9
|
+
expect(upgradeFrom0_1_0(legacyViewConfig0_1_0, 'A')).toEqual(upgradedLegacyViewConfig0_1_0);
|
|
10
|
+
});
|
|
11
|
+
it('upgrade view config from v1.0.0 to v1.0.1', () => {
|
|
12
|
+
expect(upgradeFrom1_0_0(legacyViewConfig1_0_0)).toEqual(upgradedLegacyViewConfig1_0_0);
|
|
13
|
+
});
|
|
14
|
+
it('upgrade view config from v1.0.9 to v1.0.16', () => {
|
|
15
|
+
expect(upgradeFrom1_0_15(implicitPerDatasetCoordinations))
|
|
16
|
+
.toEqual(explicitPerDatasetCoordinations);
|
|
17
|
+
});
|
|
18
|
+
it('upgrades more than once', () => {
|
|
19
|
+
const latestConfig = upgradeAndParse(legacyViewConfig1_0_0);
|
|
20
|
+
expect(latestConfig.version).toEqual('1.0.16');
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { latestConfigSchema } from './previous-config-meta.js';
|
|
3
|
+
export declare function configSchemaToVersion<T extends z.ZodTypeAny>(zodSchema: T): string;
|
|
4
|
+
export declare const VERSIONED_CONFIG_SCHEMAS: Record<string, z.ZodTypeAny>;
|
|
5
|
+
export declare function upgradeAndParse(config: any, onConfigUpgrade?: ((a: any, b: any) => void) | null): z.infer<typeof latestConfigSchema>;
|
|
6
|
+
//# sourceMappingURL=view-config-versions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"view-config-versions.d.ts","sourceRoot":"","sources":["../src/view-config-versions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAmB,kBAAkB,EAAoB,MAAM,2BAA2B,CAAC;AAElG,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,CAAC,GAAG,MAAM,CAGlF;AAED,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,UAAU,CAQjE,CAAC;AAkCF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,GAAG,EACX,eAAe,GAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC,GAAC,IAAW,GACtD,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CA6BpC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gte as semverGte } from 'semver';
|
|
4
|
+
import { OldCoordinationType } from '@vitessce/constants';
|
|
5
|
+
import { fromEntries } from '@vitessce/utils';
|
|
6
|
+
import { SCHEMA_HANDLERS, latestConfigSchema } from './previous-config-meta.js';
|
|
7
|
+
export function configSchemaToVersion(zodSchema) {
|
|
8
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
9
|
+
return zodSchema.shape.version._def.value;
|
|
10
|
+
}
|
|
11
|
+
export const VERSIONED_CONFIG_SCHEMAS = {
|
|
12
|
+
...fromEntries(SCHEMA_HANDLERS.map(([zodSchema]) => {
|
|
13
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
14
|
+
const version = configSchemaToVersion(zodSchema);
|
|
15
|
+
return [version, zodSchema];
|
|
16
|
+
})),
|
|
17
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
18
|
+
[latestConfigSchema.shape.version._def.value]: latestConfigSchema,
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Check for deprecated coordination types.
|
|
22
|
+
* @param {object} config The parsed config.
|
|
23
|
+
* @param ctx The Zod refinement context.
|
|
24
|
+
*/
|
|
25
|
+
function refineCoordinationTypes(config, ctx) {
|
|
26
|
+
if ('version' in config) {
|
|
27
|
+
const version = config?.version;
|
|
28
|
+
const deprecatedCoordinationTypes = Object.entries(OldCoordinationType)
|
|
29
|
+
.filter(([prevConstant, v]) => semverGte(version, v[2]))
|
|
30
|
+
.map(([prevConstant]) => prevConstant);
|
|
31
|
+
deprecatedCoordinationTypes.forEach((prevConstant) => {
|
|
32
|
+
const newTypeName = OldCoordinationType[prevConstant][3];
|
|
33
|
+
const prevName = OldCoordinationType[prevConstant][0];
|
|
34
|
+
if ('coordinationSpace' in config
|
|
35
|
+
&& typeof config.coordinationSpace === 'object'
|
|
36
|
+
&& config.coordinationSpace !== null
|
|
37
|
+
&& prevName in config.coordinationSpace) {
|
|
38
|
+
ctx.addIssue({
|
|
39
|
+
code: z.ZodIssueCode.custom,
|
|
40
|
+
message: `The coordination type ${prevName} was changed to ${newTypeName} in view config schema version ${version}`,
|
|
41
|
+
path: ['coordinationSpace', prevName],
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
// TODO: check config.layout[].coordinationScopes also?
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Run upgrade, then parse against the latest schema built against the registered plugins.
|
|
49
|
+
export function upgradeAndParse(config, onConfigUpgrade = null) {
|
|
50
|
+
// If this is the latest schema version, then no upgrading required.
|
|
51
|
+
if (config?.version === latestConfigSchema.shape.version.value) {
|
|
52
|
+
return latestConfigSchema.parse(config);
|
|
53
|
+
}
|
|
54
|
+
// Otherwise, do an upgrade (potentially multiple).
|
|
55
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
56
|
+
const versions = SCHEMA_HANDLERS.map(([zodSchema]) => configSchemaToVersion(zodSchema));
|
|
57
|
+
if (versions.includes(config?.version)) {
|
|
58
|
+
const versionIndex = versions.indexOf(config.version);
|
|
59
|
+
let upgradable = SCHEMA_HANDLERS[versionIndex][0];
|
|
60
|
+
SCHEMA_HANDLERS.slice(versionIndex, SCHEMA_HANDLERS.length).forEach((versionInfo) => {
|
|
61
|
+
upgradable = upgradable
|
|
62
|
+
.superRefine(refineCoordinationTypes)
|
|
63
|
+
.transform((prevConfig) => {
|
|
64
|
+
const nextConfig = versionInfo[1](prevConfig);
|
|
65
|
+
if (typeof onConfigUpgrade === 'function') {
|
|
66
|
+
onConfigUpgrade(prevConfig, nextConfig);
|
|
67
|
+
}
|
|
68
|
+
return nextConfig;
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
upgradable = upgradable.pipe(latestConfigSchema);
|
|
72
|
+
return upgradable.parse(config);
|
|
73
|
+
}
|
|
74
|
+
if (typeof config === 'object' && !('version' in config)) {
|
|
75
|
+
throw new Error('Missing version');
|
|
76
|
+
}
|
|
77
|
+
throw new Error('Config version was not recognized');
|
|
78
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vitessce/schemas",
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"author": "Gehlenborg Lab",
|
|
5
|
+
"homepage": "http://vitessce.io",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/vitessce/vitessce.git"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"src",
|
|
15
|
+
"dist",
|
|
16
|
+
"dist-tsc"
|
|
17
|
+
],
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"@types/lodash": "^4.14.191",
|
|
20
|
+
"@types/lodash-es": "^4.17.7",
|
|
21
|
+
"@types/semver": "^7.3.13",
|
|
22
|
+
"@types/uuid": "^9.0.1",
|
|
23
|
+
"lodash-es": "^4.17.21",
|
|
24
|
+
"semver": "^7.3.8",
|
|
25
|
+
"uuid": "^9.0.0",
|
|
26
|
+
"zod": "^3.21.4",
|
|
27
|
+
"@vitessce/constants": "3.0.0",
|
|
28
|
+
"@vitessce/constants-internal": "3.0.0",
|
|
29
|
+
"@vitessce/plugins": "3.0.0",
|
|
30
|
+
"@vitessce/utils": "3.0.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"json-schema-to-zod": "^0.6.3",
|
|
34
|
+
"vite": "^4.3.0",
|
|
35
|
+
"vitest": "^0.23.4",
|
|
36
|
+
"zod-to-json-schema": "^3.20.4"
|
|
37
|
+
},
|
|
38
|
+
"scripts": {
|
|
39
|
+
"bundle": "pnpm exec vite build -c ../../scripts/vite.config.js",
|
|
40
|
+
"test": "pnpm exec vitest --run -r ../../ --dir ."
|
|
41
|
+
},
|
|
42
|
+
"module": "dist/index.js",
|
|
43
|
+
"exports": {
|
|
44
|
+
".": {
|
|
45
|
+
"types": "./dist-tsc/index.d.ts",
|
|
46
|
+
"import": "./dist/index.js"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
export const cellsJsonSchema = z.object({
|
|
4
|
+
obsLabelsTypes: z.array(z.string()).optional(),
|
|
5
|
+
embeddingTypes: z.array(z.string()).optional(),
|
|
6
|
+
}).optional();
|
|
7
|
+
|
|
8
|
+
export const anndataCellsZarrSchema = z.object({
|
|
9
|
+
xy: z.string().optional(),
|
|
10
|
+
poly: z.string().optional(),
|
|
11
|
+
factors: z.array(z.string()).optional(),
|
|
12
|
+
mappings: z.record(
|
|
13
|
+
z.object({
|
|
14
|
+
key: z.string(),
|
|
15
|
+
dims: z.array(z.number()).length(2),
|
|
16
|
+
}),
|
|
17
|
+
).optional(),
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
export const anndataCellSetsZarrSchema = z.array(z.object({
|
|
21
|
+
groupName: z.string(),
|
|
22
|
+
setName: z.union([
|
|
23
|
+
z.string(),
|
|
24
|
+
z.array(z.string()),
|
|
25
|
+
]),
|
|
26
|
+
scoreName: z.string().optional(),
|
|
27
|
+
}));
|
|
28
|
+
|
|
29
|
+
export const anndataExpressionMatrixZarrSchema = z.object({
|
|
30
|
+
matrix: z.string(),
|
|
31
|
+
geneFilter: z.string().optional(),
|
|
32
|
+
matrixGeneFilter: z.string().optional(),
|
|
33
|
+
geneAlias: z.string().optional(),
|
|
34
|
+
});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
// Shared
|
|
4
|
+
const annDataObs = z.object({
|
|
5
|
+
path: z.string(),
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
const annDataObsm = z.object({
|
|
9
|
+
path: z.string(),
|
|
10
|
+
dims: z.array(z.number())
|
|
11
|
+
.optional(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
const annDataConvenienceObsLabelsItem = z.object({
|
|
15
|
+
path: z.string(),
|
|
16
|
+
obsLabelsType: z.string(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const annDataConvenienceFeatureLabelsItem = z.object({
|
|
20
|
+
path: z.string(),
|
|
21
|
+
featureLabelsType: z.string(),
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const annDataConvenienceObsEmbeddingItem = z.object({
|
|
25
|
+
path: z.string(),
|
|
26
|
+
dims: z.array(z.number())
|
|
27
|
+
.optional(),
|
|
28
|
+
embeddingType: z.string(),
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
const annDataObsLabels = annDataObs;
|
|
32
|
+
const annDataFeatureLabels = annDataObs;
|
|
33
|
+
const annDataObsFeatureMatrix = z.object({
|
|
34
|
+
path: z.string(),
|
|
35
|
+
featureFilterPath: z.string()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('If the feature index should be filtered, put a boolean column here (analogous to the previous geneFilter option). e.g., var/in_obsm_X_small_matrix'),
|
|
38
|
+
initialFeatureFilterPath: z.string()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('If only a subset of the matrix should be loaded initially, put a boolean column along the feature axis here (analogous to the previous matrixGeneFilter option). e.g., var/highly_variable'),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const annDataObsSets = z.array(
|
|
44
|
+
z.object({
|
|
45
|
+
name: z.string()
|
|
46
|
+
.describe("The display name for the set, like 'Cell Type' or 'Louvain.'"),
|
|
47
|
+
path: z.union([
|
|
48
|
+
z.string()
|
|
49
|
+
.describe("The location in the AnnData store for the set, like 'obs/louvain' or 'obs/celltype.'"),
|
|
50
|
+
z.array(z.string())
|
|
51
|
+
.describe('An array of locations in the AnnData store for a hierarchy of set names, from coarse to fine levels.'),
|
|
52
|
+
]),
|
|
53
|
+
scorePath: z.string()
|
|
54
|
+
.optional()
|
|
55
|
+
.describe("The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'"),
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const annDataObsLocations = annDataObsm;
|
|
60
|
+
const annDataObsEmbedding = annDataObsm;
|
|
61
|
+
const annDataObsSegmentations = annDataObs;
|
|
62
|
+
|
|
63
|
+
// OME
|
|
64
|
+
// coordinateTransformations matches the OME-NGFF v0.4 spec.
|
|
65
|
+
// Reference: https://ngff.openmicroscopy.org/0.4/#trafo-md
|
|
66
|
+
const omeCoordinateTransformations = z.array(z.union([
|
|
67
|
+
z.object({
|
|
68
|
+
type: z.literal('identity'),
|
|
69
|
+
}),
|
|
70
|
+
z.object({
|
|
71
|
+
type: z.literal('translation'),
|
|
72
|
+
translation: z.array(z.number()),
|
|
73
|
+
}),
|
|
74
|
+
z.object({
|
|
75
|
+
type: z.literal('scale'),
|
|
76
|
+
scale: z.array(z.number()),
|
|
77
|
+
}),
|
|
78
|
+
]));
|
|
79
|
+
|
|
80
|
+
// OME-TIFF
|
|
81
|
+
export const imageOmeTiffSchema = z.object({
|
|
82
|
+
offsetsUrl: z.string()
|
|
83
|
+
.optional(),
|
|
84
|
+
coordinateTransformations: omeCoordinateTransformations
|
|
85
|
+
.optional(),
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
// OME-Zarr (NGFF)
|
|
89
|
+
export const imageOmeZarrSchema = z.object({
|
|
90
|
+
coordinateTransformations: omeCoordinateTransformations
|
|
91
|
+
.optional(),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Options schemas for atomic file types.
|
|
97
|
+
*/
|
|
98
|
+
// AnnData
|
|
99
|
+
export const obsEmbeddingAnndataSchema = annDataObsEmbedding;
|
|
100
|
+
export const obsLocationsAnndataSchema = annDataObsLocations;
|
|
101
|
+
export const obsSegmentationsAnndataSchema = annDataObsSegmentations;
|
|
102
|
+
export const obsSetsAnndataSchema = annDataObsSets;
|
|
103
|
+
export const obsFeatureMatrixAnndataSchema = annDataObsFeatureMatrix;
|
|
104
|
+
export const obsLabelsAnndataSchema = annDataObsLabels;
|
|
105
|
+
export const featureLabelsAnndataSchema = annDataFeatureLabels;
|
|
106
|
+
|
|
107
|
+
// CSV
|
|
108
|
+
export const obsEmbeddingCsvSchema = z.object({
|
|
109
|
+
obsIndex: z.string(),
|
|
110
|
+
obsEmbedding: z.array(z.string()).length(2),
|
|
111
|
+
});
|
|
112
|
+
export const obsLocationsCsvSchema = z.object({
|
|
113
|
+
obsIndex: z.string(),
|
|
114
|
+
obsLocations: z.array(z.string()).length(2),
|
|
115
|
+
});
|
|
116
|
+
export const obsLabelsCsvSchema = z.object({
|
|
117
|
+
obsIndex: z.string(),
|
|
118
|
+
obsLabels: z.string(),
|
|
119
|
+
});
|
|
120
|
+
export const featureLabelsCsvSchema = z.object({
|
|
121
|
+
featureIndex: z.string(),
|
|
122
|
+
featureLabels: z.string(),
|
|
123
|
+
});
|
|
124
|
+
export const obsSetsCsvSchema = z.object({
|
|
125
|
+
obsIndex: z.string(),
|
|
126
|
+
obsSets: z.array(
|
|
127
|
+
z.object({
|
|
128
|
+
name: z.string(),
|
|
129
|
+
column: z.union([
|
|
130
|
+
z.string(),
|
|
131
|
+
z.array(z.string()),
|
|
132
|
+
]),
|
|
133
|
+
scoreColumn: z.string().optional(),
|
|
134
|
+
}),
|
|
135
|
+
),
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Options schemas for joint file types.
|
|
140
|
+
*/
|
|
141
|
+
export const anndataZarrSchema = z.object({
|
|
142
|
+
obsLabels: z.union([
|
|
143
|
+
annDataObsLabels,
|
|
144
|
+
z.array(annDataConvenienceObsLabelsItem),
|
|
145
|
+
]),
|
|
146
|
+
featureLabels: z.union([
|
|
147
|
+
annDataFeatureLabels,
|
|
148
|
+
z.array(annDataConvenienceFeatureLabelsItem),
|
|
149
|
+
]),
|
|
150
|
+
obsFeatureMatrix: annDataObsFeatureMatrix,
|
|
151
|
+
obsSets: annDataObsSets,
|
|
152
|
+
obsLocations: annDataObsLocations,
|
|
153
|
+
obsSegmentations: annDataObsSegmentations,
|
|
154
|
+
obsEmbedding: z.union([
|
|
155
|
+
annDataObsEmbedding,
|
|
156
|
+
z.array(annDataConvenienceObsEmbeddingItem),
|
|
157
|
+
]),
|
|
158
|
+
}).partial();
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export { buildConfigSchema } from './schema-builders.js';
|
|
2
|
+
export { latestConfigSchema } from './previous-config-meta.js';
|
|
3
|
+
export { latestFileDefSchema } from './previous-config-schemas.js';
|
|
4
|
+
export { upgradeAndParse, VERSIONED_CONFIG_SCHEMAS } from './view-config-versions.js';
|
|
5
|
+
export { rasterJsonSchema } from './raster-json.js';
|
|
6
|
+
export {
|
|
7
|
+
obsEmbeddingCsvSchema,
|
|
8
|
+
obsSetsCsvSchema,
|
|
9
|
+
obsLocationsCsvSchema,
|
|
10
|
+
obsLabelsCsvSchema,
|
|
11
|
+
featureLabelsCsvSchema,
|
|
12
|
+
obsSetsAnndataSchema,
|
|
13
|
+
obsEmbeddingAnndataSchema,
|
|
14
|
+
obsLocationsAnndataSchema,
|
|
15
|
+
obsLabelsAnndataSchema,
|
|
16
|
+
obsFeatureMatrixAnndataSchema,
|
|
17
|
+
obsSegmentationsAnndataSchema,
|
|
18
|
+
featureLabelsAnndataSchema,
|
|
19
|
+
anndataZarrSchema,
|
|
20
|
+
imageOmeZarrSchema,
|
|
21
|
+
imageOmeTiffSchema,
|
|
22
|
+
} from './file-def-options.js';
|
|
23
|
+
export {
|
|
24
|
+
anndataCellsZarrSchema,
|
|
25
|
+
anndataCellSetsZarrSchema,
|
|
26
|
+
anndataExpressionMatrixZarrSchema,
|
|
27
|
+
cellsJsonSchema,
|
|
28
|
+
} from './file-def-options-legacy.js';
|
|
29
|
+
export {
|
|
30
|
+
obsSetPath,
|
|
31
|
+
rgbArray,
|
|
32
|
+
obsSetsSchema,
|
|
33
|
+
obsSetsTabularSchema,
|
|
34
|
+
} from './shared.js';
|
|
35
|
+
export {
|
|
36
|
+
imageLayerObj,
|
|
37
|
+
cellsLayerObj,
|
|
38
|
+
neighborhoodsLayerObj,
|
|
39
|
+
moleculesLayerObj,
|
|
40
|
+
} from './spatial-layers.js';
|
|
41
|
+
export { z } from 'zod';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare module '@vitessce/utils';
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/* eslint-disable camelcase */
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import {
|
|
4
|
+
configSchema0_1_0,
|
|
5
|
+
configSchema1_0_0,
|
|
6
|
+
configSchema1_0_1,
|
|
7
|
+
configSchema1_0_2,
|
|
8
|
+
configSchema1_0_3,
|
|
9
|
+
configSchema1_0_4,
|
|
10
|
+
configSchema1_0_5,
|
|
11
|
+
configSchema1_0_6,
|
|
12
|
+
configSchema1_0_7,
|
|
13
|
+
configSchema1_0_8,
|
|
14
|
+
configSchema1_0_9,
|
|
15
|
+
configSchema1_0_10,
|
|
16
|
+
configSchema1_0_11,
|
|
17
|
+
configSchema1_0_12,
|
|
18
|
+
configSchema1_0_13,
|
|
19
|
+
configSchema1_0_14,
|
|
20
|
+
configSchema1_0_15,
|
|
21
|
+
configSchema1_0_16,
|
|
22
|
+
} from './previous-config-schemas.js';
|
|
23
|
+
import {
|
|
24
|
+
upgradeFrom0_1_0,
|
|
25
|
+
upgradeFrom1_0_0,
|
|
26
|
+
upgradeFrom1_0_1,
|
|
27
|
+
upgradeFrom1_0_2,
|
|
28
|
+
upgradeFrom1_0_3,
|
|
29
|
+
upgradeFrom1_0_4,
|
|
30
|
+
upgradeFrom1_0_5,
|
|
31
|
+
upgradeFrom1_0_6,
|
|
32
|
+
upgradeFrom1_0_7,
|
|
33
|
+
upgradeFrom1_0_8,
|
|
34
|
+
upgradeFrom1_0_9,
|
|
35
|
+
upgradeFrom1_0_10,
|
|
36
|
+
upgradeFrom1_0_11,
|
|
37
|
+
upgradeFrom1_0_12,
|
|
38
|
+
upgradeFrom1_0_13,
|
|
39
|
+
upgradeFrom1_0_14,
|
|
40
|
+
upgradeFrom1_0_15,
|
|
41
|
+
} from './previous-config-upgraders.js';
|
|
42
|
+
|
|
43
|
+
export const latestConfigSchema = configSchema1_0_16;
|
|
44
|
+
|
|
45
|
+
export type AnyVersionConfig =
|
|
46
|
+
z.infer<typeof configSchema0_1_0> |
|
|
47
|
+
z.infer<typeof configSchema1_0_0> |
|
|
48
|
+
z.infer<typeof configSchema1_0_1> |
|
|
49
|
+
z.infer<typeof configSchema1_0_2> |
|
|
50
|
+
z.infer<typeof configSchema1_0_3> |
|
|
51
|
+
z.infer<typeof configSchema1_0_4> |
|
|
52
|
+
z.infer<typeof configSchema1_0_5> |
|
|
53
|
+
z.infer<typeof configSchema1_0_6> |
|
|
54
|
+
z.infer<typeof configSchema1_0_7> |
|
|
55
|
+
z.infer<typeof configSchema1_0_8> |
|
|
56
|
+
z.infer<typeof configSchema1_0_9> |
|
|
57
|
+
z.infer<typeof configSchema1_0_10> |
|
|
58
|
+
z.infer<typeof configSchema1_0_11> |
|
|
59
|
+
z.infer<typeof configSchema1_0_12> |
|
|
60
|
+
z.infer<typeof configSchema1_0_13> |
|
|
61
|
+
z.infer<typeof configSchema1_0_14> |
|
|
62
|
+
z.infer<typeof configSchema1_0_15> |
|
|
63
|
+
z.infer<typeof configSchema1_0_16>;
|
|
64
|
+
|
|
65
|
+
export type UpgradeFunction = (config: any) => AnyVersionConfig;
|
|
66
|
+
|
|
67
|
+
export const SCHEMA_HANDLERS: [z.ZodTypeAny, UpgradeFunction][] = [
|
|
68
|
+
[configSchema0_1_0, upgradeFrom0_1_0],
|
|
69
|
+
[configSchema1_0_0, upgradeFrom1_0_0],
|
|
70
|
+
[configSchema1_0_1, upgradeFrom1_0_1],
|
|
71
|
+
[configSchema1_0_2, upgradeFrom1_0_2],
|
|
72
|
+
[configSchema1_0_3, upgradeFrom1_0_3],
|
|
73
|
+
[configSchema1_0_4, upgradeFrom1_0_4],
|
|
74
|
+
[configSchema1_0_5, upgradeFrom1_0_5],
|
|
75
|
+
[configSchema1_0_6, upgradeFrom1_0_6],
|
|
76
|
+
[configSchema1_0_7, upgradeFrom1_0_7],
|
|
77
|
+
[configSchema1_0_8, upgradeFrom1_0_8],
|
|
78
|
+
[configSchema1_0_9, upgradeFrom1_0_9],
|
|
79
|
+
[configSchema1_0_10, upgradeFrom1_0_10],
|
|
80
|
+
[configSchema1_0_11, upgradeFrom1_0_11],
|
|
81
|
+
[configSchema1_0_12, upgradeFrom1_0_12],
|
|
82
|
+
[configSchema1_0_13, upgradeFrom1_0_13],
|
|
83
|
+
[configSchema1_0_14, upgradeFrom1_0_14],
|
|
84
|
+
[configSchema1_0_15, upgradeFrom1_0_15],
|
|
85
|
+
];
|