Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__call__() keywords must be strings #62

Open
danli349 opened this issue Feb 25, 2021 · 1 comment
Open

__call__() keywords must be strings #62

danli349 opened this issue Feb 25, 2021 · 1 comment

Comments

@danli349
Copy link

danli349 commented Feb 25, 2021

When I run

%%R -i adata_luminals
adata_luminals

in Jupyter, I have the error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-131-e227b8ec76db> in <module>
----> 1 get_ipython().run_cell_magic('R', '-i adata_luminals', 'adata_luminals\n')

~/miniconda3/lib/python3.8/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
   2389             with self.builtin_trap:
   2390                 args = (magic_arg_s, cell)
-> 2391                 result = fn(*args, **kwargs)
   2392             return result
   2393 

<decorator-gen-121> in R(self, line, cell, local_ns)

~/miniconda3/lib/python3.8/site-packages/IPython/core/magic.py in <lambda>(f, *a, **k)
    185     # but it's overkill for just that one bit of state.
    186     def magic_deco(arg):
--> 187         call = lambda f, *a, **k: f(*a, **k)
    188 
    189         if callable(arg):

~/miniconda3/lib/python3.8/site-packages/rpy2/ipython/rmagic.py in R(self, line, cell, local_ns)
    735                         raise NameError("name '%s' is not defined" % input)
    736                 with localconverter(converter) as cv:
--> 737                     ro.r.assign(input, val)
    738 
    739         if args.display:

~/miniconda3/lib/python3.8/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    196                 v = kwargs.pop(k)
    197                 kwargs[r_k] = v
--> 198         return (super(SignatureTranslatedFunction, self)
    199                 .__call__(*args, **kwargs))
    200 

~/miniconda3/lib/python3.8/site-packages/rpy2/robjects/functions.py in __call__(self, *args, **kwargs)
    115 
    116     def __call__(self, *args, **kwargs):
--> 117         new_args = [conversion.py2rpy(a) for a in args]
    118         new_kwargs = {}
    119         for k, v in kwargs.items():

~/miniconda3/lib/python3.8/site-packages/rpy2/robjects/functions.py in <listcomp>(.0)
    115 
    116     def __call__(self, *args, **kwargs):
--> 117         new_args = [conversion.py2rpy(a) for a in args]
    118         new_kwargs = {}
    119         for k, v in kwargs.items():

~/miniconda3/lib/python3.8/functools.py in wrapper(*args, **kw)
    873                             '1 positional argument')
    874 
--> 875         return dispatch(args[0].__class__)(*args, **kw)
    876 
    877     funcname = getattr(func, '__name__', 'singledispatch function')

~/miniconda3/lib/python3.8/site-packages/anndata2ri/py2r.py in py2rpy_anndata(obj)
     61         if check_no_dupes(obj.var_names, "var_names"):
     62             row_args["row.names"] = pandas2ri.py2rpy(obj.var_names)
---> 63         row_data = s4v.DataFrame(**row_args)
     64 
     65         col_args = {k: pandas2ri.py2rpy(v) for k, v in obj.obs.items()}

TypeError: __call__() keywords must be strings

Can you please tell me why this error happens?
Thanks
Dan

@danli349
Copy link
Author

danli349 commented Mar 1, 2021

adata_luminals_sce = anndata2ri.py2rpy(adata_luminals)

also produce the same error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant