SnapATAC2
SnapATAC2 copied to clipboard
AnnDataSet can not be converted to AnnData when the X is empty
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).
- I find that it always report Errors when I used
to_adatafunction 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 aNonevalue note: run withRUST_BACKTRACE=1environment variable to display a backtrace
- if I run
a.X(a: AnnDataSet), it also reports error:
PanicException: called
Option::unwrap()on aNonevalue. (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
- It seems OK now for
to_adata, but stilla.Xhas 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?
- It seems OK now for
to_adata, but stilla.Xhas 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
@yojetsharma Thank you! From API, it does not mention this. Sincerely, Songpeng