@vitessce/vit-s 2.0.0-beta.2 → 2.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/VitS.js +2 -4
- package/dist/VitessceGrid.js +5 -1
- package/dist/shared-mui/styles.js +10 -0
- package/dist/state/hooks.js +6 -7
- package/dist/vitessce-grid-layout/VitessceGridLayout.js +4 -5
- package/dist/vitessce-grid-layout/layout-utils.js +0 -1
- package/package.json +4 -4
- package/dist/Vitessce.integration.test.js +0 -36
- package/dist/Vitessce.js +0 -101
- package/dist/export-utils.js +0 -70
- package/dist/export-utils.test.js +0 -66
- package/dist/loader-registry.js +0 -98
- package/dist/schemas/PrettyJsonSchema.js +0 -34
- package/dist/schemas/obsSets.schema.json +0 -194
- package/dist/schemas/obsSetsTabular.schema.json +0 -37
- package/dist/schemas/raster.schema.json +0 -119
- package/dist/schemas/schema.test.js +0 -46
package/dist/VitS.js
CHANGED
|
@@ -3,6 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import React, { useEffect, useMemo } from 'react';
|
|
4
4
|
import { ThemeProvider, StylesProvider, createGenerateClassName, } from '@material-ui/core/styles';
|
|
5
5
|
import isEqual from 'lodash/isEqual';
|
|
6
|
+
import { META_VERSION } from '@vitessce/constants-internal';
|
|
6
7
|
import { muiTheme } from './shared-mui/styles';
|
|
7
8
|
import { ViewConfigProvider, createViewConfigStore, AuxiliaryProvider, createAuxiliaryStore, } from './state/hooks';
|
|
8
9
|
import VitessceGrid from './VitessceGrid';
|
|
@@ -10,14 +11,11 @@ import { Warning } from './Warning';
|
|
|
10
11
|
import CallbackPublisher from './CallbackPublisher';
|
|
11
12
|
import { getComponent } from './component-registry';
|
|
12
13
|
import { checkTypes, initialize, upgradeAndValidate, } from './view-config-utils';
|
|
13
|
-
// TODO(monorepo): figure out how to get the current package version from package.json
|
|
14
|
-
// import packageJson from '../package.json';
|
|
15
|
-
const packageJson = { version: 'unk' };
|
|
16
14
|
const generateClassName = createGenerateClassName({
|
|
17
15
|
disableGlobal: true,
|
|
18
16
|
});
|
|
19
17
|
function logConfig(config, name) {
|
|
20
|
-
console.groupCollapsed(`🚄 Vitessce (${
|
|
18
|
+
console.groupCollapsed(`🚄 Vitessce (${META_VERSION.version}) ${name}`);
|
|
21
19
|
console.info(`data:,${JSON.stringify(config)}`);
|
|
22
20
|
console.info(JSON.stringify(config, null, 2));
|
|
23
21
|
console.groupEnd();
|
package/dist/VitessceGrid.js
CHANGED
|
@@ -38,7 +38,11 @@ export default function VitessceGrid(props) {
|
|
|
38
38
|
const removeComponent = useRemoveComponent();
|
|
39
39
|
const changeLayout = useChangeLayout();
|
|
40
40
|
const layout = useLayout();
|
|
41
|
-
const changeLayoutPostMount = useCallback(() =>
|
|
41
|
+
const changeLayoutPostMount = useCallback((newComponentProps) => {
|
|
42
|
+
if (componentWidth > 0) {
|
|
43
|
+
changeLayout(newComponentProps);
|
|
44
|
+
}
|
|
45
|
+
}, [changeLayout, componentWidth]);
|
|
42
46
|
// Update the view config and loaders in the global state.
|
|
43
47
|
useEffect(() => {
|
|
44
48
|
if (config) {
|
|
@@ -6,6 +6,10 @@ const globalColors = {
|
|
|
6
6
|
grayMid: '#808080',
|
|
7
7
|
grayDark: '#555555',
|
|
8
8
|
black: '#000000',
|
|
9
|
+
grayDarkL5: 'rgb(98, 98, 98)',
|
|
10
|
+
grayDarkD15: 'rgb(47, 47, 47)',
|
|
11
|
+
grayMidL10: 'rgb(154, 154, 154)',
|
|
12
|
+
grayLightL10: 'rgb(237, 237, 237)', // lighten(map-get($global-colors, "gray-light"), 10%);
|
|
9
13
|
};
|
|
10
14
|
export const muiTheme = {
|
|
11
15
|
dark: createTheme({
|
|
@@ -19,6 +23,9 @@ export const muiTheme = {
|
|
|
19
23
|
primaryBackgroundDim: '#333333',
|
|
20
24
|
primaryBackgroundLight: '#757575',
|
|
21
25
|
primaryForeground: '#D3D3D3',
|
|
26
|
+
primaryForegroundL5: 'rgb(224, 224, 224)',
|
|
27
|
+
primaryForegroundL10: 'rgb(237, 237, 237)',
|
|
28
|
+
primaryForegroundD15: 'rgb(173, 173, 173)',
|
|
22
29
|
primaryForegroundDim: '#000000',
|
|
23
30
|
primaryForegroundActive: '#9bb7d6',
|
|
24
31
|
secondaryBackground: '#000000',
|
|
@@ -45,6 +52,9 @@ export const muiTheme = {
|
|
|
45
52
|
primaryBackgroundDim: '#8A8A8A',
|
|
46
53
|
primaryBackgroundLight: '#e0e0e0',
|
|
47
54
|
primaryForeground: '#333333',
|
|
55
|
+
primaryForegroundL5: 'rgb(64, 64, 64)',
|
|
56
|
+
primaryForegroundL10: 'rgb(77, 77, 77)',
|
|
57
|
+
primaryForegroundD15: 'rgb(13, 13, 13)',
|
|
48
58
|
primaryForegroundDim: '#808080',
|
|
49
59
|
primaryForegroundActive: '#0074D9',
|
|
50
60
|
secondaryBackground: '#F1F1F1',
|
package/dist/state/hooks.js
CHANGED
|
@@ -55,13 +55,12 @@ export const createViewConfigStore = () => create(set => ({
|
|
|
55
55
|
};
|
|
56
56
|
}),
|
|
57
57
|
changeLayout: newComponentProps => set((state) => {
|
|
58
|
-
const newLayout = state.viewConfig.layout
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
});
|
|
58
|
+
const newLayout = state.viewConfig.layout
|
|
59
|
+
.slice()
|
|
60
|
+
.map(componentProps => ({
|
|
61
|
+
...componentProps,
|
|
62
|
+
...newComponentProps[componentProps.uid],
|
|
63
|
+
}));
|
|
65
64
|
return {
|
|
66
65
|
viewConfig: {
|
|
67
66
|
...state.viewConfig,
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import { Responsive, WidthProvider } from 'react-grid-layout-with-lodash';
|
|
4
4
|
import isEqual from 'lodash/isEqual';
|
|
5
|
-
import { getMaxRows, resolveLayout
|
|
5
|
+
import { getMaxRows, resolveLayout } from './layout-utils';
|
|
6
6
|
const ResponsiveGridLayout = WidthProvider(Responsive);
|
|
7
7
|
class ResponsiveHeightGridLayout extends ResponsiveGridLayout {
|
|
8
8
|
componentDidUpdate(prevProps) {
|
|
@@ -44,12 +44,11 @@ export function VitessceGridLayout(props) {
|
|
|
44
44
|
const [lastValidGridLayouts, setLastValidGridLayouts] = useState(gridLayouts);
|
|
45
45
|
const onValidLayoutChange = (newLayout) => {
|
|
46
46
|
if (newLayout.length === Object.entries(gridComponents).length) {
|
|
47
|
-
const newComponentProps =
|
|
47
|
+
const newComponentProps = {};
|
|
48
48
|
newLayout.forEach((nextC) => {
|
|
49
49
|
const id = nextC.i;
|
|
50
50
|
const prevC = gridComponents[id];
|
|
51
51
|
if (prevC) {
|
|
52
|
-
const i = parseInt(id.substring(id.indexOf(COMPONENT_ID_PREFIX) + 1), 10);
|
|
53
52
|
const nextProps = {
|
|
54
53
|
x: nextC.x, y: nextC.y, w: nextC.w, h: nextC.h,
|
|
55
54
|
};
|
|
@@ -57,11 +56,11 @@ export function VitessceGridLayout(props) {
|
|
|
57
56
|
x: prevC.x, y: prevC.y, w: prevC.w, h: prevC.h,
|
|
58
57
|
};
|
|
59
58
|
if (!isEqual(nextProps, prevProps)) {
|
|
60
|
-
newComponentProps
|
|
59
|
+
newComponentProps[id] = nextProps;
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
});
|
|
64
|
-
if (newComponentProps.length > 0) {
|
|
63
|
+
if (Object.keys(newComponentProps).length > 0) {
|
|
65
64
|
onLayoutChangeProp(newComponentProps);
|
|
66
65
|
}
|
|
67
66
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/vit-s",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -15,8 +15,6 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@material-ui/core": "~4.12.3",
|
|
17
17
|
"@material-ui/icons": "~4.11.2",
|
|
18
|
-
"@vitessce/constants-internal": "2.0.0-beta.2",
|
|
19
|
-
"@vitessce/utils": "2.0.0-beta.2",
|
|
20
18
|
"ajv": "^6.10.0",
|
|
21
19
|
"clsx": "^1.1.1",
|
|
22
20
|
"fast-deep-equal": "^3.1.3",
|
|
@@ -25,7 +23,9 @@
|
|
|
25
23
|
"lodash": "^4.17.21",
|
|
26
24
|
"react-grid-layout-with-lodash": "^1.3.5",
|
|
27
25
|
"uuid": "^3.3.2",
|
|
28
|
-
"zustand": "^3.5.10"
|
|
26
|
+
"zustand": "^3.5.10",
|
|
27
|
+
"@vitessce/constants-internal": "2.0.1",
|
|
28
|
+
"@vitessce/utils": "2.0.1"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"react": "^18.0.0",
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/* eslint-disable max-len */
|
|
3
|
-
// import React from 'react';
|
|
4
|
-
// import Adapter from 'enzyme-adapter-react-16';
|
|
5
|
-
// import { mount, configure } from 'enzyme';
|
|
6
|
-
// import Ajv from 'ajv';
|
|
7
|
-
// import expect from 'expect';
|
|
8
|
-
// import Vitessce from './Vitessce';
|
|
9
|
-
// import { configs } from './api';
|
|
10
|
-
// import configSchema from '../schemas/config.schema.json';
|
|
11
|
-
// configure({ adapter: new Adapter() });
|
|
12
|
-
// describe('Vitessce.js', () => {
|
|
13
|
-
// describe('<Vitessce />', () => {
|
|
14
|
-
// it('Produces valid view config', (done) => {
|
|
15
|
-
// const config = configs['linnarsson-2018'];
|
|
16
|
-
// let updatedConfig = {};
|
|
17
|
-
// // eslint-disable-next-line no-return-assign
|
|
18
|
-
// const wrapper = mount(<Vitessce config={config} onConfigChange={c => updatedConfig = c} />);
|
|
19
|
-
// setTimeout(() => {
|
|
20
|
-
// // Simulate usage of some of the app
|
|
21
|
-
// wrapper.find('[id^="deckgl-overlay-"]').at(0).simulate('wheel', { deltaY: 1000, deltaX: 1000 });
|
|
22
|
-
// wrapper.find('[id^="deckgl-overlay-"]').at(1).simulate('wheel', { deltaY: 1000, deltaX: 1000 });
|
|
23
|
-
// wrapper.find('[id^="deckgl-overlay-"]').at(2).simulate('wheel', { deltaY: 1000, deltaX: 1000 });
|
|
24
|
-
// const validate = new Ajv().compile(configSchema);
|
|
25
|
-
// const valid = validate(updatedConfig);
|
|
26
|
-
// if (!valid) {
|
|
27
|
-
// const failureReason = JSON.stringify(validate.errors, null, 2);
|
|
28
|
-
// console.error(failureReason);
|
|
29
|
-
// }
|
|
30
|
-
// expect(valid).toEqual(true);
|
|
31
|
-
// wrapper.unmount();
|
|
32
|
-
// done();
|
|
33
|
-
// }, 20000);
|
|
34
|
-
// }).timeout(30000);
|
|
35
|
-
// });
|
|
36
|
-
// });
|
package/dist/Vitessce.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable camelcase */
|
|
3
|
-
import React, { useEffect, useMemo } from 'react';
|
|
4
|
-
import { ThemeProvider, StylesProvider, createGenerateClassName, } from '@material-ui/core/styles';
|
|
5
|
-
import isEqual from 'lodash/isEqual';
|
|
6
|
-
import { muiTheme } from './shared-mui/styles';
|
|
7
|
-
import { ViewConfigProvider, createViewConfigStore, AuxiliaryProvider, createAuxiliaryStore, } from './state/hooks';
|
|
8
|
-
import VitessceGrid from './VitessceGrid';
|
|
9
|
-
import { Warning } from './Warning';
|
|
10
|
-
import CallbackPublisher from './CallbackPublisher';
|
|
11
|
-
import { getComponent } from './component-registry';
|
|
12
|
-
import { checkTypes, initialize, upgradeAndValidate } from './view-config-utils';
|
|
13
|
-
// TODO(monorepo): figure out how to get the current package version from package.json
|
|
14
|
-
// import packageJson from '../package.json';
|
|
15
|
-
const packageJson = { version: 'unk' };
|
|
16
|
-
const generateClassName = createGenerateClassName({
|
|
17
|
-
disableGlobal: true,
|
|
18
|
-
});
|
|
19
|
-
function logConfig(config, name) {
|
|
20
|
-
console.groupCollapsed(`🚄 Vitessce (${packageJson.version}) ${name}`);
|
|
21
|
-
console.info(`data:,${JSON.stringify(config)}`);
|
|
22
|
-
console.info(JSON.stringify(config, null, 2));
|
|
23
|
-
console.groupEnd();
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* The Vitessce component.
|
|
27
|
-
* @param {object} props
|
|
28
|
-
* @param {object} props.config A Vitessce view config.
|
|
29
|
-
* If the config is valid, the VitessceGrid will be rendered as a child.
|
|
30
|
-
* If the config is invalid, a Warning will be rendered instead.
|
|
31
|
-
* @param {number} props.rowHeight Row height for grid layout. Optional.
|
|
32
|
-
* @param {number} props.height Total height for grid layout. Optional.
|
|
33
|
-
* @param {string} props.theme The theme, used for styling as
|
|
34
|
-
* light or dark. Optional. By default, "dark"
|
|
35
|
-
* @param {function} props.onWarn A callback for warning messages. Optional.
|
|
36
|
-
* @param {function} props.onConfigChange A callback for view config
|
|
37
|
-
* updates. Optional.
|
|
38
|
-
* @param {function} props.onLoaderChange A callback for loader
|
|
39
|
-
* updates. Optional.
|
|
40
|
-
* @param {boolean} props.validateOnConfigChange Whether to validate
|
|
41
|
-
* against the view config schema when publishing changes. Use for debugging
|
|
42
|
-
* purposes, as this may have a performance impact. By default, false.
|
|
43
|
-
*/
|
|
44
|
-
export function Vitessce(props) {
|
|
45
|
-
const { config, rowHeight, height, theme, onWarn, onConfigChange, onLoaderChange, validateOnConfigChange = false, onConfigUpgrade, isBounded = false, } = props;
|
|
46
|
-
// Process the view config and memoize the result:
|
|
47
|
-
// - Validate.
|
|
48
|
-
// - Upgrade, if legacy schema.
|
|
49
|
-
// - Validate after upgrade, if legacy schema.
|
|
50
|
-
// - Initialize (based on initStrategy).
|
|
51
|
-
const [configOrWarning, success] = useMemo(() => {
|
|
52
|
-
// If the config value is undefined, show a warning message.
|
|
53
|
-
if (!config) {
|
|
54
|
-
return [{
|
|
55
|
-
title: 'No such dataset',
|
|
56
|
-
unformatted: 'The dataset configuration could not be found.',
|
|
57
|
-
}, false];
|
|
58
|
-
}
|
|
59
|
-
// If the view config is missing a version, show a warning message.
|
|
60
|
-
if (!config.version) {
|
|
61
|
-
return [{
|
|
62
|
-
title: 'Missing version',
|
|
63
|
-
unformatted: 'The dataset configuration is missing a version, preventing validation.',
|
|
64
|
-
}, false];
|
|
65
|
-
}
|
|
66
|
-
logConfig(config, 'input view config');
|
|
67
|
-
// Check if this is a "legacy" view config.
|
|
68
|
-
const [upgradedConfig, upgradeSuccess] = upgradeAndValidate(config, onConfigUpgrade);
|
|
69
|
-
if (upgradeSuccess) {
|
|
70
|
-
logConfig(upgradedConfig, 'upgraded view config');
|
|
71
|
-
// Initialize the view config according to the initStrategy.
|
|
72
|
-
const [typeCheckSuccess, typeCheckMessage] = checkTypes(upgradedConfig);
|
|
73
|
-
if (typeCheckSuccess) {
|
|
74
|
-
try {
|
|
75
|
-
const initializedConfig = initialize(upgradedConfig);
|
|
76
|
-
logConfig(initializedConfig, 'initialized view config');
|
|
77
|
-
return [initializedConfig, true];
|
|
78
|
-
}
|
|
79
|
-
catch (e) {
|
|
80
|
-
return [{
|
|
81
|
-
title: 'View config initialization failed.',
|
|
82
|
-
unformatted: e.message,
|
|
83
|
-
}, false];
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return [{
|
|
87
|
-
title: 'View config checks failed.',
|
|
88
|
-
unformatted: typeCheckMessage,
|
|
89
|
-
}, false];
|
|
90
|
-
}
|
|
91
|
-
return [upgradedConfig, false];
|
|
92
|
-
}, [config, onConfigUpgrade]);
|
|
93
|
-
// Emit the upgraded/initialized view config
|
|
94
|
-
// to onConfigChange if necessary.
|
|
95
|
-
useEffect(() => {
|
|
96
|
-
if (success && !isEqual(configOrWarning, config) && onConfigChange) {
|
|
97
|
-
onConfigChange(configOrWarning);
|
|
98
|
-
}
|
|
99
|
-
}, [success, config, configOrWarning, onConfigChange]);
|
|
100
|
-
return success ? (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(ViewConfigProvider, { createStore: createViewConfigStore, children: _jsxs(AuxiliaryProvider, { createStore: createAuxiliaryStore, children: [_jsx(VitessceGrid, { config: configOrWarning, getComponent: getComponent, rowHeight: rowHeight, height: height, theme: theme, isBounded: isBounded }), _jsx(CallbackPublisher, { onWarn: onWarn, onConfigChange: onConfigChange, onLoaderChange: onLoaderChange, validateOnConfigChange: validateOnConfigChange })] }) }) }) })) : (_jsx(StylesProvider, { generateClassName: generateClassName, children: _jsx(ThemeProvider, { theme: muiTheme[theme], children: _jsx(Warning, { ...configOrWarning }) }) }));
|
|
101
|
-
}
|
package/dist/export-utils.js
DELETED
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import Bowser from 'bowser';
|
|
2
|
-
import { compressToEncodedURIComponent, decompressFromEncodedURIComponent } from 'lz-string';
|
|
3
|
-
const CURRENT_VERSION = '0.0.1';
|
|
4
|
-
const VITESSCE_CONF_QUERY_STRING = 'vitessce_conf';
|
|
5
|
-
const VERSION_QUERY_STRING = 'vitessce_conf_version';
|
|
6
|
-
const LENGTH_QUERY_STRING = 'vitessce_conf_length';
|
|
7
|
-
function sniffBrowser() {
|
|
8
|
-
const { browser } = Bowser.parse(window.navigator.userAgent);
|
|
9
|
-
return browser.name;
|
|
10
|
-
}
|
|
11
|
-
// https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url-in-different-browsers
|
|
12
|
-
const MAX_BROWSER_URL_LENGTHS = {
|
|
13
|
-
Chrome: 32779,
|
|
14
|
-
'Internet Explorer': 2047,
|
|
15
|
-
Edge: 2047,
|
|
16
|
-
Safari: 65000,
|
|
17
|
-
Firefox: 65000,
|
|
18
|
-
};
|
|
19
|
-
export default class CompressedConfLengthError {
|
|
20
|
-
constructor(message) {
|
|
21
|
-
this.message = message;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Encode a configuration as url params with a version and an lz-compressed conf.
|
|
26
|
-
* @param {Object} params
|
|
27
|
-
* @param {Object} params.conf Previous scope names.
|
|
28
|
-
* @param {function} params.onOverMaximumUrlLength Callback for when new url
|
|
29
|
-
* is over max length for your browser - takes two arguments: { message, willWorkOn }
|
|
30
|
-
* for the error message and the browsers for which the url will work (optional).
|
|
31
|
-
* @returns {string} The new params like
|
|
32
|
-
* vitessce_conf_length=10&vitessce_conf_version=0.0.1&vitessce_conf=fksdfasdfjkl
|
|
33
|
-
*/
|
|
34
|
-
export function encodeConfInUrl({ conf, onOverMaximumUrlLength = () => { }, }) {
|
|
35
|
-
const compressedConf = compressToEncodedURIComponent(JSON.stringify(conf));
|
|
36
|
-
const newParams = `${LENGTH_QUERY_STRING}=${compressedConf.length}&${VERSION_QUERY_STRING}=${CURRENT_VERSION}&${VITESSCE_CONF_QUERY_STRING}=${compressedConf}`;
|
|
37
|
-
const browser = sniffBrowser();
|
|
38
|
-
const maxLength = MAX_BROWSER_URL_LENGTHS[browser];
|
|
39
|
-
if (newParams.length > maxLength) {
|
|
40
|
-
const willWorkOn = Object.entries(MAX_BROWSER_URL_LENGTHS)
|
|
41
|
-
.filter(entry => entry[1] > newParams.length)
|
|
42
|
-
.map(entry => entry[0]);
|
|
43
|
-
const message = `Configuration is ${compressedConf.length} characters; max URL for ${browser} is ${maxLength}: it will work on ${willWorkOn.join(', ') || 'no browser'}.`;
|
|
44
|
-
console.error(message);
|
|
45
|
-
onOverMaximumUrlLength({ message, willWorkOn });
|
|
46
|
-
}
|
|
47
|
-
return newParams;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Decode URL params to a Vitessce configuration.
|
|
51
|
-
* The URL params must have version and vitessce_conf params,
|
|
52
|
-
* like vitessce_conf_length=10&vitessce_conf_version=0.0.1&vitessce_conf=fksdfasdfjkl.
|
|
53
|
-
* @param {Object} queryString The URL params,
|
|
54
|
-
* like vitessce_conf_length=10&vitessce_conf_version=0.0.1&vitessce_conf=fksdfasdfjkl.
|
|
55
|
-
* @returns {string} A vitessce configuration.
|
|
56
|
-
*/
|
|
57
|
-
export function decodeURLParamsToConf(queryString) {
|
|
58
|
-
const params = new URLSearchParams(queryString.replace('#', '&'));
|
|
59
|
-
const compressedConfString = params.get(VITESSCE_CONF_QUERY_STRING);
|
|
60
|
-
const expectedConfLength = Number(params.get(LENGTH_QUERY_STRING));
|
|
61
|
-
if (expectedConfLength !== compressedConfString.length) {
|
|
62
|
-
throw new CompressedConfLengthError(`Compressed conf length (${compressedConfString.length}) != expected (${expectedConfLength}). URL truncated?`);
|
|
63
|
-
}
|
|
64
|
-
const version = params.get(VERSION_QUERY_STRING);
|
|
65
|
-
if (version === CURRENT_VERSION) {
|
|
66
|
-
const conf = JSON.parse(decompressFromEncodedURIComponent(compressedConfString));
|
|
67
|
-
return conf;
|
|
68
|
-
}
|
|
69
|
-
throw new Error('Unrecognized URL Param Version');
|
|
70
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import expect from 'expect';
|
|
2
|
-
import { encodeConfInUrl, decodeURLParamsToConf, } from './export-utils';
|
|
3
|
-
const fakeConfig = {
|
|
4
|
-
version: '0.1.0',
|
|
5
|
-
public: false,
|
|
6
|
-
layers: [
|
|
7
|
-
{
|
|
8
|
-
name: 'cells',
|
|
9
|
-
type: 'CELLS',
|
|
10
|
-
fileType: 'cells.json',
|
|
11
|
-
url: 'http://example.com/cells.json',
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
name: 'Just scatterplot',
|
|
15
|
-
staticLayout: [
|
|
16
|
-
{
|
|
17
|
-
component: 'scatterplot',
|
|
18
|
-
props: {
|
|
19
|
-
mapping: 't-SNE',
|
|
20
|
-
view: {
|
|
21
|
-
zoom: 0.75,
|
|
22
|
-
target: [0, 0, 0],
|
|
23
|
-
},
|
|
24
|
-
},
|
|
25
|
-
x: 0,
|
|
26
|
-
y: 0,
|
|
27
|
-
w: 12,
|
|
28
|
-
h: 2,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
};
|
|
32
|
-
function makeLongString(length) {
|
|
33
|
-
let result = '';
|
|
34
|
-
const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
|
|
35
|
-
const charactersLength = characters.length;
|
|
36
|
-
// eslint-disable-next-line no-plusplus
|
|
37
|
-
for (let i = 0; i < length; i++) {
|
|
38
|
-
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
39
|
-
}
|
|
40
|
-
return result;
|
|
41
|
-
}
|
|
42
|
-
describe('src/app/export-utils.js', () => {
|
|
43
|
-
describe('encodeConfInUrl', () => {
|
|
44
|
-
it('encodes a view config for a URL', () => {
|
|
45
|
-
const urlParams1 = encodeConfInUrl({ conf: {} });
|
|
46
|
-
expect(urlParams1).toEqual('vitessce_conf_length=5&vitessce_conf_version=0.0.1&vitessce_conf=N4XyA');
|
|
47
|
-
const urlParams2 = encodeConfInUrl({ conf: fakeConfig });
|
|
48
|
-
expect(urlParams2).toEqual('vitessce_conf_length=327&vitessce_conf_version=0.0.1&vitessce_conf=N4IgbgpgTgzglgewHYgFwgAwDoCMWMgA0IADgK4BGANnAMZoBmAhlTBMVUwJ7QxoDaoJEwC2ENCFoQqrIiAAuXEuPQBhAKIAZTQGU5DOFQgAVJSsnTWWAFYxkcslCoSAFvPklUAei8QAHqIkRli0CCJeUjIwNnYoAL4AusTCYhIAUmQw8gAEMLRM7tBBCPJyWQV0mtwIZKWogpJhJMgQSHUgeQXyRVQlciRQCCR8qKAiTCQkcEgA5hLyALQ6AHLqcmBwEADuaKAAXghhaNgA7ACsxPJMUDMQdfwYhI8YCXFxxH7HxFxfIDuoOAATMQXGhAYk4kA');
|
|
49
|
-
});
|
|
50
|
-
it('Calls onOverMaximumUrlLength for conf too long', () => {
|
|
51
|
-
let browsers;
|
|
52
|
-
// eslint-disable-next-line no-return-assign
|
|
53
|
-
const onOverMaximumUrlLength = ({ willWorkOn }) => browsers = willWorkOn;
|
|
54
|
-
encodeConfInUrl({ conf: { foo: makeLongString(69000) }, onOverMaximumUrlLength });
|
|
55
|
-
expect(browsers).toEqual([]);
|
|
56
|
-
encodeConfInUrl({ conf: { foo: makeLongString(37000) }, onOverMaximumUrlLength });
|
|
57
|
-
expect(browsers).toEqual(['Safari', 'Firefox']);
|
|
58
|
-
});
|
|
59
|
-
it('decodes a view config for a URL', () => {
|
|
60
|
-
const viewConfig1 = decodeURLParamsToConf('vitessce_conf_length=5&vitessce_conf_version=0.0.1&vitessce_conf=N4XyA');
|
|
61
|
-
expect(viewConfig1).toEqual({});
|
|
62
|
-
const viewConfig2 = decodeURLParamsToConf('vitessce_conf_length=327&vitessce_conf_version=0.0.1&vitessce_conf=N4IgbgpgTgzglgewHYgFwgAwDoCMWMgA0IADgK4BGANnAMZoBmAhlTBMVUwJ7QxoDaoJEwC2ENCFoQqrIiAAuXEuPQBhAKIAZTQGU5DOFQgAVJSsnTWWAFYxkcslCoSAFvPklUAei8QAHqIkRli0CCJeUjIwNnYoAL4AusTCYhIAUmQw8gAEMLRM7tBBCPJyWQV0mtwIZKWogpJhJMgQSHUgeQXyRVQlciRQCCR8qKAiTCQkcEgA5hLyALQ6AHLqcmBwEADuaKAAXghhaNgA7ACsxPJMUDMQdfwYhI8YCXFxxH7HxFxfIDuoOAATMQXGhAYk4kA');
|
|
63
|
-
expect(viewConfig2).toEqual(fakeConfig);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
package/dist/loader-registry.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { getLoaderClassesForPluginFileType, } from './plugins';
|
|
2
|
-
// TODO(monorepo)
|
|
3
|
-
/*
|
|
4
|
-
import {
|
|
5
|
-
AnnDataSource,
|
|
6
|
-
ZarrDataSource,
|
|
7
|
-
JsonSource,
|
|
8
|
-
CsvSource,
|
|
9
|
-
} from './data-sources';
|
|
10
|
-
import JsonLoader from './json-loaders/JsonLoader';
|
|
11
|
-
import ObsSetsJsonLoader from './json-loaders/ObsSetsJson';
|
|
12
|
-
import ObsSegmentationsJsonLoader from './json-loaders/ObsSegmentationsJson';
|
|
13
|
-
import OmeZarrLoader from './OmeZarrLoader';
|
|
14
|
-
import AnnDataLoaders from './anndata-loaders';
|
|
15
|
-
import GenomicProfilesZarrLoader from './GenomicProfilesZarrLoader';
|
|
16
|
-
import CellsJsonAsObsLabelsLoader from './legacy-loaders/CellsJsonAsObsLabels';
|
|
17
|
-
import CellsJsonAsObsEmbeddingLoader from './legacy-loaders/CellsJsonAsObsEmbedding';
|
|
18
|
-
import CellsJsonAsObsSegmentationsLoader from './legacy-loaders/CellsJsonAsObsSegmentations';
|
|
19
|
-
import ClustersJsonAsObsFeatureMatrixLoader from './legacy-loaders/ClustersJsonAsObsFeatureMatrix';
|
|
20
|
-
import GenesJsonAsObsFeatureMatrixLoader from './legacy-loaders/GenesJsonAsObsFeatureMatrix';
|
|
21
|
-
import RasterJsonAsImageLoader from './raster-json-loaders/RasterJsonAsImageLoader';
|
|
22
|
-
import RasterJsonAsObsSegmentationsLoader from './raster-json-loaders/RasterJsonAsObsSegmentationsLoader';
|
|
23
|
-
import MatrixZarrAsObsFeatureMatrixLoader from './matrix-loaders/MatrixZarrAsObsFeatureMatrix';
|
|
24
|
-
import MoleculesJsonAsObsLocationsLoader from './legacy-loaders/MoleculesJsonAsObsLocations';
|
|
25
|
-
import MoleculesJsonAsObsLabelsLoader from './legacy-loaders/MoleculesJsonAsObsLabels';
|
|
26
|
-
import CellsJsonAsObsLocationsLoader from './legacy-loaders/CellsJsonAsObsLocations';
|
|
27
|
-
import ObsEmbeddingCsvLoader from './csv-loaders/ObsEmbeddingCsv';
|
|
28
|
-
import ObsLocationsCsvLoader from './csv-loaders/ObsLocationsCsv';
|
|
29
|
-
import ObsLabelsCsvLoader from './csv-loaders/ObsLabelsCsv';
|
|
30
|
-
import FeatureLabelsCsvLoader from './csv-loaders/FeatureLabelsCsv';
|
|
31
|
-
import ObsFeatureMatrixCsvLoader from './csv-loaders/ObsFeatureMatrixCsv';
|
|
32
|
-
import ObsSetsCsvLoader from './csv-loaders/ObsSetsCsv';
|
|
33
|
-
*/
|
|
34
|
-
export const fileTypeToLoaderAndSource = {
|
|
35
|
-
// TODO(monorepo)
|
|
36
|
-
/*
|
|
37
|
-
[FileType.OBS_EMBEDDING_CSV]: [CsvSource, ObsEmbeddingCsvLoader],
|
|
38
|
-
[FileType.OBS_LOCATIONS_CSV]: [CsvSource, ObsLocationsCsvLoader],
|
|
39
|
-
[FileType.OBS_LABELS_CSV]: [CsvSource, ObsLabelsCsvLoader],
|
|
40
|
-
[FileType.FEATURE_LABELS_CSV]: [CsvSource, FeatureLabelsCsvLoader],
|
|
41
|
-
[FileType.OBS_FEATURE_MATRIX_CSV]: [CsvSource, ObsFeatureMatrixCsvLoader],
|
|
42
|
-
[FileType.OBS_SEGMENTATIONS_JSON]: [JsonSource, ObsSegmentationsJsonLoader],
|
|
43
|
-
[FileType.OBS_SETS_CSV]: [CsvSource, ObsSetsCsvLoader],
|
|
44
|
-
[FileType.OBS_FEATURE_MATRIX_ANNDATA_ZARR]: [
|
|
45
|
-
AnnDataSource, AnnDataLoaders.ObsFeatureMatrixAnndataLoader,
|
|
46
|
-
],
|
|
47
|
-
[FileType.OBS_SETS_ANNDATA_ZARR]: [
|
|
48
|
-
AnnDataSource, AnnDataLoaders.ObsSetsAnndataLoader,
|
|
49
|
-
],
|
|
50
|
-
[FileType.OBS_EMBEDDING_ANNDATA_ZARR]: [
|
|
51
|
-
AnnDataSource, AnnDataLoaders.ObsEmbeddingAnndataLoader,
|
|
52
|
-
],
|
|
53
|
-
[FileType.OBS_LOCATIONS_ANNDATA_ZARR]: [
|
|
54
|
-
AnnDataSource, AnnDataLoaders.ObsLocationsAnndataLoader,
|
|
55
|
-
],
|
|
56
|
-
[FileType.OBS_SEGMENTATIONS_ANNDATA_ZARR]: [
|
|
57
|
-
AnnDataSource, AnnDataLoaders.ObsSegmentationsAnndataLoader,
|
|
58
|
-
],
|
|
59
|
-
[FileType.OBS_LABELS_ANNDATA_ZARR]: [
|
|
60
|
-
AnnDataSource, AnnDataLoaders.ObsLabelsAnndataLoader,
|
|
61
|
-
],
|
|
62
|
-
[FileType.OBS_FEATURE_MATRIX_EXPRESSION_MATRIX_ZARR]: [
|
|
63
|
-
ZarrDataSource, MatrixZarrAsObsFeatureMatrixLoader,
|
|
64
|
-
],
|
|
65
|
-
[FileType.FEATURE_LABELS_ANNDATA_ZARR]: [
|
|
66
|
-
AnnDataSource, AnnDataLoaders.FeatureLabelsAnndataLoader,
|
|
67
|
-
],
|
|
68
|
-
[FileType.IMAGE_OME_ZARR]: [ZarrDataSource, OmeZarrLoader],
|
|
69
|
-
[FileType.IMAGE_RASTER_JSON]: [JsonSource, RasterJsonAsImageLoader],
|
|
70
|
-
[FileType.OBS_SEGMENTATIONS_RASTER_JSON]: [JsonSource, RasterJsonAsObsSegmentationsLoader],
|
|
71
|
-
[FileType.OBS_SETS_JSON]: [JsonSource, ObsSetsJsonLoader],
|
|
72
|
-
[FileType.OBS_SETS_CELL_SETS_JSON]: [JsonSource, ObsSetsJsonLoader],
|
|
73
|
-
[FileType.OBS_FEATURE_MATRIX_CLUSTERS_JSON]: [JsonSource, ClustersJsonAsObsFeatureMatrixLoader],
|
|
74
|
-
[FileType.OBS_FEATURE_MATRIX_GENES_JSON]: [JsonSource, GenesJsonAsObsFeatureMatrixLoader],
|
|
75
|
-
[FileType.OBS_LABELS_CELLS_JSON]: [JsonSource, CellsJsonAsObsLabelsLoader],
|
|
76
|
-
[FileType.OBS_EMBEDDING_CELLS_JSON]: [JsonSource, CellsJsonAsObsEmbeddingLoader],
|
|
77
|
-
[FileType.OBS_LOCATIONS_CELLS_JSON]: [JsonSource, CellsJsonAsObsLocationsLoader],
|
|
78
|
-
[FileType.OBS_SEGMENTATIONS_CELLS_JSON]: [JsonSource, CellsJsonAsObsSegmentationsLoader],
|
|
79
|
-
[FileType.OBS_LOCATIONS_MOLECULES_JSON]: [JsonSource, MoleculesJsonAsObsLocationsLoader],
|
|
80
|
-
[FileType.OBS_LABELS_MOLECULES_JSON]: [JsonSource, MoleculesJsonAsObsLabelsLoader],
|
|
81
|
-
// Old mappings:
|
|
82
|
-
[FileType.NEIGHBORHOODS_JSON]: [JsonSource, JsonLoader],
|
|
83
|
-
[FileType.GENOMIC_PROFILES_ZARR]: [ZarrDataSource, GenomicProfilesZarrLoader],
|
|
84
|
-
*/
|
|
85
|
-
};
|
|
86
|
-
export function getSourceAndLoaderFromFileType(type) {
|
|
87
|
-
if (fileTypeToLoaderAndSource[type]) {
|
|
88
|
-
return fileTypeToLoaderAndSource[type];
|
|
89
|
-
}
|
|
90
|
-
const pluginFileType = getLoaderClassesForPluginFileType(type);
|
|
91
|
-
if (pluginFileType) {
|
|
92
|
-
return pluginFileType;
|
|
93
|
-
}
|
|
94
|
-
// Fallback to JSON.
|
|
95
|
-
// TODO(monorepo)
|
|
96
|
-
// return [JsonSource, JsonLoader];
|
|
97
|
-
return [null, null];
|
|
98
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import yaml from 'js-yaml'; // eslint-disable-line import/no-extraneous-dependencies
|
|
4
|
-
// This should only be used by docz, and should not be part of the app build.
|
|
5
|
-
function abbreviateType(yamlString) {
|
|
6
|
-
return yamlString.replace(/:\s+type: (\w+)/g, ' ($1):');
|
|
7
|
-
}
|
|
8
|
-
function abbreviateRef(yamlString) {
|
|
9
|
-
return yamlString.replace(/:\s+\$ref: '#\/definitions\/(\w+)'/g, ' ($1)');
|
|
10
|
-
}
|
|
11
|
-
function stripAddProps(yamlString) {
|
|
12
|
-
// This should be the default in our schemas, but we don't need it in the docs.
|
|
13
|
-
return yamlString.replace(/\s+additionalProperties: false/g, '');
|
|
14
|
-
}
|
|
15
|
-
function valuesAre(yamlString) {
|
|
16
|
-
return yamlString.replace(/patternProperties:\s+\./g, 'Object values are');
|
|
17
|
-
}
|
|
18
|
-
function hasProperties(yamlString) {
|
|
19
|
-
return yamlString.replace(/\.:\s+properties:/g, 'Each value has these properties:');
|
|
20
|
-
}
|
|
21
|
-
function pretty(title, obj) {
|
|
22
|
-
// This is entirely ad-hoc:
|
|
23
|
-
// It woks well for our schema, but no assertion that it should work for anyone else.
|
|
24
|
-
if (!obj)
|
|
25
|
-
return '';
|
|
26
|
-
return (_jsxs(_Fragment, { children: [_jsx("h3", { children: title }), _jsx("pre", { children: hasProperties(valuesAre(stripAddProps(abbreviateRef(abbreviateType(yaml.safeDump(obj)))))) })] }));
|
|
27
|
-
}
|
|
28
|
-
export default function PrettyJsonSchema(props) {
|
|
29
|
-
const { children } = props;
|
|
30
|
-
const { definitions, patternProperties, properties } = children;
|
|
31
|
-
// We could grab the title as well, but when we output an <h2> it is not anchored;
|
|
32
|
-
// better to put the section headers in MD.
|
|
33
|
-
return (_jsxs("blockquote", { children: [pretty('Definitions', definitions), pretty('Properties', patternProperties), pretty('Properties', properties)] }));
|
|
34
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://github.com/vitessce/vitessce/#cell-sets",
|
|
4
|
-
"title": "Vitessce obs sets data",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"definitions": {
|
|
7
|
-
"stringArray": {
|
|
8
|
-
"type": "array",
|
|
9
|
-
"items": {
|
|
10
|
-
"type": "string"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"stringProbabilityTupleArray": {
|
|
14
|
-
"type": "array",
|
|
15
|
-
"items": {
|
|
16
|
-
"type": "array",
|
|
17
|
-
"additionalItems": false,
|
|
18
|
-
"items": [
|
|
19
|
-
{
|
|
20
|
-
"type": "string"
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
"oneOf": [
|
|
24
|
-
{
|
|
25
|
-
"type": "number",
|
|
26
|
-
"minimum": 0.0,
|
|
27
|
-
"maximum": 1.0
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"type": "null"
|
|
31
|
-
}
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"colorArray": {
|
|
38
|
-
"type": "array",
|
|
39
|
-
"items": {
|
|
40
|
-
"type": "integer",
|
|
41
|
-
"minimum": 0,
|
|
42
|
-
"maximum": 255
|
|
43
|
-
},
|
|
44
|
-
"minItems": 3,
|
|
45
|
-
"maxItems": 3
|
|
46
|
-
},
|
|
47
|
-
"treeNodeLeaf": {
|
|
48
|
-
"type": "object",
|
|
49
|
-
"additionalProperties": false,
|
|
50
|
-
"required": ["name"],
|
|
51
|
-
"properties": {
|
|
52
|
-
"name": {
|
|
53
|
-
"type": "string"
|
|
54
|
-
},
|
|
55
|
-
"color": {
|
|
56
|
-
"$ref": "#/definitions/colorArray"
|
|
57
|
-
},
|
|
58
|
-
"set": {
|
|
59
|
-
"$ref": "#/definitions/stringArray"
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
},
|
|
63
|
-
"treeNodeNonLeaf": {
|
|
64
|
-
"type": "object",
|
|
65
|
-
"additionalProperties": false,
|
|
66
|
-
"required": ["name"],
|
|
67
|
-
"properties": {
|
|
68
|
-
"name": {
|
|
69
|
-
"type": "string"
|
|
70
|
-
},
|
|
71
|
-
"color": {
|
|
72
|
-
"$ref": "#/definitions/colorArray"
|
|
73
|
-
},
|
|
74
|
-
"children": {
|
|
75
|
-
"type": "array",
|
|
76
|
-
"items": {
|
|
77
|
-
"$ref": "#/definitions/treeNode"
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
"treeNode": {
|
|
83
|
-
"oneOf": [
|
|
84
|
-
{
|
|
85
|
-
"$ref": "#/definitions/treeNodeNonLeaf"
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
"$ref": "#/definitions/treeNodeLeaf"
|
|
89
|
-
}
|
|
90
|
-
]
|
|
91
|
-
},
|
|
92
|
-
"version0.1.2": {
|
|
93
|
-
"type": "object",
|
|
94
|
-
"additionalProperties": false,
|
|
95
|
-
"required": ["version", "datatype", "tree"],
|
|
96
|
-
"properties": {
|
|
97
|
-
"dataset": {
|
|
98
|
-
"type": "string"
|
|
99
|
-
},
|
|
100
|
-
"version": {
|
|
101
|
-
"type": "string",
|
|
102
|
-
"enum": ["0.1.2"]
|
|
103
|
-
},
|
|
104
|
-
"datatype": {
|
|
105
|
-
"type": "string",
|
|
106
|
-
"enum": ["cell", "obs"]
|
|
107
|
-
},
|
|
108
|
-
"tree": {
|
|
109
|
-
"type": "array",
|
|
110
|
-
"items": {
|
|
111
|
-
"$ref": "#/definitions/treeNodeNonLeaf"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
},
|
|
116
|
-
"treeNodeLeafProbabilistic": {
|
|
117
|
-
"type": "object",
|
|
118
|
-
"additionalProperties": false,
|
|
119
|
-
"required": ["name"],
|
|
120
|
-
"properties": {
|
|
121
|
-
"name": {
|
|
122
|
-
"type": "string"
|
|
123
|
-
},
|
|
124
|
-
"color": {
|
|
125
|
-
"$ref": "#/definitions/colorArray"
|
|
126
|
-
},
|
|
127
|
-
"set": {
|
|
128
|
-
"$ref": "#/definitions/stringProbabilityTupleArray"
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"treeNodeNonLeafProbabilistic": {
|
|
133
|
-
"type": "object",
|
|
134
|
-
"additionalProperties": false,
|
|
135
|
-
"required": ["name"],
|
|
136
|
-
"properties": {
|
|
137
|
-
"name": {
|
|
138
|
-
"type": "string"
|
|
139
|
-
},
|
|
140
|
-
"color": {
|
|
141
|
-
"$ref": "#/definitions/colorArray"
|
|
142
|
-
},
|
|
143
|
-
"children": {
|
|
144
|
-
"type": "array",
|
|
145
|
-
"items": {
|
|
146
|
-
"$ref": "#/definitions/treeNodeProbabilistic"
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
"treeNodeProbabilistic": {
|
|
152
|
-
"oneOf": [
|
|
153
|
-
{
|
|
154
|
-
"$ref": "#/definitions/treeNodeNonLeafProbabilistic"
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
"$ref": "#/definitions/treeNodeLeafProbabilistic"
|
|
158
|
-
}
|
|
159
|
-
]
|
|
160
|
-
},
|
|
161
|
-
"version0.1.3": {
|
|
162
|
-
"type": "object",
|
|
163
|
-
"additionalProperties": false,
|
|
164
|
-
"required": ["version", "datatype", "tree"],
|
|
165
|
-
"properties": {
|
|
166
|
-
"dataset": {
|
|
167
|
-
"type": "string"
|
|
168
|
-
},
|
|
169
|
-
"version": {
|
|
170
|
-
"type": "string",
|
|
171
|
-
"enum": ["0.1.3"]
|
|
172
|
-
},
|
|
173
|
-
"datatype": {
|
|
174
|
-
"type": "string",
|
|
175
|
-
"enum": ["cell", "obs"]
|
|
176
|
-
},
|
|
177
|
-
"tree": {
|
|
178
|
-
"type": "array",
|
|
179
|
-
"items": {
|
|
180
|
-
"$ref": "#/definitions/treeNodeNonLeafProbabilistic"
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
"oneOf": [
|
|
187
|
-
{
|
|
188
|
-
"$ref": "#/definitions/version0.1.2"
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
"$ref": "#/definitions/version0.1.3"
|
|
192
|
-
}
|
|
193
|
-
]
|
|
194
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://github.com/vitessce/vitessce/#obsSetsTabular",
|
|
4
|
-
"title": "Vitessce obs sets data, tabular format",
|
|
5
|
-
"definitions": {
|
|
6
|
-
"colorArray": {
|
|
7
|
-
"type": "array",
|
|
8
|
-
"items": { "type": "integer", "minimum": 0, "maximum": 255 },
|
|
9
|
-
"minItems": 3,
|
|
10
|
-
"maxItems": 3
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"type": "array",
|
|
14
|
-
"items": {
|
|
15
|
-
"type": "object",
|
|
16
|
-
"additionalProperties": false,
|
|
17
|
-
"required": ["groupName", "setName", "obsId"],
|
|
18
|
-
"properties": {
|
|
19
|
-
"groupName": { "type": "string" },
|
|
20
|
-
"setName": { "type": "string" },
|
|
21
|
-
"setColor": { "$ref": "#/definitions/colorArray" },
|
|
22
|
-
"obsId": { "type": "string" },
|
|
23
|
-
"predictionScore": {
|
|
24
|
-
"oneOf": [
|
|
25
|
-
{
|
|
26
|
-
"type": "number",
|
|
27
|
-
"minimum": 0.0,
|
|
28
|
-
"maximum": 1.0
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"type": "null"
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://github.com/vitessce/vitessce/#raster",
|
|
4
|
-
"title": "Vitessce image data",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"definitions": {
|
|
7
|
-
"transform": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"additionalProperties": false,
|
|
10
|
-
"oneOf": [{ "required": ["scale", "translate"] }, { "required": ["matrix"] }],
|
|
11
|
-
"properties": {
|
|
12
|
-
"scale": { "type": "number" },
|
|
13
|
-
"translate": {
|
|
14
|
-
"type": "object",
|
|
15
|
-
"additionalProperties": false,
|
|
16
|
-
"required": ["y", "x"],
|
|
17
|
-
"properties": {
|
|
18
|
-
"y": { "type": "number" },
|
|
19
|
-
"x": { "type": "number" }
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
"matrix": {
|
|
23
|
-
"type": "array",
|
|
24
|
-
"items": { "type": "number" },
|
|
25
|
-
"minItems": 16,
|
|
26
|
-
"maxItems": 16
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
},
|
|
30
|
-
"dimensions": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"items": {
|
|
33
|
-
"type": "object",
|
|
34
|
-
"additionalProperties": false,
|
|
35
|
-
"required": ["field", "type", "values"],
|
|
36
|
-
"properties": {
|
|
37
|
-
"field": { "type": "string" },
|
|
38
|
-
"type": {
|
|
39
|
-
"type": "string",
|
|
40
|
-
"enum": ["quantitative", "nominal", "ordinal", "temporal"]
|
|
41
|
-
},
|
|
42
|
-
"values": {
|
|
43
|
-
"type": ["array", "null"],
|
|
44
|
-
"items": { "type": "string" }
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"metadata": {
|
|
50
|
-
"type": "object",
|
|
51
|
-
"additionalProperties": false,
|
|
52
|
-
"anyOf": [{ "required": ["dimensions", "isPyramid"] }, { "required": ["transform"] }, { "required": ["omeTiffOffsetsUrl"] }, { "required": ["isBitmask"] }],
|
|
53
|
-
"properties": {
|
|
54
|
-
"dimensions": { "$ref": "#/definitions/dimensions" },
|
|
55
|
-
"isPyramid": { "type": "boolean" },
|
|
56
|
-
"transform": { "$ref": "#/definitions/transform" },
|
|
57
|
-
"isBitmask": { "type": "boolean" },
|
|
58
|
-
"omeTiffOffsetsUrl": { "type": "string", "format": "uri" }
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"requestInit": {
|
|
62
|
-
"type": "object",
|
|
63
|
-
"additionalProperties": false,
|
|
64
|
-
"required": [],
|
|
65
|
-
"properties": {
|
|
66
|
-
"method": {
|
|
67
|
-
"type": "string"
|
|
68
|
-
},
|
|
69
|
-
"headers": {
|
|
70
|
-
"type": "object"
|
|
71
|
-
},
|
|
72
|
-
"body": {
|
|
73
|
-
"type": "string"
|
|
74
|
-
},
|
|
75
|
-
"mode": {
|
|
76
|
-
"type": "string"
|
|
77
|
-
},
|
|
78
|
-
"credentials": {
|
|
79
|
-
"type": "string"
|
|
80
|
-
},
|
|
81
|
-
"cache": {
|
|
82
|
-
"type": "string"
|
|
83
|
-
},
|
|
84
|
-
"redirect": {
|
|
85
|
-
"type": "string"
|
|
86
|
-
},
|
|
87
|
-
"referrer": {
|
|
88
|
-
"type": "string"
|
|
89
|
-
},
|
|
90
|
-
"integrity": {
|
|
91
|
-
"type": "string"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"image": {
|
|
96
|
-
"type": "object",
|
|
97
|
-
"additionalProperties": false,
|
|
98
|
-
"required": ["name", "url", "type"],
|
|
99
|
-
"properties": {
|
|
100
|
-
"name": { "type": "string" },
|
|
101
|
-
"url": { "type": "string", "format": "uri" },
|
|
102
|
-
"type": { "type": "string" },
|
|
103
|
-
"metadata": { "$ref": "#/definitions/metadata" },
|
|
104
|
-
"requestInit": { "$ref": "#/definitions/requestInit" }
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"additionalProperties": false,
|
|
109
|
-
"required": ["schemaVersion", "images"],
|
|
110
|
-
"properties": {
|
|
111
|
-
"schemaVersion": { "type": "string" },
|
|
112
|
-
"usePhysicalSizeScaling": { "type": "boolean", "description": "Default is false: passing true in will infer scaling from the reported physcial size" },
|
|
113
|
-
"renderLayers": { "type": "array", "items": { "type": "string" } },
|
|
114
|
-
"images": {
|
|
115
|
-
"type": "array",
|
|
116
|
-
"items": { "$ref": "#/definitions/image" }
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import Ajv from 'ajv';
|
|
2
|
-
/* eslint-disable import/no-dynamic-require */
|
|
3
|
-
/* eslint-disable global-require */
|
|
4
|
-
describe('schemas', () => {
|
|
5
|
-
[
|
|
6
|
-
'config-1.0.1',
|
|
7
|
-
'obsSets',
|
|
8
|
-
'obsSetsTabular',
|
|
9
|
-
'raster',
|
|
10
|
-
].forEach((type) => {
|
|
11
|
-
const schemaFile = `${type}.schema.json`;
|
|
12
|
-
describe(schemaFile, () => {
|
|
13
|
-
const schema = require(`./${schemaFile}`);
|
|
14
|
-
let validate;
|
|
15
|
-
if (type === 'config-1.0.1') {
|
|
16
|
-
const obsSets = require('./obsSets.schema.json');
|
|
17
|
-
const raster = require('./raster.schema.json');
|
|
18
|
-
validate = new Ajv()
|
|
19
|
-
.addSchema(obsSets)
|
|
20
|
-
.addSchema(raster)
|
|
21
|
-
.compile(schema);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
validate = new Ajv().compile(schema);
|
|
25
|
-
}
|
|
26
|
-
const [goodFixture, badFixture, badMessage] = [
|
|
27
|
-
'good', 'bad', 'bad.message',
|
|
28
|
-
].map(stem => `${type}.${stem}.json`);
|
|
29
|
-
it(`passes ${goodFixture}`, () => {
|
|
30
|
-
const data = require(`./fixtures/${goodFixture}`);
|
|
31
|
-
const valid = validate(data);
|
|
32
|
-
if (!valid) {
|
|
33
|
-
console.warn(validate.errors);
|
|
34
|
-
}
|
|
35
|
-
expect(valid).toEqual(true);
|
|
36
|
-
});
|
|
37
|
-
it(`fails ${badFixture}`, () => {
|
|
38
|
-
const data = require(`./fixtures/${badFixture}`);
|
|
39
|
-
const message = require(`./fixtures/${badMessage}`);
|
|
40
|
-
const valid = validate(data);
|
|
41
|
-
expect(valid).toEqual(false);
|
|
42
|
-
expect(validate.errors).toEqual(message);
|
|
43
|
-
});
|
|
44
|
-
});
|
|
45
|
-
});
|
|
46
|
-
});
|