@vitessce/zarr 3.3.3 → 3.3.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.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, F, G, b, M, c, O, j, f, e, h, i, d, l, k, m, n, p, o, a, S, Z } from "./index-3b4ae0c4.js";
1
+ import { A, F, G, b, M, c, k, O, j, f, e, h, i, d, m, l, n, o, q, p, a, S, Z } from "./index-64325dc0.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  export {
@@ -8,6 +8,7 @@ export {
8
8
  b as MatrixZarrAsObsFeatureMatrixLoader,
9
9
  M as MuDataSource,
10
10
  c as ObsEmbeddingAnndataLoader,
11
+ k as ObsFeatureColumnsAnndataLoader,
11
12
  O as ObsFeatureMatrixAnndataLoader,
12
13
  j as ObsLabelsAnndataLoader,
13
14
  f as ObsLocationsAnndataLoader,
@@ -15,12 +16,12 @@ export {
15
16
  h as ObsSegmentationsAnndataLoader,
16
17
  i as ObsSetsAnndataLoader,
17
18
  d as ObsSpotsAnndataLoader,
18
- l as OmeZarrAsObsSegmentationsLoader,
19
- k as OmeZarrLoader,
20
- m as SpatialDataImageLoader,
21
- n as SpatialDataLabelsLoader,
22
- p as SpatialDataObsSetsLoader,
23
- o as SpatialDataObsSpotsLoader,
19
+ m as OmeZarrAsObsSegmentationsLoader,
20
+ l as OmeZarrLoader,
21
+ n as SpatialDataImageLoader,
22
+ o as SpatialDataLabelsLoader,
23
+ q as SpatialDataObsSetsLoader,
24
+ p as SpatialDataObsSpotsLoader,
24
25
  a as SpatialDataShapesSource,
25
26
  S as SpatialDataTableSource,
26
27
  Z as ZarrDataSource
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-3b4ae0c4.js";
1
+ import { B as BaseDecoder } from "./index-64325dc0.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  const dctZigZag = new Int32Array([
@@ -1,5 +1,5 @@
1
1
  import { i as inflate_1 } from "./pako.esm-68f84e2a.js";
2
- import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-3b4ae0c4.js";
2
+ import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-64325dc0.js";
3
3
  import "@vitessce/vit-s";
4
4
  import "react";
5
5
  const LercParameters = {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-3b4ae0c4.js";
1
+ import { B as BaseDecoder } from "./index-64325dc0.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  const MIN_BITS = 9;
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-3b4ae0c4.js";
1
+ import { B as BaseDecoder } from "./index-64325dc0.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  class PackbitsDecoder extends BaseDecoder {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-3b4ae0c4.js";
1
+ import { B as BaseDecoder } from "./index-64325dc0.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  class RawDecoder extends BaseDecoder {
@@ -1,4 +1,4 @@
1
- import { B as BaseDecoder } from "./index-3b4ae0c4.js";
1
+ import { B as BaseDecoder } from "./index-64325dc0.js";
2
2
  import "@vitessce/vit-s";
3
3
  import "react";
4
4
  class WebImageDecoder extends BaseDecoder {
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Loader for embedding arrays located in anndata.zarr stores.
3
+ */
4
+ export default class ObsFeatureColumnsAnndataLoader {
5
+ /**
6
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
7
+ * @returns {Promise} A promise for an array of columns.
8
+ */
9
+ loadObsFeatureColumns(): Promise<any>;
10
+ obsFeatureColumns: Promise<null> | {
11
+ obsIndex: any;
12
+ featureIndex: any;
13
+ obsFeatureMatrix: {
14
+ data: Float32Array;
15
+ };
16
+ } | undefined;
17
+ load(): Promise<any>;
18
+ }
19
+ //# sourceMappingURL=ObsFeatureColumnsAnndataLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ObsFeatureColumnsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IACE;;;OAGG;IACH,sCA4BC;IANG;;;;;;kBAAqE;IAQzE,qBAYC;CACF"}
@@ -0,0 +1,46 @@
1
+ import { LoaderResult, AbstractTwoStepLoader, AbstractLoaderError, } from '@vitessce/vit-s';
2
+ import { basename } from '../utils.js';
3
+ /**
4
+ * Loader for embedding arrays located in anndata.zarr stores.
5
+ */
6
+ export default class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoader {
7
+ /**
8
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
9
+ * @returns {Promise} A promise for an array of columns.
10
+ */
11
+ async loadObsFeatureColumns() {
12
+ const { options } = this;
13
+ if (this.obsFeatureColumns) {
14
+ return this.obsFeatureColumns;
15
+ }
16
+ if (!this.obsFeatureColumns) {
17
+ const colPaths = options.map(({ path }) => path);
18
+ const firstPath = colPaths[0];
19
+ const obsIndex = await this.dataSource.loadObsIndex(firstPath);
20
+ const featureIndex = colPaths.map(colPath => basename(colPath));
21
+ const shape = [obsIndex.length, featureIndex.length];
22
+ const out = new Float32Array(shape[0] * shape[1]);
23
+ const data = await Promise.all(colPaths.map(colPath => this.dataSource.loadNumeric(colPath)));
24
+ data.forEach((colData, featureI) => {
25
+ obsIndex.forEach((obsId, obsI) => {
26
+ out[obsI * shape[1] + featureI] = colData.data[obsI];
27
+ });
28
+ });
29
+ const obsFeatureMatrix = { data: out };
30
+ this.obsFeatureColumns = { obsIndex, featureIndex, obsFeatureMatrix };
31
+ return this.obsFeatureColumns;
32
+ }
33
+ this.obsFeatureColumns = Promise.resolve(null);
34
+ return this.obsFeatureColumns;
35
+ }
36
+ async load() {
37
+ const superResult = await super.load().catch(reason => Promise.resolve(reason));
38
+ if (superResult instanceof AbstractLoaderError) {
39
+ return Promise.reject(superResult);
40
+ }
41
+ return Promise.all([
42
+ this.loadObsFeatureColumns(),
43
+ ]).then(([{ obsIndex, obsFeatureMatrix, featureIndex }]) => Promise
44
+ .resolve(new LoaderResult({ obsIndex, obsFeatureMatrix, featureIndex }, null)));
45
+ }
46
+ }
@@ -7,4 +7,5 @@ export { default as ObsSegmentationsAnndataLoader } from "./ObsSegmentationsAnnd
7
7
  export { default as ObsSetsAnndataLoader } from "./ObsSetsAnndataLoader.js";
8
8
  export { default as ObsLabelsAnndataLoader } from "./ObsLabelsAnndataLoader.js";
9
9
  export { default as FeatureLabelsAnndataLoader } from "./FeatureLabelsAnndataLoader.js";
10
+ export { default as ObsFeatureColumnsAnndataLoader } from "./ObsFeatureColumnsAnndataLoader.js";
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -7,3 +7,4 @@ export { default as ObsSegmentationsAnndataLoader } from './ObsSegmentationsAnnd
7
7
  export { default as ObsSetsAnndataLoader } from './ObsSetsAnndataLoader.js';
8
8
  export { default as ObsLabelsAnndataLoader } from './ObsLabelsAnndataLoader.js';
9
9
  export { default as FeatureLabelsAnndataLoader } from './FeatureLabelsAnndataLoader.js';
10
+ export { default as ObsFeatureColumnsAnndataLoader } from './ObsFeatureColumnsAnndataLoader.js';
@@ -1,2 +1,3 @@
1
1
  export function dirname(path: any): any;
2
+ export function basename(path: any): any;
2
3
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAAA,wCAIC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.js"],"names":[],"mappings":"AAAA,wCAIC;AAED,yCAGC"}
package/dist-tsc/utils.js CHANGED
@@ -3,3 +3,7 @@ export function dirname(path) {
3
3
  arr.pop();
4
4
  return arr.join('/');
5
5
  }
6
+ export function basename(path) {
7
+ const arr = path.split('/');
8
+ return arr.at(-1);
9
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitessce/zarr",
3
- "version": "3.3.3",
3
+ "version": "3.3.5",
4
4
  "author": "Gehlenborg Lab",
5
5
  "homepage": "http://vitessce.io",
6
6
  "repository": {
@@ -19,15 +19,15 @@
19
19
  "d3-array": "^2.4.0",
20
20
  "lodash-es": "^4.17.21",
21
21
  "zarrita": "0.4.0-next.4",
22
- "@vitessce/constants-internal": "3.3.3",
23
- "@vitessce/gl": "3.3.3",
24
- "@vitessce/sets-utils": "3.3.3",
25
- "@vitessce/image-utils": "3.3.3",
26
- "@vitessce/spatial-utils": "3.3.3",
27
- "@vitessce/utils": "3.3.3",
28
- "@vitessce/vit-s": "3.3.3",
29
- "@vitessce/zarr-utils": "3.3.3",
30
- "@vitessce/config": "3.3.3"
22
+ "@vitessce/constants-internal": "3.3.5",
23
+ "@vitessce/gl": "3.3.5",
24
+ "@vitessce/sets-utils": "3.3.5",
25
+ "@vitessce/spatial-utils": "3.3.5",
26
+ "@vitessce/image-utils": "3.3.5",
27
+ "@vitessce/utils": "3.3.5",
28
+ "@vitessce/vit-s": "3.3.5",
29
+ "@vitessce/zarr-utils": "3.3.5",
30
+ "@vitessce/config": "3.3.5"
31
31
  },
32
32
  "scripts": {
33
33
  "bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
@@ -0,0 +1,57 @@
1
+ import {
2
+ LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
3
+ } from '@vitessce/vit-s';
4
+ import { basename } from '../utils.js';
5
+
6
+ /**
7
+ * Loader for embedding arrays located in anndata.zarr stores.
8
+ */
9
+ export default class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoader {
10
+ /**
11
+ * Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
12
+ * @returns {Promise} A promise for an array of columns.
13
+ */
14
+ async loadObsFeatureColumns() {
15
+ const { options } = this;
16
+ if (this.obsFeatureColumns) {
17
+ return this.obsFeatureColumns;
18
+ }
19
+ if (!this.obsFeatureColumns) {
20
+ const colPaths = options.map(({ path }) => path);
21
+ const firstPath = colPaths[0];
22
+ const obsIndex = await this.dataSource.loadObsIndex(firstPath);
23
+ const featureIndex = colPaths.map(colPath => basename(colPath));
24
+ const shape = [obsIndex.length, featureIndex.length];
25
+ const out = new Float32Array(shape[0] * shape[1]);
26
+
27
+ const data = await Promise.all(
28
+ colPaths.map(colPath => this.dataSource.loadNumeric(colPath)),
29
+ );
30
+ data.forEach((colData, featureI) => {
31
+ obsIndex.forEach((obsId, obsI) => {
32
+ out[obsI * shape[1] + featureI] = colData.data[obsI];
33
+ });
34
+ });
35
+ const obsFeatureMatrix = { data: out };
36
+ this.obsFeatureColumns = { obsIndex, featureIndex, obsFeatureMatrix };
37
+
38
+ return this.obsFeatureColumns;
39
+ }
40
+ this.obsFeatureColumns = Promise.resolve(null);
41
+ return this.obsFeatureColumns;
42
+ }
43
+
44
+ async load() {
45
+ const superResult = await super.load().catch(reason => Promise.resolve(reason));
46
+ if (superResult instanceof AbstractLoaderError) {
47
+ return Promise.reject(superResult);
48
+ }
49
+ return Promise.all([
50
+ this.loadObsFeatureColumns(),
51
+ ]).then(([{ obsIndex, obsFeatureMatrix, featureIndex }]) => Promise
52
+ .resolve(new LoaderResult(
53
+ { obsIndex, obsFeatureMatrix, featureIndex },
54
+ null,
55
+ )));
56
+ }
57
+ }
@@ -7,3 +7,4 @@ export { default as ObsSegmentationsAnndataLoader } from './ObsSegmentationsAnnd
7
7
  export { default as ObsSetsAnndataLoader } from './ObsSetsAnndataLoader.js';
8
8
  export { default as ObsLabelsAnndataLoader } from './ObsLabelsAnndataLoader.js';
9
9
  export { default as FeatureLabelsAnndataLoader } from './FeatureLabelsAnndataLoader.js';
10
+ export { default as ObsFeatureColumnsAnndataLoader } from './ObsFeatureColumnsAnndataLoader.js';
package/src/utils.js CHANGED
@@ -3,3 +3,8 @@ export function dirname(path) {
3
3
  arr.pop();
4
4
  return arr.join('/');
5
5
  }
6
+
7
+ export function basename(path) {
8
+ const arr = path.split('/');
9
+ return arr.at(-1);
10
+ }