Entering edit mode
22 months ago
sidrah.maryam
▴
60
Hello everyone, I am trying to do some data analysis which requires both Python and R code chunks. So I am using R in Python using rpy2. Till now, the analysis worked fine, but when I tried doing the Differential Gene expression code, it gave me this error:
RParsingError: Parsing status not OK - PARSING_STATUS.PARSE_ERROR
The error starts from here:
RParsingError Traceback (most recent call last)
/var/folders/5y/5gmkj36s11v1y774zthcythh0000gn/T/ipykernel_18714/2325256096.py in <module>
----> 1 get_ipython().run_cell_magic(
2 "R",
3 "-i adata_test -o end_de fib_de", #%%R -i adata_test -o end_de -o fib_de
4 '''
5 #convert singlecellexperiment to singlecellassay type as required by MAST
~/opt/anaconda3/lib/python3.9/site-packages/IPython/core/interactiveshell.py in run_cell_magic(self, magic_name, line, cell)
2417 with self.builtin_trap:
2418 args = (magic_arg_s, cell)
-> 2419 result = fn(*args, **kwargs)
2420 return result
2421
~/opt/anaconda3/lib/python3.9/site-packages/decorator.py in fun(*args, **kw)
230 if not kwsyntax:
231 args, kw = fix(args, kw, sig)
--> 232 return caller(func, *(extras + args), **kw)
233 fun.__name__ = func.__name__
234 fun.__doc__ = func.__doc__*
I tried the solution given parsing error but that also did not work.
Can anyone please help me here and suggest me the possible solution.
Thank you in advance.
You don't show what is in the cell that is triggering this issue. And what in particular do you mean by "Till now, the analysis worked fine, "? Meaning the cells in the notebook all worked up to then? Or that notebook and that cell has worked as written before on the same machine and no updates have been done? Then you say you tried the workaround suggested but specifically what you tried isn't shown either, and so it is hard to judge if you implemented it. Does the case like there in the original post throw an error similar to the original post so you can share a more minimal, reproducible example? That would make things much easier to debug.
Thanks for your comment. The code that causes this is :
"Till now, the analysis worked fine, " means yes the cells in the notebook all worked fine as well as no updates have been made. And yes the error in the example shows similar error while using:
I hope it gives a better idea of the problem.
Thank you for any help!
Separating out weird characters and parsing from the
%%R
magic command input not working can be difficult. (I thought I had seen a recent StackOverflow post that had a weird character that had creeped in, but I cannot find it right now and maybe it got deleted.) One direction to go would be seeing if you can run a simpler variation on that command in pure R. Not necessarily your data even. Just some toy test. Then see if you can convert it to work in the notebook using the%%R
magic command variation. (Or the workaround.)Another direction would be to keep trying what you are trying to run in the notebook with the
%%R magic
. Two directions to pursue there. First option: Simplify as much as you can. Remove comments. Move as many commands as you can to the next cell for now. Second option: The other direction along that line of continuing to try in the notebook is to keep trying the SO workaround option. What you posted in your last reply didn't implement that adequately. That is not valid python. Python is very syntax and whitespace sensitive. Keep it very simple, too. Remove comments, blank lines, and anything not absolutely essential.