@vitessce/schemas 3.4.9 → 3.4.11

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.
@@ -1,7 +1,7 @@
1
1
  /* eslint-disable camelcase */
2
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';
3
+ import { upgradeFrom0_1_0, upgradeFrom1_0_0, upgradeFrom1_0_15, upgradeFrom1_0_16, } from './previous-config-upgraders.js';
4
+ import { legacyViewConfig0_1_0, upgradedLegacyViewConfig0_1_0, legacyViewConfig1_0_0, upgradedLegacyViewConfig1_0_0, implicitPerDatasetCoordinations, explicitPerDatasetCoordinations, annDataOptionsArrays, annDataOptionsObjects, } from './view-config-utils.test.fixtures.js';
5
5
  import { upgradeAndParse, } from './view-config-versions.js';
6
6
  describe('src/app/view-config-utils.js', () => {
7
7
  describe('upgrade', () => {
@@ -15,9 +15,13 @@ describe('src/app/view-config-utils.js', () => {
15
15
  expect(upgradeFrom1_0_15(implicitPerDatasetCoordinations))
16
16
  .toEqual(explicitPerDatasetCoordinations);
17
17
  });
18
+ it('upgrade view config from v1.0.16 to v1.0.17', () => {
19
+ expect(upgradeFrom1_0_16(annDataOptionsArrays))
20
+ .toEqual(annDataOptionsObjects);
21
+ });
18
22
  it('upgrades more than once', () => {
19
23
  const latestConfig = upgradeAndParse(legacyViewConfig1_0_0);
20
- expect(latestConfig.version).toEqual('1.0.16');
24
+ expect(latestConfig.version).toEqual('1.0.17');
21
25
  });
22
26
  });
23
27
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/schemas",
3
- "version": "3.4.9",
3
+ "version": "3.4.11",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -23,10 +23,10 @@
23
23
  "semver": "^7.3.8",
24
24
  "uuid": "^9.0.0",
25
25
  "zod": "^3.21.4",
26
- "@vitessce/constants": "3.4.9",
27
- "@vitessce/constants-internal": "3.4.9",
28
- "@vitessce/plugins": "3.4.9",
29
- "@vitessce/utils": "3.4.9"
26
+ "@vitessce/constants": "3.4.11",
27
+ "@vitessce/constants-internal": "3.4.11",
28
+ "@vitessce/plugins": "3.4.11",
29
+ "@vitessce/utils": "3.4.11"
30
30
  },
31
31
  "devDependencies": {
32
32
  "json-schema-to-zod": "^0.6.3",
@@ -41,7 +41,7 @@ const annDataObsFeatureMatrix = z.object({
41
41
  .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'),
42
42
  });
43
43
 
44
- const annDataObsSets = z.array(
44
+ const annDataObsSetsArr = z.array(
45
45
  z.object({
46
46
  name: z.string()
47
47
  .describe("The display name for the set, like 'Cell Type' or 'Louvain.'"),
@@ -57,12 +57,24 @@ const annDataObsSets = z.array(
57
57
  }),
58
58
  );
59
59
 
60
- const annDataObsFeatureColumns = z.array(
60
+ // Need to nest this within an object
61
+ // to allow for additional properties like `refSpecUrl`.
62
+ const annDataObsSets = z.object({
63
+ obsSets: annDataObsSetsArr,
64
+ });
65
+
66
+ const annDataObsFeatureColumnsArr = z.array(
61
67
  z.object({
62
68
  path: z.string(),
63
69
  }),
64
70
  );
65
71
 
72
+ // Need to nest this within an object
73
+ // to allow for additional properties like `refSpecUrl`.
74
+ const annDataObsFeatureColumns = z.object({
75
+ obsFeatureColumns: annDataObsFeatureColumnsArr,
76
+ });
77
+
66
78
  const annDataObsSpots = annDataObsm;
67
79
  const annDataObsPoints = annDataObsm;
68
80
  const annDataObsLocations = annDataObsm;
@@ -246,7 +258,7 @@ export const anndataZarrSchema = z.object({
246
258
  z.array(annDataConvenienceFeatureLabelsItem),
247
259
  ]),
248
260
  obsFeatureMatrix: annDataObsFeatureMatrix,
249
- obsSets: annDataObsSets,
261
+ obsSets: annDataObsSetsArr,
250
262
  obsSpots: annDataObsSpots,
251
263
  obsPoints: annDataObsPoints,
252
264
  obsLocations: annDataObsLocations,
@@ -258,6 +270,10 @@ export const anndataZarrSchema = z.object({
258
270
  sampleEdges: annDataSampleEdges,
259
271
  }).partial();
260
272
 
273
+ export const anndataH5adSchema = anndataZarrSchema.extend({
274
+ refSpecUrl: z.string(),
275
+ });
276
+
261
277
  export const spatialdataZarrSchema = z.object({
262
278
  // TODO: should `image` be a special schema
263
279
  // to allow specifying fileUid (like for embeddingType)?
package/src/index.ts CHANGED
@@ -24,6 +24,7 @@ export {
24
24
  featureLabelsAnndataSchema,
25
25
  sampleEdgesAnndataSchema,
26
26
  anndataZarrSchema,
27
+ anndataH5adSchema,
27
28
  spatialdataZarrSchema,
28
29
  imageOmeZarrSchema,
29
30
  imageOmeTiffSchema,
@@ -19,6 +19,7 @@ import {
19
19
  configSchema1_0_14,
20
20
  configSchema1_0_15,
21
21
  configSchema1_0_16,
22
+ configSchema1_0_17,
22
23
  } from './previous-config-schemas.js';
23
24
  import {
24
25
  upgradeFrom0_1_0,
@@ -38,9 +39,10 @@ import {
38
39
  upgradeFrom1_0_13,
39
40
  upgradeFrom1_0_14,
40
41
  upgradeFrom1_0_15,
42
+ upgradeFrom1_0_16,
41
43
  } from './previous-config-upgraders.js';
42
44
 
43
- export const latestConfigSchema = configSchema1_0_16;
45
+ export const latestConfigSchema = configSchema1_0_17;
44
46
 
45
47
  export type AnyVersionConfig =
46
48
  z.infer<typeof configSchema0_1_0> |
@@ -60,7 +62,8 @@ export type AnyVersionConfig =
60
62
  z.infer<typeof configSchema1_0_13> |
61
63
  z.infer<typeof configSchema1_0_14> |
62
64
  z.infer<typeof configSchema1_0_15> |
63
- z.infer<typeof configSchema1_0_16>;
65
+ z.infer<typeof configSchema1_0_16> |
66
+ z.infer<typeof configSchema1_0_17>;
64
67
 
65
68
  export type UpgradeFunction = (config: any) => AnyVersionConfig;
66
69
 
@@ -82,4 +85,5 @@ export const SCHEMA_HANDLERS: [z.ZodTypeAny, UpgradeFunction][] = [
82
85
  [configSchema1_0_13, upgradeFrom1_0_13],
83
86
  [configSchema1_0_14, upgradeFrom1_0_14],
84
87
  [configSchema1_0_15, upgradeFrom1_0_15],
88
+ [configSchema1_0_16, upgradeFrom1_0_16],
85
89
  ];
@@ -257,3 +257,8 @@ export const configSchema1_0_16 = configSchema1_0_13.extend({
257
257
  }),
258
258
  ),
259
259
  });
260
+
261
+ // Only coordination type or behavioral changes.
262
+ export const configSchema1_0_17 = configSchema1_0_16.extend({
263
+ version: z.literal('1.0.17'),
264
+ });
@@ -23,6 +23,7 @@ import {
23
23
  configSchema1_0_14,
24
24
  configSchema1_0_15,
25
25
  configSchema1_0_16,
26
+ configSchema1_0_17,
26
27
  } from './previous-config-schemas.js';
27
28
 
28
29
 
@@ -737,3 +738,49 @@ export function upgradeFrom1_0_15(
737
738
  version: '1.0.16',
738
739
  };
739
740
  }
741
+
742
+ // Added in version 1.0.17:
743
+ // - Convert obsSets.anndata.zarr and obsFeatureColumns.anndata.zarr options
744
+ // from array into object property.
745
+ export function upgradeFrom1_0_16(
746
+ config: z.infer<typeof configSchema1_0_16>,
747
+ ): z.infer<typeof configSchema1_0_17> {
748
+ const newConfig = cloneDeep(config);
749
+
750
+ const { datasets } = newConfig;
751
+ // eslint-disable-next-line max-len
752
+ const newDatasets = datasets.map((datasetDef): z.infer<typeof configSchema1_0_17.shape.datasets.element> => {
753
+ const { files } = datasetDef;
754
+ // eslint-disable-next-line max-len
755
+ const newFiles = files.map((fileDef): z.infer<typeof configSchema1_0_17.shape.datasets.element.shape.files.element> => {
756
+ const { fileType, options } = fileDef;
757
+ if (fileType === 'obsSets.anndata.zarr') {
758
+ return {
759
+ ...fileDef,
760
+ options: {
761
+ obsSets: options,
762
+ },
763
+ };
764
+ }
765
+ if (fileType === 'obsFeatureColumns.anndata.zarr') {
766
+ return {
767
+ ...fileDef,
768
+ options: {
769
+ obsFeatureColumns: options,
770
+ },
771
+ };
772
+ }
773
+ return fileDef;
774
+ });
775
+ return {
776
+ ...datasetDef,
777
+ files: newFiles,
778
+ };
779
+ });
780
+
781
+ return {
782
+ ...newConfig,
783
+ datasets: newDatasets,
784
+ version: '1.0.17',
785
+ };
786
+ }
@@ -6,6 +6,7 @@ import {
6
6
  configSchema1_0_1,
7
7
  configSchema1_0_15,
8
8
  configSchema1_0_16,
9
+ configSchema1_0_17,
9
10
  } from './previous-config-schemas.js';
10
11
 
11
12
  /* eslint-disable camelcase */
@@ -899,3 +900,67 @@ export const explicitPerDatasetCoordinations: z.infer<typeof configSchema1_0_16>
899
900
  },
900
901
  ],
901
902
  };
903
+
904
+ export const annDataOptionsArrays: z.infer<typeof configSchema1_0_16> = {
905
+ version: '1.0.16',
906
+ name: 'Anndata options arrays',
907
+ description: 'My config description',
908
+ initStrategy: 'auto',
909
+ datasets: [
910
+ {
911
+ files: [
912
+ {
913
+ fileType: 'obsSets.anndata.zarr',
914
+ url: 'https://example.com',
915
+ options: [
916
+ { path: 'obs/celltype', name: 'Cell Type' },
917
+ ],
918
+ },
919
+ {
920
+ fileType: 'obsFeatureColumns.anndata.zarr',
921
+ url: 'https://example.com',
922
+ options: [
923
+ { path: 'obs/qc_metric', name: 'Some metric' },
924
+ ],
925
+ },
926
+ ],
927
+ name: 'First dataset',
928
+ uid: 'first',
929
+ },
930
+ ],
931
+ layout: [],
932
+ };
933
+
934
+ export const annDataOptionsObjects: z.infer<typeof configSchema1_0_17> = {
935
+ version: '1.0.17',
936
+ name: 'Anndata options arrays',
937
+ description: 'My config description',
938
+ initStrategy: 'auto',
939
+ datasets: [
940
+ {
941
+ files: [
942
+ {
943
+ fileType: 'obsSets.anndata.zarr',
944
+ url: 'https://example.com',
945
+ options: {
946
+ obsSets: [
947
+ { path: 'obs/celltype', name: 'Cell Type' },
948
+ ],
949
+ },
950
+ },
951
+ {
952
+ fileType: 'obsFeatureColumns.anndata.zarr',
953
+ url: 'https://example.com',
954
+ options: {
955
+ obsFeatureColumns: [
956
+ { path: 'obs/qc_metric', name: 'Some metric' },
957
+ ],
958
+ },
959
+ },
960
+ ],
961
+ name: 'First dataset',
962
+ uid: 'first',
963
+ },
964
+ ],
965
+ layout: [],
966
+ };
@@ -4,6 +4,7 @@ import {
4
4
  upgradeFrom0_1_0,
5
5
  upgradeFrom1_0_0,
6
6
  upgradeFrom1_0_15,
7
+ upgradeFrom1_0_16,
7
8
  } from './previous-config-upgraders.js';
8
9
  import {
9
10
  legacyViewConfig0_1_0,
@@ -12,6 +13,8 @@ import {
12
13
  upgradedLegacyViewConfig1_0_0,
13
14
  implicitPerDatasetCoordinations,
14
15
  explicitPerDatasetCoordinations,
16
+ annDataOptionsArrays,
17
+ annDataOptionsObjects,
15
18
  } from './view-config-utils.test.fixtures.js';
16
19
  import {
17
20
  upgradeAndParse,
@@ -31,9 +34,13 @@ describe('src/app/view-config-utils.js', () => {
31
34
  expect(upgradeFrom1_0_15(implicitPerDatasetCoordinations))
32
35
  .toEqual(explicitPerDatasetCoordinations);
33
36
  });
37
+ it('upgrade view config from v1.0.16 to v1.0.17', () => {
38
+ expect(upgradeFrom1_0_16(annDataOptionsArrays))
39
+ .toEqual(annDataOptionsObjects);
40
+ });
34
41
  it('upgrades more than once', () => {
35
42
  const latestConfig = upgradeAndParse(legacyViewConfig1_0_0);
36
- expect(latestConfig.version).toEqual('1.0.16');
43
+ expect(latestConfig.version).toEqual('1.0.17');
37
44
  });
38
45
  });
39
46
  });