[Bioc-devel] eSet extension
Kasper Daniel Hansen
kasperdanielhansen at gmail.com
Tue Jul 19 05:28:49 CEST 2011
On Mon, Jul 18, 2011 at 6:03 PM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
> On 07/18/2011 01:34 PM, Kasper Daniel Hansen wrote:
> setMethod(initialize, "RGChannelSet",
> function(.Object, ...,
> assayData=assayDataNew(Red=matrix(), Green=matrix()))
> {
> callNextMethod(.Object, ..., assayData=assayData)
> })
Some experimentation has lead me to (for the moment) settle on
setMethod("initialize", "RGChannelSet",
function(.Object, Red = new("matrix"), Green = new("matrix"), ...) {
callNextMethod(.Object, Red = Red, Green = Green, ...)
})
Comments
(1) There is a difference between matrix() and new("matrix") (1x1 vs
0x0 and I think the later is more appropriate for an empty object).
(2) Your approach with using assayData = assayDataNew() in the
argument to the method led to the following construction fail:
new("RGChannelSet", Red = SOMETHING, Green = SOMETHING)
because the default value of assayData overrules the explicit values
of Red and Green. This means that one would have to give an assayData
argument, like
new("RGChannelSet", assayData = assayDataNew(Red = SOMETHING, Green
= SOMETHING))
There is something appropriate about this, using the explicit
constructor, but in the end I think too much has been invested in the
new() paradigm for me to go this way; hence my solution above.
Thanks for the help,
Kasper
More information about the Bioc-devel
mailing list