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

MAST v.1.21.3 -- Error: $ operator is invalid for atomic vectors #170

Closed
akhst7 opened this issue Dec 21, 2021 · 7 comments
Closed

MAST v.1.21.3 -- Error: $ operator is invalid for atomic vectors #170

akhst7 opened this issue Dec 21, 2021 · 7 comments

Comments

@akhst7
Copy link

akhst7 commented Dec 21, 2021

I am using Seurat FindMarkers with MAST as follows;

FindMarkers(aml, ident.1 = "10", test.use = "MAST")

and I get an error, Error: $ operator is invalid for atomic vectors

I am using a following recently published Seurat obj but I get the same error with other Seurat obj;

aml <- readRDS(url("https://ndownloader.figshare.com/files/28403676"))

I really appreciate any pointers to resolve this.

> BiocManager::valid()
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details

replacement repositories:
    CRAN: https://cran.rstudio.com/


* sessionInfo()

R version 4.1.2 (2021-11-01)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Monterey 12.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1-arm64/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] stats4    stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] MAST_1.21.3                 SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 Biobase_2.54.0             
 [5] GenomicRanges_1.46.1        GenomeInfoDb_1.30.0         IRanges_2.28.0              S4Vectors_0.32.3           
 [9] BiocGenerics_0.40.0         MatrixGenerics_1.6.0        matrixStats_0.61.0          data.table_1.14.2          
[13] Seurat_4.0.6                SeuratObject_4.0.4         

loaded via a namespace (and not attached):
  [1] plyr_1.8.6             igraph_1.2.10          lazyeval_0.2.2         splines_4.1.2          BiocParallel_1.28.3   
  [6] listenv_0.8.0          scattermore_0.7        ggplot2_3.3.5          digest_0.6.29          htmltools_0.5.2       
 [11] fansi_0.5.0            magrittr_2.0.1         memoise_2.0.1          tensor_1.5             cluster_2.1.2         
 [16] ROCR_1.0-11            limma_3.48.3           globals_0.14.0         Biostrings_2.62.0      annotate_1.72.0       
 [21] spatstat.sparse_2.1-0  prettyunits_1.1.1      colorspace_2.0-2       blob_1.2.2             ggrepel_0.9.1         
 [26] lobstr_1.1.1.9000      dplyr_1.0.7            crayon_1.4.2           RCurl_1.98-1.5         jsonlite_1.7.2        
 [31] genefilter_1.74.1      spatstat.data_2.1-2    survival_3.2-13        zoo_1.8-9              glue_1.6.0            
 [36] polyclip_1.10-0        gtable_0.3.0           zlibbioc_1.40.0        XVector_0.34.0         leiden_0.3.9          
 [41] DelayedArray_0.20.0    future.apply_1.8.1     abind_1.4-5            scales_1.1.1           DBI_1.1.2             
 [46] miniUI_0.1.1.1         Rcpp_1.0.7             viridisLite_0.4.0      xtable_1.8-4           progress_1.2.2        
 [51] reticulate_1.22        spatstat.core_2.3-2    bit_4.0.4              htmlwidgets_1.5.4      httr_1.4.2            
 [56] RColorBrewer_1.1-2     ellipsis_0.3.2         ica_1.0-2              pkgconfig_2.0.3        XML_3.99-0.8          
 [61] farver_2.1.0           uwot_0.1.11            deldir_1.0-6           locfit_1.5-9.4         utf8_1.2.2            
 [66] tidyselect_1.1.1       labeling_0.4.2         rlang_0.4.12           reshape2_1.4.4         later_1.3.0           
 [71] AnnotationDbi_1.56.2   munsell_0.5.0          tools_4.1.2            cachem_1.0.6           generics_0.1.1        
 [76] RSQLite_2.2.9          ggridges_0.5.3         stringr_1.4.0          fastmap_1.1.0          goftest_1.2-3         
 [81] bit64_4.0.5            fitdistrplus_1.1-6     purrr_0.3.4            RANN_2.6.1             KEGGREST_1.34.0       
 [86] pbapply_1.5-0          future_1.23.0          nlme_3.1-153           mime_0.12              compiler_4.1.2        
 [91] plotly_4.10.0          png_0.1-7              spatstat.utils_2.3-0   tibble_3.1.6           geneplotter_1.70.0    
 [96] stringi_1.7.6          lattice_0.20-45        Matrix_1.4-0           vctrs_0.3.8            pillar_1.6.4          
[101] lifecycle_1.0.1        BiocManager_1.30.16    spatstat.geom_2.3-1    lmtest_0.9-39          RcppAnnoy_0.0.19      
[106] cowplot_1.1.1          bitops_1.0-7           irlba_2.3.5            httpuv_1.6.4           patchwork_1.1.1       
[111] R6_2.5.1               promises_1.2.0.1       KernSmooth_2.23-20     gridExtra_2.3          parallelly_1.30.0     
[116] codetools_0.2-18       MASS_7.3-54            DESeq2_1.35.0          sctransform_0.3.2      GenomeInfoDbData_1.2.7
[121] mgcv_1.8-38            parallel_4.1.2         hms_1.1.1              grid_4.1.2             rpart_4.1-15          
[126] tidyr_1.1.4            Rtsne_0.15             shiny_1.7.1           

Bioconductor version '3.13'

  * 0 packages out-of-date
  * 50 packages too new

create a valid installation with

  BiocManager::install(c(
    "annotate", "AnnotationDbi", "beachmat", "Biobase", "BiocGenerics", "BiocIO", "BiocNeighbors", "BiocParallel",
    "BiocSingular", "Biostrings", "BSgenome", "CNEr", "ComplexHeatmap", "cpp11", "DelayedArray", "DelayedMatrixStats",
    "DESeq2", "DirichletMultinomial", "fst", "GenomeInfoDb", "GenomeInfoDbData", "GenomicAlignments", "GenomicRanges",
    "ggVennDiagram", "GO.db", "graph", "IRanges", "KEGGgraph", "KEGGREST", "lobstr", "MAST", "MatrixGenerics",
    "org.Hs.eg.db", "pathfindR", "Rgraphviz", "Rhtslib", "Rsamtools", "rtracklayer", "S4Vectors", "ScaledMatrix",
    "scater", "scuttle", "seqLogo", "seriation", "SingleCellExperiment", "sparseMatrixStats", "SummarizedExperiment",
    "TFBSTools", "XVector", "zlibbioc"
  ), update = TRUE, ask = FALSE)

more details: BiocManager::valid()$too_new, BiocManager::valid()$out_of_date

Warning message:
0 packages out-of-date; 50 packages too new 
> 
@amcdavid
Copy link
Member

amcdavid commented Dec 21, 2021 via email

@akhst7
Copy link
Author

akhst7 commented Dec 22, 2021

@amcdavid

There are 50 new packages and I am not ready to downgrade those 50 packages for a variety of reasons.

A following is the traceback. As usual, traceback is a full of Seurat garbage and not quite useful;

traceback()
8: MASTDETest(data.use = data.use, cells.1 = cells.1, cells.2 = cells.2, 
       latent.vars = latent.vars, verbose = verbose, ...)
7: PerformDE(object = object, cells.1 = cells.1, cells.2 = cells.2, 
       features = features, test.use = test.use, verbose = verbose, 
       min.cells.feature = min.cells.feature, latent.vars = latent.vars, 
       densify = densify, ...)
6: FindMarkers.default(object = data.use, slot = data.slot, counts = counts, 
       cells.1 = cells.1, cells.2 = cells.2, features = features, 
       logfc.threshold = logfc.threshold, test.use = test.use, min.pct = min.pct, 
       min.diff.pct = min.diff.pct, verbose = verbose, only.pos = only.pos, 
       max.cells.per.ident = max.cells.per.ident, random.seed = random.seed, 
       latent.vars = latent.vars, min.cells.feature = min.cells.feature, 
       min.cells.group = min.cells.group, pseudocount.use = pseudocount.use, 
       fc.results = fc.results, densify = densify, ...)
5: FindMarkers(object = data.use, slot = data.slot, counts = counts, 
       cells.1 = cells.1, cells.2 = cells.2, features = features, 
       logfc.threshold = logfc.threshold, test.use = test.use, min.pct = min.pct, 
       min.diff.pct = min.diff.pct, verbose = verbose, only.pos = only.pos, 
       max.cells.per.ident = max.cells.per.ident, random.seed = random.seed, 
       latent.vars = latent.vars, min.cells.feature = min.cells.feature, 
       min.cells.group = min.cells.group, pseudocount.use = pseudocount.use, 
       fc.results = fc.results, densify = densify, ...)
4: FindMarkers.Assay(object = data.use, slot = slot, cells.1 = cells$cells.1, 
       cells.2 = cells$cells.2, features = features, logfc.threshold = logfc.threshold, 
       test.use = test.use, min.pct = min.pct, min.diff.pct = min.diff.pct, 
       verbose = verbose, only.pos = only.pos, max.cells.per.ident = max.cells.per.ident, 
       random.seed = random.seed, latent.vars = latent.vars, min.cells.feature = min.cells.feature, 
       min.cells.group = min.cells.group, pseudocount.use = pseudocount.use, 
       mean.fxn = mean.fxn, base = base, fc.name = fc.name, densify = densify, 
       ...)
3: FindMarkers(object = data.use, slot = slot, cells.1 = cells$cells.1, 
       cells.2 = cells$cells.2, features = features, logfc.threshold = logfc.threshold, 
       test.use = test.use, min.pct = min.pct, min.diff.pct = min.diff.pct, 
       verbose = verbose, only.pos = only.pos, max.cells.per.ident = max.cells.per.ident, 
       random.seed = random.seed, latent.vars = latent.vars, min.cells.feature = min.cells.feature, 
       min.cells.group = min.cells.group, pseudocount.use = pseudocount.use, 
       mean.fxn = mean.fxn, base = base, fc.name = fc.name, densify = densify, 
       ...)
2: FindMarkers.Seurat(aml, ident.1 = "10", test.use = "MAST")
1: FindMarkers(aml, ident.1 = "10", test.use = "MAST")

At this point, I will cover this Seurat obj to SingleCellExiperiment and feed it into MAST manually and see what happens.

@lauren-fish
Copy link

lauren-fish commented Dec 23, 2021

Hi @amcdavid, I reinstalled Bioconductor a couple of days ago to update several packages and I am also having the same error. Which versions of MAST and Bioconductor should I make sure I have installed in order to get everything working again? I have Bioconductor 3.14 and MAST 1.20.0, and I'm using Seurat 4.0.6. The FindMarkers command works fine when I use DESeq2 or the default option so it does seem to be a MAST issue?
When I try BiocManager::valid() it returns TRUE. I can provide my traceback if it would be useful.
Thank you!

@akhst7
Copy link
Author

akhst7 commented Dec 23, 2021

I run MAST manually by feeding SingleCellAssay obj converted from Seurat obj into zlm as follows.

options(mc.cores = parallel::detectCores())
aml <- readRDS(url("https://ndownloader.figshare.com/files/28403676")) #Seurat Ojb
sce<-as.SingleCellExperiment(aml, assay = "RNA")
sca<-SceToSingleCellAssay(sce)
sca.fit<-zlm(~ seurat_clusters, sca)
> sca.fit
Fitted zlm on 461 genes and 31586 cells.
 Using BayesGLMlike ~ seurat_clusters 
> str(sca.fit, max.level = 2)
Formal class 'ZlmFit' [package "MAST"] with 17 slots
  ..@ coefC             : num [1:461, 1:35] 3.29 2.03 3.27 2.13 2.21 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ coefD             : num [1:461, 1:35] 2.49 -4.57 2.37 -2.24 -5.64 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ vcovC             : num [1:35, 1:35, 1:461] 9.59e-05 -9.59e-05 -9.59e-05 -9.59e-05 -9.59e-05 ...
  .. ..- attr(*, "dimnames")=List of 3
  ..@ vcovD             : num [1:35, 1:35, 1:461] 0.00336 -0.00335 -0.00324 -0.00307 -0.00334 ...
  .. ..- attr(*, "dimnames")=List of 3
  ..@ LMlike            :Formal class 'BayesGLMlike' [package "MAST"] with 16 slots
  ..@ sca               :Formal class 'SingleCellAssay' [package "MAST"] with 11 slots
  ..@ deviance          : num [1:461, 1:2] 10435 2690 7425 3121 167 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ loglik            : num [1:461, 1:2] -26116 -6476 -18857 -7701 -489 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ df.null           : int [1:461, 1:2] 28482 6754 20937 8257 666 8133 8197 18956 3531 71 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ df.resid          : num [1:461, 1:2] 28448 6721 20903 8223 641 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ dispersion        : num [1:461, 1:2] 0.366 0.398 0.355 0.378 0.254 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ dispersionNoshrink: num [1:461, 1:2] 0.366 0.398 0.355 0.378 0.251 ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ priorDOF          : num 9.36
  ..@ priorVar          : num 0.459
  ..@ converged         : logi [1:461, 1:2] TRUE TRUE TRUE TRUE TRUE TRUE ...
  .. ..- attr(*, "dimnames")=List of 2
  ..@ hookOut           : NULL
  ..@ exprs_values      : int 2

I have not yet closely looked at numbers but at least I did not get the atomic vector error.

I will leave the question open for @lauren-fish .

@amcdavid
Copy link
Member

Based on the backtrace, the error looks like it's in Seurat, probably a regression introduced in 4.0.6.

@lauren-fish
Copy link

Hi @akhst7 and @amcdavid, thanks for the tips! I'll keep this bookmarked in case I need to do this in the future.

I downloaded Seurat 4.0.5 from CRAN and restarted R and things are working now.

@YannLeGuen
Copy link

YannLeGuen commented Jan 9, 2022

Should an issue be opened on the Seurat package side? Seems like previous scripts are incompatible with this update when using "MAST" in some Seurat functions.

I see it has already been opened satijalab/seurat#5419

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

No branches or pull requests

4 participants