@vitessce/zarr 4.0.4 → 4.0.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 +14588 -18551
- package/dist-tsc/AnnDataSource.d.ts +37 -1
- package/dist-tsc/AnnDataSource.d.ts.map +1 -1
- package/dist-tsc/AnnDataSource.js +108 -22
- package/dist-tsc/AnnDataSource.js.map +1 -1
- package/dist-tsc/AnnDataSource.test.js +169 -1
- package/dist-tsc/AnnDataSource.test.js.map +1 -1
- package/dist-tsc/ZarrDataSource.d.ts +27 -8
- package/dist-tsc/ZarrDataSource.d.ts.map +1 -1
- package/dist-tsc/ZarrDataSource.js +58 -12
- package/dist-tsc/ZarrDataSource.js.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.d.ts +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +6 -2
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.js.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.d.ts +81 -22
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.js +410 -180
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.js.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.test.js +289 -1
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.test.js.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.d.ts +16 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.js +76 -10
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.js.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.test.d.ts +2 -0
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.test.d.ts.map +1 -0
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.test.js +81 -0
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.test.js.map +1 -0
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.d.ts +5 -1
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.js +2 -2
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.js.map +1 -1
- package/dist-tsc/anndata-loaders/utils.d.ts +58 -0
- package/dist-tsc/anndata-loaders/utils.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/utils.js +149 -0
- package/dist-tsc/anndata-loaders/utils.js.map +1 -1
- package/dist-tsc/anndata-loaders/utils.test.js +134 -1
- package/dist-tsc/anndata-loaders/utils.test.js.map +1 -1
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.d.ts.map +1 -1
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.js +9 -2
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.js.map +1 -1
- package/package.json +12 -12
- package/src/AnnDataSource.js +114 -37
- package/src/AnnDataSource.test.js +179 -1
- package/src/ZarrDataSource.js +60 -13
- package/src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +6 -2
- package/src/anndata-loaders/ObsFeatureMatrixAnndataLoader.js +450 -190
- package/src/anndata-loaders/ObsFeatureMatrixAnndataLoader.test.js +319 -1
- package/src/anndata-loaders/ObsSetsAnndataLoader.js +85 -10
- package/src/anndata-loaders/ObsSetsAnndataLoader.test.js +91 -0
- package/src/anndata-loaders/SampleSetsAnndataLoader.js +2 -2
- package/src/anndata-loaders/utils.js +157 -0
- package/src/anndata-loaders/utils.test.js +158 -1
- package/src/matrix-loaders/MatrixZarrAsObsFeatureMatrix.js +9 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { log } from '@vitessce/globals';
|
|
3
|
-
import { zarrOpenRoot } from '@vitessce/zarr-utils';
|
|
4
|
-
import { open as zarrOpen, root as zarrRoot } from 'zarrita';
|
|
3
|
+
import { zarrOpenRoot, applyStoreExtensions } from '@vitessce/zarr-utils';
|
|
4
|
+
import { open as zarrOpen, root as zarrRoot, Array as ZarrArray } from 'zarrita';
|
|
5
5
|
import { ZarrNodeNotFoundError } from '@vitessce/error';
|
|
6
|
-
/** @import { Location as ZarrLocation,
|
|
6
|
+
/** @import { Location as ZarrLocation, AsyncReadable } from 'zarrita' */
|
|
7
7
|
/** @import { DataSourceParams } from '@vitessce/types' */
|
|
8
8
|
/**
|
|
9
9
|
* A loader ancestor class containing a default constructor
|
|
@@ -13,47 +13,93 @@ export default class ZarrDataSource {
|
|
|
13
13
|
/**
|
|
14
14
|
* @param {DataSourceParams & { refSpecUrl?: string }} params The parameters object.
|
|
15
15
|
*/
|
|
16
|
-
constructor({ url, requestInit, refSpecUrl, store, fileType }) {
|
|
16
|
+
constructor({ url, requestInit, refSpecUrl, store, fileType, queryClient }) {
|
|
17
17
|
log.info('Using a Zarr-based data source. 403 and 404 HTTP responses for Zarr metadata files (.zattrs, .zarray, .zgroup, zarr.json) are to be expected and do not necessarily indicate errors.');
|
|
18
|
+
this.queryClient = queryClient;
|
|
18
19
|
if (store) {
|
|
19
20
|
// TODO: check here that it is a valid Zarrita Readable?
|
|
20
|
-
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
const extendedStore = applyStoreExtensions(store, url, queryClient);
|
|
23
|
+
this.storeRoot = zarrRoot(extendedStore);
|
|
21
24
|
}
|
|
22
25
|
else if (url) {
|
|
23
|
-
|
|
26
|
+
// The queryClient backs the store-level chunk cache, so that concurrent
|
|
27
|
+
// reads of the same chunk share one request. See CachedStore in zarr-utils.
|
|
28
|
+
this.storeRoot = zarrOpenRoot(url, fileType, { requestInit, refSpecUrl, queryClient });
|
|
24
29
|
}
|
|
25
30
|
else {
|
|
26
31
|
throw new Error('Either a store or a URL must be provided to the ZarrDataSource constructor.');
|
|
27
32
|
}
|
|
33
|
+
// Zarr nodes opened relative to the store root, memoized per path so that a
|
|
34
|
+
// node's metadata documents (.zattrs/.zarray/.zgroup or zarr.json) are read
|
|
35
|
+
// once per data source, however many methods touch the node.
|
|
36
|
+
/** @type {Map<string, Promise<any>>} */
|
|
37
|
+
this.nodeCache = new Map();
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Open the zarr node (array or group) at a path relative to the store root,
|
|
41
|
+
* memoized per path. A rejected open is dropped again, so a later call
|
|
42
|
+
* retries instead of re-awaiting a dead promise.
|
|
43
|
+
* @param {string} path The node path relative to the store root.
|
|
44
|
+
* @returns {Promise<any>} The zarrita Array or Group.
|
|
45
|
+
*/
|
|
46
|
+
openNode(path) {
|
|
47
|
+
// Callers pass paths both with and without a leading slash; resolve()
|
|
48
|
+
// treats them the same, so the cache key must too.
|
|
49
|
+
const key = path.startsWith('/') ? path : `/${path}`;
|
|
50
|
+
if (!this.nodeCache.has(key)) {
|
|
51
|
+
// @ts-ignore
|
|
52
|
+
const promise = zarrOpen(this.storeRoot.resolve(path)).catch((err) => {
|
|
53
|
+
this.nodeCache.delete(key);
|
|
54
|
+
throw err;
|
|
55
|
+
});
|
|
56
|
+
this.nodeCache.set(key, promise);
|
|
57
|
+
}
|
|
58
|
+
return /** @type {Promise<any>} */ (this.nodeCache.get(key));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Open the zarr array at a path relative to the store root, through the same
|
|
62
|
+
* per-path cache as openNode.
|
|
63
|
+
* @param {string} path The array path relative to the store root.
|
|
64
|
+
* @returns {Promise<any>} The zarrita Array.
|
|
65
|
+
* @throws When the node exists but is a group.
|
|
66
|
+
*/
|
|
67
|
+
async openArray(path) {
|
|
68
|
+
const node = await this.openNode(path);
|
|
69
|
+
if (!(node instanceof ZarrArray)) {
|
|
70
|
+
throw new Error(`Expected a zarr array at ${path}, but found a group.`);
|
|
71
|
+
}
|
|
72
|
+
return node;
|
|
28
73
|
}
|
|
29
74
|
/**
|
|
30
75
|
*
|
|
31
76
|
* @param {string} path
|
|
32
|
-
* @returns {ZarrLocation<
|
|
77
|
+
* @returns {ZarrLocation<AsyncReadable>}
|
|
33
78
|
*/
|
|
34
79
|
getStoreRoot(path) {
|
|
80
|
+
// @ts-ignore
|
|
35
81
|
return this.storeRoot.resolve(path);
|
|
36
82
|
}
|
|
37
83
|
/**
|
|
38
84
|
* Method for accessing JSON attributes, relative to the store root.
|
|
39
85
|
* @param {string} key A path to the item.
|
|
40
|
-
* @param {ZarrLocation<
|
|
86
|
+
* @param {ZarrLocation<AsyncReadable>|null} storeRootParam An optional location,
|
|
41
87
|
* which if provided will override the default store root.
|
|
42
88
|
* @returns {Promise<any>} This async function returns a promise
|
|
43
89
|
* that resolves to the parsed JSON if successful.
|
|
44
90
|
* @throws This may throw an error.
|
|
45
91
|
*/
|
|
46
92
|
async getJson(key, storeRootParam = null) {
|
|
47
|
-
const { storeRoot } = this;
|
|
48
|
-
const storeRootToUse = storeRootParam || storeRoot;
|
|
49
93
|
let dirKey = key;
|
|
50
94
|
// TODO: update calls to not include these file names in the first place.
|
|
51
95
|
if (key.endsWith('.zattrs') || key.endsWith('.zarray') || key.endsWith('.zgroup')) {
|
|
52
96
|
dirKey = key.substring(0, key.length - 8);
|
|
53
97
|
}
|
|
54
98
|
try {
|
|
55
|
-
const
|
|
56
|
-
|
|
99
|
+
const arrOrGroup = await (storeRootParam
|
|
100
|
+
// A custom location cannot go through the per-path cache.
|
|
101
|
+
? zarrOpen(storeRootParam.resolve(dirKey))
|
|
102
|
+
: this.openNode(dirKey));
|
|
57
103
|
return arrOrGroup.attrs;
|
|
58
104
|
}
|
|
59
105
|
catch ( /** @type {any} */e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ZarrDataSource.js","sourceRoot":"","sources":["../src/ZarrDataSource.js"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ZarrDataSource.js","sourceRoot":"","sources":["../src/ZarrDataSource.js"],"names":[],"mappings":"AAAA,YAAY;AACZ,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,IAAI,QAAQ,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,SAAS,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,yEAAyE;AACzE,0DAA0D;AAE1D;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC;;OAEG;IACH,YAAY,EAAE,GAAG,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE;QACxE,GAAG,CAAC,IAAI,CAAC,sLAAsL,CAAC,CAAC;QACjM,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,KAAK,EAAE,CAAC;YACV,wDAAwD;YACxD,aAAa;YACb,MAAM,aAAa,GAAG,oBAAoB,CAAC,KAAK,EAAE,GAAG,EAAE,WAAW,CAAC,CAAC;YACpE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,CAAC;QAC3C,CAAC;aAAM,IAAI,GAAG,EAAE,CAAC;YACf,wEAAwE;YACxE,4EAA4E;YAC5E,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC;QACzF,CAA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;IACH,YAAY,CAAC,IAAI;QACf,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,cAAc,GAAG,IAAI;QACtC,IAAI,MAAM,GAAG,GAAG,CAAC;QACjB,yEAAyE;QACzE,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAClF,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC5C,CAAC;QACD,IAAI,CAAC;YACH,MAAM,UAAU,GAAG,MAAM,CAAC,cAAc;gBACtC,0DAA0D;gBAC1D,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC1C,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;YAC3B,OAAO,UAAU,CAAC,KAAK,CAAC;QAC1B,CAAC;QAAC,QAAO,kBAAmB,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;gBACnC,oDAAoD;gBACpD,MAAM,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAAC;YAC1C,CAAC;YACD,uDAAuD;YACvD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsFeatureColumnsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;;IACE;;;OAGG;IACH,
|
|
1
|
+
{"version":3,"file":"ObsFeatureColumnsAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js"],"names":[],"mappings":"AAGA;;GAEG;AACH;;IACE;;;OAGG;IACH,sCAgCC;IANG;;;;;;kBAAqE;IAQzE;;;;QAQC;CACF;sCAtDwE,oBAAoB;6BAApB,oBAAoB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader, allocateDenseMatrix } from '@vitessce/abstract';
|
|
2
2
|
import { basename } from '../utils.js';
|
|
3
3
|
/**
|
|
4
4
|
* Loader for embedding arrays located in anndata.zarr stores.
|
|
@@ -19,7 +19,11 @@ export default class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoade
|
|
|
19
19
|
const obsIndex = await this.dataSource.loadObsIndex(firstPath);
|
|
20
20
|
const featureIndex = colPaths.map(colPath => basename(colPath));
|
|
21
21
|
const shape = [obsIndex.length, featureIndex.length];
|
|
22
|
-
const out =
|
|
22
|
+
const out = allocateDenseMatrix({
|
|
23
|
+
source: `the "obsFeatureColumns" of "${this.url?.split('?')[0]}"`,
|
|
24
|
+
shape,
|
|
25
|
+
allocate: () => new Float32Array(shape[0] * shape[1]),
|
|
26
|
+
});
|
|
23
27
|
const data = await Promise.all(colPaths.map(colPath => this.dataSource.loadNumeric(colPath)));
|
|
24
28
|
data.forEach((colData, featureI) => {
|
|
25
29
|
obsIndex.forEach((obsId, obsI) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsFeatureColumnsAnndataLoader.js","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ObsFeatureColumnsAnndataLoader.js","sourceRoot":"","sources":["../../src/anndata-loaders/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,IAAI,GAAG,MAAM,OAAO,CAAC,GAAG,CAC5B,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAC9D,CAAC;YACF,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,EAAE;gBACjC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;oBAC/B,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACvD,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;YACH,MAAM,gBAAgB,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;YACvC,IAAI,CAAC,iBAAiB,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC;YAEtE,OAAO,IAAI,CAAC,iBAAiB,CAAC;QAChC,CAAC;QACD,IAAI,CAAC,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/C,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,MAAM,CAAC,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACvE,IAAI,CAAC,qBAAqB,EAAE;SAC7B,CAAC,CAAC;QACH,OAAO,IAAI,YAAY,CACrB,EAAE,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,EAC5C,IAAI,CACL,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -4,13 +4,28 @@
|
|
|
4
4
|
export default class ObsFeatureMatrixAnndataLoader extends AbstractTwoStepLoader<any> {
|
|
5
5
|
constructor(dataSource: any, params: import("@vitessce/types").LoaderParams);
|
|
6
6
|
getOptions(): any;
|
|
7
|
+
/**
|
|
8
|
+
* Memoize the promise returned by `factory` on this loader under `key`. A
|
|
9
|
+
* rejected promise is dropped again, so that a later call (for example a
|
|
10
|
+
* react-query retry) re-runs the work instead of re-awaiting a dead promise.
|
|
11
|
+
* @param {string} key The property name to store the promise under.
|
|
12
|
+
* @param {() => Promise<any>} factory Creates the promise on first use.
|
|
13
|
+
* @returns {Promise<any>} The memoized promise.
|
|
14
|
+
*/
|
|
15
|
+
_memoized(key: string, factory: () => Promise<any>): Promise<any>;
|
|
16
|
+
/**
|
|
17
|
+
* Log a warning at most once per loader for a given topic.
|
|
18
|
+
* @param {string} topic A key identifying the warning.
|
|
19
|
+
* @param {string} message The warning message.
|
|
20
|
+
*/
|
|
21
|
+
_warnOnce(topic: string, message: string): void;
|
|
22
|
+
_warned: Set<any> | undefined;
|
|
7
23
|
/**
|
|
8
24
|
* Class method for loading the genes list from AnnData.var,
|
|
9
25
|
* filtered if a there is a `geneFilterZarr` present in the view config.
|
|
10
26
|
* @returns {Promise} A promise for the zarr array contianing the gene names.
|
|
11
27
|
*/
|
|
12
28
|
loadFilteredGeneNames(): Promise<any>;
|
|
13
|
-
filteredGeneNames: Promise<any> | undefined;
|
|
14
29
|
/**
|
|
15
30
|
* Class method for loading a filtered subset of the genes list
|
|
16
31
|
* @param {String} filterZarr A location in the zarr store to fetch a boolean array from.
|
|
@@ -20,7 +35,7 @@ export default class ObsFeatureMatrixAnndataLoader extends AbstractTwoStepLoader
|
|
|
20
35
|
/**
|
|
21
36
|
* Class method for getting the integer indices of a selection of genes within a list.
|
|
22
37
|
* @param {Array} selection A list of gene names.
|
|
23
|
-
* @returns {Array} A list of integer indices.
|
|
38
|
+
* @returns {Array} A list of integer indices (-1 for genes that are not present).
|
|
24
39
|
*/
|
|
25
40
|
_getGeneIndices(selection: any[]): any[];
|
|
26
41
|
/**
|
|
@@ -29,49 +44,93 @@ export default class ObsFeatureMatrixAnndataLoader extends AbstractTwoStepLoader
|
|
|
29
44
|
*/
|
|
30
45
|
_getNumCells(): number;
|
|
31
46
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
* @returns {
|
|
47
|
+
* Load the attributes of the matrix group or array (encoding type, and the
|
|
48
|
+
* shape for sparse encodings).
|
|
49
|
+
* @returns {Promise<object>} The attributes.
|
|
35
50
|
*/
|
|
36
|
-
|
|
51
|
+
_loadMatrixZattrs(): Promise<object>;
|
|
37
52
|
/**
|
|
38
53
|
* Class method for opening the sparse matrix arrays in zarr.
|
|
39
|
-
* @returns {Array}
|
|
54
|
+
* @returns {Promise<Array>} The opened indptr, indices, and data arrays.
|
|
55
|
+
*/
|
|
56
|
+
_openSparseArrays(): Promise<any[]>;
|
|
57
|
+
/**
|
|
58
|
+
* Open the dense matrix array in zarr.
|
|
59
|
+
* @returns {Promise<object>} The opened zarr array.
|
|
60
|
+
*/
|
|
61
|
+
_openDenseArray(): Promise<object>;
|
|
62
|
+
/**
|
|
63
|
+
* Load the sparse `indptr` array once, as plain numbers. Its values are
|
|
64
|
+
* bounded by nnz and can exceed 2^31, so int64 is converted without truncation.
|
|
65
|
+
* @returns {Promise<ArrayLike<number>>} The row (CSR) or column (CSC) pointers.
|
|
40
66
|
*/
|
|
41
|
-
|
|
42
|
-
|
|
67
|
+
_loadIndptr(): Promise<ArrayLike<number>>;
|
|
68
|
+
/**
|
|
69
|
+
* The column to report for a feature that is not in the matrix: zeros, with
|
|
70
|
+
* a warning. This matches what the CSC route always did, and keeps a feature
|
|
71
|
+
* selection shared across datasets from failing in the ones that lack a gene.
|
|
72
|
+
* @param {string} name The feature name.
|
|
73
|
+
* @param {number} numRows The number of observations.
|
|
74
|
+
* @returns {Float32Array} An all-zero column.
|
|
75
|
+
*/
|
|
76
|
+
_missingFeatureColumn(name: string, numRows: number): Float32Array;
|
|
43
77
|
/**
|
|
44
78
|
* Class method for loading a gene selection from a CSC matrix.
|
|
45
79
|
* @param {Array} selection A list of gene names whose data should be fetched.
|
|
46
|
-
* @returns {Promise} A Promise.all array of promises containing
|
|
80
|
+
* @returns {Promise} A Promise.all array of promises containing Float32Arrays, one per selection.
|
|
47
81
|
*/
|
|
48
82
|
_loadCSCGeneSelection(selection: any[]): Promise<any>;
|
|
49
83
|
/**
|
|
50
84
|
* Class method for loading a gene selection from a CSR matrix.
|
|
85
|
+
*
|
|
86
|
+
* CSR has no per-column slice, so the requested columns are gathered by one
|
|
87
|
+
* chunk-wise scan of `indices`/`data` (see extractCsrColumns); the matrix is
|
|
88
|
+
* never densified. Concurrent selections on this loader share a single scan.
|
|
51
89
|
* @param {Array} selection A list of gene names whose data should be fetched.
|
|
52
|
-
* @returns {Promise} A Promise.all array of promises containing
|
|
90
|
+
* @returns {Promise} A Promise.all array of promises containing Float32Arrays, one per selection.
|
|
53
91
|
*/
|
|
54
92
|
_loadCSRGeneSelection(selection: any[]): Promise<any>;
|
|
55
93
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
94
|
+
* Request one CSR column. Requests are collected and served by a single scan
|
|
95
|
+
* per batch, so that the one-query-per-feature pattern of the data hooks does
|
|
96
|
+
* not scan the matrix once per feature.
|
|
97
|
+
* @param {number} col The column index.
|
|
98
|
+
* @returns {Promise<Float32Array>} The column.
|
|
99
|
+
*/
|
|
100
|
+
_requestCsrColumn(col: number): Promise<Float32Array>;
|
|
101
|
+
_csrInflight: Map<any, any> | undefined;
|
|
102
|
+
_csrPending: Set<any> | undefined;
|
|
103
|
+
_scheduleCsrFlush(): void;
|
|
104
|
+
_csrFlushScheduled: boolean | undefined;
|
|
105
|
+
_flushCsrScan(): Promise<void>;
|
|
106
|
+
_csrScanning: boolean | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Scan the CSR `indices`/`data` arrays once for the given columns.
|
|
109
|
+
* @param {number[]} cols Unique column indices.
|
|
110
|
+
* @returns {Promise<Float32Array[]>} One column per entry of cols.
|
|
111
|
+
*/
|
|
112
|
+
_scanCsrColumns(cols: number[]): Promise<Float32Array[]>;
|
|
113
|
+
/**
|
|
114
|
+
* Class method for loading a full sparse (CSR or CSC) matrix from zarr into a
|
|
115
|
+
* dense row-major Float32Array.
|
|
116
|
+
* @param {string} encodingType Either 'csr_matrix' or 'csc_matrix'.
|
|
117
|
+
* @returns {Promise<Float32Array>} The dense matrix.
|
|
59
118
|
*/
|
|
60
|
-
|
|
61
|
-
_sparseMatrix: any;
|
|
119
|
+
_loadSparseCellXGene(encodingType: string): Promise<Float32Array>;
|
|
62
120
|
/**
|
|
63
|
-
* Class method for loading
|
|
64
|
-
* @returns {
|
|
121
|
+
* Class method for loading a full dense matrix from zarr.
|
|
122
|
+
* @returns {Promise<TypedArray>} The matrix, in the array's own dtype
|
|
123
|
+
* (int64 downcast to int32).
|
|
65
124
|
*/
|
|
66
|
-
|
|
125
|
+
_loadDenseCellXGene(): Promise<TypedArray>;
|
|
67
126
|
/**
|
|
68
127
|
* Class method for loading the cell x gene matrix.
|
|
69
128
|
* @returns {Promise} A promise for the zarr array contianing the cell x gene data.
|
|
70
129
|
*/
|
|
71
130
|
loadCellXGene(): Promise<any>;
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
131
|
+
_loadCellXGeneUncached(): Promise<{
|
|
132
|
+
data: any;
|
|
133
|
+
}>;
|
|
75
134
|
/**
|
|
76
135
|
* Class method for loading a gene selection.
|
|
77
136
|
* @param {Object} args
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObsFeatureMatrixAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureMatrixAnndataLoader.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ObsFeatureMatrixAnndataLoader.d.ts","sourceRoot":"","sources":["../../src/anndata-loaders/ObsFeatureMatrixAnndataLoader.js"],"names":[],"mappings":"AAmFA;;GAEG;AACH;;IACE,kBAEC;IAED;;;;;;;OAOG;IACH,eAJW,MAAM,WACN,MAAM,OAAO,CAAC,GAAG,CAAC,GACh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