- Notifications
You must be signed in to change notification settings - Fork18
Convert between AnnData and SingleCellExperiment
License
NotificationsYou must be signed in to change notification settings
theislab/anndata2ri
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
RPy2 converter fromAnnData toSingleCellExperiment and back. (Fordetails about conversion see thedocs)
You can for example use it to process your data using bothScanpy andSeurat, as described in thisexample notebook
pip install anndata2ri# orconda install -c bioconda anndata2ri
If you have problems installing or importing anndata2ri,please make sure you first:
- Check the stack trace:If the error happens while installing or importing a dependency such asrpy2,report your problem in that project’s bug tracker.
- Search theissues.At the time of writing 17 of the 29 bugs (60%) are invalid or rpy2 bugs / install problems.
- Make sure you have a compatible R version: rpy2 requires R ≥ 3.6.
Either use the converter manually …
importanndata2rifromrpy2.robjectsimportrfromrpy2.robjects.conversionimportlocalconverterwithlocalconverter(anndata2ri.converter):adata=r('as(some_data, "SingleCellExperiment")')
… or activate it globally:
importanndata2rifromrpy2.robjectsimportranndata2ri.activate()adata=r('as(some_data, "SingleCellExperiment")')
Activate the conversion before you load the extension:
importanndata2rianndata2ri.activate()%load_extrpy2.ipython
Now you can move objects from Python to R …
importscanpy.datasetsasscdadata_paul=scd.paul15()
%%R-iadata_pauladata_paul# class: SingleCellExperiment ...
… and back:
%%R-oadata_allendata(allen,package='scRNAseq')adata_allen<- as(allen,'SingleCellExperiment')
print(adata_allen)# AnnData object with ...
About
Convert between AnnData and SingleCellExperiment
Topics
Resources
License
Stars
Watchers
Forks
Packages0
No packages published