-
Notifications
You must be signed in to change notification settings - Fork 11
anndata 0.12 blog post
#173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| +++ | ||
| title = "Improved i/o in anndata 0.12" | ||
| date = 2025-07-29T10:30:00+01:00 | ||
| description = "With zarr v3 support and xarray integration, anndata takes a big step forward when it comes to i/o tasks." | ||
| author = "Ilan Gold" | ||
| draft = false | ||
| +++ | ||
|
|
||
| # 0.12 released | ||
|
|
||
| We're happy to announce that `anndata` 0.12 is out now! | ||
| Check out [the changelog](https://anndata.readthedocs.io/en/stable/release-notes/index.html#v0-12-0) for a full list of changes. | ||
| Here, we want to give our users a bit of a deep dive into the new functionality. | ||
| We have lots of great features, like zarr v3 support (package and format), full lazy loading, and new API customisability! Let’s dive in! | ||
|
|
||
| ## Zarr v3 | ||
|
|
||
| [Zarr v3 as a file format](https://zarr-specs.readthedocs.io/en/latest/v3/core/index.html) provides improved cloud support, support for sharding to reduce the number of files created in a zarr store, and improved support for extensibility. | ||
| Check out the following graphic from the zarr docs: | ||
| By grouping chunks into shards, which are the individual file units, we can cut down the number of files a given zarr store has. | ||
| Compare this to zarr v2 where every chunk was its own file! | ||
| No more file system slowdowns, you can create large zarr stores with no concerns while still retaining the ease of use of zarr. | ||
|
|
||
| <img src="https://zarr.dev/zeps/assets/images/sharding.png" style="max-width: 100%;" alt="zarr v3 sharding graphic" /> | ||
|
|
||
|
|
||
| [The zarr v3 package](https://zarr.readthedocs.io/en/stable/index.html), on top of the new format, provides a fully concurrent + parallel backend for faster cloud and local access over v2, which was both single-threaded and synchronous. | ||
| Thus, the new zarr v3 package on its own should provide a nice speedup, but if that’s not enough, various components are also extendable/replaceable. | ||
|
|
||
| Want faster cloud access? Try [obstore](https://zarr.readthedocs.io/en/latest/user-guide/storage.html#object-store) integration for rust-accelerated remote file access | ||
| What about faster local reads? Many very small chunks inside shards can be taxing for the current pure-python zarr v3 pipeline. | ||
| Thus scverse core developers Philipp Angerer and Ilan Gold together with Lachlan Deakin at ANU co-developed [the zarrs-python package](https://zarrs-python.readthedocs.io/en/latest/) for a python bridge to rust-based io acceleration from Lahclan’s zarrs package. | ||
| This acceleration really shines with small, heavily sharded stores! Want to try out direct-to-gpu io? kvikio has [a store for that](https://docs.rapids.ai/api/kvikio/nightly/zarr/#zarr-python-3-x), with a direct-to-GPU zstd codec is coming soon as well! And if all of these new functionalities are a lot to take in, we made [a digestible guide](https://anndata.readthedocs.io/en/stable/tutorials/zarr-v3.html) just for you. | ||
|
|
||
| And of course, all of this new functionality has not broken our backwards compatibility. | ||
| Anndata 0.12 is still fully zarr v2 compatible, both with the package and the file format. | ||
| Upgrade fearlessly! | ||
|
|
||
| ## Fully lazy file access | ||
|
|
||
| Moving on, we have also replaced `anndata.experimental.read_elem_as_dask` with [`anndata.experimental.read_elem_lazy`](https://anndata.readthedocs.io/en/stable/generated/anndata.experimental.read_lazy.html) and [`anndata.experimental.read_lazy`](https://anndata.readthedocs.io/en/stable/generated/anndata.experimental.read_elem_lazy.html). | ||
| Why? Because now your dataframes can be lazy too thanks to support from [xarray](https://docs.xarray.dev/en/stable/user-guide/index.html)! | ||
|
|
||
| Now you can instantly and lazily inspect entire anndata stores both locally and remotely for metadata, and then fetch only subsets you need. | ||
| Mix this with zarr v3 for performant, fully lazy, fully remote (if needed) access! Want to create a new virtual in-memory anndata objects from many disparate on-disk stores? This new functionality is fully compatible with [`anndata.concat`](https://anndata.readthedocs.io/en/latest/generated/anndata.concat.html). | ||
|
|
||
| Check out [our notebook](https://anndata.readthedocs.io/en/stable/tutorials/notebooks/read_lazy.html) to learn more about the API – thanks to [Nils Gehlenborg’s HIDIVE lab](https://hidivelab.org/) for hosting the data, and be sure to check out the [Vitessce visualisation](https://tinyurl.com/jtan4nx7) of the very same data backing the notebook. | ||
| This dual-access really showcases the power of smart remote data access! | ||
|
|
||
| ## Customizable API | ||
|
|
||
| And if that wasn’t enough, we now have [a new way of extending the anndata API](https://anndata.readthedocs.io/en/latest/generated/anndata.register_anndata_namespace.html) contributed by one of our community members, Sri Varra. | ||
| This contribution lets users extend the `AnnData` API easily, great for tinkering with new APIs and features but also for writing new methods directly into the `AnnData` object: | ||
|
|
||
| ```python | ||
| import anndata as ad | ||
|
|
||
| @ad.register_anndata_namespace("my_accessor") | ||
| class Greetings: | ||
| def __init__(self, adata: ad.AnnData): | ||
| self._adata = adata | ||
|
|
||
| def greet(): | ||
| return "hi" | ||
|
|
||
| # and to use | ||
|
|
||
| adata.my_accessor.greet() | ||
| ``` | ||
|
|
||
| Especially as we look to a more extensible future with [async access](https://github.com/scverse/anndata/issues/1897) and a [dataframe API](https://github.com/scverse/anndata/issues/2043), being able to write clean code that really fits your use-case is more important than ever. | ||
| Thanks for the contribution! Please reach out on Github or Zulip if you wish to contribute to these efforts or others! We welcome community contributions and are happy to provide feedback and guidance! | ||
|
|
||
| *— The scverse core team* | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.