OSCA-source / OSCA.basic

Basics of the OSCA book
10 stars 11 forks source link

runUMAP Error in irlba through 'Matrix' package on a non-conventional sce dataset #12

Closed semmrich closed 12 months ago

semmrich commented 12 months ago

Dear OSCA team,

When running the basic UMAP function I encountered this ERROR message:

MPA.sce <- runUMAP(MPA.sce, dimred='PCA')`
# **Error in irlba::irlba(L, nv = n, nu = 0, maxit = iters) : 
#   function 'as_cholmod_sparse' not provided by package 'Matrix'**

The dataset:

MPA.sce
# class: SingleCellExperiment 
# dim: 10 2369 
# metadata(0):
# assays(2): counts logcounts
# rownames(10): total.i dead.i ... MTG.LK.i TMRM.LK.i
# rowData names(0):
# colnames(2369): LSK1_P1_DMSO-B2 LSK1_P1_DMSO-C2 ... LSK5_P8_VE-F9 LSK5_P8_VE-F10
# colData names(13): Condition Batch ... TMRM.LSK.r EPCR.LSK.r
# reducedDimNames(6): PCA corral ... denSNE densMAP
# mainExpName: NULL
# altExpNames(0):

This is NOT single cell expression data, but a multiparametric flow cytometry screening, raw data prior indexed as relative to control measurements. Thus all controls are closely valued around 1 across all parameters (rownames(MPA.sce)), and in MPA.sce counts=logcounts.

As background, the PCA threw several warnings:

MPA.sce <- runPCA(MPA.sce)
# **Warning in (function (A, nv = 5, nu = nv, maxit = 1000, work = nv + 7, reorth = TRUE,  :
#   You're computing too large a percentage of total singular values, use a standard svd instead.
# Warning message:
# In check_numbers(k = k, nu = nu, nv = nv, limit = min(dim(x)) -  :
#   more singular values/vectors requested than available**

I am aware this is a non-traditional approach on using SingleCellExperiment containers and especially the dimred applications, however we would like to use dimred visualizations and subsequent clustering options to subset the data and stratify Hits. I have used smaller instances of the same data type (less "cells" or here samples) under R.4.3.1 with the OSCA pipeline to successfully run TSNE, UMAP and perform downstream clusterings and statistics. Moreover, any TSNE derivatives such as

runTSNE(MPA.sce, dimred='PCA')
runTSNE(MPA.sce, use_fitsne = TRUE, name="FIt-SNE")
densne(reducedDim(MPA.sce, "PCA"), dens_frac = 0.4, dens_lambda = 0.2)

and even

densmap(reducedDim(MPA.sce, "PCA"), dens_frac = 0.4, dens_lambda = 0.2)

run without issues on this dataset.

MPA.sce <- corral_sce(MPA.sce, method="svd")
# Too many components requested; setting ncomp = 9 
# **Warning in irlba::irlba(mat, nv = ncomp, ...) :
#   You're computing too large a percentage of total singular values, use a standard svd instead.**

I have no idea why of all the UMAP is not working, any help greatly appreciated! Thx in advance

> sessionInfo()
R version 4.3.2 (2023-10-31 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)

Matrix products: default

locale:
[1] LC_COLLATE=English_United States.utf8  LC_CTYPE=English_United States.utf8    LC_MONETARY=English_United States.utf8 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.utf8    

time zone: Europe/Berlin
tzcode source: internal

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

other attached packages:
 [1] snifter_1.12.0              corral_1.12.0               densvis_1.12.0              ggalt_0.4.0                 clustree_0.5.1             
 [6] ggraph_2.1.0                bluster_1.12.0              scater_1.30.1               scran_1.30.0                scuttle_1.12.0             
[11] BBmisc_1.13                 lubridate_1.9.3             forcats_1.0.0               stringr_1.5.1               dplyr_1.1.4                
[16] purrr_1.0.2                 readr_2.1.4                 tidyr_1.3.0                 tibble_3.2.1                ggplot2_3.4.4              
[21] tidyverse_2.0.0             readxl_1.4.3                SingleCellExperiment_1.24.0 SummarizedExperiment_1.32.0 Biobase_2.62.0             
[26] GenomicRanges_1.54.1        GenomeInfoDb_1.38.1         IRanges_2.36.0              S4Vectors_0.40.1            BiocGenerics_0.48.1        
[31] MatrixGenerics_1.14.0       matrixStats_1.1.0          

loaded via a namespace (and not attached):
  [1] RColorBrewer_1.1-3          rstudioapi_0.15.0           jsonlite_1.8.7              MultiAssayExperiment_1.28.0 magrittr_2.0.3             
  [6] ggbeeswarm_0.7.2            farver_2.1.1                zlibbioc_1.48.0             vctrs_0.6.4                 DelayedMatrixStats_1.24.0  
 [11] RCurl_1.98-1.13             S4Arrays_1.2.0              BiocNeighbors_1.20.0        cellranger_1.1.0            SparseArray_1.2.2          
 [16] proj4_1.0-13                KernSmooth_2.23-22          basilisk_1.14.0             plyr_1.8.9                  igraph_1.5.1               
 [21] lifecycle_1.0.4             pkgconfig_2.0.3             rsvd_1.0.5                  Matrix_1.6-4                R6_2.5.1                   
 [26] GenomeInfoDbData_1.2.11     digest_0.6.33               colorspace_2.1-1            dqrng_0.3.1                 irlba_2.3.5.1              
 [31] beachmat_2.18.0             filelock_1.0.2              fansi_1.0.5                 timechange_0.2.0            polyclip_1.10-6            
 [36] abind_1.4-7                 compiler_4.3.2              withr_2.5.2                 backports_1.4.1             BiocParallel_1.36.0        
 [41] viridis_0.6.4               ggforce_0.4.1               Rttf2pt1_1.3.12             maps_3.4.1.1                MASS_7.3-60                
 [46] DelayedArray_0.28.0         tools_4.3.2                 vipor_0.4.5                 beeswarm_0.4.0              extrafontdb_1.0            
 [51] glue_1.6.2                  grid_4.3.2                  checkmate_2.3.0             reshape2_1.4.4              cluster_2.1.4              
 [56] generics_0.1.3              gtable_0.3.4                tzdb_0.4.0                  data.table_1.14.8           hms_1.1.3                  
 [61] BiocSingular_1.18.0         tidygraph_1.2.3             ScaledMatrix_1.10.0         metapod_1.10.0              utf8_1.2.4                 
 [66] XVector_0.42.0              ggrepel_0.9.4               pillar_1.9.0                pals_1.8                    limma_3.58.1               
 [71] tweenr_2.0.2                lattice_0.22-5              FNN_1.1.3.2                 tidyselect_1.2.0            locfit_1.5-9.8             
 [76] transport_0.14-6            gridExtra_2.3               edgeR_4.0.2                 graphlayouts_1.0.2          statmod_1.5.0              
 [81] stringi_1.8.1               codetools_0.2-19            extrafont_0.19              cli_3.6.1                   uwot_0.1.16                
 [86] ash_1.0-15                  reticulate_1.34.0           munsell_0.5.0               dichromat_2.0-1             Rcpp_1.0.11                
 [91] dir.expiry_1.10.0           mapproj_1.2.11              png_0.1-8                   parallel_4.3.2              assertthat_0.2.1           
 [96] basilisk.utils_1.14.0       sparseMatrixStats_1.14.0    bitops_1.0-7                ggthemes_5.0.0              viridisLite_0.4.2 
alanocallaghan commented 12 months ago

Try re-installing irlba as suggested here: https://github.com/bwlewis/irlba/issues/70