Bioconductor / SummarizedExperiment

SummarizedExperiment container
https://bioconductor.org/packages/SummarizedExperiment
29 stars 9 forks source link

Warning and error message when using '$' operator on summarizedExperiment object #75

Closed DijkJel closed 1 year ago

DijkJel commented 1 year ago

Hi,

Since updating to the newest R version (4.3.1), I get the following error and warning message when I attempt to use the '$' operator on SE objects:

Error in order(typeScores, scores) : argument lengths differ
In addition: Warning message:
In completions$type == .rs.acCompletionTypes$DATAFRAME & !completions$context %in%  :
  longer object length is not a multiple of shorter object length

Just typing se$ is enough to trigger the message.

Strangely enough, I'm still able to select columns using the $ operator, despite the warning and error. The current version of SummarizedExperiment that I'm using is 1.30.2.

Any idea how to solve this issue?

LiNk-NY commented 1 year ago

Hi @DijkJel I am unable to reproduce this error on RELEASE_3_17 Bioconductor Docker container or in the terminal. Please make sure that BiocManager::valid() is returning TRUE. Best, Marcel

DijkJel commented 1 year ago

Hi Marcel,

Thanks for the quick response. I have checked BiocManager::valid() and it returns TRUE. I think I've found the issue: the messages only appear when the colData exceeds 2000 columns.

For example, the following code works fine:

m = matrix(runif(100), 10, dimnames = list(NULL, letters[1:10]))
cd = as.data.frame(matrix(runif(2000*10), nrow = 10))
rownames(cd) = letters[1:10]

se = SummarizedExperiment(assays = list(a = m),
                          colData = cd)

se$

But when I increase the number of columns to 2001, it returns a warning and error:

m = matrix(runif(100), 10, dimnames = list(NULL, letters[1:10]))
cd = as.data.frame(matrix(runif(2001*10), nrow = 10))
rownames(cd) = letters[1:10]

se = SummarizedExperiment(assays = list(a = m),
                          colData = cd)

se$
Error in order(typeScores, scores) : argument lengths differ
In addition: Warning message:
In completions$type == .rs.acCompletionTypes$DATAFRAME & !completions$context %in%  :
  longer object length is not a multiple of shorter object length

Best, Jelmer

PeteHaitch commented 1 year ago

I can't reproduce this running R 4.3.1 with RStudio (Version 2023.06.0+421 (2023.06.0+421)) on macOS.

How are you running R? RStudio, R app, R from the command line, something else? If something like RStudio, what version of that software are your running?

It may also help if you provide your sessionInfo() after running your example and more details about your computer. Here's mine

> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.4.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: Australia/Melbourne
tzcode source: internal

attached base packages:
[1] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] SummarizedExperiment_1.31.1 Biobase_2.61.0              GenomicRanges_1.53.1       
[4] GenomeInfoDb_1.37.2         IRanges_2.35.2              S4Vectors_0.39.1           
[7] BiocGenerics_0.47.0         MatrixGenerics_1.13.1       matrixStats_1.0.0          

loaded via a namespace (and not attached):
 [1] SparseArray_1.1.10      zlibbioc_1.47.0         Matrix_1.5-4.1         
 [4] lattice_0.21-8          GenomeInfoDbData_1.2.10 S4Arrays_1.1.4         
 [7] XVector_0.41.1          RCurl_1.98-1.12         bitops_1.0-7           
[10] grid_4.3.1              DelayedArray_0.27.5     compiler_4.3.1         
[13] rstudioapi_0.14         tools_4.3.1             BiocManager_1.30.21    
[16] crayon_1.5.2 
DijkJel commented 1 year ago

Hi,

I I have figured out that it has actually nothing to do with SummarizedExperiment, but that it is indeed an issue with the latest version of RStudio. These messages show when you try to use $ on data.frames with more than 2000 columns. Sorry for the inconvenience!

hpages commented 1 year ago

Glad that you were able to narrow down the problem to a RStudio/data.frame issue. I guess we can close this then.