Skip to content
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

AnnDataSet can not be converted to AnnData when the X is empty #331

Open
beyondpie opened this issue Aug 30, 2024 · 3 comments
Open

AnnDataSet can not be converted to AnnData when the X is empty #331

beyondpie opened this issue Aug 30, 2024 · 3 comments
Labels
bug 🐛 Something isn't working

Comments

@beyondpie
Copy link
Collaborator

beyondpie commented Aug 30, 2024

Hi Kai,

I have several AnnData created directly from fragment files. If I did not add any matrix to AnnData's X, and combine them into AnnDataSet (this step is OK).

  1. I find that it always report Errors when I used to_adata function for the merged AnnDataSet object.

thread '' panicked at /root/.cargo/registry/src/index.crates.io-6f17d22bba15001f/anndata-0.3.1/src/anndata/dataset.rs:302:81:
called Option::unwrap() on a None value
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

  1. if I run a.X (a: AnnDataSet), it also reports error:

PanicException: called Option::unwrap() on a None value. (this is the last line of the Error, the whole stacks are about using pretty method to print the results in IPython.)

But AnnData is OK if X is empty. Just nothing is showed in my IPython REPL.

Thanks!
Songpeng

@beyondpie beyondpie added the bug 🐛 Something isn't working label Aug 30, 2024
@beyondpie
Copy link
Collaborator Author

beyondpie commented Sep 25, 2024

  1. It seems OK now for to_adata, but still a.X has error.
  2. Another question is when I transform it into Ann, the fragment information is lost. Can I also keep the fragment information to Ann, too?

@yojetsharma
Copy link

yojetsharma commented Sep 25, 2024

  • It seems OK now for to_adata, but still a.X has error.
  • Another question is when I transform it into Ann, the fragment information is lost. Can I also keep the fragment information to Ann, too?

Before you run to_adata() you need to run the following:
datas.obsm['fragment_paired'] = datas.adatas.obsm['fragment_paired']
and then convert your dataset to data.
Also, you may want to check this link too:
https://kzhang.org/epigenomics-analysis/anndata.html#combining-multiple-anndata-objects-into-a-anndataset-object

@beyondpie
Copy link
Collaborator Author

@yojetsharma
Thank you! From API, it does not mention this.
Sincerely,
Songpeng

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants