@vitessce/zarr 3.4.8 → 3.4.10
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/{deflate-d6012e10.js → deflate-f092f055.js} +1 -1
- package/dist/{index-8ab15ee8.js → index-010ccee4.js} +625 -258
- package/dist/index.js +1 -1
- package/dist/{jpeg-1999a469.js → jpeg-96acb184.js} +1 -1
- package/dist/{lerc-577eef4d.js → lerc-41914740.js} +1 -1
- package/dist/{lzw-930f9b96.js → lzw-ed481c3b.js} +1 -1
- package/dist/{packbits-17aa5fe6.js → packbits-14e4265c.js} +1 -1
- package/dist/{raw-b9069edc.js → raw-1e87ff8b.js} +1 -1
- package/dist/{webimage-478acf52.js → webimage-df74a5df.js} +1 -1
- package/dist-tsc/AnnDataSource.d.ts +6 -0
- package/dist-tsc/AnnDataSource.d.ts.map +1 -1
- package/dist-tsc/AnnDataSource.js +4 -4
- package/dist-tsc/ZarrDataSource.d.ts +4 -2
- package/dist-tsc/ZarrDataSource.d.ts.map +1 -1
- package/dist-tsc/ZarrDataSource.js +3 -3
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.d.ts +2 -2
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.js +3 -3
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +1 -1
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.js +2 -2
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.js +2 -2
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.js +2 -2
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.js +5 -4
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.js +2 -2
- package/dist-tsc/spatialdata-loaders/SpatialDataObsSpotsLoader.d.ts +1 -1
- package/dist-tsc/spatialdata-loaders/SpatialDataObsSpotsLoader.d.ts.map +1 -1
- package/dist-tsc/spatialdata-loaders/SpatialDataObsSpotsLoader.js +4 -4
- package/package.json +15 -15
- package/src/AnnDataSource.js +4 -4
- package/src/ZarrDataSource.js +3 -4
- package/src/anndata-loaders/ObsEmbeddingAnndataLoader.js +3 -3
- package/src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +1 -1
- package/src/anndata-loaders/ObsLabelsAnndataLoader.js +2 -2
- package/src/anndata-loaders/ObsLocationsAnndataLoader.js +2 -2
- package/src/anndata-loaders/ObsPointsAnndataLoader.js +2 -2
- package/src/anndata-loaders/ObsSetsAnndataLoader.js +5 -4
- package/src/anndata-loaders/ObsSpotsAnndataLoader.js +2 -2
- package/src/spatialdata-loaders/SpatialDataObsSpotsLoader.js +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A, F, G, b, M, c, k, O, j, f, e, h, i, d, n, m, l, o, p, r, q, a, S, Z } from "./index-
|
|
1
|
+
import { A, F, G, b, M, c, k, O, j, f, e, h, i, d, n, m, l, o, p, r, q, a, S, Z } from "./index-010ccee4.js";
|
|
2
2
|
import "@vitessce/vit-s";
|
|
3
3
|
import "react";
|
|
4
4
|
export {
|
|
@@ -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-
|
|
2
|
+
import { g as getDefaultExportFromCjs, B as BaseDecoder } from "./index-010ccee4.js";
|
|
3
3
|
import "@vitessce/vit-s";
|
|
4
4
|
import "react";
|
|
5
5
|
const LercParameters = {
|
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
* like loading cell names and ids. It inherits from AbstractLoader.
|
|
7
7
|
*/
|
|
8
8
|
export default class AnnDataSource extends ZarrDataSource {
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {DataSourceParams} params
|
|
12
|
+
*/
|
|
13
|
+
constructor(params: DataSourceParams);
|
|
9
14
|
/** @type {Map<string, Promise<(undefined | string[] | string[][])>>} */
|
|
10
15
|
promises: Map<string, Promise<(undefined | string[] | string[][])>>;
|
|
11
16
|
/**
|
|
@@ -128,4 +133,5 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
128
133
|
import ZarrDataSource from './ZarrDataSource.js';
|
|
129
134
|
import type { Chunk } from '@zarrita/core';
|
|
130
135
|
import type { TypedArray as ZarrTypedArray } from '@zarrita/core';
|
|
136
|
+
import type { DataSourceParams } from '@vitessce/types';
|
|
131
137
|
//# sourceMappingURL=AnnDataSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnnDataSource.d.ts","sourceRoot":"","sources":["../src/AnnDataSource.js"],"names":[],"mappings":"AAMA,0DAA0D;AAC1D,6DAA6D;AAC7D,2EAA2E;AAE3E;;;GAGG;AACH;
|
|
1
|
+
{"version":3,"file":"AnnDataSource.d.ts","sourceRoot":"","sources":["../src/AnnDataSource.js"],"names":[],"mappings":"AAMA,0DAA0D;AAC1D,6DAA6D;AAC7D,2EAA2E;AAE3E;;;GAGG;AACH;IACE;;;OAGG;IACH,oBAFW,gBAAgB,EAM1B;IAFC,wEAAwE;IACxE,UADW,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,SAAS,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAC3C;IAG3B;;;;;;;OAOG;IACH,sBANW,MAAM,EAAE,GAEN,OAAO,CAAC,CAAC,SAAS,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAM1D;IAED;;;;;;;OAOG;IACH,sBANW,MAAM,EAAE,GAEN,OAAO,CAAC,CAAC,SAAS,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAM1D;IAED;;;;;;;;OAQG;IACH,oBALW,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,GAEnB,OAAO,CAAC,CAAC,SAAS,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CA2B1D;IAED;;;;OAIG;IACH,kBAHW,MAAM,qBAmDhB;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAM/B;IAED;;;;;;;;OAQG;IACH,yBAPW,MAAM,QACN,CAAC,MAAM,EAAE,MAAM,CAAC,GACd,OAAO,CAAC;QACpB,IAAO,EAAE,CAAC,eAAe,GAAG,CAAC,EAAE,eAAe,GAAG,CAAC,CAAC,CAAC;QACpD,KAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACxB,CAAC,CAeJ;IAED;;;;;OAKG;IACH,6BAHW,MAAM,GACJ,OAAO,CAAC,MAAM,EAAE,CAAC,CAW7B;IAED;;;;;OAKG;IACH,oBAJW,MAAM,GAAC,SAAS,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAa7B;IAHC,wCACsE;IAIxE;;;;OAIG;IACH,oBAHW,MAAM,GAAC,SAAS,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAY7B;IAHC,wCACsE;IAIxE;;;;;OAKG;IACH,sBAJW,MAAM,eACN,MAAM,GAAC,SAAS,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAiB7B;IALC,cAGC;IAIH;;;;OAIG;IACH,iBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAI3B;IAED;;;;OAIG;IACH,kBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,CAAC,CAoB3B;IAED;;;;OAIG;IACH,uBAHW,MAAM,GACJ,OAAO,CAAC,MAAM,EAAE,CAAC,CAa7B;IAED;;;;OAIG;IACH,mBAHW,MAAM,qCAehB;IAED;;;;;OAKG;IACH,gBAJW,MAAM,QACN,MAAM,EAAE;;OAuBlB;CACF;2BAvV0B,qBAAqB;2BAIS,eAAe;kDAAf,eAAe;sCAFlC,iBAAiB"}
|
|
@@ -111,7 +111,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
111
111
|
const arr = await zarrOpen(storeRoot.resolve(codesPath || path), { kind: 'array' });
|
|
112
112
|
const values = await zarrGet(arr, [null]);
|
|
113
113
|
const { data } = values;
|
|
114
|
-
const mappedValues = Array.from(data).map(i => (!categoriesValues ? String(i) : categoriesValues[i]));
|
|
114
|
+
const mappedValues = Array.from(data).map(i => (!categoriesValues ? String(i) : categoriesValues[ /** @type {number} */(i)]));
|
|
115
115
|
return mappedValues;
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
@@ -119,7 +119,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
119
119
|
* @param {string} path A string like obsm.X_pca.
|
|
120
120
|
* @returns {Promise<Chunk<any>>} A promise for a zarr array containing the data.
|
|
121
121
|
*/
|
|
122
|
-
loadNumeric(path) {
|
|
122
|
+
async loadNumeric(path) {
|
|
123
123
|
const { storeRoot } = this;
|
|
124
124
|
return zarrOpen(storeRoot.resolve(path), { kind: 'array' })
|
|
125
125
|
.then(arr => zarrGet(arr));
|
|
@@ -133,7 +133,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
133
133
|
* shape: [number, number],
|
|
134
134
|
* }>} A promise for a zarr array containing the data.
|
|
135
135
|
*/
|
|
136
|
-
loadNumericForDims(path, dims) {
|
|
136
|
+
async loadNumericForDims(path, dims) {
|
|
137
137
|
const { storeRoot } = this;
|
|
138
138
|
const arr = zarrOpen(storeRoot.resolve(path), { kind: 'array' });
|
|
139
139
|
return Promise.all(dims.map(dim => arr.then(loadedArr => zarrGet(loadedArr, [null, dim])))).then(cols => ({
|
|
@@ -153,7 +153,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
153
153
|
// Zarrita supports decoding vlen-utf8-encoded string arrays.
|
|
154
154
|
const data = await zarrGet(arr);
|
|
155
155
|
if (data.data?.[Symbol.iterator]) {
|
|
156
|
-
return Array.from(data.data);
|
|
156
|
+
return /** @type {string[]} */ (Array.from(data.data));
|
|
157
157
|
}
|
|
158
158
|
return /** @type {string[]} */ (data.data);
|
|
159
159
|
}
|
|
@@ -7,9 +7,11 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export default class ZarrDataSource {
|
|
9
9
|
/**
|
|
10
|
-
* @param {DataSourceParams} params The parameters object.
|
|
10
|
+
* @param {DataSourceParams & { refSpecUrl?: string }} params The parameters object.
|
|
11
11
|
*/
|
|
12
|
-
constructor({ url, requestInit, store, fileType }: DataSourceParams
|
|
12
|
+
constructor({ url, requestInit, refSpecUrl, store, fileType }: DataSourceParams & {
|
|
13
|
+
refSpecUrl?: string;
|
|
14
|
+
});
|
|
13
15
|
storeRoot: ZarrLocation<Readable>;
|
|
14
16
|
/**
|
|
15
17
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZarrDataSource.d.ts","sourceRoot":"","sources":["../src/ZarrDataSource.js"],"names":[],"mappings":"AAIA,gEAAgE;AAChE,mDAAmD;AACnD,0DAA0D;AAE1D;;;GAGG;AACH;IACE;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"ZarrDataSource.d.ts","sourceRoot":"","sources":["../src/ZarrDataSource.js"],"names":[],"mappings":"AAIA,gEAAgE;AAChE,mDAAmD;AACnD,0DAA0D;AAE1D;;;GAGG;AACH;IACE;;OAEG;IACH,+DAFW,gBAAgB,GAAG;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,EAWpD;IANG,kCAAgC;IAQpC;;;;OAIG;IACH,mBAHW,MAAM,GACJ,aAAa,QAAQ,CAAC,CAIlC;IAED;;;;;;;;OAQG;IACH,aAPW,MAAM,mBACN,aAAa,QAAQ,CAAC,GAAC,IAAI,GAEzB,OAAO,CAAC,GAAG,CAAC,CAcxB;CACF;8BAnD6B,kBAAkB;8CADF,eAAe;sCAEvB,iBAAiB"}
|
|
@@ -10,15 +10,15 @@ import { open as zarrOpen, root as zarrRoot } from 'zarrita';
|
|
|
10
10
|
*/
|
|
11
11
|
export default class ZarrDataSource {
|
|
12
12
|
/**
|
|
13
|
-
* @param {DataSourceParams} params The parameters object.
|
|
13
|
+
* @param {DataSourceParams & { refSpecUrl?: string }} params The parameters object.
|
|
14
14
|
*/
|
|
15
|
-
constructor({ url, requestInit, store, fileType }) {
|
|
15
|
+
constructor({ url, requestInit, refSpecUrl, store, fileType }) {
|
|
16
16
|
if (store) {
|
|
17
17
|
// TODO: check here that it is a valid Zarrita Readable?
|
|
18
18
|
this.storeRoot = zarrRoot(store);
|
|
19
19
|
}
|
|
20
20
|
else if (url) {
|
|
21
|
-
this.storeRoot = zarrOpenRoot(url, fileType, requestInit);
|
|
21
|
+
this.storeRoot = zarrOpenRoot(url, fileType, { requestInit, refSpecUrl });
|
|
22
22
|
}
|
|
23
23
|
else {
|
|
24
24
|
throw new Error('Either a store or a URL must be provided to the ZarrDataSource constructor.');
|
|
@@ -12,10 +12,10 @@ export default class ObsEmbeddingAnndataLoader<DataSourceType extends AnnDataSou
|
|
|
12
12
|
* @returns {Promise<MatrixResult>} A promise for an array of columns.
|
|
13
13
|
*/
|
|
14
14
|
loadEmbedding(): Promise<MatrixResult>;
|
|
15
|
-
embedding:
|
|
15
|
+
embedding: {
|
|
16
16
|
data: [import("zarrita").TypedArray<any>, import("zarrita").TypedArray<any>];
|
|
17
17
|
shape: [number, number];
|
|
18
|
-
}
|
|
18
|
+
} | undefined;
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
21
|
* @returns {Promise<LoaderResult<ObsEmbeddingData>>}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsEmbeddingAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsEmbeddingAnndataLoader.js"],"names":[],"mappings":"AAKA,uDAAuD;AACvD,wEAAwE;AAExE;;;;GAIG;AACH,+CAH6B,cAAc,SAA9B,aAAe;;IAI1B;;;OAGG;IACH,iBAFa,OAAO,CAAC,YAAY,CAAC,CAYjC;IAJG;;;
|
|
1
|
+
{"version":3,"file":"ObsEmbeddingAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsEmbeddingAnndataLoader.js"],"names":[],"mappings":"AAKA,uDAAuD;AACvD,wEAAwE;AAExE;;;;GAIG;AACH,+CAH6B,cAAc,SAA9B,aAAe;;IAI1B;;;OAGG;IACH,iBAFa,OAAO,CAAC,YAAY,CAAC,CAYjC;IAJG;;;kBAAqE;IAMzE;;;OAGG;IACH,QAFa,OAAO,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAkBnD;CACF;+BA9C8B,qBAAqB;sCAF7C,iBAAiB;kCAG4B,iBAAiB;6BAH9D,iBAAiB;sCAG4B,iBAAiB"}
|
|
@@ -15,11 +15,11 @@ export default class ObsEmbeddingAnndataLoader extends AbstractTwoStepLoader {
|
|
|
15
15
|
async loadEmbedding() {
|
|
16
16
|
const { path, dims = [0, 1] } = this.options;
|
|
17
17
|
if (this.embedding) {
|
|
18
|
-
return /** @type {
|
|
18
|
+
return /** @type {MatrixResult} */ (this.embedding);
|
|
19
19
|
}
|
|
20
20
|
if (!this.embedding) {
|
|
21
|
-
this.embedding = this.dataSource.loadNumericForDims(path, dims);
|
|
22
|
-
return /** @type {
|
|
21
|
+
this.embedding = await this.dataSource.loadNumericForDims(path, dims);
|
|
22
|
+
return /** @type {MatrixResult} */ (this.embedding);
|
|
23
23
|
}
|
|
24
24
|
return this.embedding;
|
|
25
25
|
}
|
|
@@ -14,7 +14,7 @@ export default class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoade
|
|
|
14
14
|
return this.obsFeatureColumns;
|
|
15
15
|
}
|
|
16
16
|
if (!this.obsFeatureColumns) {
|
|
17
|
-
const colPaths = options.map(({ path }) => path);
|
|
17
|
+
const colPaths = options.obsFeatureColumns?.map(({ path }) => path);
|
|
18
18
|
const firstPath = colPaths[0];
|
|
19
19
|
const obsIndex = await this.dataSource.loadObsIndex(firstPath);
|
|
20
20
|
const featureIndex = colPaths.map(colPath => basename(colPath));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsLabelsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsLabelsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;;IACE;;;OAGG;IACH,2BAYC;IALG,
|
|
1
|
+
{"version":3,"file":"ObsLabelsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsLabelsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;;IACE;;;OAGG;IACH,2BAYC;IALG,YAAqD;IAOzD;;;QAaC;CACF;sCAvCM,iBAAiB;6BAAjB,iBAAiB"}
|
|
@@ -7,14 +7,14 @@ export default class ObsLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
7
7
|
* Class method for loading observation string labels.
|
|
8
8
|
* @returns {Promise} A promise for the array.
|
|
9
9
|
*/
|
|
10
|
-
loadLabels() {
|
|
10
|
+
async loadLabels() {
|
|
11
11
|
const { path } = this.options;
|
|
12
12
|
if (this.labels) {
|
|
13
13
|
return this.labels;
|
|
14
14
|
}
|
|
15
15
|
if (!this.labels) {
|
|
16
16
|
// eslint-disable-next-line no-underscore-dangle
|
|
17
|
-
this.labels = this.dataSource._loadColumn(path);
|
|
17
|
+
this.labels = await this.dataSource._loadColumn(path);
|
|
18
18
|
return this.labels;
|
|
19
19
|
}
|
|
20
20
|
this.labels = Promise.resolve(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsLocationsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsLocationsAnndataLoader.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;;IACE;;;OAGG;IACH,8BAWC;IALG,
|
|
1
|
+
{"version":3,"file":"ObsLocationsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsLocationsAnndataLoader.js"],"names":[],"mappings":"AAIA;;GAEG;AACH;;IACE;;;OAGG;IACH,8BAWC;IALG,eAAqE;IAOzE;;;QAaC;CACF;sCArCM,iBAAiB;6BAAjB,iBAAiB"}
|
|
@@ -7,13 +7,13 @@ export default class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
7
7
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
8
8
|
* @returns {Promise} A promise for an array of columns.
|
|
9
9
|
*/
|
|
10
|
-
loadLocations() {
|
|
10
|
+
async loadLocations() {
|
|
11
11
|
const { path, dims = [0, 1] } = this.options;
|
|
12
12
|
if (this.locations) {
|
|
13
13
|
return this.locations;
|
|
14
14
|
}
|
|
15
15
|
if (!this.locations) {
|
|
16
|
-
this.locations = this.dataSource.loadNumericForDims(path, dims);
|
|
16
|
+
this.locations = await this.dataSource.loadNumericForDims(path, dims);
|
|
17
17
|
return this.locations;
|
|
18
18
|
}
|
|
19
19
|
this.locations = Promise.resolve(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsPointsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsPointsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;;IACE;;;OAGG;IACH,2BAWC;IALG,
|
|
1
|
+
{"version":3,"file":"ObsPointsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsPointsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;;IACE;;;OAGG;IACH,2BAWC;IALG,eAAqE;IAOzE;;;QAgCC;CACF;sCAzDM,iBAAiB;6BAAjB,iBAAiB"}
|
|
@@ -8,13 +8,13 @@ export default class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
8
8
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
9
9
|
* @returns {Promise} A promise for an array of columns.
|
|
10
10
|
*/
|
|
11
|
-
loadPoints() {
|
|
11
|
+
async loadPoints() {
|
|
12
12
|
const { path, dims = [0, 1] } = this.options;
|
|
13
13
|
if (this.locations) {
|
|
14
14
|
return this.locations;
|
|
15
15
|
}
|
|
16
16
|
if (!this.locations) {
|
|
17
|
-
this.locations = this.dataSource.loadNumericForDims(path, dims);
|
|
17
|
+
this.locations = await this.dataSource.loadNumericForDims(path, dims);
|
|
18
18
|
return this.locations;
|
|
19
19
|
}
|
|
20
20
|
this.locations = Promise.resolve(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsSetsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsSetsAnndataLoader.js"],"names":[],"mappings":"AAUA;;GAEG;AACH;;IACE,
|
|
1
|
+
{"version":3,"file":"ObsSetsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsSetsAnndataLoader.js"],"names":[],"mappings":"AAUA;;GAEG;AACH;;IACE,iCAkBC;IAED,sBAIC;IAED,yBAIC;IAED;;;;QA+BC;IAxBG,yCAK4F;CAoBjG;sCA5EM,iBAAiB;6BAAjB,iBAAiB"}
|
|
@@ -7,7 +7,8 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
7
7
|
loadObsIndices() {
|
|
8
8
|
const { options } = this;
|
|
9
9
|
const obsIndexPromises = options
|
|
10
|
-
.
|
|
10
|
+
.obsSets
|
|
11
|
+
?.map(({ path }) => path)
|
|
11
12
|
.map((pathOrPaths) => {
|
|
12
13
|
if (Array.isArray(pathOrPaths)) {
|
|
13
14
|
// The multi-level case, try using the first item to get the obsIndex.
|
|
@@ -24,12 +25,12 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
24
25
|
}
|
|
25
26
|
loadCellSetIds() {
|
|
26
27
|
const { options } = this;
|
|
27
|
-
const cellSetZarrLocation = options.map(({ path }) => path);
|
|
28
|
+
const cellSetZarrLocation = options.obsSets?.map(({ path }) => path);
|
|
28
29
|
return this.dataSource.loadObsColumns(cellSetZarrLocation);
|
|
29
30
|
}
|
|
30
31
|
loadCellSetScores() {
|
|
31
32
|
const { options } = this;
|
|
32
|
-
const cellSetScoreZarrLocation = options.map(option => option.scorePath || undefined);
|
|
33
|
+
const cellSetScoreZarrLocation = options.obsSets?.map(option => option.scorePath || undefined);
|
|
33
34
|
return this.dataSource.loadObsColumns(cellSetScoreZarrLocation);
|
|
34
35
|
}
|
|
35
36
|
async load() {
|
|
@@ -44,7 +45,7 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
44
45
|
this.loadObsIndices(),
|
|
45
46
|
this.loadCellSetIds(),
|
|
46
47
|
this.loadCellSetScores(),
|
|
47
|
-
]).then(data => [data[0], dataToCellSetsTree([data[1], data[2], data[3]], options)]);
|
|
48
|
+
]).then(data => [data[0], dataToCellSetsTree([data[1], data[2], data[3]], options.obsSets)]);
|
|
48
49
|
}
|
|
49
50
|
const [obsIndex, obsSets] = await this.cachedResult;
|
|
50
51
|
const obsSetsMembership = treeToMembershipMap(obsSets);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsSpotsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsSpotsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;;IACE;;;OAGG;IACH,0BAWC;IALG,
|
|
1
|
+
{"version":3,"file":"ObsSpotsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsSpotsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;;IACE;;;OAGG;IACH,0BAWC;IALG,eAAqE;IAOzE;;;QAiCC;CACF;sCA1DM,iBAAiB;6BAAjB,iBAAiB"}
|
|
@@ -8,13 +8,13 @@ export default class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
8
8
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
9
9
|
* @returns {Promise} A promise for an array of columns.
|
|
10
10
|
*/
|
|
11
|
-
loadSpots() {
|
|
11
|
+
async loadSpots() {
|
|
12
12
|
const { path, dims = [0, 1] } = this.options;
|
|
13
13
|
if (this.locations) {
|
|
14
14
|
return this.locations;
|
|
15
15
|
}
|
|
16
16
|
if (!this.locations) {
|
|
17
|
-
this.locations = this.dataSource.loadNumericForDims(path, dims);
|
|
17
|
+
this.locations = await this.dataSource.loadNumericForDims(path, dims);
|
|
18
18
|
return this.locations;
|
|
19
19
|
}
|
|
20
20
|
this.locations = Promise.resolve(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpatialDataObsSpotsLoader.d.ts","sourceRoot":"","sources":["../../src/spatialdata-loaders/SpatialDataObsSpotsLoader.js"],"names":[],"mappings":"AAaA;;KAEK;AACL;;IACE;;;SAGK;IACL,0BAWC;IALG,
|
|
1
|
+
{"version":3,"file":"SpatialDataObsSpotsLoader.d.ts","sourceRoot":"","sources":["../../src/spatialdata-loaders/SpatialDataObsSpotsLoader.js"],"names":[],"mappings":"AAaA;;KAEK;AACL;;IACE;;;SAGK;IACL,0BAWC;IALG,eAAoF;IAOxF,2BAWC;IALG,YAAoE;IAOxE;;;QAsCC;CACF;sCApFM,iBAAiB;6BAAjB,iBAAiB"}
|
|
@@ -14,25 +14,25 @@ export default class SpatialDataObsSpotsLoader extends AbstractTwoStepLoader {
|
|
|
14
14
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
15
15
|
* @returns {Promise} A promise for an array of columns.
|
|
16
16
|
*/
|
|
17
|
-
loadSpots() {
|
|
17
|
+
async loadSpots() {
|
|
18
18
|
const { path, dims = [0, 1] } = this.options;
|
|
19
19
|
if (this.locations) {
|
|
20
20
|
return this.locations;
|
|
21
21
|
}
|
|
22
22
|
if (!this.locations) {
|
|
23
|
-
this.locations = this.dataSource.loadNumericForDims(getCoordsPath(path), dims);
|
|
23
|
+
this.locations = await this.dataSource.loadNumericForDims(getCoordsPath(path), dims);
|
|
24
24
|
return this.locations;
|
|
25
25
|
}
|
|
26
26
|
this.locations = Promise.resolve(null);
|
|
27
27
|
return this.locations;
|
|
28
28
|
}
|
|
29
|
-
loadRadius() {
|
|
29
|
+
async loadRadius() {
|
|
30
30
|
const { path } = this.options;
|
|
31
31
|
if (this.radius) {
|
|
32
32
|
return this.radius;
|
|
33
33
|
}
|
|
34
34
|
if (!this.radius) {
|
|
35
|
-
this.radius = this.dataSource.loadNumeric(getRadiusPath(path));
|
|
35
|
+
this.radius = await this.dataSource.loadNumeric(getRadiusPath(path));
|
|
36
36
|
return this.radius;
|
|
37
37
|
}
|
|
38
38
|
this.radius = Promise.resolve(null);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/zarr",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"author": "Gehlenborg Lab",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -18,22 +18,22 @@
|
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"d3-array": "^2.4.0",
|
|
20
20
|
"lodash-es": "^4.17.21",
|
|
21
|
-
"zarrita": "0.4.0-next.
|
|
22
|
-
"@vitessce/constants-internal": "3.4.
|
|
23
|
-
"@vitessce/gl": "3.4.
|
|
24
|
-
"@vitessce/sets-utils": "3.4.
|
|
25
|
-
"@vitessce/spatial-utils": "3.4.
|
|
26
|
-
"@vitessce/image-utils": "3.4.
|
|
27
|
-
"@vitessce/utils": "3.4.
|
|
28
|
-
"@vitessce/vit-s": "3.4.
|
|
29
|
-
"@vitessce/zarr-utils": "3.4.
|
|
30
|
-
"@vitessce/config": "3.4.
|
|
21
|
+
"zarrita": "0.4.0-next.16",
|
|
22
|
+
"@vitessce/constants-internal": "3.4.10",
|
|
23
|
+
"@vitessce/gl": "3.4.10",
|
|
24
|
+
"@vitessce/sets-utils": "3.4.10",
|
|
25
|
+
"@vitessce/spatial-utils": "3.4.10",
|
|
26
|
+
"@vitessce/image-utils": "3.4.10",
|
|
27
|
+
"@vitessce/utils": "3.4.10",
|
|
28
|
+
"@vitessce/vit-s": "3.4.10",
|
|
29
|
+
"@vitessce/zarr-utils": "3.4.10",
|
|
30
|
+
"@vitessce/config": "3.4.10"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@zarrita/core": "0.1.0-next.
|
|
34
|
-
"@zarrita/storage": "0.1.0-next.
|
|
35
|
-
"@zarrita/typedarray": "0.1.0-next.
|
|
36
|
-
"@vitessce/types": "3.4.
|
|
33
|
+
"@zarrita/core": "0.1.0-next.14",
|
|
34
|
+
"@zarrita/storage": "0.1.0-next.6",
|
|
35
|
+
"@zarrita/typedarray": "0.1.0-next.3",
|
|
36
|
+
"@vitessce/types": "3.4.10"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.js",
|
package/src/AnnDataSource.js
CHANGED
|
@@ -132,7 +132,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
132
132
|
const values = await zarrGet(arr, [null]);
|
|
133
133
|
const { data } = values;
|
|
134
134
|
const mappedValues = Array.from(data).map(
|
|
135
|
-
i => (!categoriesValues ? String(i) : categoriesValues[i]),
|
|
135
|
+
i => (!categoriesValues ? String(i) : categoriesValues[/** @type {number} */ (i)]),
|
|
136
136
|
);
|
|
137
137
|
return mappedValues;
|
|
138
138
|
}
|
|
@@ -142,7 +142,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
142
142
|
* @param {string} path A string like obsm.X_pca.
|
|
143
143
|
* @returns {Promise<Chunk<any>>} A promise for a zarr array containing the data.
|
|
144
144
|
*/
|
|
145
|
-
loadNumeric(path) {
|
|
145
|
+
async loadNumeric(path) {
|
|
146
146
|
const { storeRoot } = this;
|
|
147
147
|
return zarrOpen(storeRoot.resolve(path), { kind: 'array' })
|
|
148
148
|
.then(arr => zarrGet(arr));
|
|
@@ -157,7 +157,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
157
157
|
* shape: [number, number],
|
|
158
158
|
* }>} A promise for a zarr array containing the data.
|
|
159
159
|
*/
|
|
160
|
-
loadNumericForDims(path, dims) {
|
|
160
|
+
async loadNumericForDims(path, dims) {
|
|
161
161
|
const { storeRoot } = this;
|
|
162
162
|
const arr = zarrOpen(storeRoot.resolve(path), { kind: 'array' });
|
|
163
163
|
return Promise.all(
|
|
@@ -184,7 +184,7 @@ export default class AnnDataSource extends ZarrDataSource {
|
|
|
184
184
|
// Zarrita supports decoding vlen-utf8-encoded string arrays.
|
|
185
185
|
const data = await zarrGet(arr);
|
|
186
186
|
if (data.data?.[Symbol.iterator]) {
|
|
187
|
-
return Array.from(data.data);
|
|
187
|
+
return /** @type {string[]} */ (Array.from(data.data));
|
|
188
188
|
}
|
|
189
189
|
return /** @type {string[]} */ (data.data);
|
|
190
190
|
}
|
package/src/ZarrDataSource.js
CHANGED
|
@@ -12,14 +12,14 @@ import { open as zarrOpen, root as zarrRoot } from 'zarrita';
|
|
|
12
12
|
*/
|
|
13
13
|
export default class ZarrDataSource {
|
|
14
14
|
/**
|
|
15
|
-
* @param {DataSourceParams} params The parameters object.
|
|
15
|
+
* @param {DataSourceParams & { refSpecUrl?: string }} params The parameters object.
|
|
16
16
|
*/
|
|
17
|
-
constructor({ url, requestInit, store, fileType }) {
|
|
17
|
+
constructor({ url, requestInit, refSpecUrl, store, fileType }) {
|
|
18
18
|
if (store) {
|
|
19
19
|
// TODO: check here that it is a valid Zarrita Readable?
|
|
20
20
|
this.storeRoot = zarrRoot(store);
|
|
21
21
|
} else if (url) {
|
|
22
|
-
this.storeRoot = zarrOpenRoot(url, fileType, requestInit);
|
|
22
|
+
this.storeRoot = zarrOpenRoot(url, fileType, { requestInit, refSpecUrl });
|
|
23
23
|
} else {
|
|
24
24
|
throw new Error('Either a store or a URL must be provided to the ZarrDataSource constructor.');
|
|
25
25
|
}
|
|
@@ -45,7 +45,6 @@ export default class ZarrDataSource {
|
|
|
45
45
|
*/
|
|
46
46
|
async getJson(key, storeRootParam = null) {
|
|
47
47
|
const { storeRoot } = this;
|
|
48
|
-
|
|
49
48
|
const storeRootToUse = storeRootParam || storeRoot;
|
|
50
49
|
|
|
51
50
|
let dirKey = key;
|
|
@@ -19,11 +19,11 @@ export default class ObsEmbeddingAnndataLoader extends AbstractTwoStepLoader {
|
|
|
19
19
|
async loadEmbedding() {
|
|
20
20
|
const { path, dims = [0, 1] } = this.options;
|
|
21
21
|
if (this.embedding) {
|
|
22
|
-
return /** @type {
|
|
22
|
+
return /** @type {MatrixResult} */ (this.embedding);
|
|
23
23
|
}
|
|
24
24
|
if (!this.embedding) {
|
|
25
|
-
this.embedding = this.dataSource.loadNumericForDims(path, dims);
|
|
26
|
-
return /** @type {
|
|
25
|
+
this.embedding = await this.dataSource.loadNumericForDims(path, dims);
|
|
26
|
+
return /** @type {MatrixResult} */ (this.embedding);
|
|
27
27
|
}
|
|
28
28
|
return this.embedding;
|
|
29
29
|
}
|
|
@@ -17,7 +17,7 @@ export default class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoade
|
|
|
17
17
|
return this.obsFeatureColumns;
|
|
18
18
|
}
|
|
19
19
|
if (!this.obsFeatureColumns) {
|
|
20
|
-
const colPaths = options.map(({ path }) => path);
|
|
20
|
+
const colPaths = options.obsFeatureColumns?.map(({ path }) => path);
|
|
21
21
|
const firstPath = colPaths[0];
|
|
22
22
|
const obsIndex = await this.dataSource.loadObsIndex(firstPath);
|
|
23
23
|
const featureIndex = colPaths.map(colPath => basename(colPath));
|
|
@@ -11,14 +11,14 @@ export default class ObsLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
11
11
|
* Class method for loading observation string labels.
|
|
12
12
|
* @returns {Promise} A promise for the array.
|
|
13
13
|
*/
|
|
14
|
-
loadLabels() {
|
|
14
|
+
async loadLabels() {
|
|
15
15
|
const { path } = this.options;
|
|
16
16
|
if (this.labels) {
|
|
17
17
|
return this.labels;
|
|
18
18
|
}
|
|
19
19
|
if (!this.labels) {
|
|
20
20
|
// eslint-disable-next-line no-underscore-dangle
|
|
21
|
-
this.labels = this.dataSource._loadColumn(path);
|
|
21
|
+
this.labels = await this.dataSource._loadColumn(path);
|
|
22
22
|
return this.labels;
|
|
23
23
|
}
|
|
24
24
|
this.labels = Promise.resolve(null);
|
|
@@ -10,13 +10,13 @@ export default class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
10
10
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
11
11
|
* @returns {Promise} A promise for an array of columns.
|
|
12
12
|
*/
|
|
13
|
-
loadLocations() {
|
|
13
|
+
async loadLocations() {
|
|
14
14
|
const { path, dims = [0, 1] } = this.options;
|
|
15
15
|
if (this.locations) {
|
|
16
16
|
return this.locations;
|
|
17
17
|
}
|
|
18
18
|
if (!this.locations) {
|
|
19
|
-
this.locations = this.dataSource.loadNumericForDims(path, dims);
|
|
19
|
+
this.locations = await this.dataSource.loadNumericForDims(path, dims);
|
|
20
20
|
return this.locations;
|
|
21
21
|
}
|
|
22
22
|
this.locations = Promise.resolve(null);
|
|
@@ -11,13 +11,13 @@ export default class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
11
11
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
12
12
|
* @returns {Promise} A promise for an array of columns.
|
|
13
13
|
*/
|
|
14
|
-
loadPoints() {
|
|
14
|
+
async loadPoints() {
|
|
15
15
|
const { path, dims = [0, 1] } = this.options;
|
|
16
16
|
if (this.locations) {
|
|
17
17
|
return this.locations;
|
|
18
18
|
}
|
|
19
19
|
if (!this.locations) {
|
|
20
|
-
this.locations = this.dataSource.loadNumericForDims(path, dims);
|
|
20
|
+
this.locations = await this.dataSource.loadNumericForDims(path, dims);
|
|
21
21
|
return this.locations;
|
|
22
22
|
}
|
|
23
23
|
this.locations = Promise.resolve(null);
|
|
@@ -15,7 +15,8 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
15
15
|
loadObsIndices() {
|
|
16
16
|
const { options } = this;
|
|
17
17
|
const obsIndexPromises = options
|
|
18
|
-
.
|
|
18
|
+
.obsSets
|
|
19
|
+
?.map(({ path }) => path)
|
|
19
20
|
.map((pathOrPaths) => {
|
|
20
21
|
if (Array.isArray(pathOrPaths)) {
|
|
21
22
|
// The multi-level case, try using the first item to get the obsIndex.
|
|
@@ -33,13 +34,13 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
33
34
|
|
|
34
35
|
loadCellSetIds() {
|
|
35
36
|
const { options } = this;
|
|
36
|
-
const cellSetZarrLocation = options.map(({ path }) => path);
|
|
37
|
+
const cellSetZarrLocation = options.obsSets?.map(({ path }) => path);
|
|
37
38
|
return this.dataSource.loadObsColumns(cellSetZarrLocation);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
loadCellSetScores() {
|
|
41
42
|
const { options } = this;
|
|
42
|
-
const cellSetScoreZarrLocation = options.map(option => option.scorePath || undefined);
|
|
43
|
+
const cellSetScoreZarrLocation = options.obsSets?.map(option => option.scorePath || undefined);
|
|
43
44
|
return this.dataSource.loadObsColumns(cellSetScoreZarrLocation);
|
|
44
45
|
}
|
|
45
46
|
|
|
@@ -55,7 +56,7 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
55
56
|
this.loadObsIndices(),
|
|
56
57
|
this.loadCellSetIds(),
|
|
57
58
|
this.loadCellSetScores(),
|
|
58
|
-
]).then(data => [data[0], dataToCellSetsTree([data[1], data[2], data[3]], options)]);
|
|
59
|
+
]).then(data => [data[0], dataToCellSetsTree([data[1], data[2], data[3]], options.obsSets)]);
|
|
59
60
|
}
|
|
60
61
|
const [obsIndex, obsSets] = await this.cachedResult;
|
|
61
62
|
const obsSetsMembership = treeToMembershipMap(obsSets);
|
|
@@ -11,13 +11,13 @@ export default class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
11
11
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
12
12
|
* @returns {Promise} A promise for an array of columns.
|
|
13
13
|
*/
|
|
14
|
-
loadSpots() {
|
|
14
|
+
async loadSpots() {
|
|
15
15
|
const { path, dims = [0, 1] } = this.options;
|
|
16
16
|
if (this.locations) {
|
|
17
17
|
return this.locations;
|
|
18
18
|
}
|
|
19
19
|
if (!this.locations) {
|
|
20
|
-
this.locations = this.dataSource.loadNumericForDims(path, dims);
|
|
20
|
+
this.locations = await this.dataSource.loadNumericForDims(path, dims);
|
|
21
21
|
return this.locations;
|
|
22
22
|
}
|
|
23
23
|
this.locations = Promise.resolve(null);
|