HelenaLC / CATALYST

Cytometry dATa anALYsis Tools
65 stars 30 forks source link

Dimension bug in `estCutoffs` #212

Closed nilseling closed 3 years ago

nilseling commented 3 years ago

Hi @HelenaLC ,

when I run sce <- estCutoffs(sce), I get the following error:

Error in base::colMeans(x, na.rm = na.rm, dims = dims, ...) : 
  'x' must be an array of at least two dimensions

by debugging the function, I noticed that there's a drop=FALSE missing here. So when subsetting by ids to which only a single cell was assigned, the function breaks. The following code should work:

ys <- vapply(ids, function(id) colMeans(ys[cs[[id]], , drop = FALSE]), numeric(n_seps))

Cheers,

Nils

nilseling commented 3 years ago

Sorry, here the sessionInfo:

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Catalina 10.15.7

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.1/Resources/lib/libRlapack.dylib

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

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

other attached packages:
 [1] CATALYST_1.16.0             forcats_0.5.1               stringr_1.4.0               purrr_0.3.4                
 [5] readr_1.4.0                 tidyr_1.1.3                 tibble_3.1.2                tidyverse_1.3.1            
 [9] dplyr_1.0.6                 magrittr_2.0.1              vroom_1.4.0                 BiocParallel_1.26.0        
[13] scater_1.20.0               ggplot2_3.3.3               scuttle_1.2.0               SpatialExperiment_1.2.0    
[17] cytomapper_1.4.1            SingleCellExperiment_1.14.1 SummarizedExperiment_1.22.0 Biobase_2.52.0             
[21] GenomicRanges_1.44.0        GenomeInfoDb_1.28.0         IRanges_2.26.0              S4Vectors_0.30.0           
[25] BiocGenerics_0.38.0         MatrixGenerics_1.4.0        matrixStats_0.58.0          EBImage_4.34.0             

loaded via a namespace (and not attached):
  [1] scattermore_0.7             flowWorkspace_4.4.0         R.methodsS3_1.8.1           bit64_4.0.5                
  [5] knitr_1.33                  irlba_2.3.3                 multcomp_1.4-17             DelayedArray_0.18.0        
  [9] R.utils_2.10.1              data.table_1.14.0           RCurl_1.98-1.3              doParallel_1.0.16          
 [13] generics_0.1.0              flowCore_2.4.0              ScaledMatrix_1.0.0          TH.data_1.0-10             
 [17] cowplot_1.1.1               ggpointdensity_0.1.0        bit_4.0.4                   xml2_1.3.2                 
 [21] lubridate_1.7.10            httpuv_1.6.1                assertthat_0.2.1            viridis_0.6.1              
 [25] xfun_0.23                   hms_1.1.0                   evaluate_0.14               promises_1.2.0.1           
 [29] fansi_0.5.0                 dbplyr_2.1.1                readxl_1.3.1                Rgraphviz_2.36.0           
 [33] igraph_1.2.6                DBI_1.1.1                   htmlwidgets_1.5.3           ellipsis_0.3.2             
 [37] ggcyto_1.20.0               ggnewscale_0.4.5            ggpubr_0.4.0                backports_1.2.1            
 [41] cytolib_2.4.0               svgPanZoom_0.3.4            RcppParallel_5.1.4          sparseMatrixStats_1.4.0    
 [45] vctrs_0.3.8                 Cairo_1.5-12.2              abind_1.4-5                 withr_2.4.2                
 [49] ggforce_0.3.3               aws.signature_0.6.0         svglite_2.0.0               cluster_2.1.2              
 [53] crayon_1.4.1                drc_3.0-1                   edgeR_3.34.0                pkgconfig_2.0.3            
 [57] tweenr_1.0.2                vipor_0.4.5                 rlang_0.4.11                lifecycle_1.0.0            
 [61] sandwich_3.0-1              modelr_0.1.8                rsvd_1.0.5                  cellranger_1.1.0           
 [65] polyclip_1.10-0             graph_1.70.0                tiff_0.1-8                  Matrix_1.3-3               
 [69] raster_3.4-10               carData_3.0-4               Rhdf5lib_1.14.0             zoo_1.8-9                  
 [73] reprex_2.0.0                base64enc_0.1-3             beeswarm_0.3.1              ggridges_0.5.3             
 [77] GlobalOptions_0.1.2         pheatmap_1.0.12             png_0.1-7                   viridisLite_0.4.0          
 [81] rjson_0.2.20                bitops_1.0-7                shinydashboard_0.7.1        R.oo_1.24.0                
 [85] ConsensusClusterPlus_1.56.0 rhdf5filters_1.4.0          DelayedMatrixStats_1.14.0   shape_1.4.6                
 [89] jpeg_0.1-8.1                rstatix_0.7.0               ggsignif_0.6.1              aws.s3_0.3.21              
 [93] beachmat_2.8.0              scales_1.1.1                plyr_1.8.6                  hexbin_1.28.2              
 [97] zlibbioc_1.38.0             compiler_4.1.0              dqrng_0.3.0                 RColorBrewer_1.1-2         
[101] plotrix_3.8-1               clue_0.3-59                 cli_2.5.0                   XVector_0.32.0             
[105] ncdfFlow_2.38.0             FlowSOM_2.0.0               MASS_7.3-54                 tidyselect_1.1.1           
[109] stringi_1.6.2               RProtoBufLib_2.4.0          yaml_2.2.1                  BiocSingular_1.8.0         
[113] locfit_1.5-9.4              latticeExtra_0.6-29         ggrepel_0.9.1               grid_4.1.0                 
[117] tools_4.1.0                 rio_0.5.26                  CytoML_2.4.0                circlize_0.4.12            
[121] rstudioapi_0.13             foreach_1.5.1               foreign_0.8-81              gridExtra_2.3              
[125] farver_2.1.0                Rtsne_0.15                  DropletUtils_1.12.0         digest_0.6.27              
[129] BiocManager_1.30.15         shiny_1.6.0                 Rcpp_1.0.6                  car_3.0-10                 
[133] broom_0.7.6                 later_1.2.0                 httr_1.4.2                  ComplexHeatmap_2.8.0       
[137] colorspace_2.0-1            rvest_1.0.0                 XML_3.99-0.6                fs_1.5.0                   
[141] splines_4.1.0               RBGL_1.68.0                 sp_1.4-5                    systemfonts_1.0.2          
[145] xtable_1.8-4                jsonlite_1.7.2              R6_2.5.0                    pillar_1.6.1               
[149] htmltools_0.5.1.1           mime_0.10                   nnls_1.4                    glue_1.4.2                 
[153] fastmap_1.1.0               BiocNeighbors_1.10.0        fftwtools_0.9-11            codetools_0.2-18           
[157] mvtnorm_1.1-1               utf8_1.2.1                  lattice_0.20-44             curl_4.3.1                 
[161] ggbeeswarm_0.6.0            colorRamps_2.3              gtools_3.8.2                magick_2.7.2               
[165] zip_2.2.0                   openxlsx_4.2.3              survival_3.2-11             limma_3.48.0               
[169] rmarkdown_2.8               munsell_0.5.0               GetoptLong_1.0.5            rhdf5_2.36.0               
[173] GenomeInfoDbData_1.2.6      iterators_1.0.13            HDF5Array_1.20.0            reshape2_1.4.4             
[177] haven_2.4.1                 gtable_0.3.0  
HelenaLC commented 3 years ago

Fix pushed to both Bioc devel (master branch) & release (RELEASE_3_13 branch).