Closed mbahin closed 3 years ago
Hi @mbahin
{zellkonverter} currently converts between an R SingleCellExperiment
and a Python AnnData
object, not an R AnnData
object from the {anndata} package.
The error you are seeing is because the Python anndata library is not installed in your Python environment. The {reticulate} documentation has useful information for managing a Python environment for R https://rstudio.github.io/reticulate/.
Alternatively, you can use the writeH5AD()
function in {zellkonverter} which will manage the environment creation process for you and give you a .h5ad
file on disk. You can then read this into R using {anndata} if you want an R AnnData
object.
Might consider exporting the BasiliskEnvironment
objects so people can just:
library(basilisk)
library(zellkonverter)
basiliskStart(zellkonverterEnv) # give it a nice name.
ad <- SCE2AnnData(sce)
This is technically not safe against displacement from other Python instances - one would have to wrap further code in basiliskRun()
to be properly protected - but it should be good enough for ad hoc scripts written by end-users.
Thanks for your answers.
The writeH5AD()
approach worked! :)
Great! 👍🏻
Reopening as a note to think about exporting the environment objects.
Environment now exported in devel as of v1.1.5
Hi,
I'm trying to convert a SCE object to an AnnData one in R but I get the following message:
Any clue on that problem?
Cheers, Mathieu
SessionInfo: