-
Notifications
You must be signed in to change notification settings - Fork 28
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
Conversion Error: Conversion from numpy array type 20 is not supported #45
Comments
Hi @const-ae Thanks for the issue (and giving zellkonverter a go)! It definitely could be whatever is in |
Ok, I have spent some time looking into this. First I can confirm this is an issue (using the smaller For zellkonverter there are a couple of things that need to be done:
Should be able to get at least the conversion check into the next release, not so sure about the |
This is great. Thank you so much for your effort :) |
Centralised in a new .convert_anndata_slot() function. Related to #45.
Ok, I've added checks that should prevent this error in the current dev version (v1.1.8) but without any conversion. I would like to be able to handle the conversion as well but I think that will require rewriting some things so might not happen for this release. |
This is already great. Thank you for the effort :) |
I'm having a similar issue
Error is similar to OP:
I did try rolling back to Zellkonverter 1.6.0 and the error is not present. Is this perhaps an anndata version issue? |
There shouldn't be any major differences between {zellkonverter} v1.6.0 and v1.6.4. Could you please post the output with |
Traceback on error:
I can't attach the object but here's the content
|
Ok, so it seems like something to do with |
I encountered it once as well with the cache <- BiocFileCache::BiocFileCache(ask = FALSE)
example_file <- BiocFileCache::bfcrpath(
cache, "https://ndownloader.figshare.com/files/30462915"
)
sce <- readH5AD(example_file, raw = TRUE) One approach we could try to use is to add an explicit converter along the lines of: # workaround for Error in py_ref_to_r(x) :
# Conversion from numpy array type 20 is not supported
# see https://github.com/theislab/zellkonverter/issues/45
py_to_r.numpy.ndarray <- function(x) {
disable_conversion_scope(x)
if (x$dtype$num == 20) {
np <- import("numpy", convert = TRUE)
out <-
tryCatch({
# assuming is float
x$dtype <- np$dtype("float32")
py_to_r(x)
}, error = function(e) {
warning("Could not convert numpy array type 20, skipping conversion")
NULL
})
return(out)
}
# no special handler found; delegate to next method
NextMethod()
} (This solution is 100% untested ;)) |
Hi Luke,
I tried to load a single cell dataset from https://singlecell.broadinstitute.org/single_cell/study/SCP1052/covid-19-lung-autopsy-samples#study-summary, however I get the following error
in line
zellkonverter/R/konverter.R
Line 160 in 069239e
I assume that the problem is the COMPOUND datatype in
/varm
, however I am not quite sure.I could try to provide a reduced file as the original is quite big (1,5GB), but I am not sure what is the best way to reduce the size of a h5ad file.
Best,
Constantin
The text was updated successfully, but these errors were encountered: