Skip to content
Prev 7270 / 21312 Next

[Bioc-devel] Build error for DESeq2 dev causing error in other package builds

On 04/03/2015 04:37 AM, Andrea Rau wrote:
I broke assays<-,SummarizedExperiment,*-method in GenomicRanges 1.19.50. it has 
been fixed and problems should clear up in the next build report. The 
(incorrect) error about 'dimnames differ between assay elements', seen in

./DESeq2/zin2-buildsrc.html
./BiocGenerics/zin2-checksrc.html
./HTSFilter/zin2-buildsrc.html
./VariantAnnotation/zin2-checksrc.html
./bsseq/zin2-buildsrc.html
./AllelicImbalance/zin2-buildsrc.html
./TCC/zin2-buildsrc.html
./gage/zin2-buildsrc.html
./ReportingTools/zin2-checksrc.html
./MLSeq/zin2-buildsrc.html
./systemPipeR/zin2-buildsrc.html
./DiffBind/zin2-buildsrc.html
./SGSeq/zin2-buildsrc.html
./VariantFiltering/zin2-buildsrc.html
./rgsepd/zin2-buildsrc.html

will not appear.

Off-list, Michael Love asked me what exactly does get checked. The row- and 
column names of each incoming assay need either to be NULL, or to match the 
current row and column names of the SummarizedExperiment. For instance the 
following

 > example(SummarizedExperiment)
## ...
 > assays(se2) = assays(se2)                           # incoming dimnames
 > assays(se2) = assays(se2, withDimnames=FALSE)       # no incoming dimnames
 > m = assays(se2)[["counts"]]; rownames(m) = NULL
 > assays(se2)[["counts"]] = m                         # no rownames
 > assays(se2)[[1]] = assays(se2)[[1]][, c(2:6, 1)]    # out-of-order columns
Error in `assays<-`(`*tmp*`, value = <S4 object of class "SimpleList">) :
   current and replacement dimnames() differ

It doesn't seem safe to allow the dimnames to mismatch, even though earlier 
versions allowed this.

The documentation page has

      assays(x, ..., withDimnames=TRUE) <- value

but says

withDimnames: A 'logical(1)', indicating whether dimnames should be
           applied to extracted assay elements (this argument is ignored
           for the setter 'assays<-'). Setting 'withDimnames=FALSE'
           increases the speed and memory efficiency with which assays
           are extracted.

which may make one wonder why withDimnames=TRUE appears in the signature for 
assays<-. The reason involves complex assignments like

   names(assays(se2)) = "foo"

versus

   names(assays(se2, withDimanames=FALSE)) = "bar"

The second version is more efficient than the first, avoiding copying dimnames. 
The reason for the efficiency is a little complicated. assays() in these 
expressions acts as both getter and setter. The signature of the setter assays<- 
needs to be able to 'pass through' the withDimnames argument to the getter, even 
if it has no effect on the setter itself. I have updated the documentation to 
clarify this, inasmuch as I am able.

   assayNames(se2) = "foo"

hides the complex assignment complexity for this common use case. Probably the 
default should be FALSE for the setter, but symmetry and the complexity of the 
update scenario made me hesitant to do so. Presumably handling of dimnames will 
be simplified in the next release cycle, when dimnames are stored redundantly on 
all assay elements.

Sorry for the confusion from my flawed commits in version 1.19.50.

Martin