waldronlab / MultiAssayExperiment

Bioconductor package for management of multi-assay data
https://waldronlab.io/MultiAssayExperiment/
70 stars 32 forks source link

`getWithColData` fails when experiment has 0 rows or columns #300

Closed danielinteractive closed 3 years ago

danielinteractive commented 3 years ago

Reprex:

example(MultiAssayExperiment)
mae
mae[[1]] <- mae[[1]][NULL, ]
mae
mae[[1]]
getWithColData(mae, 1)

Observed error:

Error in normalizeDoubleBracketSubscript(i, x, exact = exact, allow.NA = TRUE,  : 
  subscript is out of bounds

Note that the same error occurs when having an experiment with 0 columns.

Expected behavior: The function should still work as before and as the double brackets operator works, just with adding the MAE colData columns to the experiment.

Session info:

R version 4.1.1 (2021-08-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.3 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=de_DE.UTF-8       LC_NUMERIC=C               LC_TIME=de_CH.UTF-8       
 [4] LC_COLLATE=de_DE.UTF-8     LC_MONETARY=de_CH.UTF-8    LC_MESSAGES=de_DE.UTF-8   
 [7] LC_PAPER=de_CH.UTF-8       LC_NAME=C                  LC_ADDRESS=C              
[10] LC_TELEPHONE=C             LC_MEASUREMENT=de_CH.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] MultiAssayExperiment_1.18.0 SummarizedExperiment_1.22.0 Biobase_2.52.0             
 [4] GenomicRanges_1.44.0        GenomeInfoDb_1.28.1         IRanges_2.26.0             
 [7] S4Vectors_0.30.0            BiocGenerics_0.38.0         MatrixGenerics_1.4.0       
[10] matrixStats_0.60.1         

loaded via a namespace (and not attached):
 [1] lattice_0.20-44        bitops_1.0-7           grid_4.1.1             zlibbioc_1.38.0       
 [5] XVector_0.32.0         Matrix_1.3-4           tools_4.1.1            RCurl_1.98-1.4        
 [9] DelayedArray_0.18.0    compiler_4.1.1         GenomeInfoDbData_1.2.6
LiNk-NY commented 3 years ago

Hi Daniel, @danielinteractive Thanks for reporting. This should be fixed in 1.19.11. Best, Marcel

danielinteractive commented 3 years ago

Thanks a lot @LiNk-NY Marcel!