[Bioc-devel] EXTERNAL: MultiAssayExperiment silently converting RangedSummarizedExperiments into SummarizedExperiments.
Hi Marcel, Charles, Looks like S4Vectors:::coerceToSimpleList() is being to zealous here. I've tweaked the function a little (in S4Vectors 0.23.21) so that elements in the supplied list get coerced only when the 2nd argument (element.type) is specified. This fixes both Marcel's and Charles' examples. Many things in many packages depend on the delicate machinery that takes care of coercing arbitrary things to SimpleList objects. So any small change to this machinery has the potential to cause a lot of damage. Hopefully this change won't have any major adverse effect. Thursday's build report will tell us. If everything looks good on Thursday, I'll apply the change to release. Best, H.
On 9/3/19 15:03, Marcel Ramos wrote:
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
suppressPackageStartupMessages({
??? library(SummarizedExperiment)
})
example(SummarizedExperiment, echo = FALSE)
mylist <- list(exo1 = rse, exo2 = se0)
simple <- as(mylist, "SimpleList")
simple[[1]]
#> 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://urldefense.proofpoint.com/v2/url?u=https-3A__reprex.tidyverse.org&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=9duQHKmIe42r7lOJQrxpEAIYslget3GtzOUH_7YsQ-o&s=q8UONw1z3Bk43KNBDbmA-m1gBE1J7l6w3McrPDDaTfU&e= ) (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.
_______________________________________________ Bioc-devel at r-project.org mailing list https://urldefense.proofpoint.com/v2/url?u=https-3A__stat.ethz.ch_mailman_listinfo_bioc-2Ddevel&d=DwIGaQ&c=eRAMFD45gAfqt84VtBcfhQ&r=BK7q3XeAvimeWdGbWY_wJYbW0WYiZvSXAJJKaaPhzWA&m=9duQHKmIe42r7lOJQrxpEAIYslget3GtzOUH_7YsQ-o&s=xvXy_ZsQbfNnyFpn6Hg2JcVW54_vdgVntav4YTtnKkE&e=
Herv? Pag?s Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M1-B514 P.O. Box 19024 Seattle, WA 98109-1024 E-mail: hpages at fredhutch.org Phone: (206) 667-5791 Fax: (206) 667-1319