anndata2ri#
Converter between Python’s AnnData and R’s SingleCellExperiment.
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
|
⇄ |
|
- anndata2ri.activate()#
Activate conversion for supported objects.
This includes
AnnData
objects as well as Array objects andpandas.DataFrame
s viarpy2.robjects.numpy2ri
andrpy2.robjects.pandas2ri
.Does nothing if this is the active converter.
- Return type:
- anndata2ri.deactivate()#
Deactivate the conversion described above if it is active.
- Return type:
- anndata2ri.py2rpy(obj)#
Convert Python objects to R interface objects.
Supports: :rtype:
Sexp
- anndata2ri.rpy2py(obj)#
Convert R interface objects to Python objects.
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.
- Return type:
- anndata2ri.scipy2ri.deactivate()#
Deactivate the conversion described above if it is active.
- Return type:
- 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:
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_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
[Literal
['d'
,'l'
,'n'
]],Literal
['d'
,'l'
,'n'
]] (default:frozenset({'n', 'l', 'd'})
) Data type character(s) from
supported_r_matrix_types
- storage
Union
[Iterable
[Literal
['C'
,'R'
,'T'
,'di'
]],Literal
['C'
,'R'
,'T'
,'di'
]] (default:frozenset({'R', 'C', 'T', 'di'})
) Storage mode(s) from
supported_r_matrix_storage
- types
- Return type:
- Returns:
All supported classes with those characters
- 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_types = frozenset({'d', 'l', 'n'})#
The Matrix data types supported by this module; Double, Logical, and patterN.