runPCA error / Error in runSVD(x, k = rank, nu = ifelse(get.pcs, rank, 0), nv = ifelse(get.rotation, : argument "rank" is missing, with no default
1
0
Entering edit mode
tinyimp80 • 0
@fc6c21c3
Last seen 2.7 years ago
South Korea

Hi, I'm in Seurat tutorial - Interoperability between single-cell object formats https://satijalab.org/seurat/articles/conversion_vignette.html

but it has error. I don't know what's wrong....Please help. Thanks

library(scater)
library(Seurat)
library(SeuratDisk)
library(SeuratData)
library(patchwork)

pbmc <- LoadData(ds = "pbmc3k", type = "pbmc3k.final")
pbmc.sce <- as.SingleCellExperiment(pbmc)
p1 <- plotExpression(pbmc.sce, features = "MS4A1", x = "ident") + theme(axis.text.x = element_text(angle = 45, hjust = 1))
p2 <- plotPCA(pbmc.sce, colour_by = "ident")
p1 + p2

manno <- readRDS(file = "~/seurat/data/manno_human.rds")
manno <- runPCA(manno)
Error in runSVD(x, k = rank, nu = ifelse(get.pcs, rank, 0), nv = ifelse(get.rotation,  : 
  argument "rank" is missing, with no default
```r
sessionInfo( )

R version 4.1.2 (2021-11-01)
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=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=ko_KR.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=ko_KR.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=ko_KR.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=ko_KR.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] patchwork_1.1.1               thp1.eccite.SeuratData_3.1.5 
 [3] stxBrain.SeuratData_0.1.1     ssHippo.SeuratData_3.1.4     
 [5] pbmcMultiome.SeuratData_0.1.2 pbmc3k.SeuratData_3.1.4      
 [7] panc8.SeuratData_3.0.2        ifnb.SeuratData_3.0.0        
 [9] hcabm40k.SeuratData_3.0.0     bmcite.SeuratData_0.3.0      
[11] SeuratData_0.2.1              SeuratDisk_0.0.0.9019        
[13] SeuratObject_4.0.4            Seurat_4.1.0                 
[15] scater_1.22.0                 ggplot2_3.3.5                
[17] scuttle_1.4.0                 SingleCellExperiment_1.16.0  
[19] SummarizedExperiment_1.24.0   Biobase_2.54.0               
[21] GenomicRanges_1.46.1          GenomeInfoDb_1.30.0          
[23] IRanges_2.28.0                S4Vectors_0.32.3             
[25] BiocGenerics_0.40.0           MatrixGenerics_1.6.0         
[27] matrixStats_0.61.0           

loaded via a namespace (and not attached):
  [1] plyr_1.8.6                igraph_1.2.11            
  [3] lazyeval_0.2.2            splines_4.1.2            
  [5] BiocParallel_1.28.3       listenv_0.8.0            
  [7] scattermore_0.7           digest_0.6.29            
  [9] htmltools_0.5.2           viridis_0.6.2            
 [11] fansi_1.0.2               magrittr_2.0.1           
 [13] ScaledMatrix_1.2.0        tensor_1.5               
 [15] cluster_2.1.2             ROCR_1.0-11              
 [17] remotes_2.4.2             globals_0.14.0           
 [19] spatstat.sparse_2.1-0     prettyunits_1.1.1        
 [21] colorspace_2.0-2          rappdirs_0.3.3           
 [23] ggrepel_0.9.1             dplyr_1.0.7              
 [25] callr_3.7.0               crayon_1.4.2             
 [27] RCurl_1.98-1.5            jsonlite_1.7.3           
 [29] spatstat.data_2.1-2       survival_3.2-13          
 [31] zoo_1.8-9                 glue_1.6.1               
 [33] polyclip_1.10-0           gtable_0.3.0             
 [35] zlibbioc_1.40.0           XVector_0.34.0           
 [37] leiden_0.3.9              DelayedArray_0.20.0      
 [39] pkgbuild_1.3.1            BiocSingular_1.10.0      
 [41] future.apply_1.8.1        abind_1.4-5              
 [43] scales_1.1.1              DBI_1.1.2                
 [45] miniUI_0.1.1.1            Rcpp_1.0.8               
 [47] viridisLite_0.4.0         xtable_1.8-4             
 [49] reticulate_1.23           spatstat.core_2.3-2      
 [51] bit_4.0.4                 rsvd_1.0.5               
 [53] htmlwidgets_1.5.4         httr_1.4.2               
 [55] RColorBrewer_1.1-2        ellipsis_0.3.2           
 [57] ica_1.0-2                 farver_2.1.0             
 [59] pkgconfig_2.0.3           uwot_0.1.11              
 [61] deldir_1.0-6              utf8_1.2.2               
 [63] labeling_0.4.2            tidyselect_1.1.1         
 [65] rlang_0.4.12              reshape2_1.4.4           
 [67] later_1.3.0               munsell_0.5.0            
 [69] tools_4.1.2               cli_3.1.1                
 [71] generics_0.1.1            ggridges_0.5.3           
 [73] stringr_1.4.0             fastmap_1.1.0            
 [75] goftest_1.2-3             processx_3.5.2           
 [77] bit64_4.0.5               fitdistrplus_1.1-6       
 [79] purrr_0.3.4               RANN_2.6.1               
 [81] pbapply_1.5-0             future_1.23.0            
 [83] nlme_3.1-155              sparseMatrixStats_1.6.0  
 [85] mime_0.12                 rstudioapi_0.13          
 [87] hdf5r_1.3.5               compiler_4.1.2           
 [89] curl_4.3.2                beeswarm_0.4.0           
 [91] plotly_4.10.0             png_0.1-7                
 [93] spatstat.utils_2.3-0      tibble_3.1.6             
 [95] stringi_1.7.6             ps_1.6.0                 
 [97] lattice_0.20-45           Matrix_1.4-0             
 [99] vctrs_0.3.8               pillar_1.6.5             
[101] lifecycle_1.0.1           BiocManager_1.30.16      
[103] spatstat.geom_2.3-1       lmtest_0.9-39            
[105] RcppAnnoy_0.0.19          BiocNeighbors_1.12.0     
[107] data.table_1.14.2         cowplot_1.1.1            
[109] bitops_1.0-7              irlba_2.3.5              
[111] httpuv_1.6.5              R6_2.5.1                 
[113] promises_1.2.0.1          KernSmooth_2.23-20       
[115] gridExtra_2.3             vipor_0.4.5              
[117] parallelly_1.30.0         codetools_0.2-18         
[119] MASS_7.3-55               assertthat_0.2.1         
[121] rprojroot_2.0.2           withr_2.4.3              
[123] sctransform_0.3.3         GenomeInfoDbData_1.2.7   
[125] mgcv_1.8-38               parallel_4.1.2           
[127] grid_4.1.2                rpart_4.1-15             
[129] beachmat_2.10.0           tidyr_1.1.4              
[131] DelayedMatrixStats_1.16.0 Rtsne_0.15               
[133] shiny_1.7.1               ggbeeswarm_0.6.0
scater • 3.4k views
ADD COMMENT
0
Entering edit mode

Can you post this as a reproducible example? When I use runPCA with scater 1.22.0, it runs fine.

ADD REPLY
0
Entering edit mode

What is manno_human.rds?

ADD REPLY
0
Entering edit mode

Hi, sorry I'm late. manno_human.rds is in Seurat tutorial - Interoperability between single-cell object formats https://satijalab.org/seurat/articles/conversion_vignette.html

ADD REPLY
0
Entering edit mode

That dataset 404s now. Can you provide a reproducible example, please?

ADD REPLY
0
Entering edit mode
ADD REPLY
0
Entering edit mode
@alanocallaghan-14291
Last seen 5 months ago
United Kingdom

You probably want to runPCA on a SingleCellExperiment object, not a list with fields data and labels. The example you posted is using BiocSingular::runPCA, which expects rank to be specified, rather than scater::runPCA.

Something like this:

library("scater")
library("SingleCellExperiment")

manno <- readRDS(file = "manno_human.rds")
sce_manno <- SingleCellExperiment(assay = list(counts = manno$data))
sce_manno <- logNormCounts(sce_manno)
sce_manno <- runPCA(sce_manno)

I'd like to emphasise once more that this would have been much easier to resolve if you had provided a reproducible example.

ADD COMMENT

Login before adding your answer.

Traffic: 905 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6