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

FindMarkers w/ MAST returns error after Seurat SCTransform, v2 regularization #6489

Closed
grhogg opened this issue Sep 30, 2022 · 23 comments
Closed
Labels
bug Something isn't working

Comments

@grhogg
Copy link

grhogg commented Sep 30, 2022

Hello,

Thank you for everything you do! Seurat is amazing!

I have been running into an error when trying to run FindMarkers on a Seurat Object with the MAST algorithm, using their newer v2 regularization pipeline. Any help would be greatly appreciated.

error is generated after calling MAST in findmarkers. Other tests like Wilcox still work fine

Error in .nextMethod(.Object = .Object, ... = ..., design = design) :
invalid name for slot of class “BayesGLMlike”: norm.method

R base 4.2.1
Seurat version 4.2
Mast version 1.22
SCTransform version 0.3.5

Example with Seurat Dataset:


library(Seurat)
library(SeuratData)
library(patchwork)
library(dplyr)
library(ggplot2)
library(MAST)

InstallData("ifnb")

# load dataset

LoadData("ifnb")

# split the dataset into a list of two seurat objects (stim and CTRL)

ifnb.list <- SplitObject(ifnb, split.by = "stim")

ctrl <- ifnb.list[["CTRL"]]
stim <- ifnb.list[["STIM"]]

ctrl <- SCTransform(ctrl, vst.flavor = "v2")
stim <- SCTransform(stim, vst.flavor = "v2") 

ifnb.list <- list(ctrl = ctrl, stim = stim)

#integrate datasets

features <- SelectIntegrationFeatures(object.list = ifnb.list, nfeatures = 3000)
ifnb.list <- PrepSCTIntegration(object.list = ifnb.list, anchor.features = features)
immune.anchors <- FindIntegrationAnchors(object.list = ifnb.list, normalization.method = "SCT",
                                         anchor.features = features)
immune.combined.sct <- IntegrateData(anchorset = immune.anchors, normalization.method = "SCT")


#assign stim conditions

immune.combined.sct$celltype.stim <- paste(immune.combined.sct$seurat_annotations, immune.combined.sct$stim,
                                           sep = "_")
Idents(immune.combined.sct) <- "celltype.stim"

#correct SCT Counts

immune.combined.sct <- PrepSCTFindMarkers(immune.combined.sct)

#find Markers with MAST algorithm

b.interferon.response <- FindMarkers(immune.combined.sct, assay = "SCT", ident.1 = "B_STIM", ident.2 = "B_CTRL",
                                      test.use = "MAST")

Error in .nextMethod(.Object = .Object, ... = ..., design = design) :
invalid name for slot of class “BayesGLMlike”: norm.method

traceback()

18: stop(sprintf(ngettext(sum(is.na(which)), "invalid name for slot of class %s: %s",
"invalid names for slots of class %s: %s"), dQuote(Class),
paste(snames[is.na(which)], collapse = ", ")), domain = NA)

17: .nextMethod(.Object = .Object, ... = ..., design = design)

16: callNextMethod()

15: .local(.Object, ...)

14: .nextMethod(.Object = .Object, ... = ...)

13: callNextMethod()

12: initialize(value, ...)

11: initialize(value, ...)

10: new(method, design = colData(sca), formula = Formula, priorVar = priorVar,
priorDOF = priorDOF, ...)

9: MAST::zlm(formula = fmla, sca = sca, ...)

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.SCTAssay(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, mean.fxn = mean.fxn, base = base,
fc.name = fc.name, densify = densify, norm.method = norm.method,
...)

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, mean.fxn = mean.fxn, base = base,
fc.name = fc.name, densify = densify, norm.method = norm.method,
...)

2: FindMarkers.Seurat(immune.combined.sct, assay = "SCT", ident.1 = "B_STIM",
ident.2 = "B_CTRL", test.use = "MAST")

1: FindMarkers(immune.combined.sct, assay = "SCT", ident.1 = "B_STIM",
ident.2 = "B_CTRL", test.use = "MAST")

sessionInfo()

_R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

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

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

other attached packages:
[1] ifnb.SeuratData_3.1.0 SeuratData_0.2.2 MAST_1.22.0
[4] SingleCellExperiment_1.18.0 SummarizedExperiment_1.26.1 Biobase_2.56.0
[7] GenomicRanges_1.48.0 GenomeInfoDb_1.32.4 IRanges_2.30.1
[10] S4Vectors_0.34.0 BiocGenerics_0.42.0 MatrixGenerics_1.8.1
[13] matrixStats_0.62.0 ggplot2_3.3.6 dplyr_1.0.10
[16] patchwork_1.1.2 sp_1.5-0 SeuratObject_4.1.2
[19] Seurat_4.2.0

loaded via a namespace (and not attached):
[1] plyr_1.8.7 igraph_1.3.5 lazyeval_0.2.2 splines_4.2.1
[5] listenv_0.8.0 scattermore_0.8 usethis_2.1.6 digest_0.6.29
[9] htmltools_0.5.3 fansi_1.0.3 magrittr_2.0.3 memoise_2.0.1
[13] tensor_1.5 cluster_2.1.3 ROCR_1.0-11 remotes_2.4.2
[17] globals_0.16.1 spatstat.sparse_2.1-1 prettyunits_1.1.1 colorspace_2.0-3
[21] rappdirs_0.3.3 ggrepel_0.9.1 xfun_0.33 RCurl_1.98-1.8
[25] callr_3.7.2 crayon_1.5.2 jsonlite_1.8.0 progressr_0.11.0
[29] spatstat.data_2.2-0 survival_3.3-1 zoo_1.8-11 glue_1.6.2
[33] polyclip_1.10-0 gtable_0.3.1 zlibbioc_1.42.0 XVector_0.36.0
[37] leiden_0.4.3 DelayedArray_0.22.0 pkgbuild_1.3.1 future.apply_1.9.1
[41] abind_1.4-5 scales_1.2.1 DBI_1.1.3 spatstat.random_2.2-0
[45] miniUI_0.1.1.1 Rcpp_1.0.9 viridisLite_0.4.1 xtable_1.8-4
[49] reticulate_1.26 spatstat.core_2.4-4 profvis_0.3.7 htmlwidgets_1.5.4
[53] httr_1.4.4 RColorBrewer_1.1-3 ellipsis_0.3.2 ica_1.0-3
[57] urlchecker_1.0.1 pkgconfig_2.0.3 uwot_0.1.14 deldir_1.0-6
[61] utf8_1.2.2 tidyselect_1.1.2 rlang_1.0.6 reshape2_1.4.4
[65] later_1.3.0 munsell_0.5.0 tools_4.2.1 cachem_1.0.6
[69] cli_3.4.1 generics_0.1.3 devtools_2.4.4 ggridges_0.5.4
[73] evaluate_0.16 stringr_1.4.1 fastmap_1.1.0 yaml_2.3.5
[77] goftest_1.2-3 processx_3.7.0 knitr_1.40 fs_1.5.2
[81] fitdistrplus_1.1-8 purrr_0.3.4 RANN_2.6.1 sparseMatrixStats_1.8.0
[85] pbapply_1.5-0 future_1.28.0 nlme_3.1-157 mime_0.12
[89] compiler_4.2.1 rstudioapi_0.14 plotly_4.10.0 curl_4.3.2
[93] png_0.1-7 spatstat.utils_2.3-1 tibble_3.1.8 glmGamPoi_1.8.0
[97] stringi_1.7.8 ps_1.7.1 rgeos_0.5-9 lattice_0.20-45
[101] Matrix_1.5-1 vctrs_0.4.2 pillar_1.8.1 lifecycle_1.0.2
[105] spatstat.geom_2.4-0 lmtest_0.9-40 RcppAnnoy_0.0.19 bitops_1.0-7
[109] data.table_1.14.2 cowplot_1.1.1 irlba_2.3.5 httpuv_1.6.6
[113] R6_2.5.1 promises_1.2.0.1 KernSmooth_2.23-20 gridExtra_2.3
[117] parallelly_1.32.1 sessioninfo_1.2.2 codetools_0.2-18 MASS_7.3-57
[121] assertthat_0.2.1 pkgload_1.3.0 rprojroot_2.0.3 withr_2.5.0
[125] sctransform_0.3.5 GenomeInfoDbData_1.2.8 mgcv_1.8-40 parallel_4.2.1
[129] grid_4.2.1 rpart_4.1.16 tidyr_1.2.1 DelayedMatrixStats_1.18.1
[133] rmarkdown_2.16 Rtsne_0.16 shiny_1.7.2_

@AmyRossi
Copy link

Having this same issue!
Have you found any solution?

@grhogg
Copy link
Author

grhogg commented Oct 14, 2022

Sorry, no solution on my end. Hoping maybe the bug fix will be incorporated in the next Seurat release?

@lucygarner
Copy link

Same issue for me too!

@AmyRossi
Copy link

It used to run fine for me with the SCT v2 data. I definitely think there's something up on the Seurat end because I also get a warning (not error though so it still runs) about norm.method not being used when I run other tests, even though I don't supply norm.method in my code.
I haven't tried this but maybe installing an earlier version of Seurat would work?

@grhogg
Copy link
Author

grhogg commented Oct 18, 2022

Hi @AmyRossi , Do you recall which version of Seurat you used successfully run SCT v2 + MAST ? Thanks!

@AmyRossi
Copy link

@grhogg It looks like the latest release was back in May but I've definitely successfully run it as recent as mid-September ... Unfortunately, I don't know if I just hadn't updated my Seurat at that point ? Do you know if there's a way for me to figure out the last time I updated it? I don't understand enough about packages to troubleshoot where the apparently-new issue stems from...

@AmyRossi
Copy link

Ohh nevermind, it looks like 4.2 was pushed out on 09-20-22? If I'm looking in the right place this time? So I must've used the version prior to this one when it worked

@grhogg
Copy link
Author

grhogg commented Oct 18, 2022

Awesome! That is extremely helpful. I will try with the previous version, and let you know if it works :)

@MadsE10
Copy link

MadsE10 commented Nov 1, 2022

I had the same error and installing an older version of Seurat resolved it for me.

I previously had Seurat 4.2, but installed Seurat 4.1.1 then everything began to work normally again.

#just to check what version you are actually using
packageVersion('Seurat')

library(remotes)

remotes::install_version("Seurat", version = "4.1.1")

@AmyRossi
Copy link

AmyRossi commented Nov 1, 2022

Awesome, thank you @MadsE10 !

@maxc2020
Copy link

I'm having this problem... has anyone found another solution? I've changed Seurat versions a few times, to to v4.1.1 and now to Dev, but those changes didn't help. All packages up to date and FindMarkers works if I use a different method OR change assay to RNA.... but I want to use MAST on SCTv2-normalized data, if at all possible.

FindMarkers(Obj, test.use = "MAST", assay = "SCT", slot = "data", recorrect_umi = FALSE, ident.1 = "Type1", ident.2 = "Type2", min.pct = 0.1, min.diff.pct = 0.1, only.pos = FALSE, verbose = T)
Error in .nextMethod(.Object = .Object, ... = ..., design = design) : 
  invalid name for slot of class “BayesGLMlike”: norm.method

If I add norm.method parameter to above FindMarkers command, this error is returned:

Error in .nextMethod(.Object = .Object, ... = ..., design = design) : 
  duplicated slot names: ‘norm.method’

So it seems that there is an error with how Seurat's FindMarkers function is interacting with MAST.

Many thanks for any advice on how to proceed.

Session Info:

R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-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.24.1                 parallelly_1.34.0           future_1.30.0               openxlsx_4.2.5.1           
 [5] Matrix_1.5-3                ggplot2_3.4.0               dplyr_1.1.0                 patchwork_1.1.2            
 [9] cowplot_1.1.1               harmony_0.1.1               Rcpp_1.0.10                 batchelor_1.14.1           
[13] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0 Biobase_2.58.0              GenomicRanges_1.50.2       
[17] GenomeInfoDb_1.34.7         IRanges_2.32.0              S4Vectors_0.36.1            BiocGenerics_0.44.0        
[21] MatrixGenerics_1.10.0       matrixStats_0.63.0          SeuratWrappers_0.3.1        sctransform_0.3.5.9002     
[25] SeuratObject_4.1.3          Seurat_4.3.0.9001          

loaded via a namespace (and not attached):
  [1] plyr_1.8.8                igraph_1.3.5              lazyeval_0.2.2            sp_1.6-0                 
  [5] splines_4.2.2             BiocParallel_1.32.5       listenv_0.9.0             scattermore_0.8          
  [9] digest_0.6.31             htmltools_0.5.4           fansi_1.0.4               magrittr_2.0.3           
 [13] ScaledMatrix_1.6.0        tensor_1.5                cluster_2.1.4             ROCR_1.0-11              
 [17] remotes_2.4.2             globals_0.16.2            R.utils_2.12.2            spatstat.sparse_3.0-0    
 [21] prettyunits_1.1.1         colorspace_2.1-0          ggrepel_0.9.2             crayon_1.5.2             
 [25] callr_3.7.3               RCurl_1.98-1.10           jsonlite_1.8.4            progressr_0.13.0         
 [29] spatstat.data_3.0-0       survival_3.5-0            zoo_1.8-11                glue_1.6.2               
 [33] polyclip_1.10-4           gtable_0.3.1              zlibbioc_1.44.0           XVector_0.38.0           
 [37] leiden_0.4.3              DelayedArray_0.24.0       pkgbuild_1.4.0            BiocSingular_1.14.0      
 [41] future.apply_1.10.0       abind_1.4-5               scales_1.2.1              DBI_1.1.3                
 [45] spatstat.random_3.1-3     miniUI_0.1.1.1            viridisLite_0.4.1         xtable_1.8-4             
 [49] reticulate_1.28           rsvd_1.0.5                ResidualMatrix_1.8.0      htmlwidgets_1.6.1        
 [53] httr_1.4.4                RColorBrewer_1.1-3        ellipsis_0.3.2            ica_1.0-3                
 [57] farver_2.1.1              pkgconfig_2.0.3           R.methodsS3_1.8.2         scuttle_1.8.4            
 [61] uwot_0.1.14               deldir_1.0-6              utf8_1.2.3                labeling_0.4.2           
 [65] tidyselect_1.2.0          rlang_1.0.6               reshape2_1.4.4            later_1.3.0              
 [69] munsell_0.5.0             tools_4.2.2               cli_3.6.0                 generics_0.1.3           
 [73] ggridges_0.5.4            stringr_1.5.0             fastmap_1.1.0             goftest_1.2-3            
 [77] processx_3.8.0            fitdistrplus_1.1-8        zip_2.2.2                 purrr_1.0.1              
 [81] RANN_2.6.1                pbapply_1.7-0             nlme_3.1-162              sparseMatrixStats_1.10.0 
 [85] mime_0.12                 R.oo_1.25.0               compiler_4.2.2            rstudioapi_0.14          
 [89] curl_5.0.0                plotly_4.10.1             png_0.1-8                 spatstat.utils_3.0-1     
 [93] tibble_3.1.8              stringi_1.7.12            ps_1.7.2                  desc_1.4.2               
 [97] lattice_0.20-45           vctrs_0.5.2               pillar_1.8.1              lifecycle_1.0.3          
[101] BiocManager_1.30.19       spatstat.geom_3.0-6       lmtest_0.9-40             RcppAnnoy_0.0.20         
[105] BiocNeighbors_1.16.0      data.table_1.14.6         bitops_1.0-7              irlba_2.3.5.1            
[109] httpuv_1.6.8              R6_2.5.1                  promises_1.2.0.1          KernSmooth_2.23-20       
[113] gridExtra_2.3             codetools_0.2-18          MASS_7.3-58.2             rprojroot_2.0.3          
[117] withr_2.5.0               GenomeInfoDbData_1.2.9    parallel_4.2.2            grid_4.2.2               
[121] beachmat_2.14.0           tidyr_1.3.0               DelayedMatrixStats_1.20.0 Rtsne_0.16               
[125] spatstat.explore_3.0-6    shiny_1.7.4              

@maxc2020
Copy link

Any updates or assistance available on this issue? Many thanks.

@weixiao1991
Copy link

Norm.method pamameter is not valid. I have changed the R script for this. Please see https://github.com/weixiao1991/seurat.

@maxc2020
Copy link

Hi Weixiao1991. Thank you for helping. I tried again today with Development version and also with a clean installation of Seurat version 4.3.0 from CRAN, but the issue persists. Any idea what is going on?

Note that my object is a subset of the initial integration. However I am able to run FindMarkers with the default test, and can convert my Seurat object to an SCE object to run with MAST. But it would be much preferable to run directly via Seurat for a variety of reasons.

Seurat_DE <- FindMarkers(Object, ident.1 = "Celltype1", ident.2 = "Celltype2", test.use = "MAST", assay = "SCT", slot = "data", recorrect_umi = F, min.pct = 0.5, min.diff.pct = 0.5, only.pos = T, verbose = T)

results in:

Error in .nextMethod(.Object = .Object, ... = ..., design = design) : 
  invalid name for slot of class “BayesGLMlike”: norm.method

Session Info:

R version 4.2.2 (2022-10-31)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.2.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2-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] dittoSeq_1.10.0             Matrix_1.5-3                MAST_1.24.1                
 [4] harmony_0.1.1               Rcpp_1.0.10                 batchelor_1.14.1           
 [7] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0 Biobase_2.58.0             
[10] GenomicRanges_1.50.2        GenomeInfoDb_1.34.9         IRanges_2.32.0             
[13] S4Vectors_0.36.1            BiocGenerics_0.44.0         MatrixGenerics_1.10.0      
[16] matrixStats_0.63.0          SeuratWrappers_0.3.1        sctransform_0.3.5.9002     
[19] parallelly_1.34.0           future_1.31.0               openxlsx_4.2.5.2           
[22] RColorBrewer_1.1-3          patchwork_1.1.2             circlize_0.4.16            
[25] lubridate_1.9.2             forcats_1.0.0               stringr_1.5.0              
[28] dplyr_1.1.0                 purrr_1.0.1                 readr_2.1.4                
[31] tidyr_1.3.0                 tibble_3.1.8                ggplot2_3.4.1              
[34] tidyverse_2.0.0             cowplot_1.1.1               nichenetr_1.1.1            
[37] SeuratObject_4.1.3          Seurat_4.3.0               

loaded via a namespace (and not attached):
  [1] scattermore_0.8           ModelMetrics_1.2.2.2      R.methodsS3_1.8.2        
  [4] knitr_1.42                irlba_2.3.5.1             DelayedArray_0.24.0      
  [7] R.utils_2.12.2            data.table_1.14.8         rpart_4.1.19             
 [10] hardhat_1.2.0             RCurl_1.98-1.10           doParallel_1.0.17        
 [13] generics_0.1.3            ScaledMatrix_1.6.0        callr_3.7.3              
 [16] usethis_2.1.6             RANN_2.6.1                proxy_0.4-27             
 [19] DiagrammeR_1.0.9          tzdb_0.3.0                spatstat.data_3.0-0      
 [22] httpuv_1.6.9              gower_1.0.1               xfun_0.37                
 [25] hms_1.1.2                 promises_1.2.0.1          fansi_1.0.4              
 [28] caTools_1.18.2            igraph_1.4.0              DBI_1.1.3                
 [31] htmlwidgets_1.6.1         spatstat.geom_3.0-6       ellipsis_0.3.2           
 [34] backports_1.4.1           deldir_1.0-6              sparseMatrixStats_1.10.0 
 [37] vctrs_0.5.2               remotes_2.4.2             ROCR_1.0-11              
 [40] abind_1.4-5               caret_6.0-93              cachem_1.0.6             
 [43] withr_2.5.0               progressr_0.13.0          checkmate_2.1.0          
 [46] fdrtool_1.2.17            prettyunits_1.1.1         goftest_1.2-3            
 [49] cluster_2.1.4             lazyeval_0.2.2            crayon_1.5.2             
 [52] spatstat.explore_3.0-6    recipes_1.0.5             pkgconfig_2.0.3          
 [55] nlme_3.1-162              pkgload_1.3.2             nnet_7.3-18              
 [58] devtools_2.4.5            rlang_1.0.6               globals_0.16.2           
 [61] lifecycle_1.0.3           miniUI_0.1.1.1            rsvd_1.0.5               
 [64] randomForest_4.7-1.1      polyclip_1.10-4           lmtest_0.9-40            
 [67] zoo_1.8-11                base64enc_0.1-3           pheatmap_1.0.12          
 [70] ggridges_0.5.4            GlobalOptions_0.1.2       processx_3.8.0           
 [73] png_0.1-8                 viridisLite_0.4.1         rjson_0.2.21             
 [76] bitops_1.0-7              R.oo_1.25.0               KernSmooth_2.23-20       
 [79] visNetwork_2.1.2          pROC_1.18.0               DelayedMatrixStats_1.20.0
 [82] shape_1.4.6               spatstat.random_3.1-3     jpeg_0.1-10              
 [85] beachmat_2.14.0           scales_1.2.1              memoise_2.0.1            
 [88] magrittr_2.0.3            plyr_1.8.8                ica_1.0-3                
 [91] zlibbioc_1.44.0           compiler_4.2.2            clue_0.3-64              
 [94] fitdistrplus_1.1-8        cli_3.6.0                 XVector_0.38.0           
 [97] urlchecker_1.0.1          listenv_0.9.0             pbapply_1.7-0            
[100] ps_1.7.2                  htmlTable_2.4.1           Formula_1.2-4            
[103] MASS_7.3-58.2             tidyselect_1.2.0          stringi_1.7.12           
[106] BiocSingular_1.14.0       latticeExtra_0.6-30       ggrepel_0.9.3            
[109] grid_4.2.2                tools_4.2.2               timechange_0.2.0         
[112] future.apply_1.10.0       parallel_4.2.2            rstudioapi_0.14          
[115] foreach_1.5.2             foreign_0.8-84            gridExtra_2.3            
[118] prodlim_2019.11.13        Rtsne_0.16                digest_0.6.31            
[121] BiocManager_1.30.19       shiny_1.7.4               lava_1.7.1               
[124] scuttle_1.8.4             later_1.3.0               RcppAnnoy_0.0.20         
[127] httr_1.4.4                ComplexHeatmap_2.14.0     colorspace_2.1-0         
[130] fs_1.6.1                  tensor_1.5                reticulate_1.28          
[133] splines_4.2.2             uwot_0.1.14               spatstat.utils_3.0-1     
[136] sp_1.6-0                  plotly_4.10.1             sessioninfo_1.2.2        
[139] xtable_1.8-4              jsonlite_1.8.4            timeDate_4022.108        
[142] ipred_0.9-13              R6_2.5.1                  profvis_0.3.7            
[145] Hmisc_4.8-0               pillar_1.8.1              htmltools_0.5.4          
[148] mime_0.12                 glue_1.6.2                fastmap_1.1.0            
[151] BiocParallel_1.32.5       BiocNeighbors_1.16.0      class_7.3-21             
[154] codetools_0.2-19          pkgbuild_1.4.0            utf8_1.2.3               
[157] lattice_0.20-45           spatstat.sparse_3.0-0     ResidualMatrix_1.8.0     
[160] leiden_0.4.3              zip_2.2.2                 interp_1.1-3             
[163] survival_3.5-3            limma_3.54.1              munsell_0.5.0            
[166] e1071_1.7-13              GetoptLong_1.0.5          GenomeInfoDbData_1.2.9   
[169] iterators_1.0.14          reshape2_1.4.4            gtable_0.3.1           

@weixiao1991
Copy link

Hi.
The most important question is the "SCT".
The original R code have a progress to check norm.method used in the data, however if you used "SCT", the output will be "SCT". But "SCT" can not be recoginzed in the later progress.
Then in the mean.fxn code paragraph, if the output of norm.method is "SCT
", here will not run longer.
So I deleter the norm.method parameter, delete the check norm.method code.
As SCT used Log1p, I set the mean.fxn to LogNormlize directly.
You can install my version to try.

@nvribeiro
Copy link

nvribeiro commented Mar 2, 2023

Hi all!

I had the same error when trying to use the function with SCT data. What works for me is to start from the RNA assay and raw counts and normalize using NormalizeData instead of SCT.

DefaultAssay(obj) <- 'RNA'
obj <- NormalizeData(obj)
FindMarkers(obj, ident.1 = ... , ident.2 = ..., test.use = 'MAST')

It runs smoothly for me.
I believe this is an incompatibility between the output of SCT scaled data and the scaled data input required by MAST.

EDIT:
sessionInfo()

R version 4.2.1 (2022-06-23)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3

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

other attached packages:
 [1] MAST_1.24.1                 SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0
 [4] Biobase_2.58.0              GenomicRanges_1.50.2        GenomeInfoDb_1.34.9        
 [7] IRanges_2.32.0              S4Vectors_0.36.1            BiocGenerics_0.44.0        
[10] MatrixGenerics_1.10.0       matrixStats_0.63.0          SeuratDisk_0.0.0.9020      
[13] forcats_1.0.0               stringr_1.5.0               dplyr_1.1.0                
[16] purrr_1.0.1                 readr_2.1.4                 tidyr_1.3.0                
[19] tibble_3.1.8                ggplot2_3.4.1               tidyverse_1.3.2            
[22] SeuratObject_4.1.3          Seurat_4.3.0               

loaded via a namespace (and not attached):
  [1] utf8_1.2.3             spatstat.explore_3.0-6 reticulate_1.28       
  [4] tidyselect_1.2.0       RSQLite_2.3.0          AnnotationDbi_1.60.0  
  [7] htmlwidgets_1.6.1      grid_4.2.1             BiocParallel_1.32.5   
 [10] Rtsne_0.16             scatterpie_0.1.8       munsell_0.5.0         
 [13] codetools_0.2-19       ica_1.0-3              future_1.31.0         
 [16] miniUI_0.1.1.1         withr_2.5.0            spatstat.random_3.1-3 
 [19] colorspace_2.1-0       GOSemSim_2.24.0        progressr_0.13.0      
 [22] rstudioapi_0.14        ROCR_1.0-11            tensor_1.5            
 [25] DOSE_3.24.2            listenv_0.9.0          labeling_0.4.2        
 [28] GenomeInfoDbData_1.2.9 polyclip_1.10-4        bit64_4.0.5           
 [31] farver_2.1.1           downloader_0.4         treeio_1.22.0         
 [34] parallelly_1.34.0      vctrs_0.5.2            generics_0.1.3        
 [37] gson_0.0.9             timechange_0.2.0       R6_2.5.1              
 [40] graphlayouts_0.8.4     hdf5r_1.3.8            DelayedArray_0.24.0   
 [43] gridGraphics_0.5-1     bitops_1.0-7           spatstat.utils_3.0-1  
 [46] cachem_1.0.6           fgsea_1.24.0           assertthat_0.2.1      
 [49] promises_1.2.0.1       scales_1.2.1           ggraph_2.1.0          
 [52] enrichplot_1.18.3      googlesheets4_1.0.1    gtable_0.3.1          
 [55] globals_0.16.2         goftest_1.2-3          tidygraph_1.2.3       
 [58] rlang_1.0.6            splines_4.2.1          lazyeval_0.2.2        
 [61] gargle_1.3.0           spatstat.geom_3.0-6    broom_1.0.3           
 [64] reshape2_1.4.4         abind_1.4-5            modelr_0.1.10         
 [67] backports_1.4.1        httpuv_1.6.9           qvalue_2.30.0         
 [70] clusterProfiler_4.6.0  tools_4.2.1            ggplotify_0.1.0       
 [73] ellipsis_0.3.2         RColorBrewer_1.1-3     ggridges_0.5.4        
 [76] Rcpp_1.0.10            plyr_1.8.8             zlibbioc_1.44.0       
 [79] RCurl_1.98-1.10        deldir_1.0-6           viridis_0.6.2         
 [82] pbapply_1.7-0          cowplot_1.1.1          zoo_1.8-11            
 [85] haven_2.5.1            ggrepel_0.9.3          cluster_2.1.4         
 [88] fs_1.6.1               magrittr_2.0.3         data.table_1.14.8     
 [91] scattermore_0.8        lmtest_0.9-40          reprex_2.0.2          
 [94] RANN_2.6.1             googledrive_2.0.0      fitdistrplus_1.1-8    
 [97] hms_1.1.2              patchwork_1.1.2        mime_0.12             
[100] xtable_1.8-4           HDO.db_0.99.1          readxl_1.4.2          
[103] gridExtra_2.3          compiler_4.2.1         shadowtext_0.1.2      
[106] KernSmooth_2.23-20     crayon_1.5.2           htmltools_0.5.4       
[109] ggfun_0.0.9            later_1.3.0            tzdb_0.3.0            
[112] aplot_0.1.9            lubridate_1.9.2        DBI_1.1.3             
[115] tweenr_2.0.2           dbplyr_2.3.0           MASS_7.3-58.2         
[118] Matrix_1.5-3           cli_3.6.0              parallel_4.2.1        
[121] igraph_1.4.0           pkgconfig_2.0.3        sp_1.6-0              
[124] plotly_4.10.1          spatstat.sparse_3.0-0  xml2_1.3.3            
[127] ggtree_3.6.2           XVector_0.38.0         rvest_1.0.3           
[130] yulab.utils_0.0.6      digest_0.6.31          sctransform_0.3.5     
[133] RcppAnnoy_0.0.20       spatstat.data_3.0-0    Biostrings_2.66.0     
[136] cellranger_1.1.0       leiden_0.4.3           fastmatch_1.1-3       
[139] tidytree_0.4.2         uwot_0.1.14            shiny_1.7.4           
[142] lifecycle_1.0.3        nlme_3.1-162           jsonlite_1.8.4        
[145] viridisLite_0.4.1      fansi_1.0.4            pillar_1.8.1          
[148] lattice_0.20-45        KEGGREST_1.38.0        fastmap_1.1.0         
[151] httr_1.4.4             survival_3.5-3         GO.db_3.16.0          
[154] glue_1.6.2             png_0.1-8              bit_4.0.5             
[157] ggforce_0.4.1          stringi_1.7.12         blob_1.2.3            
[160] memoise_2.0.1          ape_5.7                irlba_2.3.5.1         
[163] future.apply_1.10.0

@daniannr
Copy link

daniannr commented Mar 3, 2023

Hi. The most important question is the "SCT". The original R code have a progress to check norm.method used in the data, however if you used "SCT", the output will be "SCT". But "SCT" can not be recoginzed in the later progress. Then in the mean.fxn code paragraph, if the output of norm.method is "SCT ", here will not run longer. So I deleter the norm.method parameter, delete the check norm.method code. As SCT used Log1p, I set the mean.fxn to LogNormlize directly. You can install my version to try.

Hi @weixiao1991,
I updated the package and still got an error when I use "SCT" for FindAllMarkers using the "MAST" test.use. Error looks like this:
Warning: No DE genes identified Warning: The following tests were not performed: Warning: When testing 0 versus all: invalid name for slot of class “BayesGLMlike”: norm.method

I'm trying to run it on integrated data and I made sure to run PrepSCTFindMarkers before that. Does this mean we can't use "SCT" for this function and test.use? Do you recommend using any other methods?

@weixiao1991
Copy link

  1. Intergrated data can not be used to find maerkers. Other issues have informed.
  2. I don't think SCT data can't be used to do that. I prefer to consider it's a bug.
  3. You can install my version to ues MAST for SCT transformed data. It will be ok.

@lopes36363
Copy link

If you delete SCT.model list from the seurat object, it suddenly works. I could remove it by:

sne[["LOL"]] <- CreateAssayObject(counts = GetAssayData(sne, assay="SCT", slot="data")) #Copy "SCT data" to "LOL counts" and "LOL data"
sne <- SetAssayData(sne, assay = "LOL", slot = "scale.data", new.data = GetAssayData(sne, assay="SCT", slot="scale.data")); gc() #"Copy "SCT scale.data" to "LOL scale.data"
DefaultAssay(sne) <- "LOL"
sne <- DietSeurat(sne, assays = "LOL", counts=T, data=T, scale.data=T)
sne <- RenameAssays(sne, LOL = 'SCT')

@nvribeiro
Copy link

Does anyone know if this bug was fixed in Seurat v5?

@grhogg
Copy link
Author

grhogg commented Mar 30, 2023

This bug was fixed with the most recent push of MAST. Download mast directly from GitHub, not from bioconductor.

@nvribeiro
Copy link

Oh, thanks a lot! :)

@dimitrisokolowskei
Copy link

Hi,

I was having the same issue while trying to run MAST using a SCT normalized assay. I managed to solve it by using what was described by @nvribeiro.

@saketkc saketkc closed this as completed Jun 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests