[Bioc-devel] EXTERNAL: MultiAssayExperiment silently converting RangedSummarizedExperiments into SummarizedExperiments.

Marcel Ramos M@rce|@R@mo@ @end|ng |rom ro@we||p@rk@org
Wed Sep 4 00:03:20 CEST 2019

Hi Charles,

Thank you for your post and for providing a reproducible example.

I was able to reduce the example to behavior from the coerce method on
`list`/`ANY` objects to `SimpleList`.

Here is the reduced example:

``` r
example(SummarizedExperiment, echo = FALSE)
mylist <- list(exo1 = rse, exo2 = se0)

simple <- as(mylist, "SimpleList")

#> class: SummarizedExperiment
#> dim: 200 6
#> metadata(0):
#> assays(1): counts
#> rownames: NULL
#> rowData names(1): feature_id
#> colnames(6): A B ... E F
#> colData names(1): Treatment

vapply(simple, class, character(1L))
#>                   exo1                   exo2
#> "SummarizedExperiment" "SummarizedExperiment"

<sup>Created on 2019-09-03 by the [reprex
package](https://reprex.tidyverse.org) (v0.3.0)</sup>

It appears that `S4Vectors:::coerceToSimpleList` looks for the
`S4Vectors:::lowestListElementClass` and coerces all classes in the list
to be the base `SummarizedExperiment` class. I'm not sure what the
reasoning is behind the behavior.

Can you chime in Hervé? Thanks.

- Marcel

On 8/28/19 1:28 AM, Charles Plessy wrote:
> Hello,
> I am using MultiAssayExperiment as a base class in the CAGEr package.
> In Bioconductor 3.10, CAGEr is broken because updates of
> RangeSummarizedExperiment experiments trigger their silent conversion
> to SummarizedExperiment objects (basically discarding the ranges).  This 
> only happens when there is another experiment slot that contains a plain 
> SummarizedExperiment.
> Here is a toy example to reproduce the issue:
> ```{r}
> library("MultiAssayExperiment")
> (DF       <- DataFrame(sample1=c(1,2), sample2=c(1,3)))
> (rRanges  <- GPos("chr1", 1:2, "+"))
> (cData    <- DataFrame(type=c("control", "treatment"), row.names = 
> c("sample1", "sample2")))
> (rSE      <- SummarizedExperiment(SimpleList(DF), rowRanges = rRanges, 
> colData = cData))
> (SE       <- SummarizedExperiment(SimpleList(DF), colData = cData))
> (m        <- MultiAssayExperiment(ExperimentList(exp1=rSE)))
> (m[[1]]   <- m[[1]])
> m # No change
> (m        <- c(m, exp2=SE))
> (m[[1]]   <- m[[1]])
> m # RangedSummarizedExperiment replaced with SummarizedExperiment
> sessionInfo()
> ```
> Am I misusing the MultiAssayExperiment objects, or is this a bug ?
> Have a nice day,
> Charles

This email message may contain legally privileged and/or confidential information.  If you are not the intended recipient(s), or the employee or agent responsible for the delivery of this message to the intended recipient(s), you are hereby notified that any disclosure, copying, distribution, or use of this email message is prohibited.  If you have received this message in error, please notify the sender immediately by e-mail and delete this email message from your computer. Thank you.

More information about the Bioc-devel mailing list