Entering edit mode
Hi Michael,
I'm sorry you are having trouble with the RemoveProbes() function I
posted the BioC mailing list many years ago. I have not had to use
that function myself in years, and did not know it wasn't working with
newer versions of R. I didn't write the original code, Ariel
Chernomoretz did. I only modified it, and I'm not sure I know enough
to solve the problem. I'm posting this to the BioC mailing list to see
if anyone can help. Below is my reproducible code (link to download
the "RemoveProbes.RData" file is below ), showing where the problem
occurs. It appears that the environments containing the Affymetrix
probe and probe set information that the code is trying to change in
now locked. I have no idea if there is a way to overcome this.
Thanks in advance to anyone for any help,
Jenny
https://netfiles.uiuc.edu/xythoswfs/webui/_xy-42144579_2-t_YuabdiYC
(link expires 7/7/12)
> library(affy)
Loading required package: BiocGenerics
Attaching package: 'BiocGenerics'
The following object(s) are masked from 'package:stats':
xtabs
The following object(s) are masked from 'package:base':
anyDuplicated, cbind, colnames, duplicated, eval, Filter, Find,
get, intersect, lapply, Map, mapply, mget, order, paste, pmax,
pmax.int,
pmin, pmin.int, Position, rbind, Reduce, rep.int, rownames,
sapply, setdiff, table, tapply, union, unique
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see 'citation("Biobase")',
and for packages
'citation("pkgname")'.
> load("RemoveProbes.RData")
> ls()
[1] "nonsoygenes" "RemoveProbes" "ResetEnvir" "soygenes"
>
> cleancdf <- "soybean"
>
> ResetEnvir(cleancdf)
Loading required package: soybeancdf
Loading required package: AnnotationDbi
Loading required package: soybeanprobe
>
> RemoveProbes(listOutProbeSets=nonsoygenes, cleancdf=cleancdf)
Error in assign(probepackagename, probe.env.orig[-iNA, ], pos = ipos)
:
cannot change value of locked binding for 'soybeanprobe'
>
> debug(RemoveProbes)
> RemoveProbes(listOutProbeSets=nonsoygenes, cleancdf=cleancdf)
debugging in: RemoveProbes(listOutProbeSets = nonsoygenes, cleancdf =
cleancdf)
debug: {
cdfpackagename <- paste(cleancdf, "cdf", sep = "")
probepackagename <- paste(cleancdf, "probe", sep = "")
require(cdfpackagename, character.only = TRUE)
require(probepackagename, character.only = TRUE)
probe.env.orig <- get(probepackagename)
if (!is.null(listOutProbes)) {
probes <- unlist(lapply(listOutProbes, function(x) {
a <- strsplit(x, "at")
aux1 <- paste(a[[1]][1], "at", sep = "")
aux2 <- as.integer(a[[1]][2])
c(aux1, aux2)
}))
n1 <- as.character(probes[seq(1, (length(probes)/2)) *
2 - 1])
n2 <- as.integer(probes[seq(1, (length(probes)/2)) *
2])
probes <- data.frame(I(n1), n2)
probes[, 1] <- as.character(probes[, 1])
probes[, 2] <- as.integer(probes[, 2])
pset <- unique(probes[, 1])
for (i in seq(along = pset)) {
ii <- grep(pset[i], probes[, 1])
iout <- probes[ii, 2]
a <- get(pset[i], env = get(cdfpackagename))
a <- a[-iout, ]
assign(pset[i], a, env = get(cdfpackagename))
}
}
if (!is.null(listOutProbeSets)) {
rm(list = listOutProbeSets, envir = get(cdfpackagename))
}
tmp <- get("xy2indices", paste("package:", cdfpackagename,
sep = ""))
newAB <- new("AffyBatch", cdfName = cleancdf)
pmIndex <- unlist(indexProbes(newAB, "pm"))
subIndex <- match(tmp(probe.env.orig$x, probe.env.orig$y,
cdf = cdfpackagename), pmIndex)
rm(newAB)
iNA <- whichis.na(subIndex))
if (length(iNA) > 0) {
ipos <- grep(probepackagename, search())
assign(probepackagename, probe.env.orig[-iNA, ], pos = ipos)
}
}
Browse[2]>
debug: cdfpackagename <- paste(cleancdf, "cdf", sep = "")
Browse[2]>
debug: probepackagename <- paste(cleancdf, "probe", sep = "")
Browse[2]>
debug: require(cdfpackagename, character.only = TRUE)
Browse[2]>
debug: require(probepackagename, character.only = TRUE)
Browse[2]>
debug: probe.env.orig <- get(probepackagename)
Browse[2]>
debug: if (!is.null(listOutProbes)) {
probes <- unlist(lapply(listOutProbes, function(x) {
a <- strsplit(x, "at")
aux1 <- paste(a[[1]][1], "at", sep = "")
aux2 <- as.integer(a[[1]][2])
c(aux1, aux2)
}))
n1 <- as.character(probes[seq(1, (length(probes)/2)) * 2 -
1])
n2 <- as.integer(probes[seq(1, (length(probes)/2)) * 2])
probes <- data.frame(I(n1), n2)
probes[, 1] <- as.character(probes[, 1])
probes[, 2] <- as.integer(probes[, 2])
pset <- unique(probes[, 1])
for (i in seq(along = pset)) {
ii <- grep(pset[i], probes[, 1])
iout <- probes[ii, 2]
a <- get(pset[i], env = get(cdfpackagename))
a <- a[-iout, ]
assign(pset[i], a, env = get(cdfpackagename))
}
}
Browse[2]>
debug: NULL
Browse[2]>
debug: if (!is.null(listOutProbeSets)) {
rm(list = listOutProbeSets, envir = get(cdfpackagename))
}
Browse[2]>
debug: rm(list = listOutProbeSets, envir = get(cdfpackagename))
Browse[2]>
debug: tmp <- get("xy2indices", paste("package:", cdfpackagename, sep
= ""))
Browse[2]>
debug: newAB <- new("AffyBatch", cdfName = cleancdf)
Browse[2]>
debug: pmIndex <- unlist(indexProbes(newAB, "pm"))
Browse[2]>
debug: subIndex <- match(tmp(probe.env.orig$x, probe.env.orig$y, cdf =
cdfpackagename),
pmIndex)
Browse[2]>
debug: rm(newAB)
Browse[2]>
debug: iNA <- whichis.na(subIndex))
Browse[2]>
debug: if (length(iNA) > 0) {
ipos <- grep(probepackagename, search())
assign(probepackagename, probe.env.orig[-iNA, ], pos = ipos)
}
Browse[2]>
debug: ipos <- grep(probepackagename, search())
Browse[2]>
debug: assign(probepackagename, probe.env.orig[-iNA, ], pos = ipos)
#The line above is what causes the error
Browse[2]> probepackagename
[1] "soybeanprobe"
There were 50 or more warnings (use warnings() to see the first 50)
Browse[2]> warnings()[1:3]
$`object 'AFFX-BioB-3_at' not found`
rm(list = listOutProbeSets, envir = get(cdfpackagename))
$`object 'AFFX-BioB-5_at' not found`
rm(list = listOutProbeSets, envir = get(cdfpackagename))
$`object 'AFFX-BioB-M_at' not found`
rm(list = listOutProbeSets, envir = get(cdfpackagename))
#Not sure what the above warnings mean or if they are related
Browse[2]> ?assign
starting httpd help server ... done
Browse[2]> ?lockBinding
Browse[2]> environmentIsLocked(as.environment(ipos))
[1] TRUE
Browse[2]> assign(probepackagename, probe.env.orig[-iNA, ], pos =
ipos)
Error in assign(probepackagename, probe.env.orig[-iNA, ], pos = ipos)
:
cannot change value of locked binding for 'soybeanprobe'
In addition: There were 50 or more warnings (use warnings() to see the
first 50)
> sessionInfo()
R version 2.15.0 (2012-03-30)
Platform: x86_64-pc-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United
States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] soybeanprobe_2.10.0 soybeancdf_2.10.0 AnnotationDbi_1.18.1
affy_1.34.0 Biobase_2.16.0 BiocGenerics_0.2.0
loaded via a namespace (and not attached):
[1] affyio_1.24.0 BiocInstaller_1.4.6 DBI_0.2-5
IRanges_1.14.3 preprocessCore_1.18.0 RSQLite_0.11.1
stats4_2.15.0
[8] tools_2.15.0 zlibbioc_1.2.0
Jenny Drnevich, Ph.D.
Functional Genomics Bioinformatics Specialist
W.M. Keck Center for Comparative and Functional Genomics
Roy J. Carver Biotechnology Center
High Performance Biological Computing Program
University of Illinois, Urbana-Champaign
330 ERML
1201 W. Gregory Dr.
Urbana, IL 61801
USA
NOTE NEW PHONE NUMBER
ph: 217-300-6543
fax: 217-265-5066
e-mail: drnevich@illinois.edu
[[alternative HTML version deleted]]