[Bioc-devel] Help with class lost after subsetting.

Martin Morgan mtmorg@n@bioc @ending from gm@il@com
Tue Aug 28 08:01:37 CEST 2018



On 08/28/2018 12:19 AM, Charles Plessy wrote:
> Dear Bioconductor developers,
> 
> In the CAGEr package, I created a "CAGEexp" class that extends
> "MultiAssayExperiment" without adding new slots, in order to define generic
> functions that require CAGEr-specific contents in the colData slot.
> 
> Unfortunately, when run in the development branch of Bioconductor,
> the CAGEexp objects lose their class when they are subsetted.  Here
> is an example:
> 
>> CAGEr::exampleCAGEexp
> A CAGEexp object of 4 listed
> (...)
> 
>> CAGEr::exampleCAGEexp[,1]
> A MultiAssayExperiment object of 4 listed
> (...)
> 
> This breaks examples in the package, as well as existing code.
> 
> I am lost on how to troubleshoot this.  May I ask for your help ?

I debugged this using first `selectMethod("[", "MultiAssayExperiment")` 
and then `showMethod()` / `selectMethod()` to arrive at 
`subsetByColData,MultiAssayExperiment,ANY-method`.

The problem is that this line

https://github.com/waldronlab/MultiAssayExperiment/blob/master/R/subsetBy-methods.R#L261

returns a MultiAssayExperiment; what it should do is probably closer to 
the 'copy constructor' functionality of `initialize()`, along the lines of

   initialize(x, ExperimentList = ..., )

This could be opened as an issue on the MultiAssayExperiment github 
repository; maybe Herve or Michael or others might comment on the best 
implementation.

Martin

> 
> Best regards,
>



More information about the Bioc-devel mailing list