On 2011-10-07 13:05, Thomas Kluyver wrote:
On 7 October 2011 11:57, Nick Schurch <n.schu...@dundee.ac.uk
<mailto:n.schu...@dundee.ac.uk>> wrote:
r('estimateVarianceFunctions <-
function(){load("mySavedR.rdata")\nx=estimateVarianceFunctions(z)\nreturn(x)}')
and then call it from python:
>>> test = r.estimateVarianceFunctions()
I get:
Traceback (most recent call last):
File "<console>", line 1, in <module>
RPy_RException: Error: evaluation nested too deeply: infinite
recursion / options(expressions=)?
By giving your function the same name as the function from the
library, I assume you're overriding it. This would mean your function
calls itself instead of the library function, and recurses infinitely.
Thomas' intuition about an infinite recursion is correct. The R
statement is creating a copy in the search path found before the one
from the package DESeq.
There is a bit of documentation about that at:
http://rpy.sourceforge.net/rpy2/doc-2.2/html/rinterface.html#sexpenvironment
Why not call your function something else (even just
"myEstimateVarianceFunctions" or "wrapperEstimateVarianceFunctions")?
There is also some demo code to use related Bioconductor code (edgeR).
By chronological order:
-
http://bcbio.wordpress.com/2009/09/13/differential-expression-analysis-with-bioconductor-and-python/
- http://www.biomedcentral.com/1471-2105/11/S12/S11
Statements like the one just below can be confusing and error-prone,
obviously.
r('estimateVarianceFunctions<-
function(){load("mySavedR.rdata")\nx=estimateVarianceFunctions(z)\nreturn(x)}')
Consider replacing it with:
from rpy2.robjects.packages import importr
base = importr('base')
deseq = importr('DESeq')
def estimate_variance(rdata_filename = "mySaveR.rdata"):
my_env = base.new_env()
# keep R's GlobalEnv clean (and avoid overwriting elements)
base.load(rdata_filename, envir = my_env)
return deseq.estimateVarianceFunction(my_env['z'])
estimate_variance()
Thomas
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list
------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security
threats, fraudulent activity, and more. Splunk takes this data and makes
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2dcopy2
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list