@vitessce/zarr 3.6.7 → 3.6.9
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 +760 -736
- package/dist-tsc/AnnDataSource.d.ts.map +1 -1
- package/dist-tsc/ZarrDataSource.d.ts.map +1 -1
- package/dist-tsc/ZarrDataSource.js +16 -1
- package/dist-tsc/anndata-loaders/ComparisonMetadataAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ComparisonMetadataAnndataLoader.js +3 -7
- package/dist-tsc/anndata-loaders/FeatureLabelsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/FeatureLabelsAnndataLoader.js +5 -8
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsEmbeddingAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +4 -8
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsFeatureMatrixAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLabelsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsLocationsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsPointsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/ObsSegmentationsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSegmentationsAnndataLoader.js +4 -11
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSetsAnndataLoader.js +2 -6
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/ObsSpotsAnndataLoader.js +4 -7
- package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/SampleEdgesAnndataLoader.js +5 -10
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.d.ts.map +1 -1
- package/dist-tsc/anndata-loaders/SampleSetsAnndataLoader.js +3 -7
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.d.ts +8 -2
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.d.ts.map +1 -1
- package/dist-tsc/genomic-loaders/GenomicProfilesZarrLoader.js +6 -6
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.d.ts.map +1 -1
- package/dist-tsc/matrix-loaders/MatrixZarrAsObsFeatureMatrix.js +3 -4
- package/package.json +11 -10
- package/src/AnnDataSource.js +1 -0
- package/src/ZarrDataSource.js +15 -1
- package/src/anndata-loaders/ComparisonMetadataAnndataLoader.js +3 -7
- package/src/anndata-loaders/FeatureLabelsAnndataLoader.js +5 -8
- package/src/anndata-loaders/ObsEmbeddingAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsFeatureColumnsAnndataLoader.js +7 -13
- package/src/anndata-loaders/ObsFeatureMatrixAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsLabelsAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsLocationsAnndataLoader.js +5 -10
- package/src/anndata-loaders/ObsPointsAnndataLoader.js +5 -12
- package/src/anndata-loaders/ObsSegmentationsAnndataLoader.js +7 -16
- package/src/anndata-loaders/ObsSetsAnndataLoader.js +2 -10
- package/src/anndata-loaders/ObsSpotsAnndataLoader.js +5 -12
- package/src/anndata-loaders/SampleEdgesAnndataLoader.js +8 -15
- package/src/anndata-loaders/SampleSetsAnndataLoader.js +6 -14
- package/src/genomic-loaders/GenomicProfilesZarrLoader.js +14 -14
- package/src/matrix-loaders/MatrixZarrAsObsFeatureMatrix.js +6 -7
package/src/ZarrDataSource.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
+
import { log } from '@vitessce/globals';
|
|
2
3
|
import { zarrOpenRoot } from '@vitessce/zarr-utils';
|
|
3
4
|
import { open as zarrOpen, root as zarrRoot } from 'zarrita';
|
|
5
|
+
import { ZarrNodeNotFoundError } from '@vitessce/error';
|
|
4
6
|
|
|
5
7
|
/** @import { Location as ZarrLocation, Readable } from 'zarrita' */
|
|
6
8
|
/** @import { DataSourceParams } from '@vitessce/types' */
|
|
@@ -14,6 +16,7 @@ export default class ZarrDataSource {
|
|
|
14
16
|
* @param {DataSourceParams & { refSpecUrl?: string }} params The parameters object.
|
|
15
17
|
*/
|
|
16
18
|
constructor({ url, requestInit, refSpecUrl, store, fileType }) {
|
|
19
|
+
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.');
|
|
17
20
|
if (store) {
|
|
18
21
|
// TODO: check here that it is a valid Zarrita Readable?
|
|
19
22
|
this.storeRoot = zarrRoot(store);
|
|
@@ -51,6 +54,17 @@ export default class ZarrDataSource {
|
|
|
51
54
|
if (key.endsWith('.zattrs') || key.endsWith('.zarray') || key.endsWith('.zgroup')) {
|
|
52
55
|
dirKey = key.substring(0, key.length - 8);
|
|
53
56
|
}
|
|
54
|
-
|
|
57
|
+
try {
|
|
58
|
+
const location = storeRootToUse.resolve(dirKey);
|
|
59
|
+
const arrOrGroup = await zarrOpen(location);
|
|
60
|
+
return arrOrGroup.attrs;
|
|
61
|
+
} catch (/** @type {any} */ e) {
|
|
62
|
+
if (e.name === 'NodeNotFoundError') {
|
|
63
|
+
// Throw our own error with a more specific message.
|
|
64
|
+
throw new ZarrNodeNotFoundError(dirKey);
|
|
65
|
+
}
|
|
66
|
+
// Re-throw the error if it is not a NodeNotFoundError.
|
|
67
|
+
throw e;
|
|
68
|
+
}
|
|
55
69
|
}
|
|
56
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { LoaderResult, AbstractTwoStepLoader
|
|
2
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
3
3
|
import { loadComparisonMetadata } from './comparative-utils.js';
|
|
4
4
|
|
|
5
5
|
/** @import AnnDataSource from '../AnnDataSource.js' */
|
|
@@ -17,18 +17,14 @@ export default class ComparisonMetadataAnndataLoader extends AbstractTwoStepLoad
|
|
|
17
17
|
*/
|
|
18
18
|
async load() {
|
|
19
19
|
const { path } = this.options;
|
|
20
|
-
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
21
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
22
|
-
return Promise.reject(superResult);
|
|
23
|
-
}
|
|
24
20
|
const metadata = await loadComparisonMetadata(this.dataSource, path);
|
|
25
|
-
return
|
|
21
|
+
return new LoaderResult(
|
|
26
22
|
{
|
|
27
23
|
// Should a more complex class be wrapping this
|
|
28
24
|
// JSON object to help with downstream querying?
|
|
29
25
|
comparisonMetadata: metadata,
|
|
30
26
|
},
|
|
31
27
|
null,
|
|
32
|
-
)
|
|
28
|
+
);
|
|
33
29
|
}
|
|
34
30
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { LoaderResult, AbstractTwoStepLoader
|
|
2
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
3
3
|
|
|
4
4
|
/** @import AnnDataSource from '../AnnDataSource.js' */
|
|
5
5
|
/** @import { FeatureLabelsData } from '@vitessce/types' */
|
|
@@ -33,23 +33,20 @@ export default class FeatureLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
33
33
|
*/
|
|
34
34
|
async load() {
|
|
35
35
|
const { path } = this.options;
|
|
36
|
-
const
|
|
37
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
38
|
-
return Promise.reject(superResult);
|
|
39
|
-
}
|
|
40
|
-
return Promise.all([
|
|
36
|
+
const [featureIndex, featureLabels] = await Promise.all([
|
|
41
37
|
// Pass in the obsEmbedding path,
|
|
42
38
|
// to handle the MuData case where the obsIndex is located at
|
|
43
39
|
// `mod/rna/index` rather than `index`.
|
|
44
40
|
this.dataSource.loadVarIndex(path),
|
|
45
41
|
this.loadLabels(),
|
|
46
|
-
])
|
|
42
|
+
]);
|
|
43
|
+
return new LoaderResult(
|
|
47
44
|
{
|
|
48
45
|
featureIndex,
|
|
49
46
|
featureLabels,
|
|
50
47
|
featureLabelsMap: new Map(featureIndex.map((key, i) => ([key, featureLabels?.[i]]))),
|
|
51
48
|
},
|
|
52
49
|
null,
|
|
53
|
-
)
|
|
50
|
+
);
|
|
54
51
|
}
|
|
55
52
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import {
|
|
3
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
4
|
-
} from '@vitessce/abstract';
|
|
2
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
5
3
|
|
|
6
4
|
/** @import AnnDataSource from '../AnnDataSource.js' */
|
|
7
5
|
/** @import { ObsEmbeddingData, MatrixResult } from '@vitessce/types' */
|
|
@@ -34,19 +32,16 @@ export default class ObsEmbeddingAnndataLoader extends AbstractTwoStepLoader {
|
|
|
34
32
|
*/
|
|
35
33
|
async load() {
|
|
36
34
|
const { path } = this.options;
|
|
37
|
-
const
|
|
38
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
39
|
-
return Promise.reject(superResult);
|
|
40
|
-
}
|
|
41
|
-
return Promise.all([
|
|
35
|
+
const [obsIndex, obsEmbedding] = await Promise.all([
|
|
42
36
|
// Pass in the obsEmbedding path,
|
|
43
37
|
// to handle the MuData case where the obsIndex is located at
|
|
44
38
|
// `mod/rna/index` rather than `index`.
|
|
45
39
|
this.dataSource.loadObsIndex(path),
|
|
46
40
|
this.loadEmbedding(),
|
|
47
|
-
])
|
|
41
|
+
]);
|
|
42
|
+
return new LoaderResult(
|
|
48
43
|
{ obsIndex, obsEmbedding },
|
|
49
44
|
null,
|
|
50
|
-
)
|
|
45
|
+
);
|
|
51
46
|
}
|
|
52
47
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
import { basename } from '../utils.js';
|
|
5
3
|
|
|
6
4
|
/**
|
|
@@ -42,16 +40,12 @@ export default class ObsFeatureColumnsAnndataLoader extends AbstractTwoStepLoade
|
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
async load() {
|
|
45
|
-
const
|
|
46
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
47
|
-
return Promise.reject(superResult);
|
|
48
|
-
}
|
|
49
|
-
return Promise.all([
|
|
43
|
+
const [{ obsIndex, obsFeatureMatrix, featureIndex }] = await Promise.all([
|
|
50
44
|
this.loadObsFeatureColumns(),
|
|
51
|
-
])
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
]);
|
|
46
|
+
return new LoaderResult(
|
|
47
|
+
{ obsIndex, obsFeatureMatrix, featureIndex },
|
|
48
|
+
null,
|
|
49
|
+
);
|
|
56
50
|
}
|
|
57
51
|
}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
2
|
import { open as zarrOpen, get as zarrGet, slice } from 'zarrita';
|
|
3
3
|
import { createZarrArrayAdapter } from '@vitessce/zarr-utils';
|
|
4
|
-
import {
|
|
5
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
6
|
-
} from '@vitessce/abstract';
|
|
4
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
7
5
|
import { maybeDowncastInt64, concatenateColumnVectors } from './utils.js';
|
|
8
6
|
|
|
9
7
|
// Put array of data into an object,
|
|
@@ -356,17 +354,14 @@ export default class ObsFeatureMatrixAnndataLoader extends AbstractTwoStepLoader
|
|
|
356
354
|
|
|
357
355
|
async load() {
|
|
358
356
|
const { path } = this.getOptions();
|
|
359
|
-
const
|
|
360
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
361
|
-
return Promise.reject(superResult);
|
|
362
|
-
}
|
|
363
|
-
return Promise.all([
|
|
357
|
+
const [obsIndex, featureIndex, obsFeatureMatrix] = await Promise.all([
|
|
364
358
|
this.dataSource.loadObsIndex(path),
|
|
365
359
|
this.loadInitialFilteredGeneNames(),
|
|
366
360
|
this.loadCellXGene(),
|
|
367
|
-
])
|
|
361
|
+
]);
|
|
362
|
+
return new LoaderResult(
|
|
368
363
|
{ obsIndex, featureIndex, obsFeatureMatrix },
|
|
369
364
|
null,
|
|
370
|
-
)
|
|
365
|
+
);
|
|
371
366
|
}
|
|
372
367
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
|
|
5
3
|
|
|
6
4
|
/**
|
|
@@ -27,16 +25,13 @@ export default class ObsLabelsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
27
25
|
|
|
28
26
|
async load() {
|
|
29
27
|
const { path } = this.options;
|
|
30
|
-
const
|
|
31
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
32
|
-
return Promise.reject(superResult);
|
|
33
|
-
}
|
|
34
|
-
return Promise.all([
|
|
28
|
+
const [obsIndex, obsLabels] = await Promise.all([
|
|
35
29
|
this.dataSource.loadObsIndex(path),
|
|
36
30
|
this.loadLabels(),
|
|
37
|
-
])
|
|
31
|
+
]);
|
|
32
|
+
return new LoaderResult(
|
|
38
33
|
{ obsIndex, obsLabels },
|
|
39
34
|
null,
|
|
40
|
-
)
|
|
35
|
+
);
|
|
41
36
|
}
|
|
42
37
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
|
|
5
3
|
/**
|
|
6
4
|
* Loader for embedding arrays located in anndata.zarr stores.
|
|
@@ -25,16 +23,13 @@ export default class ObsLocationsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
25
23
|
|
|
26
24
|
async load() {
|
|
27
25
|
const { path } = this.options;
|
|
28
|
-
const
|
|
29
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
30
|
-
return Promise.reject(superResult);
|
|
31
|
-
}
|
|
32
|
-
return Promise.all([
|
|
26
|
+
const [obsIndex, obsLocations] = await Promise.all([
|
|
33
27
|
this.dataSource.loadObsIndex(path),
|
|
34
28
|
this.loadLocations(),
|
|
35
|
-
])
|
|
29
|
+
]);
|
|
30
|
+
return new LoaderResult(
|
|
36
31
|
{ obsIndex, obsLocations },
|
|
37
32
|
null,
|
|
38
|
-
)
|
|
33
|
+
);
|
|
39
34
|
}
|
|
40
35
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
import { CoordinationLevel as CL } from '@vitessce/config';
|
|
5
3
|
|
|
6
4
|
/**
|
|
@@ -26,11 +24,6 @@ export default class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
26
24
|
|
|
27
25
|
async load() {
|
|
28
26
|
const { path } = this.options;
|
|
29
|
-
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
30
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
31
|
-
return Promise.reject(superResult);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
const coordinationValues = {
|
|
35
28
|
pointLayer: CL({
|
|
36
29
|
obsType: 'point',
|
|
@@ -47,14 +40,14 @@ export default class ObsPointsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
47
40
|
// obsLabelsType: null,
|
|
48
41
|
}),
|
|
49
42
|
};
|
|
50
|
-
|
|
51
|
-
return Promise.all([
|
|
43
|
+
const [obsIndex, obsPoints] = await Promise.all([
|
|
52
44
|
this.dataSource.loadObsIndex(path),
|
|
53
45
|
this.loadPoints(),
|
|
54
|
-
])
|
|
46
|
+
]);
|
|
47
|
+
return new LoaderResult(
|
|
55
48
|
{ obsIndex, obsPoints },
|
|
56
49
|
null,
|
|
57
50
|
coordinationValues,
|
|
58
|
-
)
|
|
51
|
+
);
|
|
59
52
|
}
|
|
60
53
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
import { DEFAULT_CELLS_LAYER } from '@vitessce/constants-internal';
|
|
5
3
|
import { CoordinationLevel as CL } from '@vitessce/config';
|
|
6
4
|
|
|
@@ -50,11 +48,6 @@ export default class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader
|
|
|
50
48
|
|
|
51
49
|
async load() {
|
|
52
50
|
const { path } = this.options;
|
|
53
|
-
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
54
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
55
|
-
return Promise.reject(superResult);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
51
|
const channelCoordination = [{
|
|
59
52
|
// obsType: null,
|
|
60
53
|
spatialChannelColor: [255, 255, 255],
|
|
@@ -85,17 +78,15 @@ export default class ObsSegmentationsAnndataLoader extends AbstractTwoStepLoader
|
|
|
85
78
|
]),
|
|
86
79
|
};
|
|
87
80
|
|
|
88
|
-
|
|
81
|
+
const [obsIndex, obsSegmentations] = await Promise.all([
|
|
89
82
|
this.dataSource.loadObsIndex(path),
|
|
90
83
|
this.loadSegmentations(),
|
|
91
|
-
])
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
obsSegmentationsType: 'polygon',
|
|
96
|
-
},
|
|
84
|
+
]);
|
|
85
|
+
|
|
86
|
+
return new LoaderResult(
|
|
87
|
+
{ obsIndex, obsSegmentations, obsSegmentationsType: 'polygon' },
|
|
97
88
|
null,
|
|
98
89
|
coordinationValues,
|
|
99
|
-
)
|
|
90
|
+
);
|
|
100
91
|
}
|
|
101
92
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
import {
|
|
5
3
|
initializeCellSetColor,
|
|
6
4
|
treeToMembershipMap,
|
|
@@ -52,10 +50,6 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
async load() {
|
|
55
|
-
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
56
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
57
|
-
return Promise.reject(superResult);
|
|
58
|
-
}
|
|
59
53
|
if (!this.cachedResult) {
|
|
60
54
|
const { options } = this;
|
|
61
55
|
this.cachedResult = Promise.all([
|
|
@@ -79,8 +73,6 @@ export default class ObsSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
79
73
|
const newAutoSetColors = initializeCellSetColor(obsSets, []);
|
|
80
74
|
coordinationValues.obsSetSelection = newAutoSetSelections;
|
|
81
75
|
coordinationValues.obsSetColor = newAutoSetColors;
|
|
82
|
-
return
|
|
83
|
-
new LoaderResult({ obsIndex, obsSets, obsSetsMembership }, null, coordinationValues),
|
|
84
|
-
);
|
|
76
|
+
return new LoaderResult({ obsIndex, obsSets, obsSetsMembership }, null, coordinationValues);
|
|
85
77
|
}
|
|
86
78
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
import { CoordinationLevel as CL } from '@vitessce/config';
|
|
5
3
|
|
|
6
4
|
/**
|
|
@@ -26,11 +24,6 @@ export default class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
26
24
|
|
|
27
25
|
async load() {
|
|
28
26
|
const { path } = this.options;
|
|
29
|
-
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
30
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
31
|
-
return Promise.reject(superResult);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
27
|
const coordinationValues = {
|
|
35
28
|
spotLayer: CL({
|
|
36
29
|
obsType: 'spot',
|
|
@@ -48,14 +41,14 @@ export default class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
48
41
|
// additionalObsSets: null,
|
|
49
42
|
}),
|
|
50
43
|
};
|
|
51
|
-
|
|
52
|
-
return Promise.all([
|
|
44
|
+
const [obsIndex, obsSpots] = await Promise.all([
|
|
53
45
|
this.dataSource.loadObsIndex(path),
|
|
54
46
|
this.loadSpots(),
|
|
55
|
-
])
|
|
47
|
+
]);
|
|
48
|
+
return new LoaderResult(
|
|
56
49
|
{ obsIndex, obsSpots },
|
|
57
50
|
null,
|
|
58
51
|
coordinationValues,
|
|
59
|
-
)
|
|
52
|
+
);
|
|
60
53
|
}
|
|
61
54
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
|
|
5
3
|
|
|
6
4
|
/**
|
|
@@ -27,19 +25,14 @@ export default class SampleEdgesAnndataLoader extends AbstractTwoStepLoader {
|
|
|
27
25
|
|
|
28
26
|
async load() {
|
|
29
27
|
const { path } = this.options;
|
|
30
|
-
const
|
|
31
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
32
|
-
return Promise.reject(superResult);
|
|
33
|
-
}
|
|
34
|
-
return Promise.all([
|
|
28
|
+
const [obsIndex, sampleIds] = await Promise.all([
|
|
35
29
|
this.dataSource.loadObsIndex(path),
|
|
36
30
|
this.loadLabels(),
|
|
37
|
-
])
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
});
|
|
31
|
+
]);
|
|
32
|
+
const sampleEdges = new Map(obsIndex.map((obsId, i) => ([obsId, sampleIds[i]])));
|
|
33
|
+
return new LoaderResult(
|
|
34
|
+
{ sampleEdges },
|
|
35
|
+
null,
|
|
36
|
+
);
|
|
44
37
|
}
|
|
45
38
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
LoaderResult, AbstractTwoStepLoader, AbstractLoaderError,
|
|
3
|
-
} from '@vitessce/abstract';
|
|
1
|
+
import { LoaderResult, AbstractTwoStepLoader } from '@vitessce/abstract';
|
|
4
2
|
import {
|
|
5
3
|
initializeCellSetColor,
|
|
6
4
|
treeToMembershipMap,
|
|
@@ -46,10 +44,6 @@ export default class SampleSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
async load() {
|
|
49
|
-
const superResult = await super.load().catch(reason => Promise.resolve(reason));
|
|
50
|
-
if (superResult instanceof AbstractLoaderError) {
|
|
51
|
-
return Promise.reject(superResult);
|
|
52
|
-
}
|
|
53
47
|
if (!this.cachedResult) {
|
|
54
48
|
const { options } = this;
|
|
55
49
|
this.cachedResult = Promise.all([
|
|
@@ -77,12 +71,10 @@ export default class SampleSetsAnndataLoader extends AbstractTwoStepLoader {
|
|
|
77
71
|
const newAutoSetColors = initializeCellSetColor(obsSets, []);
|
|
78
72
|
// coordinationValues.sampleSetSelection = newAutoSetSelections;
|
|
79
73
|
coordinationValues.sampleSetColor = newAutoSetColors;
|
|
80
|
-
return
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, null, coordinationValues),
|
|
86
|
-
);
|
|
74
|
+
return new LoaderResult({
|
|
75
|
+
sampleIndex: obsIndex,
|
|
76
|
+
sampleSets: obsSets,
|
|
77
|
+
sampleSetsMembership: obsSetsMembership,
|
|
78
|
+
}, null, coordinationValues);
|
|
87
79
|
}
|
|
88
80
|
}
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { AbstractTwoStepLoader, LoaderResult } from '@vitessce/abstract';
|
|
2
2
|
|
|
3
3
|
export default class GenomicProfilesZarrLoader extends AbstractTwoStepLoader {
|
|
4
|
-
loadAttrs() {
|
|
4
|
+
async loadAttrs() {
|
|
5
5
|
if (this.attrs) {
|
|
6
6
|
return this.attrs;
|
|
7
7
|
}
|
|
8
|
-
this.attrs = this.dataSource.getJson('.zattrs');
|
|
8
|
+
this.attrs = await this.dataSource.getJson('.zattrs');
|
|
9
9
|
return this.attrs;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
load() {
|
|
12
|
+
async load() {
|
|
13
13
|
const { url, requestInit } = this;
|
|
14
14
|
const storeRoot = this.dataSource.getStoreRoot('/');
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
15
|
+
const attrs = await this.loadAttrs();
|
|
16
|
+
return new LoaderResult(
|
|
17
|
+
{
|
|
18
|
+
genomicProfiles: {
|
|
19
|
+
storeRoot,
|
|
20
|
+
attrs,
|
|
22
21
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
},
|
|
23
|
+
url,
|
|
24
|
+
null,
|
|
25
|
+
requestInit,
|
|
26
|
+
);
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -24,12 +24,11 @@ export default class MatrixZarrAsObsFeatureMatrixLoader extends AbstractTwoStepL
|
|
|
24
24
|
return this.arr;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
load() {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
)));
|
|
27
|
+
async load() {
|
|
28
|
+
const [attrs, arr] = await Promise.all([this.loadAttrs(), this.loadArr()]);
|
|
29
|
+
return new LoaderResult(
|
|
30
|
+
{ obsIndex: attrs.data.rows, featureIndex: attrs.data.cols, obsFeatureMatrix: arr },
|
|
31
|
+
null,
|
|
32
|
+
);
|
|
34
33
|
}
|
|
35
34
|
}
|