Skip to content

Commit

Permalink
List tables in metadata (as suggested by @will-moore)
Browse files Browse the repository at this point in the history
  • Loading branch information
minnerbe committed Jun 30, 2023
1 parent 9b08825 commit 15c9a20
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
3 changes: 2 additions & 1 deletion latest/generate_anndata_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def write_anndata(adata, filename, chunks):
root = zarr.open(filename, mode="w")
root.array("some_image", np.array([0]), chunks=(1,))
tables = root.create_group("tables")
tables.attrs["tables"] = ["/anndata/obs", "/anndata/var", "/anndata/obsm", "/anndata/varm", "/anndata/obsp", "/anndata/varp"]
adgroup = tables.create_group("anndata")
adgroup.attrs["anndata"] = "0.9.1"
adgroup.attrs["other-metadata"] = "metadata describing how the anndata annotates some_image"
Expand Down Expand Up @@ -96,6 +97,7 @@ def write_anndata_suggestion(adata, filename, chunks):
root = zarr.open(filename, mode="w")
root.array("some_image", np.array([0]), chunks=(1,))
tables = root.create_group("tables")
tables.attrs["tables"] = ["/anndata/obs", "/anndata/var"]
adgroup = tables.create_group("anndata")
adgroup.attrs["anndata"] = "0.9.1"
adgroup.attrs["other-metadata"] = "metadata describing how the anndata annotates some_image"
Expand All @@ -107,7 +109,6 @@ def write_anndata_suggestion(adata, filename, chunks):
row_names = np.array(["X", "log_transformed", "other_data"])
layers.create_dataset("row_names", data=row_names, dtype=object, object_codec=numcodecs.VLenUTF8())
layers.attrs["annotated-data"] = [{"array": "/tables/anndata/X", "dimension": "2"}]
obs.attrs["column-order"] = ["row_names"]

# obs (combines obs, obsm, obsp)
localChunks = (chunks[0],)
Expand Down
6 changes: 2 additions & 4 deletions latest/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@ The on-disk format of a table group looks like this:
└── 123.zarr
|
├── .zgroup
├── .zattrs
|
└──tables
|
├── .zgroup
├── .zattrs
├── .zattrs # A table group's `.zattrs` file MUST contain an attribute "tables" that lists all
| # tables in the group with relative paths, e.g., `{"tables": ["table_1", "some/nested/table_2"]}`
|
└── table_1 # A table group holds arrays (called columns) with one or more dimensions,
| # where the number of rows n MUST be the same across all arrays.
Expand All @@ -253,7 +253,6 @@ The on-disk format of a table group looks like this:
├── column_1 # The table group MAY hold zero, one, or an arbitrary number of column arrays.
| |
| ├── .zarray
| ├── .zattrs
| |
| ├── 0.0
| | ...
Expand All @@ -262,7 +261,6 @@ The on-disk format of a table group looks like this:
└── row_names # The table group SHOULD contain a 1D array of strings of length n called `row_names`.
|
├── .zarray
├── .zattrs
|
├── 0
| :
Expand Down

0 comments on commit 15c9a20

Please sign in to comment.