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

When using schard::h5ad2seurat() in Windows 11 to read an AnnData object as a Seurat object, categorical variables with string values in the metadata are converted into numbers 0123456. #10

Open
cystone opened this issue Dec 4, 2024 · 5 comments

Comments

@cystone
Copy link

cystone commented Dec 4, 2024

Would you please check out the issue.
Now I use sceasy to read h5ad in R temporarily.

h5ad_file = paste0('sce_qc.h5ad')
sceasy::convertFormat(h5ad_file, from="anndata", to="seurat",
outFile='tmp_sce_qc.rds'))

sce = schard::h5ad2seurat(h5ad_file)

sce0 = readRDS('sce_qc.rds')
[email protected] %>% head()

@iaaka
Copy link
Contributor

iaaka commented Dec 4, 2024

Hi, thanks for reporting it. Could you please share input file (as small as possible), exact code you use and your [undesired] output?

@cystone
Copy link
Author

cystone commented Dec 6, 2024

I found that it woks well in scanpy workflow.
The necessary files for test were archived into a zip file.
tmp (2).zip
Thanks for your work.

@iaaka
Copy link
Contributor

iaaka commented Dec 6, 2024

Hi @cystone, I've just pushed fixed version, could you please re-install and check whether it works for you?

@cystone
Copy link
Author

cystone commented Dec 6, 2024

I just reinstalled the package a few minutes ago, yet the issue persists.

devtools::install_github("cellgeni/schard", force = T)
sce = schard::h5ad2seurat('tmp_sce_qc.h5ad')
[email protected] %>% head()

doublet_score cellIndex datasetID sampleID cancerType tissueOrgan
AAACCTGAGATGTAAC-1 9.044023e-05 2 0 0 0 0
AAACCTGAGGACAGAA-1 1.687027e-02 7 0 0 0 0
AAACCTGAGGTGATTA-1 1.251088e-02 9 0 0 0 0
AAACCTGAGTCAAGCG-1 2.340808e-03 11 0 0 0 0
AAACCTGCAAGAGGCT-1 1.320272e-03 17 0 0 0 0
AAACCTGCACCGAAAG-1 1.726603e-04 20 0 0 0 0

I plan to delve into the source code of the package, as I believe it to be an exemplary tool for converting between Seurat and Scanpy.

@iaaka
Copy link
Contributor

iaaka commented Dec 9, 2024

That is strange, I can confirm that schard was not working correctly with the file you send but it is fixed now and I cannot see how it can be platform-dependent. Just to make sure we are on same version, could you please share source code of schard::h5ad2data.frame for your installation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants