@vitessce/vit-s 2.0.3-beta.0 → 2.0.3

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 (184) hide show
  1. package/dist/index.mjs +84801 -0
  2. package/{dist → dist-tsc}/index.js +2 -2
  3. package/package.json +7 -7
  4. package/src/CallbackPublisher.js +81 -0
  5. package/src/LoadingIndicator.js +34 -0
  6. package/src/TitleInfo.js +240 -0
  7. package/src/VitS.js +180 -0
  8. package/src/VitessceGrid.js +110 -0
  9. package/src/VitessceGrid.test.jsx +48 -0
  10. package/src/Warning.js +62 -0
  11. package/{dist → src}/classNames.js +0 -0
  12. package/src/component-registry.js +21 -0
  13. package/src/data/AbstractLoader.js +46 -0
  14. package/{dist → src}/data/AbstractTwoStepLoader.js +5 -4
  15. package/src/data/LoaderResult.js +8 -0
  16. package/{dist → src}/data/index.js +0 -0
  17. package/src/data/loader-registry.js +19 -0
  18. package/src/data-hook-utils.js +197 -0
  19. package/src/data-hooks.js +354 -0
  20. package/src/errors/AbstractLoaderError.js +14 -0
  21. package/src/errors/DataSourceFetchError.js +15 -0
  22. package/src/errors/DatasetNotFoundError.js +23 -0
  23. package/src/errors/LoaderNotFoundError.js +24 -0
  24. package/src/errors/LoaderValidationError.js +23 -0
  25. package/src/errors/OptionsValidationError.js +25 -0
  26. package/{dist → src}/errors/index.js +0 -0
  27. package/src/file-options-schemas-legacy.js +139 -0
  28. package/src/file-options-schemas-legacy.test.js +138 -0
  29. package/src/file-options-schemas.js +327 -0
  30. package/src/file-options-schemas.test.js +26 -0
  31. package/src/hooks.js +252 -0
  32. package/src/index.js +101 -0
  33. package/src/joint-file-types-legacy.js +298 -0
  34. package/src/joint-file-types-legacy.test.js +412 -0
  35. package/src/joint-file-types.js +171 -0
  36. package/src/joint-file-types.test.js +144 -0
  37. package/{dist/schemas.js → src/json-schemas.js} +6 -1
  38. package/{dist → src}/plugins.js +102 -70
  39. package/src/plugins.test.fixtures.js +78 -0
  40. package/src/plugins.test.js +42 -0
  41. package/src/schemas/config-0.1.0.schema.json +85 -0
  42. package/src/schemas/config-1.0.0.schema.json +733 -0
  43. package/src/schemas/config-1.0.1.schema.json +909 -0
  44. package/src/schemas/config-1.0.10.schema.json +969 -0
  45. package/src/schemas/config-1.0.11.schema.json +990 -0
  46. package/src/schemas/config-1.0.12.schema.json +997 -0
  47. package/src/schemas/config-1.0.13.schema.json +1013 -0
  48. package/src/schemas/config-1.0.14.schema.json +1048 -0
  49. package/src/schemas/config-1.0.15.schema.json +1048 -0
  50. package/src/schemas/config-1.0.16.schema.json +1069 -0
  51. package/src/schemas/config-1.0.16.schema.test.js +32 -0
  52. package/src/schemas/config-1.0.2.schema.json +911 -0
  53. package/src/schemas/config-1.0.3.schema.json +911 -0
  54. package/src/schemas/config-1.0.4.schema.json +949 -0
  55. package/src/schemas/config-1.0.5.schema.json +949 -0
  56. package/src/schemas/config-1.0.6.schema.json +950 -0
  57. package/src/schemas/config-1.0.7.schema.json +950 -0
  58. package/src/schemas/config-1.0.8.schema.json +966 -0
  59. package/src/schemas/config-1.0.9.schema.json +965 -0
  60. package/src/schemas/fixtures/cellSets.good.json +16 -0
  61. package/src/schemas/fixtures/config-1.0.1.bad.json +1 -0
  62. package/src/schemas/fixtures/config-1.0.1.bad.message.json +11 -0
  63. package/src/schemas/fixtures/config-1.0.1.good.json +37 -0
  64. package/src/schemas/fixtures/config-1.0.2.bad.json +1 -0
  65. package/src/schemas/fixtures/config-1.0.2.bad.message.json +11 -0
  66. package/src/schemas/fixtures/config-1.0.2.good.json +38 -0
  67. package/src/schemas/fixtures/config-1.0.3.bad.json +1 -0
  68. package/src/schemas/fixtures/config-1.0.3.bad.message.json +11 -0
  69. package/src/schemas/fixtures/config-1.0.3.good.json +38 -0
  70. package/src/schemas/fixtures/obsSets.bad.json +1 -0
  71. package/src/schemas/fixtures/obsSets.bad.message.json +11 -0
  72. package/src/schemas/fixtures/obsSets.good.json +16 -0
  73. package/src/schemas/fixtures/obsSetsTabular.bad.json +1 -0
  74. package/src/schemas/fixtures/obsSetsTabular.bad.message.json +11 -0
  75. package/src/schemas/fixtures/obsSetsTabular.good.json +26 -0
  76. package/src/schemas/fixtures/raster.bad.json +1 -0
  77. package/src/schemas/fixtures/raster.bad.message.json +11 -0
  78. package/src/schemas/fixtures/raster.good.json +39 -0
  79. package/src/schemas/obsSets.schema.js +195 -0
  80. package/src/schemas/obsSetsTabular.schema.js +39 -0
  81. package/src/schemas/raster.schema.js +121 -0
  82. package/src/schemas/schema-schema.sh +34 -0
  83. package/{dist → src}/schemas/schema.test-old.js +0 -1
  84. package/src/shared-mui/components.js +79 -0
  85. package/src/shared-mui/container.js +212 -0
  86. package/src/shared-mui/styles.js +110 -0
  87. package/src/shared-plot-options/CellColorEncodingOption.js +43 -0
  88. package/src/shared-plot-options/OptionSelect.js +19 -0
  89. package/src/shared-plot-options/OptionsContainer.js +26 -0
  90. package/{dist → src}/shared-plot-options/index.js +0 -0
  91. package/src/shared-plot-options/styles.js +49 -0
  92. package/src/state/hooks.js +633 -0
  93. package/src/view-config-upgraders.js +628 -0
  94. package/src/view-config-utils.js +315 -0
  95. package/src/view-config-utils.test.fixtures.js +893 -0
  96. package/src/view-config-utils.test.js +95 -0
  97. package/src/view-config-versions.js +68 -0
  98. package/src/vitessce-grid-layout/VitessceGridLayout.js +158 -0
  99. package/src/vitessce-grid-layout/VitessceGridLayout.test.jsx +56 -0
  100. package/{dist → src}/vitessce-grid-layout/index.js +0 -0
  101. package/src/vitessce-grid-layout/layout-utils.js +76 -0
  102. package/src/vitessce-grid-layout/layout-utils.test.js +167 -0
  103. package/src/vitessce-grid-utils.js +160 -0
  104. package/dist/CallbackPublisher.js +0 -68
  105. package/dist/LoadingIndicator.js +0 -27
  106. package/dist/TitleInfo.js +0 -151
  107. package/dist/VitS.js +0 -117
  108. package/dist/Vitessce.integration.test.js +0 -36
  109. package/dist/Vitessce.js +0 -101
  110. package/dist/VitessceGrid.js +0 -59
  111. package/dist/VitessceGrid.test.js +0 -36
  112. package/dist/Warning.js +0 -45
  113. package/dist/component-registry.js +0 -16
  114. package/dist/data/AbstractLoader.js +0 -35
  115. package/dist/data/LoaderResult.js +0 -7
  116. package/dist/data/loader-registry.js +0 -15
  117. package/dist/data-hook-utils.js +0 -175
  118. package/dist/data-hooks.js +0 -241
  119. package/dist/errors/AbstractLoaderError.js +0 -13
  120. package/dist/errors/DataSourceFetchError.js +0 -13
  121. package/dist/errors/DatasetNotFoundError.js +0 -17
  122. package/dist/errors/LoaderNotFoundError.js +0 -17
  123. package/dist/errors/LoaderValidationError.js +0 -15
  124. package/dist/errors/OptionsValidationError.js +0 -15
  125. package/dist/export-utils.js +0 -70
  126. package/dist/export-utils.test.js +0 -66
  127. package/dist/file-options-schemas-legacy.js +0 -136
  128. package/dist/file-options-schemas-legacy.test.js +0 -126
  129. package/dist/file-options-schemas.js +0 -322
  130. package/dist/file-options-schemas.test.js +0 -23
  131. package/dist/hooks.js +0 -215
  132. package/dist/joint-file-types-legacy.js +0 -278
  133. package/dist/joint-file-types-legacy.test.js +0 -400
  134. package/dist/joint-file-types.js +0 -148
  135. package/dist/joint-file-types.test.js +0 -139
  136. package/dist/loader-registry.js +0 -98
  137. package/dist/plugins.test.fixtures.js +0 -76
  138. package/dist/plugins.test.js +0 -30
  139. package/dist/schemas/PrettyJsonSchema.js +0 -34
  140. package/dist/schemas/config-0.1.0.schema.json +0 -84
  141. package/dist/schemas/config-1.0.0.schema.json +0 -733
  142. package/dist/schemas/config-1.0.1.schema.json +0 -909
  143. package/dist/schemas/config-1.0.10.schema.json +0 -969
  144. package/dist/schemas/config-1.0.11.schema.json +0 -990
  145. package/dist/schemas/config-1.0.12.schema.json +0 -997
  146. package/dist/schemas/config-1.0.13.schema.json +0 -1013
  147. package/dist/schemas/config-1.0.14.schema.json +0 -1048
  148. package/dist/schemas/config-1.0.15.schema.json +0 -1048
  149. package/dist/schemas/config-1.0.15.schema.test.js +0 -22
  150. package/dist/schemas/config-1.0.16.schema.json +0 -1109
  151. package/dist/schemas/config-1.0.16.schema.test.js +0 -22
  152. package/dist/schemas/config-1.0.2.schema.json +0 -910
  153. package/dist/schemas/config-1.0.3.schema.json +0 -910
  154. package/dist/schemas/config-1.0.4.schema.json +0 -949
  155. package/dist/schemas/config-1.0.5.schema.json +0 -949
  156. package/dist/schemas/config-1.0.6.schema.json +0 -949
  157. package/dist/schemas/config-1.0.7.schema.json +0 -949
  158. package/dist/schemas/config-1.0.8.schema.json +0 -965
  159. package/dist/schemas/config-1.0.9.schema.json +0 -965
  160. package/dist/schemas/obs-sets-tabular.schema.js +0 -37
  161. package/dist/schemas/obs-sets.schema.js +0 -194
  162. package/dist/schemas/obsSets.schema.js +0 -195
  163. package/dist/schemas/obsSetsTabular.schema.js +0 -38
  164. package/dist/schemas/raster.schema.js +0 -120
  165. package/dist/schemas/schema.test.js +0 -46
  166. package/dist/schemas-extra.js +0 -3
  167. package/dist/shared-mui/components.js +0 -35
  168. package/dist/shared-mui/container.js +0 -211
  169. package/dist/shared-mui/styles.js +0 -107
  170. package/dist/shared-plot-options/CellColorEncodingOption.js +0 -18
  171. package/dist/shared-plot-options/OptionSelect.js +0 -12
  172. package/dist/shared-plot-options/OptionsContainer.js +0 -12
  173. package/dist/shared-plot-options/styles.js +0 -48
  174. package/dist/state/hooks.js +0 -549
  175. package/dist/view-config-upgraders.js +0 -525
  176. package/dist/view-config-utils.js +0 -286
  177. package/dist/view-config-utils.test.fixtures.js +0 -765
  178. package/dist/view-config-utils.test.js +0 -66
  179. package/dist/view-config-versions.js +0 -47
  180. package/dist/vitessce-grid-layout/VitessceGridLayout.js +0 -95
  181. package/dist/vitessce-grid-layout/VitessceGridLayout.test.js +0 -40
  182. package/dist/vitessce-grid-layout/layout-utils.js +0 -60
  183. package/dist/vitessce-grid-layout/layout-utils.test.js +0 -146
  184. package/dist/vitessce-grid-utils.js +0 -140
@@ -1,17 +0,0 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
2
- export default class DatasetNotFoundError extends AbstractLoaderError {
3
- constructor(datasetUid) {
4
- super(`Error finding dataset for ${datasetUid}. Please check that at least one dataset exists in the view config.`);
5
- this.name = 'DatasetNotFoundError';
6
- this.datasetUid = datasetUid;
7
- }
8
- warnInConsole() {
9
- const { datasetUid, } = this;
10
- if (datasetUid) {
11
- console.warn(`Unable to find dataset for ${datasetUid}`);
12
- }
13
- else {
14
- console.warn('No dataset uid specified.');
15
- }
16
- }
17
- }
@@ -1,17 +0,0 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
2
- export default class LoaderNotFoundError extends AbstractLoaderError {
3
- constructor(loaders, dataset, fileType, viewCoordinationValues) {
4
- super(`Error: unable to find matching ${fileType} file in dataset ${dataset}.`);
5
- this.name = 'LoaderNotFoundError';
6
- this.loaders = loaders;
7
- this.dataset = dataset;
8
- this.fileType = fileType;
9
- this.viewCoordinationValues = viewCoordinationValues;
10
- }
11
- warnInConsole() {
12
- const { loaders, viewCoordinationValues, } = this;
13
- console.warn(
14
- // eslint-disable-next-line prefer-template
15
- `Expected to match on { ${Object.entries(viewCoordinationValues).map(([k, v]) => k + ': ' + v).join(', ')} }`, loaders);
16
- }
17
- }
@@ -1,15 +0,0 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
2
- export default class LoaderValidationError extends AbstractLoaderError {
3
- constructor(datasetType, datasetFileType, datasetUrl, reason) {
4
- super(`Error while validating ${datasetType}.`);
5
- this.name = 'LoaderValidationError';
6
- this.datasetType = datasetType;
7
- this.datasetFileType = datasetFileType;
8
- this.datasetUrl = datasetUrl;
9
- this.reason = reason;
10
- }
11
- warnInConsole() {
12
- const { datasetType, datasetUrl, reason, } = this;
13
- console.warn(`${datasetType} from ${datasetUrl}: validation failed`, JSON.stringify(reason, null, 2));
14
- }
15
- }
@@ -1,15 +0,0 @@
1
- import AbstractLoaderError from './AbstractLoaderError';
2
- export default class OptionsValidationError extends AbstractLoaderError {
3
- constructor(fileType, url, options, reason) {
4
- super(`Error while validating file definition options: ${fileType} from ${url}.`);
5
- this.name = 'OptionsValidationError';
6
- this.fileType = fileType;
7
- this.url = url;
8
- this.options = options;
9
- this.reason = reason;
10
- }
11
- warnInConsole() {
12
- const { options, reason, } = this;
13
- console.warn('Received options\n', JSON.stringify(options, null, 2), 'JSON schema validation failure reason\n', JSON.stringify(reason, null, 2));
14
- }
15
- }
@@ -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
- });
@@ -1,136 +0,0 @@
1
- export const cellsJsonSchema = {
2
- $schema: 'http://json-schema.org/draft-07/schema#',
3
- $id: 'https://github.com/vitessce/vitessce/#cells-json-options',
4
- title: 'cells.json options',
5
- oneOf: [
6
- { type: 'null' },
7
- {
8
- type: 'object',
9
- additionalProperties: false,
10
- required: [],
11
- properties: {
12
- obsLabelsTypes: {
13
- type: 'array',
14
- items: { type: 'string' },
15
- },
16
- embeddingTypes: {
17
- type: 'array',
18
- items: { type: 'string' },
19
- },
20
- },
21
- },
22
- ],
23
- };
24
- export const anndataCellsZarrSchema = {
25
- $schema: 'http://json-schema.org/draft-07/schema#',
26
- $id: 'https://github.com/vitessce/vitessce/#anndata-cells-zarr-options',
27
- title: 'anndata-cells.zarr options',
28
- type: 'object',
29
- minProperties: 1,
30
- additionalProperties: false,
31
- required: [],
32
- properties: {
33
- xy: {
34
- type: 'string',
35
- description: "The location in the AnnData store of cell centroids, like 'obsm/X_centroids.'",
36
- },
37
- poly: {
38
- type: 'string',
39
- description: "The location in the AnnData store of cell polygon outlines, like 'obsm/X_polygons.'",
40
- },
41
- factors: {
42
- type: 'array',
43
- description: "List of locations in the AnnData store of cell sets, like 'obs/louvain'",
44
- items: {
45
- type: 'string',
46
- },
47
- },
48
- mappings: {
49
- patternProperties: {
50
- '.': {
51
- type: 'object',
52
- description: "An object containing key-values for mappings like { UMAP: { key: 'obsm/X_umap', dims: [0, 1] } }.",
53
- additionalProperties: false,
54
- required: ['key'],
55
- properties: {
56
- key: {
57
- type: 'string',
58
- description: "Where to look in the AnnData store for this mapping, like 'obsm/X_umap.'",
59
- },
60
- dims: {
61
- type: 'array',
62
- description: 'Which indices of the obsm object to take for a scatterplot, allowing for, for example, different PCs from obsm/X_pca',
63
- minItems: 2,
64
- maxItems: 2,
65
- items: { type: 'number' },
66
- },
67
- },
68
- },
69
- },
70
- },
71
- },
72
- };
73
- export const anndataCellSetsZarrSchema = {
74
- $schema: 'http://json-schema.org/draft-07/schema#',
75
- $id: 'https://github.com/vitessce/vitessce/#anndata-cell-sets-zarr-options',
76
- title: 'anndata-cell-sets.zarr options',
77
- type: 'array',
78
- items: {
79
- type: 'object',
80
- additionalProperties: false,
81
- required: ['groupName', 'setName'],
82
- properties: {
83
- groupName: {
84
- type: 'string',
85
- description: "The display name for the set, like 'Cell Type' or 'Louvain.'",
86
- },
87
- setName: {
88
- oneOf: [
89
- {
90
- type: 'string',
91
- description: "The location in the AnnData store for the set, like 'obs/louvain' or 'obs/celltype.'",
92
- },
93
- {
94
- type: 'array',
95
- items: { type: 'string' },
96
- description: 'An array of locations in the AnnData store for a hierarchy of set names, from coarse to fine levels.',
97
- },
98
- ],
99
- },
100
- scoreName: {
101
- oneOf: [
102
- {
103
- type: 'string',
104
- description: "The location in the AnnData store for the set confidence scores, like 'obs/celltype_prediction_score.'",
105
- },
106
- ],
107
- },
108
- },
109
- },
110
- };
111
- export const anndataExpressionMatrixZarrSchema = {
112
- $schema: 'http://json-schema.org/draft-07/schema#',
113
- $id: 'https://github.com/vitessce/vitessce/#anndata-expression-matrix-zarr-options',
114
- title: 'anndata-expression-matrix.zarr options',
115
- type: 'object',
116
- additionalProperties: false,
117
- required: ['matrix'],
118
- properties: {
119
- matrix: {
120
- type: 'string',
121
- description: "The location in the AnnData store of the cell x gene matrix, like 'obsm/hvg_subset.' or 'X'",
122
- },
123
- geneFilter: {
124
- type: 'string',
125
- description: "The location in the AnnData store of a filter for the genes if using a subset of the data, like 'var.highly_variable.' if the matrix comes from 'obsm/hvg_subset.'",
126
- },
127
- matrixGeneFilter: {
128
- type: 'string',
129
- description: "The location in the AnnData store of a filter for the matrix data (used in heatmap and histogram), like 'var.highly_variable.''",
130
- },
131
- geneAlias: {
132
- type: 'string',
133
- description: 'The location in the AnnData store of a different list of names for gene list component, other than the `var` index',
134
- },
135
- },
136
- };
@@ -1,126 +0,0 @@
1
- import { expandExpressionMatrixZarr, expandRasterOmeZarr, expandGenesJson, expandCellsJson, expandCellSetsJson, expandMoleculesJson, expandAnndataCellsZarr, expandAnndataCellSetsZarr, expandAnndataExpressionMatrixZarr, expandClustersJson, } from './joint-file-types-legacy';
2
- describe('src/app/file-options-schemas-legacy.js', () => {
3
- describe('Options validation for joint file type expansion functions', () => {
4
- it('cells.json with extra options fails validation', () => {
5
- expect(() => expandCellsJson({
6
- fileType: 'cells.json',
7
- url: 'http://localhost:8000/cells.json',
8
- options: {
9
- badKey: 'test',
10
- embeddingTypes: ['UMAP', 't-SNE'],
11
- obsLabelsTypes: ['cluster', 'subcluster'],
12
- },
13
- })).toThrow();
14
- });
15
- it('molecules.json with any options fails validation', () => {
16
- expect(() => expandMoleculesJson({
17
- fileType: 'molecules.json',
18
- url: 'http://localhost:8000/molecules.json',
19
- options: {},
20
- })).toThrow();
21
- });
22
- it('expression-matrix.zarr with any options fails validation', () => {
23
- expect(() => expandExpressionMatrixZarr({
24
- fileType: 'expression-matrix.zarr',
25
- url: 'http://localhost:8000/expression-matrix.zarr',
26
- options: {},
27
- })).toThrow();
28
- });
29
- it('raster.ome-zarr with any options fails validation', () => {
30
- expect(() => expandRasterOmeZarr({
31
- fileType: 'raster.ome-zarr',
32
- url: 'http://localhost:8000/raster.ome-zarr',
33
- options: {},
34
- })).toThrow();
35
- });
36
- it('cell-sets.json with any options fails validation', () => {
37
- expect(() => expandCellSetsJson({
38
- fileType: 'cell-sets.json',
39
- url: 'http://localhost:8000/cell-sets.json',
40
- options: {},
41
- })).toThrow();
42
- });
43
- it('clusters.json with any options fails validation', () => {
44
- expect(() => expandClustersJson({
45
- fileType: 'clusters.json',
46
- url: 'http://localhost:8000/clusters.json',
47
- options: {},
48
- })).toThrow();
49
- });
50
- it('genes.json with any options fails validation', () => {
51
- expect(() => expandGenesJson({
52
- fileType: 'genes.json',
53
- url: 'http://localhost:8000/genes.json',
54
- options: {},
55
- })).toThrow();
56
- });
57
- it('anndata-cells.zarr with extra options fails validation', () => {
58
- expect(() => expandAnndataCellsZarr({
59
- fileType: 'anndata-cells.zarr',
60
- url: 'http://localhost:8000/anndata-cells.zarr',
61
- options: {
62
- poly: 'obsm/poly',
63
- xy: 'obsm/xy',
64
- bad: 'bad',
65
- },
66
- })).toThrow();
67
- });
68
- it('anndata-cells.zarr with invalid options fails validation', () => {
69
- expect(() => expandAnndataCellsZarr({
70
- fileType: 'anndata-cells.zarr',
71
- url: 'http://localhost:8000/anndata-cells.zarr',
72
- options: {
73
- poly: 'obsm/poly',
74
- xy: 'obsm/xy',
75
- mappings: {
76
- UMAP: ['bad'],
77
- },
78
- },
79
- })).toThrow();
80
- });
81
- it('anndata-cell-sets.zarr with invalid options fails validation', () => {
82
- expect(() => expandAnndataCellSetsZarr({
83
- fileType: 'anndata-cell-sets.zarr',
84
- url: 'http://localhost:8000/anndata-cell-sets.zarr',
85
- options: {},
86
- })).toThrow();
87
- });
88
- it('anndata-cell-sets.zarr with extra options fails validation', () => {
89
- expect(() => expandAnndataCellSetsZarr({
90
- fileType: 'anndata-cell-sets.zarr',
91
- url: 'http://localhost:8000/anndata-cell-sets.zarr',
92
- options: [
93
- {
94
- groupName: 'Cell Type Annotations',
95
- setName: 'obs/cell_type',
96
- scoreName: 'obs/score',
97
- bad: 'bad',
98
- },
99
- ],
100
- })).toThrow();
101
- });
102
- it('anndata-expression-matrix.zarr with invalid options fails validation', () => {
103
- expect(() => expandAnndataExpressionMatrixZarr({
104
- fileType: 'anndata-expression-matrix.zarr',
105
- url: 'http://localhost:8000/anndata-expression-matrix.zarr',
106
- options: {
107
- matrix: 'good',
108
- geneAlias: 1,
109
- },
110
- })).toThrow();
111
- });
112
- it('anndata-expression-matrix.zarr with extra options fails validation', () => {
113
- expect(() => expandAnndataExpressionMatrixZarr({
114
- fileType: 'anndata-expression-matrix.zarr',
115
- url: 'http://localhost:8000/anndata-expression-matrix.zarr',
116
- options: {
117
- matrix: 'good',
118
- geneAlias: 'good',
119
- geneFilter: 'good',
120
- matrixGeneFilter: 'good',
121
- bad: 'bad',
122
- },
123
- })).toThrow();
124
- });
125
- });
126
- });