-
Notifications
You must be signed in to change notification settings - Fork 6
Add anndata export options (.h5ad, .zarr)
#351
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
Conversation
.h5ad, .zarr).h5ad, .zarr)
gwaybio
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing to see this functionality! Once anndata is added, it is worth a minor release IMO 🎉
Co-Authored-By: Gregory Way <gregory.way@gmail.com>
Co-Authored-By: Gregory Way <gregory.way@gmail.com>
Co-Authored-By: Gregory Way <gregory.way@gmail.com>
Co-Authored-By: Gregory Way <gregory.way@gmail.com>
Co-Authored-By: Gregory Way <gregory.way@gmail.com>
|
Thanks @gwaybio ! Merging this in after making changes. |
| { version = "<0.12.2", python = "<3.11" }, | ||
| { version = ">=0.12.2", python = ">=3.11" }, | ||
| ] | ||
| # zarr is required by anndata <0.12.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zarr is a required dependency in anndata >=0.12.0, not <!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking in on this @flying-sheep and sorry again about the version issue confusion on my part! I should have been more explicit with this particular comment; I found that I needed to manually add zarr for anndata <0.12.2 with Python 3.10 and below.
Here's an example reproducing the error I saw:
example.py
import anndata as ad
import pandas as pd
print(ad.__version__)
adata = ad.AnnData(X=pd.DataFrame({"example":[1,2,3]}))
adata.write_zarr("example.zarr")Executed with uvx using only pandas and anndata through Python 3.10:
uvx -p 3.10 --with anndata,pandas python example.pyYields an error: ImportError: zarr is not installed.
From this PR's standpoint I sought mostly to find a simple resolution for the many different possible versions which could be installed. Do you feel we should raise an issue about this within anndata (happy to do so)? I felt it might be due to what might have previously been treated as an optional or extra installation within the package (and perhaps not an actual error / fault of the project).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a minor clarification on the zarr dependency comment in #352 - thanks again for your comment!
Description
This PR adds the option to export data to anndata formats
h5adandzarr.In order to reach this I felt that we should abstract the initial design of CytoTable to enable these and other export formats in the near future. To this effect, I changed
_to_parquetto be_run_export_workflow(which is more true to what it does anyhow).Please note: the
anndataproject is only compatible with Python <=3.11 and as a result shifts how implementation was performed.Closes #346
What is the nature of your change?
Checklist
Please ensure that all boxes are checked before indicating that a pull request is ready for review.