Skip to content

Commit

Permalink
(fix): using zip files for backwards compat
Browse files Browse the repository at this point in the history
  • Loading branch information
ilan-gold committed Jan 24, 2025
1 parent bc3f2bc commit ae18de3
Show file tree
Hide file tree
Showing 466 changed files with 4,036 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/anndata/_io/specs/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,7 @@ def read_basic_zarr(
OldFormatWarning,
stacklevel=3,
)

if isinstance(elem, Mapping):
if isinstance(elem, ZarrGroup):
# Backwards compat sparse arrays
if "h5sparse_format" in elem.attrs:
return sparse_dataset(elem).to_memory()
Expand Down Expand Up @@ -981,8 +980,8 @@ def read_series(dataset: h5py.Dataset) -> np.ndarray | pd.Categorical:
if isinstance(dataset, ZarrArray):
import zarr

parent_name = dataset.name.rstrip(dataset.basename)
parent = zarr.open(dataset.store)[parent_name]
parent_name = dataset.name.rstrip(dataset.basename).strip("/")
parent = zarr.open(dataset.store, mode="r")[parent_name]
else:
parent = dataset.parent
categories_dset = parent[_read_attr(dataset.attrs, "categories")]
Expand Down
Binary file removed tests/data/archives/v0.7.0/adata.zarr.zip
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/.zgroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
8 changes: 8 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/X/.zattrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"encoding-type": "csr_matrix",
"encoding-version": "0.1.0",
"shape": [
30,
20
]
}
3 changes: 3 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/X/.zgroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/X/data/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
228
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<f4",
"fill_value": 0.0,
"filters": null,
"order": "C",
"shape": [
228
],
"zarr_format": 2
}
Binary file added tests/data/archives/v0.7.0/adata.zarr/X/data/0
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/X/indices/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
228
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i4",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
228
],
"zarr_format": 2
}
Binary file added tests/data/archives/v0.7.0/adata.zarr/X/indices/0
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/X/indptr/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
31
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i4",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
31
],
"zarr_format": 2
}
Binary file added tests/data/archives/v0.7.0/adata.zarr/X/indptr/0
Binary file not shown.
3 changes: 3 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/layers/.zgroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
22 changes: 22 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/layers/array/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"chunks": [
30,
20
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<f8",
"fill_value": 0.0,
"filters": null,
"order": "C",
"shape": [
30,
20
],
"zarr_format": 2
}
Binary file not shown.
8 changes: 8 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/layers/sparse/.zattrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"encoding-type": "csr_matrix",
"encoding-version": "0.1.0",
"shape": [
30,
20
]
}
3 changes: 3 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/layers/sparse/.zgroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/layers/sparse/data/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
6
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<f8",
"fill_value": 0.0,
"filters": null,
"order": "C",
"shape": [
6
],
"zarr_format": 2
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
6
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i4",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
6
],
"zarr_format": 2
}
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/layers/sparse/indptr/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
31
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i4",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
31
],
"zarr_format": 2
}
Binary file not shown.
12 changes: 12 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/.zattrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"_index": "_index",
"column-order": [
"obs_cat",
"cat_ordered",
"int64",
"float64",
"uint8"
],
"encoding-type": "dataframe",
"encoding-version": "0.1.0"
}
3 changes: 3 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/.zgroup
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"chunks": [
22
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "|O",
"fill_value": 0,
"filters": [
{
"id": "vlen-utf8"
}
],
"order": "C",
"shape": [
22
],
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ordered": true
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"chunks": [
22
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "|O",
"fill_value": 0,
"filters": [
{
"id": "vlen-utf8"
}
],
"order": "C",
"shape": [
22
],
"zarr_format": 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"ordered": false
}
Binary file not shown.
24 changes: 24 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/_index/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"chunks": [
30
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "|O",
"fill_value": 0,
"filters": [
{
"id": "vlen-utf8"
}
],
"order": "C",
"shape": [
30
],
"zarr_format": 2
}
Binary file added tests/data/archives/v0.7.0/adata.zarr/obs/_index/0
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/cat_ordered/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
30
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "|i1",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
30
],
"zarr_format": 2
}
3 changes: 3 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/cat_ordered/.zattrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"categories": "__categories/cat_ordered"
}
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/float64/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
30
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<f8",
"fill_value": 0.0,
"filters": null,
"order": "C",
"shape": [
30
],
"zarr_format": 2
}
Binary file added tests/data/archives/v0.7.0/adata.zarr/obs/float64/0
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/int64/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
30
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "<i8",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
30
],
"zarr_format": 2
}
Binary file added tests/data/archives/v0.7.0/adata.zarr/obs/int64/0
Binary file not shown.
20 changes: 20 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/obs_cat/.zarray
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"chunks": [
30
],
"compressor": {
"blocksize": 0,
"clevel": 5,
"cname": "lz4",
"id": "blosc",
"shuffle": 1
},
"dtype": "|i1",
"fill_value": 0,
"filters": null,
"order": "C",
"shape": [
30
],
"zarr_format": 2
}
3 changes: 3 additions & 0 deletions tests/data/archives/v0.7.0/adata.zarr/obs/obs_cat/.zattrs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"categories": "__categories/obs_cat"
}
Binary file added tests/data/archives/v0.7.0/adata.zarr/obs/obs_cat/0
Binary file not shown.
Loading

0 comments on commit ae18de3

Please sign in to comment.