theislab/anndata2ri

na error in anndata2ri py2py_single_cell_experiment

Hrovatin opened this issue · 2 comments

Any ideas about this?

>>> adata = ro.r('as.SingleCellExperiment(sobj)')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/rpy2/robjects/__init__.py", line 451, in __call__
    res = self.eval(p)
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/rpy2/robjects/functions.py", line 201, in __call__
    return (super(SignatureTranslatedFunction, self)
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/rpy2/robjects/functions.py", line 125, in __call__
    res = conversion.rpy2py(res)
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/functools.py", line 875, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/anndata2ri/r2py.py", line 28, in rpy2py_s4
    return rpy2py_single_cell_experiment(obj)
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/anndata2ri/r2py.py", line 95, in rpy2py_single_cell_experiment
    obs = rpy2py_data_frame(col_data)
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/anndata2ri/r2py.py", line 58, in rpy2py_data_frame
    columns = {k: rpy2py_vector(v) for k, v in slots["listData"].items()}
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/anndata2ri/r2py.py", line 58, in <dictcomp>
    columns = {k: rpy2py_vector(v) for k, v in slots["listData"].items()}
  File "/p/project/hai_scr_int/hrovatin1/miniconda3/envs/scib-pipeline/lib/python3.8/site-packages/anndata2ri/r2py.py", line 47, in rpy2py_vector
    r[np.array(baseenv["is.na"](v), dtype=bool)] = pd.NA
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NAType'

Had the same issue, downgrading rpy2 to 3.4.2 worked for me

Thanks