No project description provided
Project description
AnnData ↭ SingleCellExperiment
RPy2 converter from AnnData to SingleCellExperiment and back. (For details about conversion see the docs)
You can for example use it to process your data using both Scanpy and Seurat, as described in this example notebook
Installation
pip install anndata2ri
# or
conda install -c bioconda anndata2ri
Troubleshooting
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 as rpy2, report your problem in that project’s bug tracker.
Search the issues. 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.
Usage from Python
Either use the converter manually …
import anndata2ri
from rpy2.robjects import r
from rpy2.robjects.conversion import localconverter
with localconverter(anndata2ri.converter):
adata = r('as(some_data, "SingleCellExperiment")')
… or activate it globally:
import anndata2ri
from rpy2.robjects import r
anndata2ri.activate()
adata = r('as(some_data, "SingleCellExperiment")')
Usage from Jupyter
Activate the conversion before you load the extension:
import anndata2ri
anndata2ri.activate()
%load_ext rpy2.ipython
Now you can move objects from Python to R …
import scanpy.datasets as scd
adata_paul = scd.paul15()
%%R -i adata_paul
adata_paul # class: SingleCellExperiment ...
… and back:
%%R -o adata_allen
data(allen, package = 'scRNAseq')
adata_allen <- as(allen, 'SingleCellExperiment')
print(adata_allen) # AnnData object with ...
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file anndata2ri-1.3.tar.gz
.
File metadata
- Download URL: anndata2ri-1.3.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ac1aae38021eab6843e9c04d5d536ede2dc644d863241ae84764f64a4f04179 |
|
MD5 | 8fa4cabf562182ae86001d4353ca8e6f |
|
BLAKE2b-256 | 711ba5564aebd87ad14da1a30fae632a4cf1d35512d07b9042788a348e2cb0c7 |
File details
Details for the file anndata2ri-1.3-py3-none-any.whl
.
File metadata
- Download URL: anndata2ri-1.3-py3-none-any.whl
- Upload date:
- Size: 27.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab21f61a431947e1bb745cd8eecc6f7383864cd5873151949fb4281331387ba4 |
|
MD5 | e0465eb7b14b71db7adea2a2f82b527b |
|
BLAKE2b-256 | ac98db1bac23040802e6fd5219355f198fd2a87db011f9aeb6f3ee76f2038a46 |