seurat-wrappers icon indicating copy to clipboard operation
seurat-wrappers copied to clipboard

Unexpected behaviour

Open stemangiola opened this issue 4 years ago • 1 comments

Hello thanks for the tool.

When I run liger through SeuratWrappers regressing for (i) total reads per cell and (ii) mitochondrial percent I get a stringy UMAP plot. While I get a more normal looking UMAP plot if I don't regress for any variable.

Could you please advise?

WithOUT regressing variables. Looging "normal"

cancer_lymphoid %>%
    NormalizeData() %>%
    FindVariableFeatures() %>%
    ScaleData(split.by = "sample", do.center = FALSE) %>%
    SeuratWrappers::RunOptimizeALS(k = 20, lambda = 5, split.by = "sample") %>%
    SeuratWrappers::RunQuantileNorm(split.by = "sample") %>%
         RunUMAP(dims = 1:20, reduction = "iNMF", n.components = 3L) %>% 
          ggplot(aes(UMAP_1, UMAP_2)) +   
          geom_point(size = 0.2, shape=".") 

image

Regressing for variables. Looking stringy

cancer_lymphoid %>%
    NormalizeData() %>%
    FindVariableFeatures() %>%
    ScaleData(split.by = "sample", do.center = FALSE, vars.to.regress = c("sum", "subsets_Mito_percent")) %>%
    SeuratWrappers::RunOptimizeALS(k = 20, lambda = 5, split.by = "sample") %>%
    SeuratWrappers::RunQuantileNorm(split.by = "sample") %>%
         RunUMAP(dims = 1:20, reduction = "iNMF", n.components = 3L) %>% 
          ggplot(aes(UMAP_1, UMAP_2)) +   
          geom_point(size = 0.2, shape=".") 

image

Sessioninfo

> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

Matrix products: default
BLAS:   /stornext/System/data/apps/R/R-4.0.3/lib64/R/lib/libRblas.so
LAPACK: /stornext/System/data/apps/R/R-4.0.3/lib64/R/lib/libRlapack.so

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] parallel  stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] scales_1.1.1                functional_0.6              SingleR_1.4.0              
 [4] SeuratWrappers_0.3.0        liger_0.5.0                 patchwork_1.1.0            
 [7] Matrix_1.2-18               cowplot_1.1.0               furrr_0.2.1                
[10] future_1.21.0               googlesheets4_0.2.0         nanny_0.1.8                
[13] tidybulk_1.2.1              DropletUtils_1.10.0         scran_1.18.1               
[16] scater_1.18.3               SingleCellExperiment_1.12.0 ggExtra_0.9                
[19] RColorBrewer_1.1-2          tidyHeatmap_1.1.5           tidysc_0.1.0               
[22] forcats_0.5.0               stringr_1.4.0               dplyr_1.0.2                
[25] purrr_0.3.4                 readr_1.4.0                 tidyr_1.1.2                
[28] tibble_3.0.4                ggplot2_3.3.2               tidyverse_1.3.0            
[31] tidyseurat_0.1.18           Seurat_3.2.2                SummarizedExperiment_1.20.0
[34] Biobase_2.50.0              GenomicRanges_1.42.0        GenomeInfoDb_1.26.0        
[37] IRanges_2.24.0              S4Vectors_0.28.0            BiocGenerics_0.36.0        
[40] MatrixGenerics_1.2.0        matrixStats_0.57.0         

loaded via a namespace (and not attached):
  [1] rappdirs_0.3.1                widyr_0.1.3                   R.methodsS3_1.8.1            
  [4] bit64_4.0.5                   irlba_2.3.3                   DelayedArray_0.16.0          
  [7] R.utils_2.10.1                data.table_1.13.2             rpart_4.1-15                 
 [10] RCurl_1.98-1.2                generics_0.1.0                snow_0.4-3                   
 [13] preprocessCore_1.52.0         RSQLite_2.2.1                 RANN_2.6.1                   
 [16] bit_4.0.4                     spatstat.data_1.5-2           xml2_1.3.2                   
 [19] lubridate_1.7.9.2             httpuv_1.5.4                  assertthat_0.2.1             
 [22] viridis_0.5.1                 celldex_1.0.0                 hms_0.5.3                    
 [25] promises_1.1.1                fansi_0.4.1                   dbplyr_2.0.0                 
 [28] readxl_1.3.1                  igraph_1.2.6                  DBI_1.1.0                    
 [31] htmlwidgets_1.5.2             googledrive_1.0.1             ellipsis_0.3.1               
 [34] riverplot_0.6                 RSpectra_0.16-0               backports_1.2.0              
 [37] deldir_0.2-3                  sparseMatrixStats_1.2.0       vctrs_0.3.5                  
 [40] remotes_2.2.0                 Cairo_1.5-12.2                ROCR_1.0-11                  
 [43] abind_1.4-5                   withr_2.3.0                   sctransform_0.3.1            
 [46] dittoSeq_1.2.0                mclust_5.4.7                  goftest_1.2-2                
 [49] cluster_2.1.0                 ExperimentHub_1.16.0          lazyeval_0.2.2               
 [52] crayon_1.3.4                  labeling_0.4.2                edgeR_3.32.0                 
 [55] pkgconfig_2.0.3               nlme_3.1-150                  vipor_0.4.5                  
 [58] rlang_0.4.8                   globals_0.14.0                lifecycle_0.2.0              
 [61] miniUI_0.1.1.1                BiocFileCache_1.14.0          doSNOW_1.0.19                
 [64] modelr_0.1.8                  rsvd_1.0.3                    AnnotationHub_2.22.0         
 [67] cellranger_1.1.0              polyclip_1.10-0               lmtest_0.9-38                
 [70] Rhdf5lib_1.12.0               zoo_1.8-8                     reprex_0.3.0                 
 [73] beeswarm_0.2.3                ggridges_0.5.2                GlobalOptions_0.1.2          
 [76] pheatmap_1.0.12               png_0.1-7                     viridisLite_0.3.0            
 [79] rjson_0.2.20                  bitops_1.0-6                  R.oo_1.24.0                  
 [82] KernSmooth_2.23-18            rhdf5filters_1.2.0            blob_1.2.1                   
 [85] DelayedMatrixStats_1.12.0     shape_1.4.5                   parallelly_1.21.0            
 [88] beachmat_2.6.1                memoise_1.1.0                 magrittr_2.0.1               
 [91] plyr_1.8.6                    ica_1.0-2                     zlibbioc_1.36.0              
 [94] compiler_4.0.3                dqrng_0.2.1                   clue_0.3-57                  
 [97] fitdistrplus_1.1-1            cli_2.2.0                     XVector_0.30.0               
[100] listenv_0.8.0                 pbapply_1.4-3                 MASS_7.3-53                  
[103] mgcv_1.8-33                   tidyselect_1.1.0              stringi_1.5.3                
[106] yaml_2.2.1                    BiocSingular_1.6.0            locfit_1.5-9.4               
[109] ggrepel_0.8.2                 grid_4.0.3                    tools_4.0.3                  
[112] future.apply_1.6.0            circlize_0.4.11               rstudioapi_0.13              
[115] bluster_1.0.0                 foreach_1.5.1                 gridExtra_2.3                
[118] farver_2.0.3                  Rtsne_0.15                    digest_0.6.27                
[121] BiocManager_1.30.10           FNN_1.1.3                     shiny_1.5.0                  
[124] Rcpp_1.0.5                    broom_0.7.2                   scuttle_1.0.0                
[127] BiocVersion_3.12.0            later_1.1.0.1                 RcppAnnoy_0.0.17             
[130] httr_1.4.2                    AnnotationDbi_1.52.0          ComplexHeatmap_2.6.1         
[133] colorspace_2.0-0              rvest_0.3.6                   fs_1.5.0                     
[136] tensor_1.5                    reticulate_1.18               splines_4.0.3                
[139] uwot_0.1.9                    statmod_1.4.35                spatstat.utils_1.17-0        
[142] plotly_4.9.2.1                xtable_1.8-4                  jsonlite_1.7.1               
[145] spatstat_1.64-1               R6_2.5.0                      pillar_1.4.7                 
[148] htmltools_0.5.0               mime_0.9                      glue_1.4.2                   
[151] fastmap_1.0.1                 BiocParallel_1.24.1           BiocNeighbors_1.8.0          
[154] interactiveDisplayBase_1.28.0 codetools_0.2-18              utf8_1.1.4                   
[157] lattice_0.20-41               curl_4.3                      ggbeeswarm_0.6.0             
[160] leiden_0.3.5                  gtools_3.8.2                  survival_3.2-7               
[163] limma_3.46.0                  munsell_0.5.0                 GetoptLong_1.0.4             
[166] rhdf5_2.34.0                  GenomeInfoDbData_1.2.4        iterators_1.0.13             
[169] HDF5Array_1.18.0              haven_2.3.1                   reshape2_1.4.4               
[172] gtable_0.3.0   

stemangiola avatar Feb 10 '21 05:02 stemangiola

I found that possibly regressing here is not the answer, but discarting some dimension might be.

https://github.com/welch-lab/liger/issues/113

stemangiola avatar Feb 11 '21 02:02 stemangiola