[Bioc-devel] eSet extension

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Mon Jul 18 22:34:05 CEST 2011


I am interested in extending the eSet class.  Specifically I want to
have a number of specifically name elements in my assayData slot (I
also have additional slots, but leave that aside).  It looks like a
way to achieve this is by

setClass("RGChannelSet",
         contains = "eSet",
         validity = function(object) {
             ## msg <- validMsg(NULL,
Biobase:::isValidVersion0(object, "RGChannelSet"))
             msg <- validMsg(NULL,
assayDataValidMembers(assayData(object),
                                                        c("Red",
"Green")))
             if (is.null(msg)) TRUE else msg
         })

(this is clearly a two color array).  However, this fails in the sense that

new("RGChannelSet")

fails, presumably because nothings tells initialize that these two
elements of assayData needs to be there.  Looking at the code for
ExpressionSet and NChannelset, it seems like the way around this is to
write a big initialize method that takes care of this.  I have done
so, essentially copying most of the code from intialize-eSet, but this
seems like code duplication.  Is there any other approach?

Now, one may ask, why do I care, because even if new("RGChannelSet")
does not work, stuff like
  new("RGChannelSet", Red = SOMETHING, Green = SOMETHING)
still works.  However, it is impossible to further extend my
RGChannelSet without errors, ie., something like
  setClass("RGChannelExt", contains = "RGChannelSet")
fails.

Kasper



More information about the Bioc-devel mailing list