Skip to content
Back to formatted view

Raw Message

Message-ID: <CAC2h7uuivY0icLqZSGuMDb+AAv+i8-9+_Gew91yHqD=CnaO4oQ@mail.gmail.com>
Date: 2011-07-19T03:28:49Z
From: Kasper Daniel Hansen
Subject: [Bioc-devel] eSet extension
In-Reply-To: <4E24AD94.2070700@fhcrc.org>

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