[Bioc-devel] SummarizedExperiment, differing assay dimnames
Michael Love
michaelisaiahlove at gmail.com
Fri Apr 3 13:34:55 CEST 2015
On Fri, Apr 3, 2015 at 7:32 AM, Michael Love
<michaelisaiahlove at gmail.com> wrote:
> hi Martin,
>
> I noticed with GenomicRanges 1.19.51, a new, or newly functional,
> check on dimnames differing between assays.
ah, I'm still using 1.19.50, maybe that's the issue. But I'd still
like to hear what the new behavior will be so I can build without
error :)
>
> It might be convenient to add an option that assays() will take an
> incoming matrix without error no matter what, even if the dimnames on
> the incoming matrix are not the same as those of the
> SummarizedExperiment.
>
> Currently, it appears if there are no dimnames on the incoming matrix,
> withDimnames=FALSE allows assignment (without this arg we get an
> error), but with mismatched dimnames, withDimnames=FALSE gives an
> error.
>
> Also, the help file should probably be updated, as it seems the
> argument is not actually ignored for the setter. Unless this
> functionality above was unintended?
>
> "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."
>
> best,
>
> Mike
>
> ~~~~~
>
>
>> (se <- SummarizedExperiment(matrix(1:6, ncol=2, dimnames=list(1:3,1:2)), colData=DataFrame(x=1:2)))
> class: SummarizedExperiment
> dim: 3 2
> exptData(0):
> assays(1): ''
> rownames(3): 1 2 3
> rowRanges metadata column names(0):
> colnames: NULL
> colData names(1): x
>
>> assays(se)[["test"]] <- matrix(7:12, ncol=2)
> Error in `assays<-`(`*tmp*`, value = <S4 object of class "SimpleList">) :
> 'dimnames' differ between assay elements
> Calls: assays<- -> assays<-
>
> # error because the incoming matrix doesn't have the same dimnames
>
>> assays(se, withDimnames=FALSE)[["test"]] <- matrix(7:12, ncol=2)
>
> # no error, as expected because withDimnames=FALSE
>
>> assays(se)[["test"]] <- matrix(7:12, ncol=2, dimnames=list(4:6,3:4))
> Error in `assays<-`(`*tmp*`, value = <S4 object of class "SimpleList">) :
> 'dimnames' differ between assay elements
> Calls: assays<- -> assays<-
>
> # again, mismatched dimnames, so error
>
>> assays(se, withDimnames=FALSE)[["test"]] <- matrix(7:12, ncol=2, dimnames=list(4:6,3:4))
> Error in `assays<-`(`*tmp*`, withDimnames = FALSE, value = <S4 object
> of class "SimpleList">) :
> 'dimnames' differ between assay elements
> Calls: assays<- -> assays<-
>
> # error despite asking withDimnames=FALSE
>
>> sessionInfo()
> R Under development (unstable) (2015-01-19 r67547)
> Platform: x86_64-unknown-linux-gnu (64-bit)
> Running under: Ubuntu 14.04.2 LTS
>
> locale:
> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
> LC_TIME=en_US.UTF-8
> [4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8
> LC_MESSAGES=en_US.UTF-8
> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
> LC_ADDRESS=C
> [10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8
> LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats4 parallel stats graphics grDevices datasets utils
> methods
> [9] base
>
> other attached packages:
> [1] GenomicRanges_1.19.50 GenomeInfoDb_1.3.16 IRanges_2.1.43
> [4] S4Vectors_0.5.22 BiocGenerics_0.13.10 RUnit_0.4.28
> [7] devtools_1.7.0 knitr_1.9 BiocInstaller_1.17.7
>
> loaded via a namespace (and not attached):
> [1] evaluate_0.5.5 formatR_1.0 stringr_0.6.2 tools_3.2.0 XVector_0.7.4
More information about the Bioc-devel
mailing list