@vitessce/comparative 0.0.1 → 3.9.5

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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +4 -18
  3. package/dist/OrbitControls-BwflPmLE.js +6202 -0
  4. package/dist/ReactNeuroglancer-UbR-Ehra.js +43478 -0
  5. package/dist/blosc-DKW2fp0s.js +716 -0
  6. package/dist/chunk-INHXZS53-DiyuLb3Z.js +14 -0
  7. package/dist/deflate-DFQkIOhL.js +10 -0
  8. package/dist/higlass-DHc5-L51.js +92988 -0
  9. package/dist/index-BLxG4AHN.js +3127 -0
  10. package/dist/index-DAP0IGbf.js +6178 -0
  11. package/dist/index-cJZeOqnJ.js +283191 -0
  12. package/dist/index.min.js +43 -0
  13. package/dist/jpeg-DalHlKqK.js +533 -0
  14. package/dist/lerc-Bj34z9Qs.js +1032 -0
  15. package/dist/lz4-D5NbssRf.js +640 -0
  16. package/dist/lzw-N9cMPzo2.js +84 -0
  17. package/dist/packbits-DGrkR5HU.js +24 -0
  18. package/dist/pako.esm-D68R8YXe.js +1071 -0
  19. package/dist/raw-D6zj6koi.js +9 -0
  20. package/dist/troika-three-text.esm-C-0BO8OV.js +4192 -0
  21. package/dist/webimage-D1WQPC9_.js +19 -0
  22. package/dist/zstd-DoGJTjDa.js +603 -0
  23. package/dist-tsc/BiomarkerSelect.d.ts +2 -0
  24. package/dist-tsc/BiomarkerSelect.d.ts.map +1 -0
  25. package/dist-tsc/BiomarkerSelect.js +65 -0
  26. package/dist-tsc/ComparativeConfig.d.ts +12 -0
  27. package/dist-tsc/ComparativeConfig.d.ts.map +1 -0
  28. package/dist-tsc/ComparativeConfig.js +326 -0
  29. package/dist-tsc/ControlledComparative.d.ts +30 -0
  30. package/dist-tsc/ControlledComparative.d.ts.map +1 -0
  31. package/dist-tsc/ControlledComparative.js +95 -0
  32. package/dist-tsc/UncontrolledComparative.d.ts +10 -0
  33. package/dist-tsc/UncontrolledComparative.d.ts.map +1 -0
  34. package/dist-tsc/UncontrolledComparative.js +50 -0
  35. package/dist-tsc/index.d.ts +7 -0
  36. package/dist-tsc/index.d.ts.map +1 -0
  37. package/dist-tsc/index.js +14 -0
  38. package/package.json +53 -16
  39. package/src/BiomarkerSelect.jsx +107 -0
  40. package/src/ComparativeConfig.jsx +562 -0
  41. package/src/ControlledComparative.jsx +140 -0
  42. package/src/UncontrolledComparative.jsx +88 -0
  43. package/src/index.js +18 -0
  44. package/dist/index.d.ts +0 -4
  45. package/dist/index.js +0 -9
package/package.json CHANGED
@@ -1,23 +1,60 @@
1
1
  {
2
2
  "name": "@vitessce/comparative",
3
- "version": "0.0.1",
4
- "public": true,
5
- "description": "",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "files": [
9
- "dist"
10
- ],
11
- "scripts": {
12
- "build": "tsc",
13
- "prepublishOnly": "npm run build"
3
+ "version": "3.9.5",
4
+ "author": "HIDIVE Lab at HMS",
5
+ "homepage": "http://vitessce.io",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/vitessce/vitessce.git"
14
9
  },
15
- "keywords": [],
16
10
  "license": "MIT",
17
- "publishConfig": {
18
- "access": "public"
11
+ "type": "module",
12
+ "main": "dist/index.min.js",
13
+ "files": [
14
+ "src",
15
+ "dist",
16
+ "dist-tsc"
17
+ ],
18
+ "dependencies": {
19
+ "clsx": "^1.1.1",
20
+ "lodash-es": "^4.17.21",
21
+ "internmap": "^2.0.3",
22
+ "react-sticky-el": "^2.1.1",
23
+ "react-window": "^1.8.10",
24
+ "nuqs": "^2.6.0",
25
+ "@vitessce/abstract": "3.9.5",
26
+ "@vitessce/all": "3.9.5",
27
+ "@vitessce/constants": "3.9.5",
28
+ "@vitessce/config": "3.9.5",
29
+ "@vitessce/error": "3.9.5",
30
+ "@vitessce/vit-s": "3.9.5",
31
+ "@vitessce/styles": "3.9.5",
32
+ "@vitessce/constants-internal": "3.9.5",
33
+ "@vitessce/export-utils": "3.9.5",
34
+ "@vitessce/zarr": "3.9.5"
19
35
  },
20
36
  "devDependencies": {
21
- "typescript": "^5.0.0"
37
+ "@vitejs/plugin-react": "^4.5.0",
38
+ "cross-env": "^7.0.0",
39
+ "rimraf": "^3.0.2",
40
+ "rollup-plugin-visualizer": "^5.8.3",
41
+ "vite": "^7.0.0"
42
+ },
43
+ "peerDependencies": {
44
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
45
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
46
+ },
47
+ "scripts": {
48
+ "build": "rimraf ./dist/ && pnpm run build-lib",
49
+ "build-lib": "pnpm run build-lib:prod",
50
+ "build-lib:prod": "cross-env APP_ENV=production vite build --mode lib",
51
+ "build-lib:dev": "cross-env APP_ENV=development vite build --mode lib"
52
+ },
53
+ "module": "dist/index.min.js",
54
+ "exports": {
55
+ ".": {
56
+ "types": "./dist-tsc/index.d.ts",
57
+ "import": "./dist/index.min.js"
58
+ }
22
59
  }
23
- }
60
+ }
@@ -0,0 +1,107 @@
1
+ /* eslint-disable max-len */
2
+ /* eslint-disable no-underscore-dangle */
3
+ import React, { useMemo, useState, useCallback } from 'react';
4
+ import { Vitessce } from '@vitessce/all';
5
+ import { isEqual } from 'lodash-es';
6
+ import { BiomarkerSelectPageComponent, generateComparativeConfig } from './ComparativeConfig.jsx';
7
+
8
+ export function BiomarkerSelect(props) {
9
+ const {
10
+ datasetUrl = 'https://data-2.vitessce.io/kpmp-atlas-v2/sn-rna-seq/processed/kpmp-aug-2025.adata.zarr',
11
+ geneSelection,
12
+ sampleSetSelection,
13
+ setGeneSelection,
14
+ setSampleSetSelection,
15
+ theme = 'light2',
16
+ debugMode = false,
17
+ logLevel = undefined,
18
+ } = props;
19
+
20
+ const initialConfig = useMemo(() => generateComparativeConfig(datasetUrl, true), [datasetUrl]);
21
+ const [currentConfig, setCurrentConfig] = useState(null);
22
+
23
+ // Merge currentConfig with geneSelection and sampleSetSelection,
24
+ // which may have been updated from outside Vitessce (e.g., from URL params).
25
+ const mergedConfig = useMemo(() => {
26
+ if (!currentConfig) {
27
+ return initialConfig;
28
+ }
29
+ // Merge currentConfig with geneSelection and sampleSetSelection.
30
+ const isValidGeneSelection = Array.isArray(geneSelection) && geneSelection.every(g => typeof g === 'string');
31
+ const isValidSampleSetSelection = Array.isArray(sampleSetSelection) && sampleSetSelection.every(s => Array.isArray(s) && s.every(t => typeof t === 'string'));
32
+
33
+ const newConfig = {
34
+ ...currentConfig,
35
+ coordinationSpace: {
36
+ ...currentConfig.coordinationSpace,
37
+ featureSelection: {
38
+ ...currentConfig.coordinationSpace?.featureSelection,
39
+ __comparison__: (isValidGeneSelection
40
+ ? geneSelection
41
+ : currentConfig.coordinationSpace?.featureSelection?.__comparison__
42
+ ),
43
+ },
44
+ sampleSetSelection: {
45
+ ...currentConfig.coordinationSpace?.sampleSetSelection,
46
+ __comparison__: (
47
+ isValidSampleSetSelection
48
+ ? sampleSetSelection
49
+ : currentConfig.coordinationSpace?.sampleSetSelection?.__comparison__
50
+ ),
51
+ },
52
+ },
53
+ };
54
+ return newConfig;
55
+ }, [initialConfig, currentConfig, geneSelection, sampleSetSelection]);
56
+
57
+ const onConfigChange = useCallback((newConfig) => {
58
+ // Listen for changes to the config from inside vITESSCE
59
+ setCurrentConfig(newConfig);
60
+
61
+ // Listen for changes to featureSelection and sampleSetSelection in the coordination space.
62
+ const newFeatureSelection = newConfig.coordinationSpace?.featureSelection?.__comparison__;
63
+ const newSampleSetSelection = newConfig.coordinationSpace?.sampleSetSelection?.__comparison__;
64
+
65
+ // Was there a new selection made from inside Vitessce?
66
+ // Note: this will prevent from CLEARING the selections from inside Vitessce
67
+ // (any clearing will need to be done from the BiomarkerSelect UI).
68
+ const hasNewGeneSelection = (
69
+ Array.isArray(newFeatureSelection)
70
+ && newFeatureSelection.length > 0
71
+ && !isEqual(newFeatureSelection, geneSelection)
72
+ );
73
+ const hasNewSampleSetSelection = (
74
+ Array.isArray(newSampleSetSelection)
75
+ && newSampleSetSelection.length > 0
76
+ && !isEqual(newSampleSetSelection, sampleSetSelection)
77
+ );
78
+
79
+ if (hasNewGeneSelection) {
80
+ setGeneSelection(newFeatureSelection);
81
+ }
82
+ if (hasNewSampleSetSelection) {
83
+ setSampleSetSelection(newSampleSetSelection);
84
+ }
85
+ }, [geneSelection, sampleSetSelection]);
86
+
87
+ const didFirstValidation = currentConfig !== null;
88
+
89
+ return (
90
+ <div>
91
+ <Vitessce
92
+ config={mergedConfig}
93
+ onConfigChange={onConfigChange}
94
+ remountOnUidChange={false}
95
+ validateConfig={!didFirstValidation}
96
+ validateOnConfigChange={false}
97
+ rowHeight={null}
98
+ theme={theme}
99
+ pageMode
100
+ debugMode={debugMode}
101
+ logLevel={logLevel}
102
+ >
103
+ <BiomarkerSelectPageComponent />
104
+ </Vitessce>
105
+ </div>
106
+ );
107
+ }