anndata2ri
Converter between Python’s AnnData and R’s SingleCellExperiment.
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
- anndata2ri.activate()
Activate conversion for
AnnData
objects as well as Array objects andpandas.DataFrame
s viarpy2.robjects.numpy2ri
andrpy2.robjects.pandas2ri
.Does nothing if this is the active converter.
- anndata2ri.deactivate()
Deactivate the conversion described above if it is active.
- anndata2ri.py2rpy(obj)
Convert Python objects to R interface objects. Supports: :rtype:
Sexp
- anndata2ri.rpy2py(obj)
Convert R interface objects to Python objects. Supports: :rtype:
Sexp
anndata2ri.scipy2ri
Convert scipy.sparse matrices between Python and R.
For a detailed comparison between the two languages’ sparse matrix environment, see issue #8.
Here’s an overview over the matching classes
R |
Python |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- anndata2ri.scipy2ri.activate()
Activate conversion between sparse matrices from Scipy and R’s Matrix package.
Does nothing if this is the active conversion.
- anndata2ri.scipy2ri.deactivate()
Deactivate the conversion described above if it is active.
- anndata2ri.scipy2ri.py2rpy(obj)
Convert scipy sparse matrices objects to R sparse matrices. Supports:
- Return type
Sexp
csc_matrix
(dtype in {float32, float64, bool}) →csr_matrix
(dtype in {float32, float64, bool}) →coo_matrix
(dtype in {float32, float64, bool}) →dia_matrix
(dtype in {float32, float64, bool}) →
- anndata2ri.scipy2ri.rpy2py(obj)
Convert R sparse matrices to scipy sparse matrices. Supports:
- Return type
Sexp
dgCMatrix
,lgCMatrix
, orngCMatrix
→csc_matrix
(dtype float64 or bool)dgRMatrix
,lgRMatrix
, orngRMatrix
→csr_matrix
(dtype float64 or bool)dgTMatrix
,lgTMatrix
, orngTMatrix
→coo_matrix
(dtype float64 or bool)ddiMatrix
orldiMatrix
→dia_matrix
(dtype float64 or bool)
- anndata2ri.scipy2ri.supported_r_matrix_types = frozenset({'d', 'l', 'n'})
The Matrix data types supported by this module; Double, Logical, and patterN.
- anndata2ri.scipy2ri.supported_r_matrix_storage = frozenset({'C', 'R', 'T', 'di'})
The Matrix storage types supported by this module; Column-sparse, Row-Sparse, Triplets, and DIagonal.
- anndata2ri.scipy2ri.supported_r_matrix_classes(types=frozenset({'d', 'l', 'n'}), storage=frozenset({'C', 'R', 'T', 'di'}))
Get supported classes, possibly limiting data types or storage types.
- Parameters
- types :
Union
[Iterable
[str
],str
] (default:frozenset({'n', 'd', 'l'})
) Data type character(s) from
supported_r_matrix_types
- storage :
Union
[Iterable
[str
],str
] (default:frozenset({'di', 'T', 'C', 'R'})
) Storage mode(s) from
supported_r_matrix_storage
- types :
- Return type
- Returns
All supported classes with those characters