Giter Site home page Giter Site logo

anndata2ri's Introduction

pypi conda travis doi

AnnData ↭ SingleCellExperiment

RPy2 converter from AnnData to SingleCellExperiment and back.

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:

  1. 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.
  2. Search the issues. 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 …

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 IPython

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

anndata2ri's People

Contributors

flying-sheep avatar gokceneraslan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.