A simple solution for converting Seurat objects into AnnData, as described in this vignette:
library(reticulate)
seuratobject_ad <- Convert(from=seuratobject, to="anndata", filename="seuratobject.h5ad")
Alternatively, one can use Loom, "a file format designed to store and work with single-cell RNA-seq data".
In R, install LoomR:
devtools::install_github(repo = "mojaveazure/loomR")
Convert from Seurat object to loom:
pfile <- Convert(from = pbmc_small, to = "loom", filename = "pbmc_small.loom")
pfile$close() # close loom objects when finished using them.
Then import loom object in Python using loompy, or directly as AnnData:
scanpy.api.read_loom
Alternatively, see feather
.
Or export as some text format (csv, json) then import into Python.