@vitessce/all 2.0.3 → 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.
Files changed (48) hide show
  1. package/dist/{deflate.8ace1ac4.mjs → deflate-f57b3163.js} +2 -2
  2. package/dist/hglib-1422f224.js +138925 -0
  3. package/dist/{index.7dac8670.mjs → index-3f1c1764.js} +67100 -52955
  4. package/dist/index.js +12 -0
  5. package/dist/{jpeg.c8011e3a.mjs → jpeg-e740c9a5.js} +1 -1
  6. package/dist/{lerc.ccda5eb2.mjs → lerc-01e6c4d8.js} +76 -5
  7. package/dist/{lzw.39876143.mjs → lzw-865bd058.js} +1 -1
  8. package/dist/{packbits.9e95d117.mjs → packbits-d4191efd.js} +1 -1
  9. package/dist/{pako.esm.4b234125.mjs → pako.esm-68f84e2a.js} +97 -15
  10. package/dist/{raw.0279d74b.mjs → raw-3c693341.js} +1 -1
  11. package/dist/{webimage.5ac7ce95.mjs → webimage-83da2258.js} +1 -1
  12. package/dist-tsc/Vitessce.d.ts +2 -0
  13. package/dist-tsc/Vitessce.d.ts.map +1 -0
  14. package/dist-tsc/Vitessce.js +41 -0
  15. package/dist-tsc/base-plugins.d.ts +854 -0
  16. package/dist-tsc/base-plugins.d.ts.map +1 -0
  17. package/dist-tsc/base-plugins.js +191 -0
  18. package/dist-tsc/index.d.ts +4 -0
  19. package/dist-tsc/index.d.ts.map +1 -0
  20. package/dist-tsc/index.js +3 -2
  21. package/dist-tsc/joint-file-types-legacy.d.ts +226 -0
  22. package/dist-tsc/joint-file-types-legacy.d.ts.map +1 -0
  23. package/dist-tsc/joint-file-types-legacy.js +266 -0
  24. package/dist-tsc/joint-file-types-legacy.test.d.ts +2 -0
  25. package/dist-tsc/joint-file-types-legacy.test.d.ts.map +1 -0
  26. package/dist-tsc/joint-file-types-legacy.test.js +401 -0
  27. package/dist-tsc/joint-file-types.d.ts +4 -0
  28. package/dist-tsc/joint-file-types.d.ts.map +1 -0
  29. package/dist-tsc/joint-file-types.js +127 -0
  30. package/dist-tsc/joint-file-types.test.d.ts +2 -0
  31. package/dist-tsc/joint-file-types.test.d.ts.map +1 -0
  32. package/dist-tsc/joint-file-types.test.js +128 -0
  33. package/dist-tsc/latest-config-schema.test.d.ts +2 -0
  34. package/dist-tsc/latest-config-schema.test.d.ts.map +1 -0
  35. package/dist-tsc/latest-config-schema.test.js +19 -0
  36. package/package.json +37 -21
  37. package/src/Vitessce.tsx +74 -0
  38. package/src/base-plugins.ts +362 -0
  39. package/src/index.ts +8 -0
  40. package/src/joint-file-types-legacy.test.ts +413 -0
  41. package/src/joint-file-types-legacy.ts +284 -0
  42. package/src/joint-file-types.test.ts +132 -0
  43. package/src/joint-file-types.ts +142 -0
  44. package/src/latest-config-schema.test.ts +26 -0
  45. package/dist/hglib.1f1ea875.mjs +0 -130303
  46. package/dist/index.mjs +0 -11
  47. package/src/index.js +0 -7
  48. package/src/setup.js +0 -143
@@ -0,0 +1,127 @@
1
+ import { FileType } from '@vitessce/constants-internal';
2
+ export function expandAnndataZarr(fileDef) {
3
+ const baseFileDef = {
4
+ url: fileDef.url,
5
+ requestInit: fileDef.requestInit,
6
+ coordinationValues: {
7
+ ...fileDef.coordinationValues,
8
+ obsType: fileDef.coordinationValues?.obsType || 'cell',
9
+ featureType: fileDef.coordinationValues?.featureType || 'gene',
10
+ featureValueType: fileDef.coordinationValues?.featureValueType || 'expression',
11
+ },
12
+ };
13
+ const { options = {} } = fileDef;
14
+ return [
15
+ // obsFeatureMatrix
16
+ ...(options.obsFeatureMatrix ? [{
17
+ ...baseFileDef,
18
+ fileType: FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR,
19
+ options: options.obsFeatureMatrix,
20
+ coordinationValues: {
21
+ obsType: baseFileDef.coordinationValues.obsType,
22
+ featureType: baseFileDef.coordinationValues.featureType,
23
+ featureValueType: baseFileDef.coordinationValues.featureValueType,
24
+ },
25
+ }] : []),
26
+ // obsSets
27
+ ...(options.obsSets ? [{
28
+ ...baseFileDef,
29
+ fileType: FileType.OBS_SETS_ANNDATA_ZARR,
30
+ options: options.obsSets,
31
+ coordinationValues: {
32
+ obsType: baseFileDef.coordinationValues.obsType,
33
+ },
34
+ }] : []),
35
+ // obsLocations
36
+ ...(options.obsLocations ? [{
37
+ ...baseFileDef,
38
+ fileType: FileType.OBS_LOCATIONS_ANNDATA_ZARR,
39
+ options: options.obsLocations,
40
+ coordinationValues: {
41
+ obsType: baseFileDef.coordinationValues.obsType,
42
+ },
43
+ }] : []),
44
+ // obsSegmentations
45
+ ...(options.obsSegmentations ? [{
46
+ ...baseFileDef,
47
+ fileType: FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR,
48
+ options: options.obsSegmentations,
49
+ coordinationValues: {
50
+ obsType: baseFileDef.coordinationValues.obsType,
51
+ },
52
+ }] : []),
53
+ // obsEmbedding
54
+ // eslint-disable-next-line no-nested-ternary
55
+ ...(options.obsEmbedding ? (Array.isArray(options.obsEmbedding) ? options.obsEmbedding.map((oe) => ({
56
+ // obsEmbedding was an array, process each element.
57
+ ...baseFileDef,
58
+ fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
59
+ options: {
60
+ path: oe.path,
61
+ dims: oe.dims,
62
+ },
63
+ coordinationValues: {
64
+ obsType: baseFileDef.coordinationValues.obsType,
65
+ // Move embedding type property out of options and into coordinationValues.
66
+ embeddingType: oe.embeddingType,
67
+ },
68
+ })) : [{
69
+ // obsEmbedding was an object.
70
+ ...baseFileDef,
71
+ fileType: FileType.OBS_EMBEDDING_ANNDATA_ZARR,
72
+ options: options.obsEmbedding,
73
+ coordinationValues: {
74
+ obsType: baseFileDef.coordinationValues.obsType,
75
+ embeddingType: baseFileDef.coordinationValues.embeddingType,
76
+ },
77
+ }]) : []),
78
+ // obsLabels
79
+ // eslint-disable-next-line no-nested-ternary
80
+ ...(options.obsLabels ? (Array.isArray(options.obsLabels) ? options.obsLabels.map((ol) => ({
81
+ // obsLabels was an array, process each element.
82
+ ...baseFileDef,
83
+ fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
84
+ options: {
85
+ path: ol.path,
86
+ },
87
+ coordinationValues: {
88
+ obsType: baseFileDef.coordinationValues.obsType,
89
+ // Move obsLabels type property out of options and into coordinationValues.
90
+ obsLabelsType: ol.obsLabelsType,
91
+ },
92
+ })) : [{
93
+ // obsLabels was an object.
94
+ ...baseFileDef,
95
+ fileType: FileType.OBS_LABELS_ANNDATA_ZARR,
96
+ options: options.obsLabels,
97
+ coordinationValues: {
98
+ obsType: baseFileDef.coordinationValues.obsType,
99
+ obsLabelsType: baseFileDef.coordinationValues.obsLabelsType,
100
+ },
101
+ }]) : []),
102
+ // featureLabels
103
+ // eslint-disable-next-line no-nested-ternary
104
+ ...(options.featureLabels ? (Array.isArray(options.featureLabels) ? options.featureLabels.map((fl) => ({
105
+ // featureLabels was an array, process each element.
106
+ ...baseFileDef,
107
+ fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
108
+ options: {
109
+ path: fl.path,
110
+ },
111
+ coordinationValues: {
112
+ featureType: baseFileDef.coordinationValues.featureType,
113
+ // Move featureLabels type property out of options and into coordinationValues.
114
+ featureLabelsType: fl.featureLabelsType,
115
+ },
116
+ })) : [{
117
+ // featureLabels was an object.
118
+ ...baseFileDef,
119
+ fileType: FileType.FEATURE_LABELS_ANNDATA_ZARR,
120
+ options: options.featureLabels,
121
+ coordinationValues: {
122
+ featureType: baseFileDef.coordinationValues.featureType,
123
+ featureLabelsType: baseFileDef.coordinationValues.featureLabelsType,
124
+ },
125
+ }]) : []),
126
+ ];
127
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=joint-file-types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joint-file-types.test.d.ts","sourceRoot":"","sources":["../src/joint-file-types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,128 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { expandAnndataZarr, } from './joint-file-types.js';
3
+ describe('src/app/joint-file-types.js', () => {
4
+ describe('expandAnndataZarr', () => {
5
+ it('fails to expand when there are no options', () => {
6
+ expect(expandAnndataZarr({
7
+ fileType: 'anndata.zarr',
8
+ url: 'http://localhost:8000/anndata.zarr',
9
+ })).toEqual([]);
10
+ });
11
+ it('expands when there is an obsEmbedding object', () => {
12
+ expect(expandAnndataZarr({
13
+ fileType: 'anndata.zarr',
14
+ url: 'http://localhost:8000/anndata.zarr',
15
+ options: {
16
+ obsLabels: {
17
+ path: 'obs/spot_name',
18
+ },
19
+ featureLabels: {
20
+ path: 'var/gene_symbol',
21
+ },
22
+ obsEmbedding: {
23
+ path: 'obsm/pca',
24
+ dims: [2, 4],
25
+ },
26
+ },
27
+ coordinationValues: {
28
+ obsType: 'spot',
29
+ featureType: 'transcript',
30
+ obsLabelsType: 'spotName',
31
+ featureLabelsType: 'geneSymbol',
32
+ embeddingType: 'PCA',
33
+ },
34
+ })).toEqual([
35
+ {
36
+ fileType: 'obsEmbedding.anndata.zarr',
37
+ url: 'http://localhost:8000/anndata.zarr',
38
+ options: {
39
+ path: 'obsm/pca',
40
+ dims: [2, 4],
41
+ },
42
+ coordinationValues: {
43
+ obsType: 'spot',
44
+ embeddingType: 'PCA',
45
+ },
46
+ },
47
+ {
48
+ fileType: 'obsLabels.anndata.zarr',
49
+ url: 'http://localhost:8000/anndata.zarr',
50
+ options: {
51
+ path: 'obs/spot_name',
52
+ },
53
+ coordinationValues: {
54
+ obsType: 'spot',
55
+ obsLabelsType: 'spotName',
56
+ },
57
+ },
58
+ {
59
+ fileType: 'featureLabels.anndata.zarr',
60
+ url: 'http://localhost:8000/anndata.zarr',
61
+ options: {
62
+ path: 'var/gene_symbol',
63
+ },
64
+ coordinationValues: {
65
+ featureType: 'transcript',
66
+ featureLabelsType: 'geneSymbol',
67
+ },
68
+ },
69
+ ]);
70
+ });
71
+ it('expands when there is an obsEmbedding array of objects', () => {
72
+ expect(expandAnndataZarr({
73
+ fileType: 'anndata.zarr',
74
+ url: 'http://localhost:8000/anndata.zarr',
75
+ options: {
76
+ obsLocations: {
77
+ path: 'obsm/xy',
78
+ },
79
+ obsEmbedding: [
80
+ {
81
+ path: 'obsm/pca',
82
+ dims: [2, 4],
83
+ embeddingType: 'PCA',
84
+ },
85
+ {
86
+ path: 'obsm/umap',
87
+ embeddingType: 'UMAP',
88
+ },
89
+ ],
90
+ },
91
+ })).toEqual([
92
+ {
93
+ fileType: 'obsLocations.anndata.zarr',
94
+ url: 'http://localhost:8000/anndata.zarr',
95
+ options: {
96
+ path: 'obsm/xy',
97
+ },
98
+ coordinationValues: {
99
+ obsType: 'cell',
100
+ },
101
+ },
102
+ {
103
+ fileType: 'obsEmbedding.anndata.zarr',
104
+ url: 'http://localhost:8000/anndata.zarr',
105
+ options: {
106
+ path: 'obsm/pca',
107
+ dims: [2, 4],
108
+ },
109
+ coordinationValues: {
110
+ obsType: 'cell',
111
+ embeddingType: 'PCA',
112
+ },
113
+ },
114
+ {
115
+ fileType: 'obsEmbedding.anndata.zarr',
116
+ url: 'http://localhost:8000/anndata.zarr',
117
+ options: {
118
+ path: 'obsm/umap',
119
+ },
120
+ coordinationValues: {
121
+ obsType: 'cell',
122
+ embeddingType: 'UMAP',
123
+ },
124
+ },
125
+ ]);
126
+ });
127
+ });
128
+ });
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=latest-config-schema.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"latest-config-schema.test.d.ts","sourceRoot":"","sources":["../src/latest-config-schema.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ import { describe, expect, it } from 'vitest';
2
+ import { CoordinationType } from '@vitessce/constants-internal';
3
+ import { baseCoordinationTypes, } from './base-plugins.js';
4
+ describe('view config schema', () => {
5
+ describe('coordination types', () => {
6
+ it('defines schema for all valid coordination types', () => {
7
+ const coordinationTypeNamesFromConstants = Object.values(CoordinationType).sort();
8
+ const coordinationTypeNamesFromBasePlugins = baseCoordinationTypes.map(ct => ct.name).sort();
9
+ expect(coordinationTypeNamesFromConstants)
10
+ .toEqual(expect.arrayContaining(coordinationTypeNamesFromBasePlugins));
11
+ });
12
+ it('defines schema for only valid coordination types (does not have extra)', () => {
13
+ const coordinationTypeNamesFromConstants = Object.values(CoordinationType).sort();
14
+ const coordinationTypeNamesFromBasePlugins = baseCoordinationTypes.map(ct => ct.name).sort();
15
+ expect(coordinationTypeNamesFromBasePlugins)
16
+ .toEqual(expect.arrayContaining(coordinationTypeNamesFromConstants));
17
+ });
18
+ });
19
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/all",
3
- "version": "2.0.3",
3
+ "version": "3.0.0",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -8,32 +8,40 @@
8
8
  "url": "git+https://github.com/vitessce/vitessce.git"
9
9
  },
10
10
  "license": "MIT",
11
- "main": "dist/index.mjs",
11
+ "type": "module",
12
+ "main": "dist/index.js",
12
13
  "files": [
14
+ "src",
13
15
  "dist",
14
- "src"
16
+ "dist-tsc"
15
17
  ],
16
18
  "dependencies": {
17
19
  "@material-ui/core": "~4.12.3",
18
- "@vitessce/constants-internal": "2.0.3",
19
- "@vitessce/csv": "2.0.3",
20
- "@vitessce/description": "2.0.3",
21
- "@vitessce/feature-list": "2.0.3",
22
- "@vitessce/genomic-profiles": "2.0.3",
23
- "@vitessce/heatmap": "2.0.3",
24
- "@vitessce/json": "2.0.3",
25
- "@vitessce/layer-controller": "2.0.3",
26
- "@vitessce/obs-sets-manager": "2.0.3",
27
- "@vitessce/scatterplot-embedding": "2.0.3",
28
- "@vitessce/scatterplot-gating": "2.0.3",
29
- "@vitessce/spatial": "2.0.3",
30
- "@vitessce/statistical-plots": "2.0.3",
31
- "@vitessce/status": "2.0.3",
32
- "@vitessce/vit-s": "2.0.3",
33
- "@vitessce/zarr": "2.0.3"
20
+ "zod": "^3.21.4",
21
+ "@vitessce/constants-internal": "3.0.0",
22
+ "@vitessce/csv": "3.0.0",
23
+ "@vitessce/description": "3.0.0",
24
+ "@vitessce/feature-list": "3.0.0",
25
+ "@vitessce/genomic-profiles": "3.0.0",
26
+ "@vitessce/heatmap": "3.0.0",
27
+ "@vitessce/json": "3.0.0",
28
+ "@vitessce/layer-controller": "3.0.0",
29
+ "@vitessce/obs-sets-manager": "3.0.0",
30
+ "@vitessce/ome-tiff": "3.0.0",
31
+ "@vitessce/plugins": "3.0.0",
32
+ "@vitessce/scatterplot-embedding": "3.0.0",
33
+ "@vitessce/scatterplot-gating": "3.0.0",
34
+ "@vitessce/schemas": "3.0.0",
35
+ "@vitessce/spatial": "3.0.0",
36
+ "@vitessce/statistical-plots": "3.0.0",
37
+ "@vitessce/status": "3.0.0",
38
+ "@vitessce/vit-s": "3.0.0",
39
+ "@vitessce/zarr": "3.0.0"
34
40
  },
35
41
  "devDependencies": {
36
- "react": "^18.0.0"
42
+ "@types/react": "^18.0.28",
43
+ "react": "^18.0.0",
44
+ "vitest": "^0.23.4"
37
45
  },
38
46
  "peerDependencies": {
39
47
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0"
@@ -41,6 +49,14 @@
41
49
  "scripts": {
42
50
  "start": "pnpm -C ../../../ run start-tsc",
43
51
  "build": "pnpm -C ../../../ run build-tsc",
44
- "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js"
52
+ "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
53
+ "test": "pnpm exec vitest --run -r ../../../ --dir ."
54
+ },
55
+ "module": "dist/index.js",
56
+ "exports": {
57
+ ".": {
58
+ "types": "./dist-tsc/index.d.ts",
59
+ "import": "./dist/index.js"
60
+ }
45
61
  }
46
62
  }
@@ -0,0 +1,74 @@
1
+ /* eslint-disable max-len */
2
+ import React, { useMemo } from 'react';
3
+ import {
4
+ VitS,
5
+ } from '@vitessce/vit-s';
6
+ import {
7
+ upgradeAndParse,
8
+ } from '@vitessce/schemas';
9
+ import {
10
+ baseViewTypes,
11
+ baseFileTypes,
12
+ baseJointFileTypes,
13
+ baseCoordinationTypes,
14
+ } from './base-plugins.js';
15
+
16
+ export function Vitessce(props: any) {
17
+ const {
18
+ config,
19
+ onConfigUpgrade,
20
+ pluginViewTypes: pluginViewTypesProp,
21
+ pluginFileTypes: pluginFileTypesProp,
22
+ pluginCoordinationTypes: pluginCoordinationTypesProp,
23
+ pluginJointFileTypes: pluginJointFileTypesProp,
24
+ } = props;
25
+
26
+ const configUid = config?.uid;
27
+ const configVersion = config?.version;
28
+
29
+ const [configOrWarning, success] = useMemo(() => {
30
+ try {
31
+ const validConfig = upgradeAndParse(config, onConfigUpgrade);
32
+ return [validConfig, true];
33
+ } catch (e) {
34
+ console.error(e);
35
+ return [
36
+ {
37
+ title: 'Config validation or upgrade failed.',
38
+ unformatted: (e as any).message,
39
+ },
40
+ false,
41
+ ];
42
+ }
43
+ // eslint-disable-next-line react-hooks/exhaustive-deps
44
+ }, [configUid, configVersion]);
45
+
46
+ const mergedPluginViewTypes = useMemo(() => ([
47
+ ...baseViewTypes, ...(pluginViewTypesProp || []),
48
+ ]), [pluginViewTypesProp]);
49
+
50
+ const mergedPluginFileTypes = useMemo(() => ([
51
+ ...baseFileTypes, ...(pluginFileTypesProp || []),
52
+ ]), [pluginFileTypesProp]);
53
+
54
+ const mergedPluginJointFileTypes = useMemo(() => ([
55
+ ...baseJointFileTypes, ...(pluginJointFileTypesProp || []),
56
+ ]), [pluginJointFileTypesProp]);
57
+
58
+ const mergedPluginCoordinationTypes = useMemo(() => ([
59
+ ...baseCoordinationTypes, ...(pluginCoordinationTypesProp || []),
60
+ ]), [pluginCoordinationTypesProp]);
61
+
62
+
63
+ return (
64
+ <VitS
65
+ {...props}
66
+ config={configOrWarning}
67
+ viewTypes={mergedPluginViewTypes}
68
+ fileTypes={mergedPluginFileTypes}
69
+ jointFileTypes={mergedPluginJointFileTypes}
70
+ coordinationTypes={mergedPluginCoordinationTypes}
71
+ warning={(success ? null : configOrWarning)}
72
+ />
73
+ );
74
+ }