def activate(): global original_converter # If module is already activated, there is nothing to do if original_converter is not None: return original_converter = conversion.converter new_converter = conversion.Converter('numpy conversion', template=original_converter) for k,v in py2ri.registry.items(): if k is object: continue new_converter.py2ri.register(k, v) for k,v in ri2ro.registry.items(): if k is object: continue new_converter.ri2ro.register(k, v) for k,v in py2ro.registry.items(): if k is object: continue new_converter.py2ro.register(k, v) for k,v in ri2py.registry.items(): if k is object: continue new_converter.ri2py.register(k, v) conversion.set_conversion(new_converter)
def activate(): warnings.warn('The global conversion available with activate() ' 'is deprecated and will be removed in the next major ' 'release. Use a local converter.', category=DeprecationWarning) global original_converter # If module is already activated, there is nothing to do if original_converter is not None: return original_converter = conversion.converter new_converter = conversion.Converter('numpy conversion', template=original_converter) for k, v in py2rpy.registry.items(): if k is object: continue new_converter.py2rpy.register(k, v) for k, v in rpy2py.registry.items(): if k is object: continue new_converter.rpy2py.register(k, v) conversion.set_conversion(new_converter)
def activate(): global original_converter # If module is already activated, there is nothing to do if original_converter is not None: return original_converter = conversion.Converter( 'snapshot before pandas conversion', template=conversion.converter) numpy2ri.activate() new_converter = conversion.Converter('snapshot before pandas conversion', template=conversion.converter) numpy2ri.deactivate() for k, v in py2ri.registry.items(): if k is object: continue new_converter.py2ri.register(k, v) for k, v in ri2ro.registry.items(): if k is object: continue new_converter.ri2ro.register(k, v) for k, v in py2ro.registry.items(): if k is object: continue new_converter.py2ro.register(k, v) for k, v in ri2py.registry.items(): if k is object: continue new_converter.ri2py.register(k, v) conversion.set_conversion(new_converter)
def deactivate(): global original_converter # If module has never been activated or already deactivated, # there is nothing to do if original_converter is None: return conversion.set_conversion(original_converter) original_converter = None
def deactivate(): """Deactivate the conversion described above if it is active.""" global original_converter if original_converter is None: return conversion.set_conversion(original_converter) original_converter = None
def deactivate(): """Deactivate!""" global original_converter if original_converter is None: return conversion.set_conversion(original_converter) original_converter = None
def activate(): """ Activate conversion for :class:`~anndata.AnnData` objects as well as :doc:`numpy` arrays and :class:`pandas.DataFrame`\ s via ``rpy2.robjects.numpy2ri`` and ``rpy2.robjects.pandas2ri``. """ global original_converter if original_converter is not None: return new_converter = full_converter() original_converter = conversion.converter conversion.set_conversion(new_converter)
def activate(): r""" Activate conversion for :class:`~anndata.AnnData` objects as well as :ref:`numpy:arrays` and :class:`pandas.DataFrame`\ s via ``rpy2.robjects.numpy2ri`` and ``rpy2.robjects.pandas2ri``. Does nothing if this is the active converter. """ global original_converter if original_converter is not None: return new_converter = full_converter() original_converter = conversion.converter conversion.set_conversion(new_converter)
def activate(): """ Activate conversion between sparse matrices from Scipy and R’s Matrix package. Does nothing if this is the active conversion. """ global original_converter if original_converter is not None: return original_converter = conversion.converter numpy2ri.activate() new_converter = conversion.Converter("scipy conversion", template=conversion.converter) numpy2ri.deactivate() overlay_converter(converter, new_converter) conversion.set_conversion(new_converter)
def activate(): global original_converter # If module is already activated, there is nothing to do if original_converter is not None: return original_converter = conversion.converter new_converter = conversion.Converter('numpy conversion', template=original_converter) for k, v in py2rpy.registry.items(): if k is object: continue new_converter.py2rpy.register(k, v) for k, v in rpy2py.registry.items(): if k is object: continue new_converter.rpy2py.register(k, v) conversion.set_conversion(new_converter)