[Rd] Is the tcltk failure in affylmGUI related to R bug 15957

peter dalgaard pdalgd at gmail.com
Wed Jan 14 20:04:14 CET 2015

Seems unlikely that that particular bug is involved. I seem to recall some change related to inadvertent variable capture in .TkRoot$env (?). At any rate, we currently have

> parent.env(.TkRoot$env)
<environment: R_EmptyEnv>

which used to be

> parent.env(.TkRoot$env)
<environment: R_GlobalEnv>

as a result, this won't work any more because R_EmptyEnv has no operators and functions in it:

> evalq(x <- 1, .TkRoot$env)
Error in eval(substitute(expr), envir, enclos) : 
  could not find function "<-"

and consequently, you conk out at

   Try(n <- evalq(TclVarCount <- TclVarCount + 1, .TkRoot$env))

which presumably needs to be recoded in the same way as the current code in tclVar():

> tclVar
function (init = "") 
    n <- .TkRoot$env$TclVarCount <- .TkRoot$env$TclVarCount + 
    name <- paste0("::RTcl", n)
    l <- list(env = new.env())
    assign(name, NULL, envir = l$env)
    reg.finalizer(l$env, function(env) tcl("unset", ls(env)))
    class(l) <- "tclVar"
    tclvalue(l) <- init

(The whole thing looks a bit odd: Your function clones a fair bit of tclVar, wrapping each line in Try() for no apparent reason (or?), with the apparent purpose of doing something that seems quite similar to what tclArray() already does...)


> On 14 Jan 2015, at 06:50 , Keith Satterley <keith at wehi.edu.au> wrote:
> I maintain the package affylmGUI. It works when installed on many previous versions of R. I have today tested exactly the same code under R-2.15.3, R-3.0.2, R-3.1.0, R-3.1.1, R-3.1.2 and R-devel.
> I have also tested the versions of affylmGUI downloaded by biocLite for each version of R and the same result applies.
> I have no errors under 2.15.3, 3.0.2, 3.1.0 and 3.1.1. The following error occurs under 3.1.2 and R-devel.
> I run affylmGUI and read a targets file which then causes affylmGUI to read the specified cel files. On attempting to display the RNA targets file in a Tk window using the "RNA Targets" option from the "RNA Targets" Menu item and the following errors occur:
> Error text box 1: Error in eval(substitute(expr),enclos):could not find function "<-"   - pressed OK
> Following error text box: Error in paste("::RTcl",n,sep=""): object 'n' not found   - pressed OK
> Following error text box: Error in assign(name, NULL, environ = I$env): object 'name' not found   - pressed OK
> Following error text box: Error in paste("set",name, "(0,0)\"\"",sep= ""):object 'name' not found   - pressed OK
> This then results in an unfilled Tk window.
> I am testing on a Windows 7, 64 bit environment. My sessionInfo is:
> R version 3.1.2 (2014-10-31)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> locale:
> [1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252 LC_MONETARY=English_Australia.1252
> [4] LC_NUMERIC=C LC_TIME=English_Australia.1252
> attached base packages:
> [1] stats4    parallel  tcltk     stats     graphics  grDevices utils     datasets  methods   base
> other attached packages:
> [1] affylmGUI_1.40.0      AnnotationDbi_1.28.1 GenomeInfoDb_1.2.4    IRanges_2.0.1         S4Vectors_0.4.0
> [6] xtable_1.7-4          R2HTML_2.3.1 affyPLM_1.42.0        preprocessCore_1.28.0 gcrma_2.38.0
> [11] tkrplot_0.0-23        affyio_1.34.0 BiocInstaller_1.16.1  affy_1.44.0           Biobase_2.26.0
> [16] BiocGenerics_0.12.1   limma_3.22.3
> loaded via a namespace (and not attached):
> [1] Biostrings_2.34.1 DBI_0.3.1         RSQLite_1.0.0 splines_3.1.2     XVector_0.6.0     zlibbioc_1.12.0
> I think the relevant code that is resulting in the error is generated by this function in main.R:
> tclArrayVar <- function(){
>    Try(n <- evalq(TclVarCount <- TclVarCount + 1, .TkRoot$env))
>    Try(name <- paste("::RTcl", n,sep = ""))
>    Try(l <- list(env = new.env()))
>    Try(assign(name, NULL, envir = l$env))
>    Try(reg.finalizer(l$env, function(env) tcl("unset", ls(env))))
>    Try(class(l) <- "tclArrayVar")
>    Try(.Tcl(paste("set ",name,"(0,0) \"\"",sep="")))
>    l  ### Investigate this line KS
> } #end of tclArrayVar <- function()
> This code is lines 877-886 in main.R
> Despite the un-investigated last line in this function, it works fine in earlier versions of R as described above.
> The original programmer has left our division some years ago and I have maintained the code since then. Consequently my understandings as to why the code was written the way it was is somewhat limited, so I have not touched anything unless it was broken.
> My question is, do I need to do something with the affylmGUI code? I'd appreciate some advice if so.
> Is this failure related to bug 15957 (https://bugs.r-project.org/bugzilla3/show_bug.cgi?id=15957) that Duncan fixed on 2014-09-08.
> cheers,
> Keith
> ==============================
> Keith Satterley
> Bioinformatics Division
> The Walter & Eliza Hall Institute of Medical Research
> Melbourne, Victoria, Australia
> ==============================
> ______________________________________________________________________
> The information in this email is confidential and =\ i...{{dropped:21}}

More information about the R-devel mailing list