Error in .local(.Object, ...) : could not find function "checkClass"
1
0
Entering edit mode
Bucher Elmar ▴ 80
@bucher-elmar-3683
Last seen 9.6 years ago
Dear List, I'm writing on extension of the eSet class. getMethod("initialize","eSet") and getMethod("sampleNames<-","AssayData") from the Biobase package are particularly using functions like "checkClass", "assayDataEnvLock", "assayDataStorageMode". In my implementation I would like to use the same functions but I receive errors like: Error in .local(.Object, ...) : could not find function "checkClass" Why? How can I enable my code to use this functions? Because the eSet initialize code seems to be able to use this functions, whit the very same packages loaded. I have the same problem on linux and windows machines. See sessionInfo below. Grateful for help, Elmar > sessionInfo() R version 2.10.0 (2009-10-26) x86_64-pc-linux-gnu locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=en_US.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RBioinf_1.6.0 graph_1.20.0 Biobase_2.6.0 loaded via a namespace (and not attached): [1] cluster_1.12.1 tools_2.10.0 > > sessionInfo() R version 2.10.0 (2009-10-26) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] RBioinf_1.6.0 graph_1.24.1 Biobase_2.6.0 loaded via a namespace (and not attached): [1] tools_2.10.0
Biobase Biobase • 3.3k views
ADD COMMENT
0
Entering edit mode
@martin-morgan-1513
Last seen 6 weeks ago
United States
Hi Elmar -- Ext-Elmar.Bucher at vtt.fi wrote: > Dear List, > > I'm writing on extension of the eSet class. > > getMethod("initialize","eSet") and getMethod("sampleNames<-","AssayData") from the Biobase package are particularly using functions like "checkClass", "assayDataEnvLock", "assayDataStorageMode". > > In my implementation I would like to use the same functions but I receive errors like: > Error in .local(.Object, ...) : could not find function "checkClass" > > Why? > How can I enable my code to use this functions? Because the eSet initialize code seems to be able to use this functions, whit the very same packages loaded. > I have the same problem on linux and windows machines. See sessionInfo below. These functions are defined in Biobase but not exported. They are accessible with Biobase:::checkClass and the like, but probably you do not want to do this. Perhaps you want to use callNextMethod() or similar, or the functions that are actually exported? What specifically do you want to accomplish? Maybe some hints in, e.g., library(oligoClasses) selectMethod(initialize, "SnpCallSetPlus") If I'd written a class to do something special with 'sampleNames', say force them to be upper case, then I might do something like setClass("A", contains="eSet") setReplaceMethod("sampleNames", c("A", "character"), function(object, value) { callNextMethod(object=object, value=toupper(value)) }) and then > a = new("A", exprs=matrix(rnorm(200), 20)) > sampleNames(a) [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" > sampleNames(a) <- letters[1:10] > sampleNames(a) [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" > Martin > > Grateful for help, Elmar > > > >> sessionInfo() > R version 2.10.0 (2009-10-26) > x86_64-pc-linux-gnu > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] RBioinf_1.6.0 graph_1.20.0 Biobase_2.6.0 > > loaded via a namespace (and not attached): > [1] cluster_1.12.1 tools_2.10.0 > >> sessionInfo() > R version 2.10.0 (2009-10-26) > i386-pc-mingw32 > > locale: > [1] LC_COLLATE=English_United Kingdom.1252 > [2] LC_CTYPE=English_United Kingdom.1252 > [3] LC_MONETARY=English_United Kingdom.1252 > [4] LC_NUMERIC=C > [5] LC_TIME=English_United Kingdom.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] RBioinf_1.6.0 graph_1.24.1 Biobase_2.6.0 > > loaded via a namespace (and not attached): > [1] tools_2.10.0 > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
ADD COMMENT
0
Entering edit mode
Hi Martin, Thank you for the prompt "not exported function" hint. It was what I want to do :). To your question: " What specifically do you want to accomplish? " I like to implement a additional slot to the eSet class. So it differs from the code you suggested to study. I list here the essential of the code I have written till now. The code is not working as I wished. The main problem is, that the additional slot (leukoData) shows the correct values inside the initialize-routine (observer by browser()), but the output of the initialize-routine shows for leukoData just a empty AnnotatedDataFrame. Do you have a clue what I do wrong there? Elmar /*** begin listing ****/ library(Biobase) # base library ### build class and methodes #### removeClass("LeukoSet") # only for development reason # define LeukoSet class, inhert eSet class setClass("LeukoSet", contains = "eSet", representation(leukoData = "AnnotatedDataFrame"), prototype(new("VersionedBiobase", versions = c(classVersion("eSet"), classVersion("AnnotatedDataFrame"), LeukoSet = "0.1.0")))) # manipulate generic functions # initialize to set the input to the slots. signature LeukoSet. setMethod("initialize", signature("LeukoSet"), function(.Object, assayData, leukoData = new("AnnotatedDataFrame"), ... ) { #function(.Object, ... ) { #.local <- function(.Object, assayData, leukoData = annotatedDataFrameFrom(assayData, byaxis= 'z'), ... ) { # ctrl assayData stolen from eSet Initialization method mySlots <- slotNames(.Object) dotArgs <- list(...) isSlot <- names(dotArgs) %in% mySlots if (missing(assayData)) assayData <- do.call(assayDataNew, dotArgs[!isSlot], envir = parent.frame()) else { Biobase:::checkClass(assayData, "AssayData", class(.Object)) cat("hallo assayData \n") nms <- if (storageMode(assayData) == "list") names(assayData) else ls(assayData) dupNames <- nms %in% names(dotArgs[!isSlot]) if (any(dupNames)) warning("initialize argument(s) '", paste(nms[dupNames], collapse = "' '"), "' also present in 'assayData'; argument(s) ignored") } # ctrl leukoData if (!missing(leukoData)) { Biobase:::checkClass(leukoData, "AnnotatedDataFrame", class(.Object)) cat("hallo leukoData \n") dimLabels(leukoData) <- c("leukoNames", "leukoColumns") } # pass ctrl to the next methode in the linearization that was computed by the generic function and return browser() callNextMethod(.Object, assayData = assayData, ...) #.Object <- callNextMethod(.Object, assayData = assayData, ...) #do.call(callNextMethod, c(.Object, assayData = assayData, ...)) #} #.local(.Object, ...) }) # generic accessor function for the leukoData slot - abstract data type ADT setGeneric("leukoData", function(object,...) standardGeneric("leukoData")) setMethod("leukoData", signature("LeukoSet"), function(object,...) object at leukoData) # TEST # the environment e1 = new.env(hash = TRUE) e1$a0 <- matrix(0:8, nc = 3) rownames(e1$a0) <- c("y0","y1","y2") colnames(e1$a0) <- c("x0","x1","x2") # the list l1 = list(a0 = e1$a0) # the matrix m1 = e1$a0 # annotateddataframes pd.df <- data.frame(abc = c("phe_null","phe_eins","phe_zwei"), numb = c("+0","+1.1","+2")) fd.df <- data.frame(abc = c("fea_null","fea_eins","fea_zwei"), numb = c("0","1.1","2")) ld.df <- data.frame(abc = c("leo_null","leo_eins","leo_zwei"), numb = c("-0","-1.1","-2")) rownames(pd.df) <- c("x0","x1","x2") rownames(fd.df) <- c("y0","y1","y2") rownames(ld.df) <- c("a0","a1","a2") mewe.df <- data.frame(labelDescription = c("alpha BETI c","nu MERI c"), row.names = c("abc","numb")) pd.s4 <- new("AnnotatedDataFrame", data = pd.df, varMetadata = mewe.df) fd.s4 <- new("AnnotatedDataFrame", data = fd.df, varMetadata = mewe.df) ld.s4 <- new("AnnotatedDataFrame", data = ld.df, varMetadata = mewe.df) # vectors a.v <- "htsdb" # miame miame.s4 <- new('MIAME', name = "Elmar Bucher", lab = "VTT Technical Research Center of Finalnd - Medical Biotechnology", contact = "elmar.bucheratvtt.fi", title = "the LeukoSet", abstract = "crash test", url = "http://www.petzl.com/en/outdoor/petzl-tv", other = list(notes = "check it out!")) # run lset <- new("LeukoSet", assayData = e1, phenoData = pd.s4, featureData = fd.s4, leukoData = ld.s4, experimentData = miame.s4, annnotation = a.v) # browser! lset leukoData(lset) /*** end of listing ***/ -----Original Message----- From: Martin Morgan [mailto:mtmorgan@fhcrc.org] Sent: 08 December 2009 20:55 To: Bucher Elmar Cc: bioconductor at stat.math.ethz.ch Subject: Re: [BioC] Error in .local(.Object, ...) : could not find function "checkClass" Hi Elmar -- Ext-Elmar.Bucher at vtt.fi wrote: > Dear List, > > I'm writing on extension of the eSet class. > > getMethod("initialize","eSet") and getMethod("sampleNames<-","AssayData") from the Biobase package are particularly using functions like "checkClass", "assayDataEnvLock", "assayDataStorageMode". > > In my implementation I would like to use the same functions but I receive errors like: > Error in .local(.Object, ...) : could not find function "checkClass" > > Why? > How can I enable my code to use this functions? Because the eSet initialize code seems to be able to use this functions, whit the very same packages loaded. > I have the same problem on linux and windows machines. See sessionInfo below. These functions are defined in Biobase but not exported. They are accessible with Biobase:::checkClass and the like, but probably you do not want to do this. Perhaps you want to use callNextMethod() or similar, or the functions that are actually exported? What specifically do you want to accomplish? Maybe some hints in, e.g., library(oligoClasses) selectMethod(initialize, "SnpCallSetPlus") If I'd written a class to do something special with 'sampleNames', say force them to be upper case, then I might do something like setClass("A", contains="eSet") setReplaceMethod("sampleNames", c("A", "character"), function(object, value) { callNextMethod(object=object, value=toupper(value)) }) and then > a = new("A", exprs=matrix(rnorm(200), 20)) > sampleNames(a) [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" > sampleNames(a) <- letters[1:10] > sampleNames(a) [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" > Martin > > Grateful for help, Elmar > > > >> sessionInfo() > R version 2.10.0 (2009-10-26) > x86_64-pc-linux-gnu > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=en_US.UTF-8 LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] RBioinf_1.6.0 graph_1.20.0 Biobase_2.6.0 > > loaded via a namespace (and not attached): > [1] cluster_1.12.1 tools_2.10.0 > >> sessionInfo() > R version 2.10.0 (2009-10-26) > i386-pc-mingw32 > > locale: > [1] LC_COLLATE=English_United Kingdom.1252 > [2] LC_CTYPE=English_United Kingdom.1252 > [3] LC_MONETARY=English_United Kingdom.1252 > [4] LC_NUMERIC=C > [5] LC_TIME=English_United Kingdom.1252 > > attached base packages: > [1] stats graphics grDevices utils datasets methods base > > other attached packages: > [1] RBioinf_1.6.0 graph_1.24.1 Biobase_2.6.0 > > loaded via a namespace (and not attached): > [1] tools_2.10.0 > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
ADD REPLY
0
Entering edit mode
You might want to detail the dimensions and type of this additional slot. My guess - based on the name -- is that this can easily be carried out within the eSet stuff. Kasper On Dec 9, 2009, at 9:42 AM, <ext-elmar.bucher at="" vtt.fi=""> <ext- elmar.bucher="" at="" vtt.fi=""> wrote: > Hi Martin, > > Thank you for the prompt "not exported function" hint. It was what I want to do :). > To your question: " What specifically do you want to accomplish? " > I like to implement a additional slot to the eSet class. So it differs from the code you suggested to study. I list here the essential of the code I have written till now. The code is not working as I wished. The main problem is, that the additional slot (leukoData) shows the correct values inside the initialize-routine (observer by browser()), but the output of the initialize-routine shows for leukoData just a empty AnnotatedDataFrame. Do you have a clue what I do wrong there? > > Elmar > > > /*** begin listing ****/ > > library(Biobase) # base library > > ### build class and methodes #### > removeClass("LeukoSet") # only for development reason > > # define LeukoSet class, inhert eSet class > setClass("LeukoSet", contains = "eSet", representation(leukoData = "AnnotatedDataFrame"), prototype(new("VersionedBiobase", versions = c(classVersion("eSet"), classVersion("AnnotatedDataFrame"), LeukoSet = "0.1.0")))) > > # manipulate generic functions > # initialize to set the input to the slots. signature LeukoSet. > setMethod("initialize", signature("LeukoSet"), > function(.Object, assayData, leukoData = new("AnnotatedDataFrame"), ... ) { > #function(.Object, ... ) { > #.local <- function(.Object, assayData, leukoData = annotatedDataFrameFrom(assayData, byaxis= 'z'), ... ) { > # ctrl assayData stolen from eSet Initialization method > mySlots <- slotNames(.Object) > dotArgs <- list(...) > isSlot <- names(dotArgs) %in% mySlots > if (missing(assayData)) assayData <- do.call(assayDataNew, dotArgs[!isSlot], envir = parent.frame()) > else { > Biobase:::checkClass(assayData, "AssayData", class(.Object)) > cat("hallo assayData \n") > nms <- if (storageMode(assayData) == "list") names(assayData) > else ls(assayData) > dupNames <- nms %in% names(dotArgs[!isSlot]) > if (any(dupNames)) warning("initialize argument(s) '", paste(nms[dupNames], collapse = "' '"), "' also present in 'assayData'; argument(s) ignored") > } > # ctrl leukoData > if (!missing(leukoData)) { > Biobase:::checkClass(leukoData, "AnnotatedDataFrame", class(.Object)) > cat("hallo leukoData \n") > dimLabels(leukoData) <- c("leukoNames", "leukoColumns") > } > # pass ctrl to the next methode in the linearization that was computed by the generic function and return > browser() > callNextMethod(.Object, assayData = assayData, ...) > #.Object <- callNextMethod(.Object, assayData = assayData, ...) > #do.call(callNextMethod, c(.Object, assayData = assayData, ...)) > #} > #.local(.Object, ...) > }) > > # generic accessor function for the leukoData slot - abstract data type ADT > setGeneric("leukoData", function(object,...) standardGeneric("leukoData")) > setMethod("leukoData", signature("LeukoSet"), function(object,...) object at leukoData) > > # TEST > # the environment > e1 = new.env(hash = TRUE) > e1$a0 <- matrix(0:8, nc = 3) > rownames(e1$a0) <- c("y0","y1","y2") > colnames(e1$a0) <- c("x0","x1","x2") > # the list > l1 = list(a0 = e1$a0) > # the matrix > m1 = e1$a0 > # annotateddataframes > pd.df <- data.frame(abc = c("phe_null","phe_eins","phe_zwei"), numb = c("+0","+1.1","+2")) > fd.df <- data.frame(abc = c("fea_null","fea_eins","fea_zwei"), numb = c("0","1.1","2")) > ld.df <- data.frame(abc = c("leo_null","leo_eins","leo_zwei"), numb = c("-0","-1.1","-2")) > rownames(pd.df) <- c("x0","x1","x2") > rownames(fd.df) <- c("y0","y1","y2") > rownames(ld.df) <- c("a0","a1","a2") > mewe.df <- data.frame(labelDescription = c("alpha BETI c","nu MERI c"), row.names = c("abc","numb")) > pd.s4 <- new("AnnotatedDataFrame", data = pd.df, varMetadata = mewe.df) > fd.s4 <- new("AnnotatedDataFrame", data = fd.df, varMetadata = mewe.df) > ld.s4 <- new("AnnotatedDataFrame", data = ld.df, varMetadata = mewe.df) > # vectors > a.v <- "htsdb" > # miame > miame.s4 <- new('MIAME', name = "Elmar Bucher", lab = "VTT Technical Research Center of Finalnd - Medical Biotechnology", contact = "elmar.bucheratvtt.fi", title = "the LeukoSet", abstract = "crash test", url = "http://www.petzl.com/en/outdoor/petzl-tv", other = list(notes = "check it out!")) > > # run > lset <- new("LeukoSet", assayData = e1, phenoData = pd.s4, featureData = fd.s4, leukoData = ld.s4, experimentData = miame.s4, annnotation = a.v) > # browser! > lset > leukoData(lset) > > > /*** end of listing ***/ > > > > -----Original Message----- > From: Martin Morgan [mailto:mtmorgan at fhcrc.org] > Sent: 08 December 2009 20:55 > To: Bucher Elmar > Cc: bioconductor at stat.math.ethz.ch > Subject: Re: [BioC] Error in .local(.Object, ...) : could not find function "checkClass" > > Hi Elmar -- > > Ext-Elmar.Bucher at vtt.fi wrote: >> Dear List, >> >> I'm writing on extension of the eSet class. >> >> getMethod("initialize","eSet") and getMethod("sampleNames<-","AssayData") from the Biobase package are particularly using functions like "checkClass", "assayDataEnvLock", "assayDataStorageMode". >> >> In my implementation I would like to use the same functions but I receive errors like: >> Error in .local(.Object, ...) : could not find function "checkClass" >> >> Why? >> How can I enable my code to use this functions? Because the eSet initialize code seems to be able to use this functions, whit the very same packages loaded. >> I have the same problem on linux and windows machines. See sessionInfo below. > > These functions are defined in Biobase but not exported. They are > accessible with > > Biobase:::checkClass > > and the like, but probably you do not want to do this. Perhaps you want > to use callNextMethod() or similar, or the functions that are actually > exported? What specifically do you want to accomplish? Maybe some hints > in, e.g., > > library(oligoClasses) > selectMethod(initialize, "SnpCallSetPlus") > > If I'd written a class to do something special with 'sampleNames', say > force them to be upper case, then I might do something like > > setClass("A", contains="eSet") > setReplaceMethod("sampleNames", c("A", "character"), > function(object, value) > { > callNextMethod(object=object, value=toupper(value)) > }) > > and then > >> a = new("A", exprs=matrix(rnorm(200), 20)) >> sampleNames(a) > [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" >> sampleNames(a) <- letters[1:10] >> sampleNames(a) > [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" >> > > > > Martin > >> >> Grateful for help, Elmar >> >> >> >>> sessionInfo() >> R version 2.10.0 (2009-10-26) >> x86_64-pc-linux-gnu >> >> locale: >> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 >> [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 >> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C >> [9] LC_ADDRESS=C LC_TELEPHONE=C >> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> other attached packages: >> [1] RBioinf_1.6.0 graph_1.20.0 Biobase_2.6.0 >> >> loaded via a namespace (and not attached): >> [1] cluster_1.12.1 tools_2.10.0 >> >>> sessionInfo() >> R version 2.10.0 (2009-10-26) >> i386-pc-mingw32 >> >> locale: >> [1] LC_COLLATE=English_United Kingdom.1252 >> [2] LC_CTYPE=English_United Kingdom.1252 >> [3] LC_MONETARY=English_United Kingdom.1252 >> [4] LC_NUMERIC=C >> [5] LC_TIME=English_United Kingdom.1252 >> >> attached base packages: >> [1] stats graphics grDevices utils datasets methods base >> >> other attached packages: >> [1] RBioinf_1.6.0 graph_1.24.1 Biobase_2.6.0 >> >> loaded via a namespace (and not attached): >> [1] tools_2.10.0 >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > > > -- > Martin Morgan > Computational Biology / Fred Hutchinson Cancer Research Center > 1100 Fairview Ave. N. > PO Box 19024 Seattle, WA 98109 > > Location: Arnold Building M1 B861 > Phone: (206) 667-2793 > > _______________________________________________ > Bioconductor mailing list > Bioconductor at stat.math.ethz.ch > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD REPLY
0
Entering edit mode
Kasper Daniel Hansen wrote: > You might want to detail the dimensions and type of this additional > slot. My guess - based on the name -- is that this can easily be > carried out within the eSet stuff. > > Kasper > > On Dec 9, 2009, at 9:42 AM, <ext-elmar.bucher at="" vtt.fi=""> <ext- elmar.bucher="" at="" vtt.fi=""> wrote: > >> Hi Martin, >> >> Thank you for the prompt "not exported function" hint. It was what >> I want to do :). >> >> To your question: " What specifically do you want to accomplish? " >> >> I like to implement a additional slot to the eSet class. So it >> differs from the code you suggested to study. I list here the >> essential of the code I have written till now. The code is not >> working as I wished. The main problem is, that the additional slot >> (leukoData) shows the correct values inside the initialize-routine >> (observer by browser()), but the output of the initialize-routine >> shows for leukoData just a empty AnnotatedDataFrame. Do you have a >> clue what I do wrong there? Hi Elmar -- The initialize,eSet-method handles your case 'out-of the box', so there is no need for an initialize,LeukoSet-method at all. Specifically ## define LeukoSet class, inhert eSet class setClass("LeukoSet", contains = "eSet", representation=representation(leukoData = "AnnotatedDataFrame"), prototype=prototype(new("VersionedBiobase", versions = c(classVersion("eSet"), classVersion("AnnotatedDataFrame"), LeukoSet = "0.1.0")))) ## generic accessor function for the leukoData slot - abstract data type ADT setGeneric("leukoData", function(object,...) standardGeneric("leukoData")) setMethod("leukoData", signature("LeukoSet"), function(object,...) object at leukoData) and you're ready to go: > a0 <- matrix(0:8, nc = 3, + dimnames=list(c("y0","y1","y2"),c("x0","x1","x2"))) > e1 <- assayDataNew(a0=a0) > pd.df <- data.frame(abc = c("phe_null","phe_eins","phe_zwei"), + numb = c("+0","+1.1","+2"), + row.names = c("x0","x1","x2")) > fd.df <- data.frame(abc = c("fea_null","fea_eins","fea_zwei"), + numb = c("0","1.1","2"), + row.names = c("y0","y1","y2")) > ld.df <- data.frame(abc = c("leo_null","leo_eins","leo_zwei"), + numb = c("-0","-1.1","-2"), + row.names = c("a0","a1","a2")) > mewe.df <- data.frame(labelDescription = c("alpha BETI c","nu MERI c"), + row.names = c("abc","numb")) > pd.s4 <- new("AnnotatedDataFrame", data = pd.df, varMetadata = mewe.df) > fd.s4 <- new("AnnotatedDataFrame", data = fd.df, varMetadata = mewe.df) > ld.s4 <- new("AnnotatedDataFrame", data = ld.df, varMetadata = mewe.df) > miame.s4 <- new('MIAME', name = "Elmar Bucher", + lab = "VTT Technical Research Center of Finalnd - Medical Biotechnology", + contact = "elmar.bucheratvtt.fi", title = "the LeukoSet", + abstract = "crash test", + url = "http://www.petzl.com/en/outdoor/petzl-tv", + other = list(notes = "check it out!")) > lset <- new("LeukoSet", assayData = e1, phenoData = pd.s4, + featureData = fd.s4, leukoData = ld.s4, + experimentData = miame.s4, annnotation = "htsdb") > lset LeukoSet (storageMode: lockedEnvironment) assayData: 3 features, 3 samples element names: a0 phenoData sampleNames: x0, x1, x2 varLabels and varMetadata description: abc: alpha BETI c numb: nu MERI c featureData featureNames: y0, y1, y2 fvarLabels and fvarMetadata description: abc: alpha BETI c numb: nu MERI c experimentData: use 'experimentData(object)' Annotation: > leukoData(lset) An object of class "AnnotatedDataFrame" rowNames: a0, a1, a2 varLabels and varMetadata description: abc: alpha BETI c numb: nu MERI c > In terms of your initialize method... >> >> Elmar >> >> >> /*** begin listing ****/ >> >> library(Biobase) # base library >> >> ### build class and methodes #### >> removeClass("LeukoSet") # only for development reason >> >> # define LeukoSet class, inhert eSet class >> setClass("LeukoSet", contains = "eSet", representation(leukoData = "AnnotatedDataFrame"), prototype(new("VersionedBiobase", versions = c(classVersion("eSet"), classVersion("AnnotatedDataFrame"), LeukoSet = "0.1.0")))) >> >> # manipulate generic functions >> # initialize to set the input to the slots. signature LeukoSet. >> setMethod("initialize", signature("LeukoSet"), >> function(.Object, assayData, leukoData = new("AnnotatedDataFrame"), ... ) { >> #function(.Object, ... ) { >> #.local <- function(.Object, assayData, leukoData = annotatedDataFrameFrom(assayData, byaxis= 'z'), ... ) { >> # ctrl assayData stolen from eSet Initialization method >> mySlots <- slotNames(.Object) >> dotArgs <- list(...) >> isSlot <- names(dotArgs) %in% mySlots >> if (missing(assayData)) assayData <- do.call(assayDataNew, dotArgs[!isSlot], envir = parent.frame()) >> else { >> Biobase:::checkClass(assayData, "AssayData", class(.Object)) >> cat("hallo assayData \n") >> nms <- if (storageMode(assayData) == "list") names(assayData) >> else ls(assayData) >> dupNames <- nms %in% names(dotArgs[!isSlot]) >> if (any(dupNames)) warning("initialize argument(s) '", paste(nms[dupNames], collapse = "' '"), "' also present in 'assayData'; argument(s) ignored") >> } >> # ctrl leukoData >> if (!missing(leukoData)) { >> Biobase:::checkClass(leukoData, "AnnotatedDataFrame", class(.Object)) >> cat("hallo leukoData \n") >> dimLabels(leukoData) <- c("leukoNames", "leukoColumns") >> } >> # pass ctrl to the next methode in the linearization that was computed by the generic function and return >> browser() >> callNextMethod(.Object, assayData = assayData, ...) at this point you pass ... to callNextMethod, but you've 'captured' leukoData in the method signature, so it doesn't get passed to callNextMethod. Consequently, the next method (initialize,eSet-method) returns an object with the default value for this slot -- an empty AnnotatedDataFrame. You could have if (!missing(leukoData)) { ## whatever manipulations you'd like, then... } callNextMethod(.Object, assayData=assayData, leukoData=leukoData, ...) (the assayData check is run anyway, in eSet,initialize-method). The other approach, assuming a leukoData<- method, is along the lines of .Object = callNextMethod(.Object, assayData=assayData, ...) leukoData(.Object) <- leukoData .Object but is likely to involve additional copying. I think a better way to do this is to provide a constructor that does whatever magic you'd like, and then to call new("LeukoSet") with the correct arguments -- it's a cleaner interface for the user, and makes the initialize method less tricky (in hind sight, that would have been a better strategy for ExpressionSet etc.) LeukoSet <- function(assay=matrix(), phenoData=annotatedDataFrameFrom(assay, byrow=FALSE), featureData=annotatedDataFrameFrom(assay, byrow=TRUE), leukoData=annotatedDataFrameFrom(assay, byrow=FALSE), ...) { if (!missing(leukoData)) { ## etc } new("LeukoSet", assayData=assayDataNew(assay=assay), phenoData=phenoData, featureData=featureData, leukoData=leukoData, ...) } LeukoSet() LeukoSet(matrix(rnorm(200), 50, dimnames=list(NULL, letters[1:4]))) Martin >> #.Object <- callNextMethod(.Object, assayData = assayData, ...) >> #do.call(callNextMethod, c(.Object, assayData = assayData, ...)) >> #} >> #.local(.Object, ...) >> }) >> >> # generic accessor function for the leukoData slot - abstract data type ADT >> setGeneric("leukoData", function(object,...) standardGeneric("leukoData")) >> setMethod("leukoData", signature("LeukoSet"), function(object,...) object at leukoData) >> >> # TEST >> # the environment >> e1 = new.env(hash = TRUE) >> e1$a0 <- matrix(0:8, nc = 3) >> rownames(e1$a0) <- c("y0","y1","y2") >> colnames(e1$a0) <- c("x0","x1","x2") >> # the list >> l1 = list(a0 = e1$a0) >> # the matrix >> m1 = e1$a0 >> # annotateddataframes >> pd.df <- data.frame(abc = c("phe_null","phe_eins","phe_zwei"), numb = c("+0","+1.1","+2")) >> fd.df <- data.frame(abc = c("fea_null","fea_eins","fea_zwei"), numb = c("0","1.1","2")) >> ld.df <- data.frame(abc = c("leo_null","leo_eins","leo_zwei"), numb = c("-0","-1.1","-2")) >> rownames(pd.df) <- c("x0","x1","x2") >> rownames(fd.df) <- c("y0","y1","y2") >> rownames(ld.df) <- c("a0","a1","a2") >> mewe.df <- data.frame(labelDescription = c("alpha BETI c","nu MERI c"), row.names = c("abc","numb")) >> pd.s4 <- new("AnnotatedDataFrame", data = pd.df, varMetadata = mewe.df) >> fd.s4 <- new("AnnotatedDataFrame", data = fd.df, varMetadata = mewe.df) >> ld.s4 <- new("AnnotatedDataFrame", data = ld.df, varMetadata = mewe.df) >> # vectors >> a.v <- "htsdb" >> # miame >> miame.s4 <- new('MIAME', name = "Elmar Bucher", lab = "VTT Technical Research Center of Finalnd - Medical Biotechnology", contact = "elmar.bucheratvtt.fi", title = "the LeukoSet", abstract = "crash test", url = "http://www.petzl.com/en/outdoor/petzl-tv", other = list(notes = "check it out!")) >> >> # run >> lset <- new("LeukoSet", assayData = e1, phenoData = pd.s4, featureData = fd.s4, leukoData = ld.s4, experimentData = miame.s4, annnotation = a.v) >> # browser! >> lset >> leukoData(lset) >> >> >> /*** end of listing ***/ >> >> >> >> -----Original Message----- >> From: Martin Morgan [mailto:mtmorgan at fhcrc.org] >> Sent: 08 December 2009 20:55 >> To: Bucher Elmar >> Cc: bioconductor at stat.math.ethz.ch >> Subject: Re: [BioC] Error in .local(.Object, ...) : could not find function "checkClass" >> >> Hi Elmar -- >> >> Ext-Elmar.Bucher at vtt.fi wrote: >>> Dear List, >>> >>> I'm writing on extension of the eSet class. >>> >>> getMethod("initialize","eSet") and getMethod("sampleNames<-","AssayData") from the Biobase package are particularly using functions like "checkClass", "assayDataEnvLock", "assayDataStorageMode". >>> >>> In my implementation I would like to use the same functions but I receive errors like: >>> Error in .local(.Object, ...) : could not find function "checkClass" >>> >>> Why? >>> How can I enable my code to use this functions? Because the eSet initialize code seems to be able to use this functions, whit the very same packages loaded. >>> I have the same problem on linux and windows machines. See sessionInfo below. >> These functions are defined in Biobase but not exported. They are >> accessible with >> >> Biobase:::checkClass >> >> and the like, but probably you do not want to do this. Perhaps you want >> to use callNextMethod() or similar, or the functions that are actually >> exported? What specifically do you want to accomplish? Maybe some hints >> in, e.g., >> >> library(oligoClasses) >> selectMethod(initialize, "SnpCallSetPlus") >> >> If I'd written a class to do something special with 'sampleNames', say >> force them to be upper case, then I might do something like >> >> setClass("A", contains="eSet") >> setReplaceMethod("sampleNames", c("A", "character"), >> function(object, value) >> { >> callNextMethod(object=object, value=toupper(value)) >> }) >> >> and then >> >>> a = new("A", exprs=matrix(rnorm(200), 20)) >>> sampleNames(a) >> [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" >>> sampleNames(a) <- letters[1:10] >>> sampleNames(a) >> [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" >> >> >> Martin >> >>> Grateful for help, Elmar >>> >>> >>> >>>> sessionInfo() >>> R version 2.10.0 (2009-10-26) >>> x86_64-pc-linux-gnu >>> >>> locale: >>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 >>> [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 >>> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C >>> [9] LC_ADDRESS=C LC_TELEPHONE=C >>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >>> >>> attached base packages: >>> [1] stats graphics grDevices utils datasets methods base >>> >>> other attached packages: >>> [1] RBioinf_1.6.0 graph_1.20.0 Biobase_2.6.0 >>> >>> loaded via a namespace (and not attached): >>> [1] cluster_1.12.1 tools_2.10.0 >>> >>>> sessionInfo() >>> R version 2.10.0 (2009-10-26) >>> i386-pc-mingw32 >>> >>> locale: >>> [1] LC_COLLATE=English_United Kingdom.1252 >>> [2] LC_CTYPE=English_United Kingdom.1252 >>> [3] LC_MONETARY=English_United Kingdom.1252 >>> [4] LC_NUMERIC=C >>> [5] LC_TIME=English_United Kingdom.1252 >>> >>> attached base packages: >>> [1] stats graphics grDevices utils datasets methods base >>> >>> other attached packages: >>> [1] RBioinf_1.6.0 graph_1.24.1 Biobase_2.6.0 >>> >>> loaded via a namespace (and not attached): >>> [1] tools_2.10.0 >>> >>> _______________________________________________ >>> Bioconductor mailing list >>> Bioconductor at stat.math.ethz.ch >>> https://stat.ethz.ch/mailman/listinfo/bioconductor >>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> -- >> Martin Morgan >> Computational Biology / Fred Hutchinson Cancer Research Center >> 1100 Fairview Ave. N. >> PO Box 19024 Seattle, WA 98109 >> >> Location: Arnold Building M1 B861 >> Phone: (206) 667-2793 >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
ADD REPLY
0
Entering edit mode
Dear Martin and Kasper, Thank you very much for the detailed explanation. The real class (LeukoSet was just a test and learning object) seems now to do the magic I wished, and my understanding of s4 oop implementation has grown :). I try now to refine de Class by writing setValidity, show, ect... methods. I'm happy to ask again if I'm get stuck. T: Elmar -----Original Message----- From: Martin Morgan [mailto:mtmorgan@fhcrc.org] Sent: 09 December 2009 20:49 To: Kasper Daniel Hansen Cc: Bucher Elmar; bioconductor at stat.math.ethz.ch Subject: Re: [BioC] implement a additional slot to the eSet class (Formar: Error in .local(.Object, ...) : could not find function "checkClass") Kasper Daniel Hansen wrote: > You might want to detail the dimensions and type of this additional > slot. My guess - based on the name -- is that this can easily be > carried out within the eSet stuff. > > Kasper > > On Dec 9, 2009, at 9:42 AM, <ext-elmar.bucher at="" vtt.fi=""> <ext- elmar.bucher="" at="" vtt.fi=""> wrote: > >> Hi Martin, >> >> Thank you for the prompt "not exported function" hint. It was what >> I want to do :). >> >> To your question: " What specifically do you want to accomplish? " >> >> I like to implement a additional slot to the eSet class. So it >> differs from the code you suggested to study. I list here the >> essential of the code I have written till now. The code is not >> working as I wished. The main problem is, that the additional slot >> (leukoData) shows the correct values inside the initialize-routine >> (observer by browser()), but the output of the initialize-routine >> shows for leukoData just a empty AnnotatedDataFrame. Do you have a >> clue what I do wrong there? Hi Elmar -- The initialize,eSet-method handles your case 'out-of the box', so there is no need for an initialize,LeukoSet-method at all. Specifically ## define LeukoSet class, inhert eSet class setClass("LeukoSet", contains = "eSet", representation=representation(leukoData = "AnnotatedDataFrame"), prototype=prototype(new("VersionedBiobase", versions = c(classVersion("eSet"), classVersion("AnnotatedDataFrame"), LeukoSet = "0.1.0")))) ## generic accessor function for the leukoData slot - abstract data type ADT setGeneric("leukoData", function(object,...) standardGeneric("leukoData")) setMethod("leukoData", signature("LeukoSet"), function(object,...) object at leukoData) and you're ready to go: > a0 <- matrix(0:8, nc = 3, + dimnames=list(c("y0","y1","y2"),c("x0","x1","x2"))) > e1 <- assayDataNew(a0=a0) > pd.df <- data.frame(abc = c("phe_null","phe_eins","phe_zwei"), + numb = c("+0","+1.1","+2"), + row.names = c("x0","x1","x2")) > fd.df <- data.frame(abc = c("fea_null","fea_eins","fea_zwei"), + numb = c("0","1.1","2"), + row.names = c("y0","y1","y2")) > ld.df <- data.frame(abc = c("leo_null","leo_eins","leo_zwei"), + numb = c("-0","-1.1","-2"), + row.names = c("a0","a1","a2")) > mewe.df <- data.frame(labelDescription = c("alpha BETI c","nu MERI c"), + row.names = c("abc","numb")) > pd.s4 <- new("AnnotatedDataFrame", data = pd.df, varMetadata = mewe.df) > fd.s4 <- new("AnnotatedDataFrame", data = fd.df, varMetadata = mewe.df) > ld.s4 <- new("AnnotatedDataFrame", data = ld.df, varMetadata = mewe.df) > miame.s4 <- new('MIAME', name = "Elmar Bucher", + lab = "VTT Technical Research Center of Finalnd - Medical Biotechnology", + contact = "elmar.bucheratvtt.fi", title = "the LeukoSet", + abstract = "crash test", + url = "http://www.petzl.com/en/outdoor/petzl-tv", + other = list(notes = "check it out!")) > lset <- new("LeukoSet", assayData = e1, phenoData = pd.s4, + featureData = fd.s4, leukoData = ld.s4, + experimentData = miame.s4, annnotation = "htsdb") > lset LeukoSet (storageMode: lockedEnvironment) assayData: 3 features, 3 samples element names: a0 phenoData sampleNames: x0, x1, x2 varLabels and varMetadata description: abc: alpha BETI c numb: nu MERI c featureData featureNames: y0, y1, y2 fvarLabels and fvarMetadata description: abc: alpha BETI c numb: nu MERI c experimentData: use 'experimentData(object)' Annotation: > leukoData(lset) An object of class "AnnotatedDataFrame" rowNames: a0, a1, a2 varLabels and varMetadata description: abc: alpha BETI c numb: nu MERI c > In terms of your initialize method... >> >> Elmar >> >> >> /*** begin listing ****/ >> >> library(Biobase) # base library >> >> ### build class and methodes #### >> removeClass("LeukoSet") # only for development reason >> >> # define LeukoSet class, inhert eSet class >> setClass("LeukoSet", contains = "eSet", representation(leukoData = "AnnotatedDataFrame"), prototype(new("VersionedBiobase", versions = c(classVersion("eSet"), classVersion("AnnotatedDataFrame"), LeukoSet = "0.1.0")))) >> >> # manipulate generic functions >> # initialize to set the input to the slots. signature LeukoSet. >> setMethod("initialize", signature("LeukoSet"), >> function(.Object, assayData, leukoData = new("AnnotatedDataFrame"), ... ) { >> #function(.Object, ... ) { >> #.local <- function(.Object, assayData, leukoData = annotatedDataFrameFrom(assayData, byaxis= 'z'), ... ) { >> # ctrl assayData stolen from eSet Initialization method >> mySlots <- slotNames(.Object) >> dotArgs <- list(...) >> isSlot <- names(dotArgs) %in% mySlots >> if (missing(assayData)) assayData <- do.call(assayDataNew, dotArgs[!isSlot], envir = parent.frame()) >> else { >> Biobase:::checkClass(assayData, "AssayData", class(.Object)) >> cat("hallo assayData \n") >> nms <- if (storageMode(assayData) == "list") names(assayData) >> else ls(assayData) >> dupNames <- nms %in% names(dotArgs[!isSlot]) >> if (any(dupNames)) warning("initialize argument(s) '", paste(nms[dupNames], collapse = "' '"), "' also present in 'assayData'; argument(s) ignored") >> } >> # ctrl leukoData >> if (!missing(leukoData)) { >> Biobase:::checkClass(leukoData, "AnnotatedDataFrame", class(.Object)) >> cat("hallo leukoData \n") >> dimLabels(leukoData) <- c("leukoNames", "leukoColumns") >> } >> # pass ctrl to the next methode in the linearization that was computed by the generic function and return >> browser() >> callNextMethod(.Object, assayData = assayData, ...) at this point you pass ... to callNextMethod, but you've 'captured' leukoData in the method signature, so it doesn't get passed to callNextMethod. Consequently, the next method (initialize,eSet-method) returns an object with the default value for this slot -- an empty AnnotatedDataFrame. You could have if (!missing(leukoData)) { ## whatever manipulations you'd like, then... } callNextMethod(.Object, assayData=assayData, leukoData=leukoData, ...) (the assayData check is run anyway, in eSet,initialize-method). The other approach, assuming a leukoData<- method, is along the lines of .Object = callNextMethod(.Object, assayData=assayData, ...) leukoData(.Object) <- leukoData .Object but is likely to involve additional copying. I think a better way to do this is to provide a constructor that does whatever magic you'd like, and then to call new("LeukoSet") with the correct arguments -- it's a cleaner interface for the user, and makes the initialize method less tricky (in hind sight, that would have been a better strategy for ExpressionSet etc.) LeukoSet <- function(assay=matrix(), phenoData=annotatedDataFrameFrom(assay, byrow=FALSE), featureData=annotatedDataFrameFrom(assay, byrow=TRUE), leukoData=annotatedDataFrameFrom(assay, byrow=FALSE), ...) { if (!missing(leukoData)) { ## etc } new("LeukoSet", assayData=assayDataNew(assay=assay), phenoData=phenoData, featureData=featureData, leukoData=leukoData, ...) } LeukoSet() LeukoSet(matrix(rnorm(200), 50, dimnames=list(NULL, letters[1:4]))) Martin >> #.Object <- callNextMethod(.Object, assayData = assayData, ...) >> #do.call(callNextMethod, c(.Object, assayData = assayData, ...)) >> #} >> #.local(.Object, ...) >> }) >> >> # generic accessor function for the leukoData slot - abstract data type ADT >> setGeneric("leukoData", function(object,...) standardGeneric("leukoData")) >> setMethod("leukoData", signature("LeukoSet"), function(object,...) object at leukoData) >> >> # TEST >> # the environment >> e1 = new.env(hash = TRUE) >> e1$a0 <- matrix(0:8, nc = 3) >> rownames(e1$a0) <- c("y0","y1","y2") >> colnames(e1$a0) <- c("x0","x1","x2") >> # the list >> l1 = list(a0 = e1$a0) >> # the matrix >> m1 = e1$a0 >> # annotateddataframes >> pd.df <- data.frame(abc = c("phe_null","phe_eins","phe_zwei"), numb = c("+0","+1.1","+2")) >> fd.df <- data.frame(abc = c("fea_null","fea_eins","fea_zwei"), numb = c("0","1.1","2")) >> ld.df <- data.frame(abc = c("leo_null","leo_eins","leo_zwei"), numb = c("-0","-1.1","-2")) >> rownames(pd.df) <- c("x0","x1","x2") >> rownames(fd.df) <- c("y0","y1","y2") >> rownames(ld.df) <- c("a0","a1","a2") >> mewe.df <- data.frame(labelDescription = c("alpha BETI c","nu MERI c"), row.names = c("abc","numb")) >> pd.s4 <- new("AnnotatedDataFrame", data = pd.df, varMetadata = mewe.df) >> fd.s4 <- new("AnnotatedDataFrame", data = fd.df, varMetadata = mewe.df) >> ld.s4 <- new("AnnotatedDataFrame", data = ld.df, varMetadata = mewe.df) >> # vectors >> a.v <- "htsdb" >> # miame >> miame.s4 <- new('MIAME', name = "Elmar Bucher", lab = "VTT Technical Research Center of Finalnd - Medical Biotechnology", contact = "elmar.bucheratvtt.fi", title = "the LeukoSet", abstract = "crash test", url = "http://www.petzl.com/en/outdoor/petzl-tv", other = list(notes = "check it out!")) >> >> # run >> lset <- new("LeukoSet", assayData = e1, phenoData = pd.s4, featureData = fd.s4, leukoData = ld.s4, experimentData = miame.s4, annnotation = a.v) >> # browser! >> lset >> leukoData(lset) >> >> >> /*** end of listing ***/ >> >> >> >> -----Original Message----- >> From: Martin Morgan [mailto:mtmorgan at fhcrc.org] >> Sent: 08 December 2009 20:55 >> To: Bucher Elmar >> Cc: bioconductor at stat.math.ethz.ch >> Subject: Re: [BioC] Error in .local(.Object, ...) : could not find function "checkClass" >> >> Hi Elmar -- >> >> Ext-Elmar.Bucher at vtt.fi wrote: >>> Dear List, >>> >>> I'm writing on extension of the eSet class. >>> >>> getMethod("initialize","eSet") and getMethod("sampleNames<-","AssayData") from the Biobase package are particularly using functions like "checkClass", "assayDataEnvLock", "assayDataStorageMode". >>> >>> In my implementation I would like to use the same functions but I receive errors like: >>> Error in .local(.Object, ...) : could not find function "checkClass" >>> >>> Why? >>> How can I enable my code to use this functions? Because the eSet initialize code seems to be able to use this functions, whit the very same packages loaded. >>> I have the same problem on linux and windows machines. See sessionInfo below. >> These functions are defined in Biobase but not exported. They are >> accessible with >> >> Biobase:::checkClass >> >> and the like, but probably you do not want to do this. Perhaps you want >> to use callNextMethod() or similar, or the functions that are actually >> exported? What specifically do you want to accomplish? Maybe some hints >> in, e.g., >> >> library(oligoClasses) >> selectMethod(initialize, "SnpCallSetPlus") >> >> If I'd written a class to do something special with 'sampleNames', say >> force them to be upper case, then I might do something like >> >> setClass("A", contains="eSet") >> setReplaceMethod("sampleNames", c("A", "character"), >> function(object, value) >> { >> callNextMethod(object=object, value=toupper(value)) >> }) >> >> and then >> >>> a = new("A", exprs=matrix(rnorm(200), 20)) >>> sampleNames(a) >> [1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" >>> sampleNames(a) <- letters[1:10] >>> sampleNames(a) >> [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" >> >> >> Martin >> >>> Grateful for help, Elmar >>> >>> >>> >>>> sessionInfo() >>> R version 2.10.0 (2009-10-26) >>> x86_64-pc-linux-gnu >>> >>> locale: >>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C >>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 >>> [5] LC_MONETARY=C LC_MESSAGES=en_US.UTF-8 >>> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C >>> [9] LC_ADDRESS=C LC_TELEPHONE=C >>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C >>> >>> attached base packages: >>> [1] stats graphics grDevices utils datasets methods base >>> >>> other attached packages: >>> [1] RBioinf_1.6.0 graph_1.20.0 Biobase_2.6.0 >>> >>> loaded via a namespace (and not attached): >>> [1] cluster_1.12.1 tools_2.10.0 >>> >>>> sessionInfo() >>> R version 2.10.0 (2009-10-26) >>> i386-pc-mingw32 >>> >>> locale: >>> [1] LC_COLLATE=English_United Kingdom.1252 >>> [2] LC_CTYPE=English_United Kingdom.1252 >>> [3] LC_MONETARY=English_United Kingdom.1252 >>> [4] LC_NUMERIC=C >>> [5] LC_TIME=English_United Kingdom.1252 >>> >>> attached base packages: >>> [1] stats graphics grDevices utils datasets methods base >>> >>> other attached packages: >>> [1] RBioinf_1.6.0 graph_1.24.1 Biobase_2.6.0 >>> >>> loaded via a namespace (and not attached): >>> [1] tools_2.10.0 >>> >>> _______________________________________________ >>> Bioconductor mailing list >>> Bioconductor at stat.math.ethz.ch >>> https://stat.ethz.ch/mailman/listinfo/bioconductor >>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor >> >> -- >> Martin Morgan >> Computational Biology / Fred Hutchinson Cancer Research Center >> 1100 Fairview Ave. N. >> PO Box 19024 Seattle, WA 98109 >> >> Location: Arnold Building M1 B861 >> Phone: (206) 667-2793 >> >> _______________________________________________ >> Bioconductor mailing list >> Bioconductor at stat.math.ethz.ch >> https://stat.ethz.ch/mailman/listinfo/bioconductor >> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor > -- Martin Morgan Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
ADD REPLY

Login before adding your answer.

Traffic: 440 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6