@vitessce/zarr 3.3.9 → 3.3.11
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-2f7f502f.js → deflate-b162c7aa.js} +1 -1
- package/dist/{index-200d5108.js → index-184aee21.js} +290 -124
- package/dist/index.js +1 -1
- package/dist/{jpeg-3ff942a5.js → jpeg-dbb0f9d9.js} +1 -1
- package/dist/{lerc-762cc666.js → lerc-e45d57dc.js} +1 -1
- package/dist/{lzw-97464fce.js → lzw-05e88e18.js} +1 -1
- package/dist/{packbits-daaf8f04.js → packbits-922f4592.js} +1 -1
- package/dist/{raw-8fdba750.js → raw-a8de9c08.js} +1 -1
- package/dist/{webimage-e98ea52f.js → webimage-27013e2d.js} +1 -1
- package/dist-tsc/AnnDataSource.d.ts +96 -30
- package/dist-tsc/AnnDataSource.d.ts.map +1 -1
- package/dist-tsc/AnnDataSource.js +147 -53
- package/dist-tsc/MuDataSource.d.ts +1 -1
- package/dist-tsc/MuDataSource.d.ts.map +1 -1
- package/dist-tsc/SpatialDataShapesSource.d.ts +40 -12
- package/dist-tsc/SpatialDataShapesSource.d.ts.map +1 -1
- package/dist-tsc/SpatialDataShapesSource.js +58 -27
- package/dist-tsc/SpatialDataTableSource.d.ts +35 -14
- package/dist-tsc/SpatialDataTableSource.d.ts.map +1 -1
- package/dist-tsc/SpatialDataTableSource.js +57 -27
- package/dist-tsc/ZarrDataSource.d.ts +22 -11
- package/dist-tsc/ZarrDataSource.d.ts.map +1 -1
- package/dist-tsc/ZarrDataSource.js +20 -3
- package/dist-tsc/anndata-loaders/FeatureLabelsAnndataLoader.d.ts +18 -5
- package/dist-tsc/anndata-loaders/FeatureLabelsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/FeatureLabelsAnndataLoader.js +12 -4
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.d.ts +22 -5
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.js +13 -5
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.d.ts +9 -2
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.d.ts +9 -2
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.d.ts +8 -2
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.d.ts +8 -2
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.d.ts +8 -2
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSegmentationsAnndataLoader.d.ts +9 -2
- package/dist-tsc/anndata-loaders/ObsSegmentationsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.d.ts +10 -3
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.d.ts +8 -2
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.d.ts +8 -2
- package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.d.ts +3 -1
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.d.ts.map +1 -1
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.d.ts +9 -2
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.d.ts.map +1 -1
- package/dist-tsc/ome-loaders/OmeZarrAsObsSegmentationsLoader.d.ts +10 -1
- package/dist-tsc/ome-loaders/OmeZarrAsObsSegmentationsLoader.d.ts.map +1 -1
- package/dist-tsc/ome-loaders/OmeZarrLoader.d.ts +12 -2
- package/dist-tsc/ome-loaders/OmeZarrLoader.d.ts.map +1 -1
- package/dist-tsc/ome-loaders/OmeZarrLoader.js +2 -2
- package/dist-tsc/spatialdata-loaders/SpatialDataImageLoader.d.ts +1 -1
- package/dist-tsc/spatialdata-loaders/SpatialDataImageLoader.d.ts.map +1 -1
- package/dist-tsc/spatialdata-loaders/SpatialDataLabelsLoader.d.ts +1 -1
- package/dist-tsc/spatialdata-loaders/SpatialDataLabelsLoader.d.ts.map +1 -1
- package/dist-tsc/spatialdata-loaders/SpatialDataObsSetsLoader.d.ts +1 -2
- package/dist-tsc/spatialdata-loaders/SpatialDataObsSetsLoader.d.ts.map +1 -1
- package/dist-tsc/spatialdata-loaders/SpatialDataObsSpotsLoader.d.ts +8 -2
- package/dist-tsc/spatialdata-loaders/SpatialDataObsSpotsLoader.d.ts.map +1 -1
- package/dist-tsc/utils.d.ts +14 -2
- package/dist-tsc/utils.d.ts.map +1 -1
- package/dist-tsc/utils.js +19 -1
- package/package.json +16 -10
- package/src/AnnDataSource.js +170 -53
- package/src/SpatialDataShapesSource.js +61 -28
- package/src/SpatialDataTableSource.js +60 -27
- package/src/ZarrDataSource.js +20 -3
- package/src/anndata-loaders/FeatureLabelsAnndataLoader.js +13 -4
- package/src/anndata-loaders/ObsEmbeddingAnndataLoader.js +14 -5
- package/src/utils.js +20 -1
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
/* eslint-disable no-underscore-dangle */
|
|
2
3
|
import AnnDataSource from './AnnDataSource.js';
|
|
4
|
+
/** @import { DataSourceParams } from '@vitessce/types' */
|
|
3
5
|
// If the array path starts with table/something/rest
|
|
4
6
|
// capture table/something.
|
|
5
7
|
const regex = /^shapes\/([^/]*)\/(.*)$/;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {string|undefined} arrPath
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
6
13
|
function getShapesPrefix(arrPath) {
|
|
7
14
|
if (arrPath) {
|
|
8
15
|
const matches = arrPath.match(regex);
|
|
@@ -12,24 +19,51 @@ function getShapesPrefix(arrPath) {
|
|
|
12
19
|
}
|
|
13
20
|
return '';
|
|
14
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @param {string|undefined} arrPath
|
|
25
|
+
* @returns
|
|
26
|
+
*/
|
|
15
27
|
export function getIndexPath(arrPath) {
|
|
16
28
|
return `${getShapesPrefix(arrPath)}Index`;
|
|
17
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
*
|
|
32
|
+
* @param {string|undefined} arrPath
|
|
33
|
+
* @returns
|
|
34
|
+
*/
|
|
18
35
|
export function getVarPath(arrPath) {
|
|
19
36
|
return `${getShapesPrefix(arrPath)}var`;
|
|
20
37
|
}
|
|
21
38
|
export default class SpatialDataShapesSource extends AnnDataSource {
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param {DataSourceParams} params
|
|
42
|
+
*/
|
|
43
|
+
constructor(params) {
|
|
44
|
+
super(params);
|
|
45
|
+
/** @type {{ [k: string]: Promise<string[]> }} */
|
|
46
|
+
this.obsIndices = {};
|
|
47
|
+
/** @type {{ [k: string]: Promise<string[]> }} */
|
|
48
|
+
this.varIndices = {};
|
|
49
|
+
/** @type {{ [k: string]: string[] }} */
|
|
50
|
+
this.varAliases = {};
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @param {string} tablePath
|
|
55
|
+
* @returns
|
|
56
|
+
*/
|
|
22
57
|
async loadSpatialDataAttrs(tablePath) {
|
|
23
58
|
return this._loadDict(`${tablePath}/uns/spatialdata_attrs`, ['instance_key', 'region', 'region_key']);
|
|
24
59
|
}
|
|
25
60
|
/**
|
|
26
61
|
* Class method for loading the obs index.
|
|
27
|
-
* @
|
|
62
|
+
* @param {string|undefined} path
|
|
63
|
+
* @param {string|undefined} tablePath
|
|
64
|
+
* @returns {Promise<string[]>} An promise for a zarr array containing the indices.
|
|
28
65
|
*/
|
|
29
|
-
async loadObsIndex(path =
|
|
30
|
-
if (!this.obsIndex) {
|
|
31
|
-
this.obsIndex = {};
|
|
32
|
-
}
|
|
66
|
+
async loadObsIndex(path = undefined, tablePath = undefined) {
|
|
33
67
|
let indexPath = getIndexPath(path);
|
|
34
68
|
if (tablePath) {
|
|
35
69
|
// TODO: given a path to the shapes,
|
|
@@ -46,43 +80,40 @@ export default class SpatialDataShapesSource extends AnnDataSource {
|
|
|
46
80
|
} = await this.loadSpatialDataAttrs(tablePath);
|
|
47
81
|
indexPath = `${obsPath}/${instanceKey}`;
|
|
48
82
|
}
|
|
49
|
-
if (this.
|
|
50
|
-
return this.
|
|
83
|
+
if (indexPath in this.obsIndices) {
|
|
84
|
+
return this.obsIndices[indexPath];
|
|
51
85
|
}
|
|
52
|
-
this.
|
|
53
|
-
return this.
|
|
86
|
+
this.obsIndices[indexPath] = this._loadColumn(indexPath);
|
|
87
|
+
return this.obsIndices[indexPath];
|
|
54
88
|
}
|
|
55
89
|
/**
|
|
56
90
|
* Class method for loading the var index.
|
|
57
|
-
* @
|
|
91
|
+
* @param {string|undefined} path
|
|
92
|
+
* @returns {Promise<string[]>} An promise for a zarr array containing the indices.
|
|
58
93
|
*/
|
|
59
|
-
loadVarIndex(path =
|
|
60
|
-
if (!this.varIndex) {
|
|
61
|
-
this.varIndex = {};
|
|
62
|
-
}
|
|
94
|
+
loadVarIndex(path = undefined) {
|
|
63
95
|
const varPath = getVarPath(path);
|
|
64
|
-
if (this.
|
|
65
|
-
return this.
|
|
96
|
+
if (varPath in this.varIndices) {
|
|
97
|
+
return this.varIndices[varPath];
|
|
66
98
|
}
|
|
67
|
-
this.
|
|
99
|
+
this.varIndices[varPath] = this.getJson(`${varPath}/.zattrs`)
|
|
68
100
|
.then(({ _index }) => this.getFlatArrDecompressed(`${varPath}/${_index}`));
|
|
69
|
-
return this.
|
|
101
|
+
return this.varIndices[varPath];
|
|
70
102
|
}
|
|
71
103
|
/**
|
|
72
104
|
* Class method for loading the var alias.
|
|
73
|
-
* @
|
|
105
|
+
* @param {string} varPath
|
|
106
|
+
* @param {string} matrixPath
|
|
107
|
+
* @returns {Promise<string[]>} An promise for a zarr array containing the aliased names.
|
|
74
108
|
*/
|
|
75
109
|
async loadVarAlias(varPath, matrixPath) {
|
|
76
|
-
if (
|
|
77
|
-
this.
|
|
78
|
-
}
|
|
79
|
-
if (this.varAlias[varPath]) {
|
|
80
|
-
return this.varAlias[varPath];
|
|
110
|
+
if (varPath in this.varAliases) {
|
|
111
|
+
return this.varAliases[varPath];
|
|
81
112
|
}
|
|
82
113
|
const [varAliasData] = await this.loadVarColumns([varPath]);
|
|
83
|
-
this.
|
|
114
|
+
this.varAliases[varPath] = /** @type {string[]} */ (varAliasData);
|
|
84
115
|
const index = await this.loadVarIndex(matrixPath);
|
|
85
|
-
this.
|
|
86
|
-
return this.
|
|
116
|
+
this.varAliases[varPath] = this.varAliases[varPath].map((val, ind) => (val ? val.concat(` (${index[ind]})`) : index[ind]));
|
|
117
|
+
return this.varAliases[varPath];
|
|
87
118
|
}
|
|
88
119
|
}
|
|
@@ -1,22 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
* @param {string|undefined} arrPath
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export function getObsPath(arrPath: string | undefined): string;
|
|
7
|
+
/**
|
|
8
|
+
*
|
|
9
|
+
* @param {string|undefined} arrPath
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export function getVarPath(arrPath: string | undefined): string;
|
|
3
13
|
export default class SpatialDataTableSource extends AnnDataSource {
|
|
4
|
-
|
|
14
|
+
/** @type {{ [k: string]: Promise<string[]> }} */
|
|
15
|
+
obsIndices: {
|
|
16
|
+
[k: string]: Promise<string[]>;
|
|
17
|
+
};
|
|
18
|
+
/** @type {{ [k: string]: Promise<string[]> }} */
|
|
19
|
+
varIndices: {
|
|
20
|
+
[k: string]: Promise<string[]>;
|
|
21
|
+
};
|
|
22
|
+
/** @type {{ [k: string]: string[] }} */
|
|
23
|
+
varAliases: {
|
|
24
|
+
[k: string]: string[];
|
|
25
|
+
};
|
|
5
26
|
/**
|
|
6
|
-
*
|
|
7
|
-
* @
|
|
27
|
+
*
|
|
28
|
+
* @param {string} tablePath
|
|
29
|
+
* @returns
|
|
8
30
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
* @returns {Promise} An promise for a zarr array containing the indices.
|
|
13
|
-
*/
|
|
14
|
-
loadVarIndex(path?: null): Promise<any>;
|
|
31
|
+
loadSpatialDataAttrs(tablePath: string): Promise<{
|
|
32
|
+
[k: string]: string | string[] | null;
|
|
33
|
+
}>;
|
|
15
34
|
/**
|
|
16
35
|
* Class method for loading the var alias.
|
|
17
|
-
* @
|
|
36
|
+
* @param {string} varPath
|
|
37
|
+
* @param {string} matrixPath
|
|
38
|
+
* @returns {Promise<string[]>} An promise for a zarr array containing the aliased names.
|
|
18
39
|
*/
|
|
19
|
-
loadVarAlias(varPath:
|
|
40
|
+
loadVarAlias(varPath: string, matrixPath: string): Promise<string[]>;
|
|
20
41
|
}
|
|
21
|
-
import AnnDataSource from
|
|
42
|
+
import AnnDataSource from './AnnDataSource.js';
|
|
22
43
|
//# sourceMappingURL=SpatialDataTableSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpatialDataTableSource.d.ts","sourceRoot":"","sources":["../src/SpatialDataTableSource.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SpatialDataTableSource.d.ts","sourceRoot":"","sources":["../src/SpatialDataTableSource.js"],"names":[],"mappings":"AA2BA;;;;GAIG;AACH,oCAHW,MAAM,GAAC,SAAS,UAK1B;AAED;;;;GAIG;AACH,oCAHW,MAAM,GAAC,SAAS,UAK1B;AAED;IAOI,iDAAiD;IACjD,YADW;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;KAAE,CACzB;IACpB,iDAAiD;IACjD,YADW;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAA;KAAE,CACzB;IACpB,wCAAwC;IACxC,YADW;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;KAAE,CAChB;IAGtB;;;;OAIG;IACH,gCAHW,MAAM;;OAKhB;IA2CD;;;;;OAKG;IACH,sBAJW,MAAM,cACN,MAAM,GACJ,OAAO,CAAC,MAAM,EAAE,CAAC,CAa7B;CACF;0BA9HyB,oBAAoB"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
/* eslint-disable no-underscore-dangle */
|
|
2
3
|
import AnnDataSource from './AnnDataSource.js';
|
|
4
|
+
/** @import { DataSourceParams } from '@vitessce/types' */
|
|
3
5
|
// If the array path starts with table/something/rest
|
|
4
6
|
// capture table/something.
|
|
5
7
|
const regex = /^table\/([^/]*)\/(.*)$/;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param {string|undefined} arrPath
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
6
13
|
function getTablePrefix(arrPath) {
|
|
7
14
|
if (arrPath) {
|
|
8
15
|
const matches = arrPath.match(regex);
|
|
@@ -14,24 +21,50 @@ function getTablePrefix(arrPath) {
|
|
|
14
21
|
// ObsSetsAnndataLoader will need to pass a path to loadObsIndex().
|
|
15
22
|
return 'table/table/';
|
|
16
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {string|undefined} arrPath
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
17
29
|
export function getObsPath(arrPath) {
|
|
18
30
|
return `${getTablePrefix(arrPath)}obs`;
|
|
19
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
* @param {string|undefined} arrPath
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
20
37
|
export function getVarPath(arrPath) {
|
|
21
38
|
return `${getTablePrefix(arrPath)}var`;
|
|
22
39
|
}
|
|
23
40
|
export default class SpatialDataTableSource extends AnnDataSource {
|
|
41
|
+
/**
|
|
42
|
+
*
|
|
43
|
+
* @param {DataSourceParams} params
|
|
44
|
+
*/
|
|
45
|
+
constructor(params) {
|
|
46
|
+
super(params);
|
|
47
|
+
/** @type {{ [k: string]: Promise<string[]> }} */
|
|
48
|
+
this.obsIndices = {};
|
|
49
|
+
/** @type {{ [k: string]: Promise<string[]> }} */
|
|
50
|
+
this.varIndices = {};
|
|
51
|
+
/** @type {{ [k: string]: string[] }} */
|
|
52
|
+
this.varAliases = {};
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
*
|
|
56
|
+
* @param {string} tablePath
|
|
57
|
+
* @returns
|
|
58
|
+
*/
|
|
24
59
|
async loadSpatialDataAttrs(tablePath) {
|
|
25
60
|
return this._loadDict(`${tablePath}uns/spatialdata_attrs`, ['instance_key', 'region', 'region_key']);
|
|
26
61
|
}
|
|
27
62
|
/**
|
|
28
63
|
* Class method for loading the obs index.
|
|
29
|
-
* @
|
|
64
|
+
* @param {string|undefined} path
|
|
65
|
+
* @returns {Promise<string[]>} An promise for a zarr array containing the indices.
|
|
30
66
|
*/
|
|
31
|
-
async loadObsIndex(path =
|
|
32
|
-
if (!this.obsIndex) {
|
|
33
|
-
this.obsIndex = {};
|
|
34
|
-
}
|
|
67
|
+
async loadObsIndex(path = undefined) {
|
|
35
68
|
const obsPath = getObsPath(path);
|
|
36
69
|
const { _index } = await this.getJson(`${obsPath}/.zattrs`);
|
|
37
70
|
let indexPath = `${obsPath}/${_index}`;
|
|
@@ -41,43 +74,40 @@ export default class SpatialDataTableSource extends AnnDataSource {
|
|
|
41
74
|
// region,
|
|
42
75
|
} = await this.loadSpatialDataAttrs(getTablePrefix(path));
|
|
43
76
|
indexPath = `${obsPath}/${instanceKey}`;
|
|
44
|
-
if (this.
|
|
45
|
-
return this.
|
|
77
|
+
if (indexPath in this.obsIndices) {
|
|
78
|
+
return this.obsIndices[indexPath];
|
|
46
79
|
}
|
|
47
|
-
this.
|
|
48
|
-
return this.
|
|
80
|
+
this.obsIndices[indexPath] = this._loadColumn(indexPath);
|
|
81
|
+
return this.obsIndices[indexPath];
|
|
49
82
|
}
|
|
50
83
|
/**
|
|
51
84
|
* Class method for loading the var index.
|
|
52
|
-
* @
|
|
85
|
+
* @param {string|undefined} path
|
|
86
|
+
* @returns {Promise<string[]>} An promise for a zarr array containing the indices.
|
|
53
87
|
*/
|
|
54
|
-
loadVarIndex(path =
|
|
55
|
-
if (!this.varIndex) {
|
|
56
|
-
this.varIndex = {};
|
|
57
|
-
}
|
|
88
|
+
loadVarIndex(path = undefined) {
|
|
58
89
|
const varPath = getVarPath(path);
|
|
59
|
-
if (this.
|
|
60
|
-
return this.
|
|
90
|
+
if (varPath in this.varIndices) {
|
|
91
|
+
return this.varIndices[varPath];
|
|
61
92
|
}
|
|
62
|
-
this.
|
|
93
|
+
this.varIndices[varPath] = this.getJson(`${varPath}/.zattrs`)
|
|
63
94
|
.then(({ _index }) => this.getFlatArrDecompressed(`${varPath}/${_index}`));
|
|
64
|
-
return this.
|
|
95
|
+
return this.varIndices[varPath];
|
|
65
96
|
}
|
|
66
97
|
/**
|
|
67
98
|
* Class method for loading the var alias.
|
|
68
|
-
* @
|
|
99
|
+
* @param {string} varPath
|
|
100
|
+
* @param {string} matrixPath
|
|
101
|
+
* @returns {Promise<string[]>} An promise for a zarr array containing the aliased names.
|
|
69
102
|
*/
|
|
70
103
|
async loadVarAlias(varPath, matrixPath) {
|
|
71
|
-
if (
|
|
72
|
-
this.
|
|
73
|
-
}
|
|
74
|
-
if (this.varAlias[varPath]) {
|
|
75
|
-
return this.varAlias[varPath];
|
|
104
|
+
if (varPath in this.varAliases) {
|
|
105
|
+
return this.varAliases[varPath];
|
|
76
106
|
}
|
|
77
107
|
const [varAliasData] = await this.loadVarColumns([varPath]);
|
|
78
|
-
this.
|
|
108
|
+
this.varAliases[varPath] = /** @type {string[]} */ (varAliasData);
|
|
79
109
|
const index = await this.loadVarIndex(matrixPath);
|
|
80
|
-
this.
|
|
81
|
-
return this.
|
|
110
|
+
this.varAliases[varPath] = this.varAliases[varPath].map((val, ind) => (val ? val.concat(` (${index[ind]})`) : index[ind]));
|
|
111
|
+
return this.varAliases[varPath];
|
|
82
112
|
}
|
|
83
113
|
}
|
|
@@ -1,23 +1,34 @@
|
|
|
1
|
+
/** @import { Location as ZarrLocation } from '@zarrita/core' */
|
|
2
|
+
/** @import { Readable } from '@zarrita/storage' */
|
|
3
|
+
/** @import { DataSourceParams } from '@vitessce/types' */
|
|
1
4
|
/**
|
|
2
5
|
* A loader ancestor class containing a default constructor
|
|
3
6
|
* and a stub for the required load() method.
|
|
4
7
|
*/
|
|
5
8
|
export default class ZarrDataSource {
|
|
6
|
-
constructor({ url, requestInit, store, fileType }: {
|
|
7
|
-
url: any;
|
|
8
|
-
requestInit: any;
|
|
9
|
-
store: any;
|
|
10
|
-
fileType: any;
|
|
11
|
-
});
|
|
12
|
-
storeRoot: any;
|
|
13
|
-
getStoreRoot(path: any): any;
|
|
14
9
|
/**
|
|
15
|
-
*
|
|
10
|
+
* @param {DataSourceParams} params The parameters object.
|
|
11
|
+
*/
|
|
12
|
+
constructor({ url, requestInit, store, fileType }: DataSourceParams);
|
|
13
|
+
storeRoot: ZarrLocation<Readable>;
|
|
14
|
+
/**
|
|
15
|
+
*
|
|
16
|
+
* @param {string} path
|
|
17
|
+
* @returns {ZarrLocation<Readable>}
|
|
18
|
+
*/
|
|
19
|
+
getStoreRoot(path: string): ZarrLocation<Readable>;
|
|
20
|
+
/**
|
|
21
|
+
* Method for accessing JSON attributes, relative to the store root.
|
|
16
22
|
* @param {string} key A path to the item.
|
|
17
|
-
* @
|
|
23
|
+
* @param {ZarrLocation<Readable>|null} storeRootParam An optional location,
|
|
24
|
+
* which if provided will override the default store root.
|
|
25
|
+
* @returns {Promise<any>} This async function returns a promise
|
|
18
26
|
* that resolves to the parsed JSON if successful.
|
|
19
27
|
* @throws This may throw an error.
|
|
20
28
|
*/
|
|
21
|
-
getJson(key: string, storeRootParam?: null): Promise<any>;
|
|
29
|
+
getJson(key: string, storeRootParam?: ZarrLocation<Readable> | null): Promise<any>;
|
|
22
30
|
}
|
|
31
|
+
import type { Readable } from '@zarrita/storage';
|
|
32
|
+
import type { Location as ZarrLocation } from '@zarrita/core';
|
|
33
|
+
import type { DataSourceParams } from '@vitessce/types';
|
|
23
34
|
//# sourceMappingURL=ZarrDataSource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZarrDataSource.d.ts","sourceRoot":"","sources":["../src/ZarrDataSource.js"],"names":[],"mappings":"
|
|
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,qEASC;IANG,kCAAgC;IAQpC;;;;OAIG;IACH,mBAHW,MAAM,0BAKhB;IAED;;;;;;;;OAQG;IACH,aAPW,MAAM,mDAGJ,OAAO,CAAC,GAAG,CAAC,CAexB;CACF;8BApD6B,kBAAkB;8CADF,eAAe;sCAEvB,iBAAiB"}
|
|
@@ -1,26 +1,43 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { zarrOpenRoot } from '@vitessce/zarr-utils';
|
|
2
3
|
import { open as zarrOpen, root as zarrRoot } from 'zarrita';
|
|
4
|
+
/** @import { Location as ZarrLocation } from '@zarrita/core' */
|
|
5
|
+
/** @import { Readable } from '@zarrita/storage' */
|
|
6
|
+
/** @import { DataSourceParams } from '@vitessce/types' */
|
|
3
7
|
/**
|
|
4
8
|
* A loader ancestor class containing a default constructor
|
|
5
9
|
* and a stub for the required load() method.
|
|
6
10
|
*/
|
|
7
11
|
export default class ZarrDataSource {
|
|
12
|
+
/**
|
|
13
|
+
* @param {DataSourceParams} params The parameters object.
|
|
14
|
+
*/
|
|
8
15
|
constructor({ url, requestInit, store, fileType }) {
|
|
9
16
|
if (store) {
|
|
10
17
|
// TODO: check here that it is a valid Zarrita Readable?
|
|
11
18
|
this.storeRoot = zarrRoot(store);
|
|
12
19
|
}
|
|
13
|
-
else {
|
|
20
|
+
else if (url) {
|
|
14
21
|
this.storeRoot = zarrOpenRoot(url, fileType, requestInit);
|
|
15
22
|
}
|
|
23
|
+
else {
|
|
24
|
+
throw new Error('Either a store or a URL must be provided to the ZarrDataSource constructor.');
|
|
25
|
+
}
|
|
16
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param {string} path
|
|
30
|
+
* @returns {ZarrLocation<Readable>}
|
|
31
|
+
*/
|
|
17
32
|
getStoreRoot(path) {
|
|
18
33
|
return this.storeRoot.resolve(path);
|
|
19
34
|
}
|
|
20
35
|
/**
|
|
21
|
-
*
|
|
36
|
+
* Method for accessing JSON attributes, relative to the store root.
|
|
22
37
|
* @param {string} key A path to the item.
|
|
23
|
-
* @
|
|
38
|
+
* @param {ZarrLocation<Readable>|null} storeRootParam An optional location,
|
|
39
|
+
* which if provided will override the default store root.
|
|
40
|
+
* @returns {Promise<any>} This async function returns a promise
|
|
24
41
|
* that resolves to the parsed JSON if successful.
|
|
25
42
|
* @throws This may throw an error.
|
|
26
43
|
*/
|
|
@@ -1,13 +1,26 @@
|
|
|
1
|
+
/** @import AnnDataSource from '../AnnDataSource.js' */
|
|
2
|
+
/** @import { FeatureLabelsData } from '@vitessce/types' */
|
|
1
3
|
/**
|
|
2
4
|
* Loader for string arrays located in anndata.zarr stores.
|
|
5
|
+
* @template {AnnDataSource} DataSourceType
|
|
6
|
+
* @extends {AbstractTwoStepLoader<DataSourceType>}
|
|
3
7
|
*/
|
|
4
|
-
export default class FeatureLabelsAnndataLoader {
|
|
8
|
+
export default class FeatureLabelsAnndataLoader<DataSourceType extends AnnDataSource> extends AbstractTwoStepLoader<DataSourceType> {
|
|
9
|
+
constructor(dataSource: DataSourceType, params: import("@vitessce/types").LoaderParams);
|
|
5
10
|
/**
|
|
6
11
|
* Class method for loading feature string labels.
|
|
7
|
-
* @returns {Promise} A promise for the array.
|
|
12
|
+
* @returns {Promise<string[]>} A promise for the array.
|
|
8
13
|
*/
|
|
9
|
-
loadLabels(): Promise<
|
|
10
|
-
labels:
|
|
11
|
-
|
|
14
|
+
loadLabels(): Promise<string[]>;
|
|
15
|
+
labels: Promise<string[]> | undefined;
|
|
16
|
+
/**
|
|
17
|
+
*
|
|
18
|
+
* @returns {Promise<LoaderResult<FeatureLabelsData>>}
|
|
19
|
+
*/
|
|
20
|
+
load(): Promise<LoaderResult<FeatureLabelsData>>;
|
|
12
21
|
}
|
|
22
|
+
import type AnnDataSource from '../AnnDataSource.js';
|
|
23
|
+
import { AbstractTwoStepLoader } from '@vitessce/vit-s';
|
|
24
|
+
import { LoaderResult } from '@vitessce/vit-s';
|
|
25
|
+
import type { FeatureLabelsData } from '@vitessce/types';
|
|
13
26
|
//# sourceMappingURL=FeatureLabelsAnndataLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureLabelsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/FeatureLabelsAnndataLoader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FeatureLabelsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/FeatureLabelsAnndataLoader.js"],"names":[],"mappings":"AAGA,uDAAuD;AACvD,2DAA2D;AAE3D;;;;GAIG;AACH;IAPY,wFAKD;IAGT;;;OAGG;IACH,cAFa,OAAO,CAAC,MAAM,EAAE,CAAC,CAa7B;IAJG,sCAA+C;IAMnD;;;OAGG;IACH,iDAoBC;CACF;+BAnD8B,qBAAqB;sCAFqB,iBAAiB;6BAAjB,iBAAiB;uCAGnD,iBAAiB"}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { LoaderResult, AbstractTwoStepLoader, AbstractLoaderError } from '@vitessce/vit-s';
|
|
3
|
+
/** @import AnnDataSource from '../AnnDataSource.js' */
|
|
4
|
+
/** @import { FeatureLabelsData } from '@vitessce/types' */
|
|
2
5
|
/**
|
|
3
6
|
* Loader for string arrays located in anndata.zarr stores.
|
|
7
|
+
* @template {AnnDataSource} DataSourceType
|
|
8
|
+
* @extends {AbstractTwoStepLoader<DataSourceType>}
|
|
4
9
|
*/
|
|
5
10
|
export default class FeatureLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
6
11
|
/**
|
|
7
12
|
* Class method for loading feature string labels.
|
|
8
|
-
* @returns {Promise} A promise for the array.
|
|
13
|
+
* @returns {Promise<string[]>} A promise for the array.
|
|
9
14
|
*/
|
|
10
|
-
loadLabels() {
|
|
15
|
+
async loadLabels() {
|
|
11
16
|
const { path } = this.options;
|
|
12
17
|
if (this.labels) {
|
|
13
18
|
return this.labels;
|
|
@@ -17,9 +22,12 @@ export default class FeatureLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
17
22
|
this.labels = this.dataSource._loadColumn(path);
|
|
18
23
|
return this.labels;
|
|
19
24
|
}
|
|
20
|
-
this.labels = Promise.resolve(null);
|
|
21
25
|
return this.labels;
|
|
22
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @returns {Promise<LoaderResult<FeatureLabelsData>>}
|
|
30
|
+
*/
|
|
23
31
|
async load() {
|
|
24
32
|
const { path } = this.options;
|
|
25
33
|
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
@@ -35,7 +43,7 @@ export default class FeatureLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
35
43
|
]).then(([featureIndex, featureLabels]) => Promise.resolve(new LoaderResult({
|
|
36
44
|
featureIndex,
|
|
37
45
|
featureLabels,
|
|
38
|
-
featureLabelsMap: new Map(featureIndex.map((key, i) => ([key, featureLabels[i]]))),
|
|
46
|
+
featureLabelsMap: new Map(featureIndex.map((key, i) => ([key, featureLabels?.[i]]))),
|
|
39
47
|
}, null)));
|
|
40
48
|
}
|
|
41
49
|
}
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
/** @import AnnDataSource from '../AnnDataSource.js' */
|
|
2
|
+
/** @import { ObsEmbeddingData, MatrixResult } from '@vitessce/types' */
|
|
1
3
|
/**
|
|
2
4
|
* Loader for embedding arrays located in anndata.zarr stores.
|
|
5
|
+
* @template {AnnDataSource} DataSourceType
|
|
6
|
+
* @extends {AbstractTwoStepLoader<DataSourceType>}
|
|
3
7
|
*/
|
|
4
|
-
export default class ObsEmbeddingAnndataLoader {
|
|
8
|
+
export default class ObsEmbeddingAnndataLoader<DataSourceType extends AnnDataSource> extends AbstractTwoStepLoader<DataSourceType> {
|
|
9
|
+
constructor(dataSource: DataSourceType, params: import("@vitessce/types").LoaderParams);
|
|
5
10
|
/**
|
|
6
11
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
7
|
-
* @returns {Promise} A promise for an array of columns.
|
|
12
|
+
* @returns {Promise<MatrixResult>} A promise for an array of columns.
|
|
8
13
|
*/
|
|
9
|
-
loadEmbedding(): Promise<
|
|
10
|
-
embedding:
|
|
11
|
-
|
|
14
|
+
loadEmbedding(): Promise<MatrixResult>;
|
|
15
|
+
embedding: Promise<{
|
|
16
|
+
data: [any[] | Int8Array | Int16Array | Int32Array | BigInt64Array | Uint8Array | Uint16Array | Uint32Array | BigUint64Array | Float32Array | Float64Array | import("@zarrita/typedarray").BoolArray | import("@zarrita/typedarray").UnicodeStringArray | import("@zarrita/typedarray").ByteStringArray, any[] | Int8Array | Int16Array | Int32Array | BigInt64Array | Uint8Array | Uint16Array | Uint32Array | BigUint64Array | Float32Array | Float64Array | import("@zarrita/typedarray").BoolArray | import("@zarrita/typedarray").UnicodeStringArray | import("@zarrita/typedarray").ByteStringArray];
|
|
17
|
+
shape: [number, number];
|
|
18
|
+
}> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @returns {Promise<LoaderResult<ObsEmbeddingData>>}
|
|
22
|
+
*/
|
|
23
|
+
load(): Promise<LoaderResult<ObsEmbeddingData>>;
|
|
12
24
|
}
|
|
25
|
+
import type AnnDataSource from '../AnnDataSource.js';
|
|
26
|
+
import { AbstractTwoStepLoader } from '@vitessce/vit-s';
|
|
27
|
+
import type { MatrixResult } from '@vitessce/types';
|
|
28
|
+
import { LoaderResult } from '@vitessce/vit-s';
|
|
29
|
+
import type { ObsEmbeddingData } from '@vitessce/types';
|
|
13
30
|
//# sourceMappingURL=ObsEmbeddingAnndataLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsEmbeddingAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsEmbeddingAnndataLoader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObsEmbeddingAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsEmbeddingAnndataLoader.js"],"names":[],"mappings":"AAKA,uDAAuD;AACvD,wEAAwE;AAExE;;;;GAIG;AACH;IAPS,wFAI2B;IAIlC;;;OAGG;IACH,uCAUC;IAJG;;;mBAA+D;IAMnE;;;OAGG;IACH,gDAgBC;CACF;+BA9C8B,qBAAqB;sCAF7C,iBAAiB;kCAG4B,iBAAiB;6BAH9D,iBAAiB;sCAG4B,iBAAiB"}
|
|
@@ -1,24 +1,32 @@
|
|
|
1
|
+
// @ts-check
|
|
1
2
|
import { LoaderResult, AbstractTwoStepLoader, AbstractLoaderError, } from '@vitessce/vit-s';
|
|
3
|
+
/** @import AnnDataSource from '../AnnDataSource.js' */
|
|
4
|
+
/** @import { ObsEmbeddingData, MatrixResult } from '@vitessce/types' */
|
|
2
5
|
/**
|
|
3
6
|
* Loader for embedding arrays located in anndata.zarr stores.
|
|
7
|
+
* @template {AnnDataSource} DataSourceType
|
|
8
|
+
* @extends {AbstractTwoStepLoader<DataSourceType>}
|
|
4
9
|
*/
|
|
5
10
|
export default class ObsEmbeddingAnndataLoader extends AbstractTwoStepLoader {
|
|
6
11
|
/**
|
|
7
12
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
8
|
-
* @returns {Promise} A promise for an array of columns.
|
|
13
|
+
* @returns {Promise<MatrixResult>} A promise for an array of columns.
|
|
9
14
|
*/
|
|
10
|
-
loadEmbedding() {
|
|
15
|
+
async loadEmbedding() {
|
|
11
16
|
const { path, dims = [0, 1] } = this.options;
|
|
12
17
|
if (this.embedding) {
|
|
13
|
-
return this.embedding;
|
|
18
|
+
return /** @type {Promise<MatrixResult>} */ (this.embedding);
|
|
14
19
|
}
|
|
15
20
|
if (!this.embedding) {
|
|
16
21
|
this.embedding = this.dataSource.loadNumericForDims(path, dims);
|
|
17
|
-
return this.embedding;
|
|
22
|
+
return /** @type {Promise<MatrixResult>} */ (this.embedding);
|
|
18
23
|
}
|
|
19
|
-
this.embedding = Promise.resolve(null);
|
|
20
24
|
return this.embedding;
|
|
21
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
*
|
|
28
|
+
* @returns {Promise<LoaderResult<ObsEmbeddingData>>}
|
|
29
|
+
*/
|
|
22
30
|
async load() {
|
|
23
31
|
const { path } = this.options;
|
|
24
32
|
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Loader for embedding arrays located in anndata.zarr stores.
|
|
3
3
|
*/
|
|
4
|
-
export default class ObsFeatureColumnsAnndataLoader {
|
|
4
|
+
export default class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoader<any> {
|
|
5
|
+
constructor(dataSource: any, params: import("@vitessce/types").LoaderParams);
|
|
5
6
|
/**
|
|
6
7
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
|
7
8
|
* @returns {Promise} A promise for an array of columns.
|
|
@@ -14,6 +15,12 @@ export default class ObsFeatureColumnsAnndataLoader {
|
|
|
14
15
|
data: Float32Array;
|
|
15
16
|
};
|
|
16
17
|
} | undefined;
|
|
17
|
-
load(): Promise<
|
|
18
|
+
load(): Promise<LoaderResult<{
|
|
19
|
+
obsIndex: any;
|
|
20
|
+
obsFeatureMatrix: any;
|
|
21
|
+
featureIndex: any;
|
|
22
|
+
}>>;
|
|
18
23
|
}
|
|
24
|
+
import { AbstractTwoStepLoader } from '@vitessce/vit-s';
|
|
25
|
+
import { LoaderResult } from '@vitessce/vit-s';
|
|
19
26
|
//# sourceMappingURL=ObsFeatureColumnsAnndataLoader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsFeatureColumnsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;
|
|
1
|
+
{"version":3,"file":"ObsFeatureColumnsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js"],"names":[],"mappings":"AAKA;;GAEG;AACH;IAFkC,6EAIW;IAD3C;;;OAGG;IACH,sCA4BC;IANG;;;;;;kBAAqE;IAQzE;;;;QAYC;CACF;sCAtDM,iBAAiB;6BAAjB,iBAAiB"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Loader for converting zarr into the a cell x gene matrix for use in Genes/Heatmap components.
|
|
3
3
|
*/
|
|
4
|
-
export default class ObsFeatureMatrixAnndataLoader {
|
|
4
|
+
export default class ObsFeatureMatrixAnndataLoader extends AbstractTwoStepLoader<any> {
|
|
5
|
+
constructor(dataSource: any, params: import("@vitessce/types").LoaderParams);
|
|
5
6
|
getOptions(): any;
|
|
6
7
|
/**
|
|
7
8
|
* Class method for loading the genes list from AnnData.var,
|
|
@@ -87,6 +88,12 @@ export default class ObsFeatureMatrixAnndataLoader {
|
|
|
87
88
|
*/
|
|
88
89
|
loadAttrs(): Object;
|
|
89
90
|
loadInitialFilteredGeneNames(): Promise<any>;
|
|
90
|
-
load(): Promise<
|
|
91
|
+
load(): Promise<LoaderResult<{
|
|
92
|
+
obsIndex: any;
|
|
93
|
+
featureIndex: any;
|
|
94
|
+
obsFeatureMatrix: any;
|
|
95
|
+
}>>;
|
|
91
96
|
}
|
|
97
|
+
import { AbstractTwoStepLoader } from '@vitessce/vit-s';
|
|
98
|
+
import { LoaderResult } from '@vitessce/vit-s';
|
|
92
99
|
//# sourceMappingURL=ObsFeatureMatrixAnndataLoader.d.ts.map
|