[BioC] limma MArrayLM subclass question

Cyrus Harmon ch-bioc at bobobeach.com
Fri Sep 16 08:39:43 CEST 2005


Hi Gordon,

Sorry for the bogus code there. Let me try again. As for reading the  
help pages, yes, certainly. As for getting the usage correct? No,  
you're right, that was wrong. However, the problem that led me to  
writing the email in the first place still seems to exist. Allow me  
to try again.

First, for the trivial example of a class and subclass to prove to  
myself that I'm not completely inept:


 > setClass("moose", representation(antler="character"))
[1] "moose"
 > setClass("oldMoose", representation("moose",age="numeric"))
[1] "oldMoose"
 > m1 <- new("moose", antler="bogus")
 > m1
An object of class "moose"
Slot "antler":
[1] "bogus"

 > m2 <- as(m1, "oldMoose")
 > m2
An object of class "oldMoose"
Slot "age":
numeric(0)

Slot "antler":
[1] "bogus"

 >

Second, for the example with MArrayLM that still doesn't seem to work  
for me:


 > setClass("myMArrayLM", representation("MArrayLM"))
[1] "myMArrayLM"
 > class(def)
[1] "MArrayLM"
attr(,"package")
[1] "limma"
 > as(def,"myMArrayLM");
Error in names(x) : trying to get slot "contains" from an object of a  
basic class ("NULL") with no slots

Obviously, this is not a completely reproducible example as def is a  
big object. But I trust that if one were to plug in another MArrayLM  
object, instead of def, one would see the same results.

If I'm missing something fundamental, my apologies for taking up bioc  
bandwidth.

Thanks again,

Cyrus


On Sep 15, 2005, at 10:53 PM, Gordon Smyth wrote:

> Hi Cyrus,
>
> This is a bit laconic for me. Can you give explicit reproducible  
> code which leads to an error, and send back to list?
>
> I assume you wouldn't be trying to do something as advanced as  
> creating a new sub-class without reading the help for as() and setAs 
> () etc, but the usage you describe for as() certainly does not  
> appear to match the function definition. Have you successfully  
> experimented with a toy example of a class and subclass and got  
> everything working? If not, R-help would be a better place for  
> questions about S4.
>
> Regards
> Gordon
>
>
>> Dear bioc-devel,
>>
>> I'd like to subclass MArrayLM (I think), but I'm having some trouble:
>>
>> setClass("myMArrayLM", "MArrayLM")
>> assign("[.myMArrayLM", function(object, i, j, ...)
>> { "[.MArrayLM"(object, i, j, ...) });
>>
>> and then I thought I could just do this (given def, an MArrayLM  
>> object)
>>
>> as("myArrayLM", def);
>>
>> But when I try that I get the following error message:
>>
>>  > as("myArrayLM", def);
>> Error in methodsPackageMetaName("C", name) :
>>      'The name of the object (e.g,. a class or generic function) to
>> find in the meta-data' must be a single string (got an object of
>> class "matrix")
>> In addition: Warning message:
>> the condition has length > 1 and only the first element will be used
>> in: if (is.na(i)) {
>>  >
>>
>> Has anyone successfully subclassed MArrayLM? Is this something I just
>> shouldn't be doing? It seems natural to want to store additional data
>> in an MArrayLM and get the proper subsetting behavior, piggybacking
>> on MArrayLM's existing behavior.
>>
>> Also, is this the right place for limma questions? It doesn't have
>> its own mailing list yet, does it?
>>
>> Thanks,
>>
>> Cyrus Harmon
>>
>
>
>



More information about the Bioconductor mailing list