Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateSeuratObject fails when counts is a matrix #15

Closed
lazappi opened this issue May 13, 2021 · 4 comments · Fixed by #16
Closed

CreateSeuratObject fails when counts is a matrix #15

lazappi opened this issue May 13, 2021 · 4 comments · Fixed by #16

Comments

@lazappi
Copy link

lazappi commented May 13, 2021

I'm getting the following error when I try to create a Seurat object from a matrix. A data frame seems to work fine so not sure exactly what is going on.

library(SeuratObject)

pbmc_raw <- read.table(
    file = system.file('extdata', 'pbmc_raw.txt', package = 'Seurat'),
    as.is = TRUE
)

CreateSeuratObject(counts = pbmc_raw)
#> An object of class Seurat 
#> 230 features across 80 samples within 1 assay 
#> Active assay: RNA (230 features, 0 variable features)

CreateSeuratObject(counts = as.matrix(pbmc_raw))
#> Error in switch(EXPR = getOption(x = "Seurat.checkdots"), warn = warning(msg, : EXPR must be a length 1 vector

Created on 2021-05-13 by the reprex package (v2.0.0)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                                             
#>  version  R Under development (unstable) (2021-03-29 r80130)
#>  os       macOS Catalina 10.15.7                            
#>  system   x86_64, darwin17.0                                
#>  ui       X11                                               
#>  language (EN)                                              
#>  collate  en_US.UTF-8                                       
#>  ctype    en_US.UTF-8                                       
#>  tz       Europe/Berlin                                     
#>  date     2021-05-13                                        
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package      * version date       lib source             
#>  backports      1.2.1   2020-12-09 [1] standard (@1.2.1)  
#>  cli            2.5.0   2021-04-26 [1] standard (@2.5.0)  
#>  crayon         1.4.1   2021-02-08 [1] CRAN (R 4.1.0)     
#>  digest         0.6.27  2020-10-24 [1] CRAN (R 4.1.0)     
#>  ellipsis       0.3.2   2021-04-29 [1] CRAN (R 4.1.0)     
#>  evaluate       0.14    2019-05-28 [1] standard (@0.14)   
#>  fansi          0.4.2   2021-01-15 [1] CRAN (R 4.1.0)     
#>  fs             1.5.0   2020-07-31 [1] standard (@1.5.0)  
#>  glue           1.4.2   2020-08-27 [1] CRAN (R 4.1.0)     
#>  highr          0.9     2021-04-16 [1] standard (@0.9)    
#>  htmltools      0.5.1.1 2021-01-22 [1] standard (@0.5.1.1)
#>  knitr          1.33    2021-04-24 [1] standard (@1.33)   
#>  lattice        0.20-44 2021-05-02 [1] CRAN (R 4.1.0)     
#>  lifecycle      1.0.0   2021-02-15 [1] CRAN (R 4.1.0)     
#>  magrittr       2.0.1   2020-11-17 [1] CRAN (R 4.1.0)     
#>  Matrix         1.3-3   2021-05-04 [1] CRAN (R 4.1.0)     
#>  pillar         1.6.0   2021-04-13 [1] CRAN (R 4.1.0)     
#>  pkgconfig      2.0.3   2019-09-22 [1] CRAN (R 4.1.0)     
#>  purrr          0.3.4   2020-04-17 [1] standard (@0.3.4)  
#>  Rcpp           1.0.6   2021-01-15 [1] standard (@1.0.6)  
#>  reprex         2.0.0   2021-04-02 [1] standard (@2.0.0)  
#>  rlang          0.4.11  2021-04-30 [1] CRAN (R 4.1.0)     
#>  rmarkdown      2.8     2021-05-07 [1] CRAN (R 4.1.0)     
#>  sessioninfo    1.1.1   2018-11-05 [1] standard (@1.1.1)  
#>  SeuratObject * 4.0.1   2021-05-08 [1] standard (@4.0.1)  
#>  stringi        1.6.1   2021-05-10 [1] CRAN (R 4.1.0)     
#>  stringr        1.4.0   2019-02-10 [1] CRAN (R 4.1.0)     
#>  styler         1.4.1   2021-03-30 [1] standard (@1.4.1)  
#>  tibble         3.1.1   2021-04-18 [1] CRAN (R 4.1.0)     
#>  utf8           1.2.1   2021-03-12 [1] CRAN (R 4.1.0)     
#>  vctrs          0.3.8   2021-04-29 [1] CRAN (R 4.1.0)     
#>  withr          2.4.2   2021-04-18 [1] CRAN (R 4.1.0)     
#>  xfun           0.22    2021-03-11 [1] standard (@0.22)   
#>  yaml           2.2.1   2020-02-01 [1] standard (@2.2.1)  
#> 
#> [1] /Library/Frameworks/R.framework/Versions/4.1/Resources/library
@lazappi
Copy link
Author

lazappi commented May 13, 2021

This works if you do library(Seurat) first, so I'm guessing that is setting something? Maybe SeuratObject needs to do the same?

mojaveazure added a commit that referenced this issue May 13, 2021
Provide default when option Seurat.checkdots is not set

fixes #15
@mojaveazure mojaveazure linked a pull request May 13, 2021 that will close this issue
@mojaveazure
Copy link
Member

Hi Luke, thanks for bringing this up. Can you try with the a patch on the fix/checkdots branch?

if (!requireNamespace("remotes", quietly = TRUE)) {
  install.packages("remotes")
}
remotes::install_github("mojaveazure/seurat-object", ref = "fix/checkdots")

@lazappi
Copy link
Author

lazappi commented May 14, 2021

That seems to work! 🎉

Just in case it's interesting I got this error on R 4.1. Not sure if it is something to do with SeuratObject or remotes

> remotes::install_github("mojaveazure/seurat-object", ref = "fix/checkdots")
Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo mojaveazure/seurat-object@fix/checkdots
Error: Failed to install 'SeuratObject' from GitHub:
  invalid 'type'

Worked ok on R 4.0 though.

@mojaveazure
Copy link
Member

Sorry for the delay. Neither Andrew nor I have been able to replicate the installation issue. We think it's an issue with {remotes} instead of SeuratObject

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants