[BioC] AnnBuilder bug // R-2.0.0 // getList4GO
Harry Athanassiou
hathanassiou at automatedcell.com
Tue Nov 9 07:22:42 CET 2004
I'm trying to use AnnBuilder to make some custom annotation files for a
non-standard microarray chip. In running the tests with R-2.0.0, I run
acroos a problem in the function getList4GO. I'm not sure if this issue is
due to R-2.0.0 or not.
Here's the issue:
when the sub-function procOne is called by sapply, the names(goids) is NULL.
Thus when procOne calls :
apply(temp, 1, vect2List, vectNames = c("GOID", "Evidence", "Ontology"))
the number of list-elements to be named is mismatched.
I do not know how to make sapply pass the names() of its first argument to
the FUN() it calls, so I modified procOne->procOne.new to drop the column
"Evidence".
And add this column with a trick afterwards.
I'm sure this is not the best solution, just worked for me
>>>
getList4GO <- function (goNCat, goNEvi)
{
procOne <- function(goids) {
if (is.null(goids) || is.na(goids)) {
return(NA)
}
else {
temp <- cbind(goids, names(goids), goNCat[goids])
rownames(temp) <- goids
return(apply(temp, 1, vect2List, vectNames = c("GOID",
"Evidence", "Ontology")))
}
}
# the names(goids) do not get propagated through the sapply() in
R-2.0.0!
# remove the column evidence
procOne.new <- function(goids) {
if (is.null(goids) || is.na(goids)) {
return(NA)
}
else {
temp <- cbind(goids, goNCat[goids])
rownames(temp) <- goids
return(apply(temp, 1, vect2List, vectNames = c("GOID",
"Ontology")))
}
}
temp <- sapply(goNEvi, procOne.new)
names(temp) <- 1:length(temp)
# add the evidence list-element
# do not know a better way will do a loop on an index to acc two arrays
at the same time
for (r in 1:length(goNEvi)) {
if (!is.na(temp[r])) {
temp[[r]] <- c(temp[[r]], "Evidence"=names(goNEvi)[r])
}
}
return(temp)
}
>>>
Harry Athanassiou
BioInformatics manager
Automated Cell, Inc
More information about the Bioconductor
mailing list