cellgeni / sceasy

A package to help convert different single-cell data formats to each other
GNU General Public License v3.0
346 stars 52 forks source link

Evaluation error: Unable to convert R object to Python type #68

Open Christ14n97 opened 1 year ago

Christ14n97 commented 1 year ago

Hello, I'm trying to convert a SingleCellExperiment object to anndata h5ad file. And the function convert is having issues convirting R to Python.

Thank you in advance!

I am using a Python virtual environment passed to reticulate as:

Sys.setenv(RETICULATE_PYTHON="~python_3_8_venv/bin/python")

I didn't use conda, I used virtualenv

Then, I do:

convertFormat(sce, from="sce", to="anndata", outFile="ann_format.h5ad)

NOTE: sce <- SingleCellExperiment()

The error:

"Error in py_call_impl(callable, dots$args, dots$keywords) : Evaluation error: Unable to convert R object to Python type."

Traceback:

5: stop(structure(list(message = "Evaluation error: Unable to convert R object to Python type.", call = py_call_impl(callable, dots$args, dots$keywords), cppstack = NULL), class = c("Rcpp::eval_error", "C++Error", "error", "condition"))) 4: py_call_impl(callable, dots$args, dots$keywords) 3: anndata$AnnData(X = Matrix::t(X), obs = obs, var = var, obsm = obsm, layers = layers) 2: func(obj, outFile = outFile, main_layer = main_layer, ...) 1: convertFormat(obj = sce, from = "sce", to = "anndata", outFile = file.path(dir, name))

sessionInfo()

R version 4.2.2 Patched (2022-11-10 r83330) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.5 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3 LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

locale: [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
[5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8 LC_PAPER=en_GB.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] sceasy_0.0.7 reticulate_1.26 SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0 [5] Biobase_2.58.0 GenomicRanges_1.50.1 GenomeInfoDb_1.34.4 HDF5Array_1.26.0
[9] rhdf5_2.42.0 DelayedArray_0.24.0 IRanges_2.32.0 S4Vectors_0.36.1
[13] MatrixGenerics_1.10.0 matrixStats_0.63.0 BiocGenerics_0.44.0 Matrix_1.5-1

loaded via a namespace (and not attached): [1] Rcpp_1.0.9 XVector_0.38.0 zlibbioc_1.44.0 lattice_0.20-45 tools_4.2.2
[6] grid_4.2.2 png_0.1-8 GenomeInfoDbData_1.2.9 Rhdf5lib_1.20.0 rhdf5filters_1.10.0
[11] bitops_1.0-7 RCurl_1.98-1.9 compiler_4.2.2 jsonlite_1.8.4