Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Convert between AnnData and SingleCellExperiment

License

NotificationsYou must be signed in to change notification settings

theislab/anndata2ri

Repository files navigation

PyPI VersionBioconda VersionDocumentation StatusUnit TestsPublication DOI

AnnData ↭ SingleCellExperiment

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

Installation

pip install anndata2ri# orconda install -c bioconda anndata2ri

Troubleshooting

If you have problems installing or importing anndata2ri,please make sure you first:

  1. 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.
  2. Search theissues.At the time of writing 17 of the 29 bugs (60%) are invalid or rpy2 bugs / install problems.
  3. Make sure you have a compatible R version: rpy2 requires R ≥ 3.6.

Usage from Python

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")')

Usage from Jupyter

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 ...

[8]ページ先頭

©2009-2025 Movatter.jp