-
Notifications
You must be signed in to change notification settings - Fork 18
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
BPCells to h5AD #49
Comments
Currently no, but I've been waiting for an excuse to add the functionality. I'll try adding it over the next couple days and post back here how it goes |
- Support writing sparse matrices to AnnData files - Allow AnnData matrices of type uint32_t, float, and double rather than just float. (This is confirmed working in the Python library, so it seems reasonable to have here) - Dim names will automatically work properly when writing to X or layers/*. Other cases might not pick up the dimension names from the obs or var annotations.
Sorry for the delay on this, but I've finally pushed an update which adds the function |
Thanks, really appreciate it! |
Hello again, this package is getting everyday better!
Even though the function is there in the help Thanks a lot again for your help! |
Oh thanks for the heads up @Dario-Rocha! It looks like I hadn't re-generated the NAMESPACE file so the function wasn't getting exported. Should be fixed now by commit f1b9f6b. (Also for future temporary workarounds, you can use |
Great! that worked. Now I am only wondering if BPCells can write the expression matrix along with the obs and vars data in the h5ad file |
Right now the intended behavior is as follows (though correct me if you're seeing something else happen):
Assuming you are wanting to write additional data to (If you just want a quick way to pass metadata yourself, I'd recommend |
Thank you!, I understand |
I'm posting this here in case it helps others who were in my situation. I was unable to access the data matrix after converting to an h5ad. For example, trying to access the first 5 genes and cells would give an error that said "ValueError: unsupported data types in input". Eventually, I found a solution on my own. I changed the data type of the matrix to an integer.
|
Thanks for the advice @ggruenhagen3! If I remember correctly the Anndata specification doesn't require any particular data type for matrices stored on disk, but evidently the python package implementation is not so flexible when reading from disk. I suppose your workaround might be the best option for now, or I believe calling |
@bnprks I had tried For the record, I am using the following versions: R 4.3.1, BPCells_0.1.0, Seurat_5.0.0, anndata in R version 0.7.5.6 (not sure that this one is relevant), python 3.9.18, scanpy 1.9.3, and anndata in python version 0.8.0 (I had tried other versions, including 0.10.something). |
…nprks#49 (comment)] * When data type of `indptr` is fixed to `int64`, the .h5ad created by `write_matrix_anndata_hdf5` will work with python `sc.read_h5ad`.
* [cpp] Force the `X/indptr` to be int64 for `createAnnDataMatrix`, solving #76 For additional details, see: - #49 (comment) --------- Co-authored-by: Ben Parks <[email protected]>
Hi,
Thanks for creating this great tool! I'd like to use data I currently have stored in a BPCells matrix with a library only found in Python and that takes in h5ad Anndata files - does BPCells have functionality to write matrices to h5ad?
Thanks!
The text was updated successfully, but these errors were encountered: