@vitessce/zarr 3.8.5 → 3.8.7
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 +245 -0
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -5658,6 +5658,24 @@ const PALETTE = [
|
|
|
5658
5658
|
[136, 34, 85],
|
|
5659
5659
|
[170, 68, 153]
|
|
5660
5660
|
];
|
|
5661
|
+
class VitessceConfigViewHConcat {
|
|
5662
|
+
constructor(views) {
|
|
5663
|
+
this.views = views;
|
|
5664
|
+
}
|
|
5665
|
+
}
|
|
5666
|
+
class VitessceConfigViewVConcat {
|
|
5667
|
+
constructor(views) {
|
|
5668
|
+
this.views = views;
|
|
5669
|
+
}
|
|
5670
|
+
}
|
|
5671
|
+
function hconcat(...views) {
|
|
5672
|
+
const vcvhc = new VitessceConfigViewHConcat(views);
|
|
5673
|
+
return vcvhc;
|
|
5674
|
+
}
|
|
5675
|
+
function vconcat(...views) {
|
|
5676
|
+
const vcvvc = new VitessceConfigViewVConcat(views);
|
|
5677
|
+
return vcvvc;
|
|
5678
|
+
}
|
|
5661
5679
|
class CoordinationLevel {
|
|
5662
5680
|
constructor(value) {
|
|
5663
5681
|
this.value = value;
|
|
@@ -5676,6 +5694,233 @@ class CoordinationLevel {
|
|
|
5676
5694
|
function CL(value) {
|
|
5677
5695
|
return new CoordinationLevel(value);
|
|
5678
5696
|
}
|
|
5697
|
+
class AbstractAutoConfig {
|
|
5698
|
+
constructor(parsedStore) {
|
|
5699
|
+
const { url, fileType, zmetadata } = parsedStore;
|
|
5700
|
+
this.url = url;
|
|
5701
|
+
this.fileType = fileType;
|
|
5702
|
+
this.zmetadata = zmetadata;
|
|
5703
|
+
}
|
|
5704
|
+
// eslint-disable-next-line class-methods-use-this
|
|
5705
|
+
addFiles(vc, dataset) {
|
|
5706
|
+
throw new Error("The addFiles() method has not been implemented.");
|
|
5707
|
+
}
|
|
5708
|
+
// eslint-disable-next-line class-methods-use-this
|
|
5709
|
+
addViews(vc, dataset, layoutOption) {
|
|
5710
|
+
throw new Error("The addViews() method has not been implemented.");
|
|
5711
|
+
}
|
|
5712
|
+
}
|
|
5713
|
+
class AnnDataAutoConfig extends AbstractAutoConfig {
|
|
5714
|
+
getOptions() {
|
|
5715
|
+
const { zmetadata } = this;
|
|
5716
|
+
const options = {
|
|
5717
|
+
obsEmbedding: [],
|
|
5718
|
+
obsSets: []
|
|
5719
|
+
};
|
|
5720
|
+
zmetadata.forEach(({ path, attrs }) => {
|
|
5721
|
+
const lowerPath = path.toLowerCase();
|
|
5722
|
+
const relPath = path.substring(1);
|
|
5723
|
+
if (["/x"].includes(lowerPath)) {
|
|
5724
|
+
options.obsFeatureMatrix = {
|
|
5725
|
+
path: relPath
|
|
5726
|
+
// TODO: Also check the shape of X.
|
|
5727
|
+
// If X is very large, try to initialize initial-filtering properties
|
|
5728
|
+
// (will require that /var contains a boolean column however.)
|
|
5729
|
+
};
|
|
5730
|
+
}
|
|
5731
|
+
if (["/obsm/x_spatial", "/obsm/spatial"].includes(lowerPath)) {
|
|
5732
|
+
options.obsLocations = {
|
|
5733
|
+
path: relPath
|
|
5734
|
+
};
|
|
5735
|
+
}
|
|
5736
|
+
if (["/obsm/x_umap", "/obsm/umap"].includes(lowerPath)) {
|
|
5737
|
+
options.obsEmbedding.push({ path: relPath, embeddingType: "UMAP" });
|
|
5738
|
+
}
|
|
5739
|
+
if (["/obsm/x_tsne", "/obsm/tsne"].includes(lowerPath)) {
|
|
5740
|
+
options.obsEmbedding.push({ path: relPath, embeddingType: "t-SNE" });
|
|
5741
|
+
}
|
|
5742
|
+
if (["/obsm/x_pca", "/obsm/pca"].includes(lowerPath)) {
|
|
5743
|
+
options.obsEmbedding.push({ path: relPath, embeddingType: "PCA" });
|
|
5744
|
+
}
|
|
5745
|
+
const supportedObsSetsPaths = [
|
|
5746
|
+
"cluster",
|
|
5747
|
+
"clusters",
|
|
5748
|
+
"subcluster",
|
|
5749
|
+
"cell_type",
|
|
5750
|
+
"celltype",
|
|
5751
|
+
"leiden",
|
|
5752
|
+
"louvain",
|
|
5753
|
+
"disease",
|
|
5754
|
+
"organism",
|
|
5755
|
+
"self_reported_ethnicity",
|
|
5756
|
+
"tissue",
|
|
5757
|
+
"sex"
|
|
5758
|
+
].map((colname) => `/obs/${colname}`);
|
|
5759
|
+
if (supportedObsSetsPaths.includes(lowerPath)) {
|
|
5760
|
+
const name = relPath.split("/").at(-1);
|
|
5761
|
+
options.obsSets.push({ path: relPath, name });
|
|
5762
|
+
}
|
|
5763
|
+
});
|
|
5764
|
+
return options;
|
|
5765
|
+
}
|
|
5766
|
+
addFiles(vc, dataset) {
|
|
5767
|
+
const { url, fileType } = this;
|
|
5768
|
+
dataset.addFile({
|
|
5769
|
+
url,
|
|
5770
|
+
fileType,
|
|
5771
|
+
options: this.getOptions()
|
|
5772
|
+
// TODO: coordination values?
|
|
5773
|
+
});
|
|
5774
|
+
}
|
|
5775
|
+
// eslint-disable-next-line class-methods-use-this
|
|
5776
|
+
addViews(vc, dataset, layoutOption) {
|
|
5777
|
+
}
|
|
5778
|
+
}
|
|
5779
|
+
class SpatialDataAutoConfig extends AbstractAutoConfig {
|
|
5780
|
+
getOptions() {
|
|
5781
|
+
const { zmetadata } = this;
|
|
5782
|
+
const options = {};
|
|
5783
|
+
const availableElements = zmetadata.filter(({ path }) => {
|
|
5784
|
+
const relPath = path.substring(1);
|
|
5785
|
+
return relPath.match(/^(tables|table|images|labels|shapes|points)\/([^/]*)$/);
|
|
5786
|
+
});
|
|
5787
|
+
availableElements.forEach(({ path, attrs }) => {
|
|
5788
|
+
const relPath = path.substring(1);
|
|
5789
|
+
const firstCoordinateSystem = attrs?.multiscales?.[0]?.coordinateTransformations?.[0]?.output?.name;
|
|
5790
|
+
if (relPath.match(/^(images)\/([^/]*)$/)) {
|
|
5791
|
+
options.image = {
|
|
5792
|
+
path: relPath,
|
|
5793
|
+
coordinateSystem: firstCoordinateSystem
|
|
5794
|
+
// TODO: support a fileUid property in the schema?
|
|
5795
|
+
};
|
|
5796
|
+
}
|
|
5797
|
+
if (relPath.match(/^(labels)\/([^/]*)$/)) {
|
|
5798
|
+
options.obsSegmentations = {
|
|
5799
|
+
path: relPath,
|
|
5800
|
+
coordinateSystem: firstCoordinateSystem
|
|
5801
|
+
// TODO: support a fileUid property in the schema?
|
|
5802
|
+
};
|
|
5803
|
+
}
|
|
5804
|
+
if (relPath.match(/^(shapes)\/([^/]*)$/)) {
|
|
5805
|
+
options.obsSpots = {
|
|
5806
|
+
path: relPath,
|
|
5807
|
+
coordinateSystem: firstCoordinateSystem
|
|
5808
|
+
};
|
|
5809
|
+
}
|
|
5810
|
+
if (relPath.match(/^(points)\/([^/]*)$/)) {
|
|
5811
|
+
options.obsPoints = {
|
|
5812
|
+
path: relPath,
|
|
5813
|
+
coordinateSystem: firstCoordinateSystem
|
|
5814
|
+
};
|
|
5815
|
+
}
|
|
5816
|
+
if (relPath.match(/^(tables|table)\/([^/]*)$/)) {
|
|
5817
|
+
const tableEls = zmetadata.filter(({ path: subpath }) => subpath.startsWith(path));
|
|
5818
|
+
const hasX = tableEls.find((el) => el.path === `${path}/X`);
|
|
5819
|
+
if (hasX) {
|
|
5820
|
+
options.obsFeatureMatrix = {
|
|
5821
|
+
path: hasX.path.substring(1)
|
|
5822
|
+
// region: null,
|
|
5823
|
+
};
|
|
5824
|
+
}
|
|
5825
|
+
const hasObs = tableEls.find((el) => el.path === `${path}/obs`);
|
|
5826
|
+
if (hasObs) {
|
|
5827
|
+
const columnOrder = hasObs.attrs?.["column-order"];
|
|
5828
|
+
options.obsSets = {
|
|
5829
|
+
// region: null,
|
|
5830
|
+
tablePath: relPath,
|
|
5831
|
+
obsSets: columnOrder.map((c) => ({
|
|
5832
|
+
// TODO: determine whether this column is string/categorical.
|
|
5833
|
+
// TODO: determine whether this column contains too many
|
|
5834
|
+
// categories to make sense to consider a cell set.
|
|
5835
|
+
path: `${hasObs.path.substring(1)}/${c}`,
|
|
5836
|
+
name: c
|
|
5837
|
+
}))
|
|
5838
|
+
};
|
|
5839
|
+
}
|
|
5840
|
+
}
|
|
5841
|
+
});
|
|
5842
|
+
return options;
|
|
5843
|
+
}
|
|
5844
|
+
addFiles(vc, dataset) {
|
|
5845
|
+
const { url, fileType } = this;
|
|
5846
|
+
dataset.addFile({
|
|
5847
|
+
url,
|
|
5848
|
+
fileType,
|
|
5849
|
+
options: this.getOptions()
|
|
5850
|
+
// TODO: coordination values?
|
|
5851
|
+
});
|
|
5852
|
+
}
|
|
5853
|
+
// eslint-disable-next-line class-methods-use-this
|
|
5854
|
+
addViews(vc, dataset, layoutOption) {
|
|
5855
|
+
const options = this.getOptions();
|
|
5856
|
+
const spatialView = vc.addView(dataset, "spatialBeta");
|
|
5857
|
+
const lcView = vc.addView(dataset, "layerControllerBeta");
|
|
5858
|
+
const controlViews = [lcView];
|
|
5859
|
+
if (options.obsSets) {
|
|
5860
|
+
const obsSets = vc.addView(dataset, "obsSets");
|
|
5861
|
+
controlViews.push(obsSets);
|
|
5862
|
+
}
|
|
5863
|
+
if (options.obsFeatureMatrix) {
|
|
5864
|
+
const featureList = vc.addView(dataset, "featureList");
|
|
5865
|
+
controlViews.push(featureList);
|
|
5866
|
+
}
|
|
5867
|
+
vc.layout(hconcat(spatialView, vconcat(...controlViews)));
|
|
5868
|
+
}
|
|
5869
|
+
}
|
|
5870
|
+
class OmeAutoConfig extends AbstractAutoConfig {
|
|
5871
|
+
addFiles(vc, dataset) {
|
|
5872
|
+
const { url, fileType } = this;
|
|
5873
|
+
dataset.addFile({
|
|
5874
|
+
url,
|
|
5875
|
+
fileType
|
|
5876
|
+
// TODO: options?
|
|
5877
|
+
// TODO: coordination values?
|
|
5878
|
+
});
|
|
5879
|
+
}
|
|
5880
|
+
// eslint-disable-next-line class-methods-use-this
|
|
5881
|
+
addViews(vc, dataset, layoutOption) {
|
|
5882
|
+
const spatialView = vc.addView(dataset, "spatialBeta");
|
|
5883
|
+
const lcView = vc.addView(dataset, "layerControllerBeta");
|
|
5884
|
+
vc.layout(hconcat(spatialView, lcView));
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
({
|
|
5888
|
+
[FileType$1.IMAGE_OME_TIFF]: [".ome.tif", ".ome.tiff", ".ome.tf2", ".ome.tf8"],
|
|
5889
|
+
[FileType$1.IMAGE_OME_ZARR]: [".ome.zarr"],
|
|
5890
|
+
[FileType$1.IMAGE_OME_ZARR_ZIP]: [".ome.zarr.zip"],
|
|
5891
|
+
[FileType$1.ANNDATA_ZARR]: [".ad.zarr", ".h5ad.zarr", ".adata.zarr", ".anndata.zarr"],
|
|
5892
|
+
[FileType$1.ANNDATA_ZARR_ZIP]: [".ad.zarr.zip", ".h5ad.zarr.zip", ".adata.zarr.zip", ".anndata.zarr.zip"],
|
|
5893
|
+
// TODO: how to handle h5ad-based AnnData (since needs reference JSON file).
|
|
5894
|
+
// Perhaps just assume one H5AD+one JSON (or .ref.json) file correspond to each other?
|
|
5895
|
+
[FileType$1.SPATIALDATA_ZARR]: [".sd.zarr", ".sdata.zarr", ".spatialdata.zarr"],
|
|
5896
|
+
[FileType$1.SPATIALDATA_ZARR_ZIP]: [".sd.zarr.zip", ".sdata.zarr.zip", ".spatialdata.zarr.zip"]
|
|
5897
|
+
});
|
|
5898
|
+
({
|
|
5899
|
+
// OME-TIFF
|
|
5900
|
+
[FileType$1.IMAGE_OME_TIFF]: OmeAutoConfig,
|
|
5901
|
+
[FileType$1.OBS_SEGMENTATIONS_OME_TIFF]: OmeAutoConfig,
|
|
5902
|
+
// OME-Zarr
|
|
5903
|
+
[FileType$1.IMAGE_OME_ZARR]: OmeAutoConfig,
|
|
5904
|
+
[FileType$1.IMAGE_OME_ZARR_ZIP]: OmeAutoConfig,
|
|
5905
|
+
[FileType$1.OBS_SEGMENTATIONS_OME_ZARR]: OmeAutoConfig,
|
|
5906
|
+
[FileType$1.OBS_SEGMENTATIONS_OME_ZARR_ZIP]: OmeAutoConfig,
|
|
5907
|
+
// AnnData
|
|
5908
|
+
[FileType$1.ANNDATA_ZARR]: AnnDataAutoConfig,
|
|
5909
|
+
[FileType$1.ANNDATA_ZARR_ZIP]: AnnDataAutoConfig,
|
|
5910
|
+
// SpatialData
|
|
5911
|
+
[FileType$1.SPATIALDATA_ZARR]: SpatialDataAutoConfig,
|
|
5912
|
+
[FileType$1.SPATIALDATA_ZARR_ZIP]: SpatialDataAutoConfig
|
|
5913
|
+
});
|
|
5914
|
+
[
|
|
5915
|
+
FileType$1.ANNDATA_ZARR,
|
|
5916
|
+
FileType$1.ANNDATA_ZARR_ZIP,
|
|
5917
|
+
FileType$1.SPATIALDATA_ZARR,
|
|
5918
|
+
FileType$1.SPATIALDATA_ZARR_ZIP,
|
|
5919
|
+
FileType$1.IMAGE_OME_ZARR,
|
|
5920
|
+
FileType$1.IMAGE_OME_ZARR_ZIP,
|
|
5921
|
+
FileType$1.OBS_SEGMENTATIONS_OME_ZARR,
|
|
5922
|
+
FileType$1.OBS_SEGMENTATIONS_OME_ZARR_ZIP
|
|
5923
|
+
];
|
|
5679
5924
|
class ObsSpotsAnndataLoader extends AbstractTwoStepLoader {
|
|
5680
5925
|
/**
|
|
5681
5926
|
* Class method for loading embedding coordinates, such as those from UMAP or t-SNE.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitessce/zarr",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.7",
|
|
4
4
|
"author": "HIDIVE Lab at HMS",
|
|
5
5
|
"homepage": "http://vitessce.io",
|
|
6
6
|
"repository": {
|
|
@@ -22,18 +22,18 @@
|
|
|
22
22
|
"apache-arrow": "^17.0.0",
|
|
23
23
|
"parquet-wasm": "^0.6.1",
|
|
24
24
|
"ol": "^10.2.1",
|
|
25
|
-
"@vitessce/abstract": "3.8.
|
|
26
|
-
"@vitessce/error": "3.8.
|
|
27
|
-
"@vitessce/constants-internal": "3.8.
|
|
28
|
-
"@vitessce/sets-utils": "3.8.
|
|
29
|
-
"@vitessce/image-utils": "3.8.
|
|
30
|
-
"@vitessce/utils": "3.8.
|
|
31
|
-
"@vitessce/zarr-utils": "3.8.
|
|
32
|
-
"@vitessce/config": "3.8.
|
|
33
|
-
"@vitessce/globals": "3.8.
|
|
25
|
+
"@vitessce/abstract": "3.8.7",
|
|
26
|
+
"@vitessce/error": "3.8.7",
|
|
27
|
+
"@vitessce/constants-internal": "3.8.7",
|
|
28
|
+
"@vitessce/sets-utils": "3.8.7",
|
|
29
|
+
"@vitessce/image-utils": "3.8.7",
|
|
30
|
+
"@vitessce/utils": "3.8.7",
|
|
31
|
+
"@vitessce/zarr-utils": "3.8.7",
|
|
32
|
+
"@vitessce/config": "3.8.7",
|
|
33
|
+
"@vitessce/globals": "3.8.7"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@vitessce/types": "3.8.
|
|
36
|
+
"@vitessce/types": "3.8.7"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"bundle": "pnpm exec vite build -c ../../../scripts/vite.config.mjs",
|