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

Unable to add QC metrics to chicken data - missing prefix #223

Open
ishwarvh opened this issue Feb 20, 2025 · 3 comments
Open

Unable to add QC metrics to chicken data - missing prefix #223

ishwarvh opened this issue Feb 20, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@ishwarvh
Copy link

Hi Sam,

I am getting the following error while trying to add QC metrics to a dual_assay_seurat_object that contains chicken gene names.

Error in Retrieve_MSigDB_Lists(species = species) : object 'prefix' not found

I noticed the Retrieve_MSigDB_Lists function is missing chicken and marmoset prefixes, I am wondering if this is the cause/solution to this issue.

# set prefix
   if (species %in% mouse_options) {
     prefix <- "Mus_musculus_"
   }
   if (species %in% human_options) {
     prefix <- "Homo_sapiens_"
   }
   if (species %in% zebrafish_options) {
     prefix <- "Dario_rerio_"
   }
   if (species %in% rat_options) {
     prefix <- "Rattus_norvegicus_"
   }
   if (species %in% drosophila_options) {
     prefix <- "Drosophila_melanogaster_"
   }
   if (species %in% macaque_options) {
     prefix <- "Macaca_mulatta_"
   }
Error message and traceback.

> dual_seu_obj <- Add_Cell_QC_Metrics(dual_seu_obj, species = 'Gallus')
• Adding Mito/Ribo Percentages to meta.data.Adding Percent Mitochondrial genes for Gallus using gene symbol pattern: .Adding Percent Ribosomal genes for Gallus using gene symbol pattern: "^RP[SL]".Adding Percent Mito+Ribo by adding Mito & Ribo percentages.Adding Cell Complexity #1 (log10GenesPerUMI) to meta.data.• Adding Cell Complexity #2 (Top 50 Percentages) to meta.data.Calculating percent expressing top 50 for layer: counts• Adding MSigDB Oxidative Phosphorylation, Apoptosis, and DNA Repair Percentages to meta.data.Error in Retrieve_MSigDB_Lists(species = species) : 
  object 'prefix' not found
> packageVersion('scCustomize')
[1] ‘3.0.1> traceback()
5: paste0(prefix, "msigdb_oxphos") at Internal_Utilities.R#644
4: Retrieve_MSigDB_Lists(species = species) at Internal_Utilities.R#1133
3: Add_MSigDB_Seurat(seurat_object = object, species = species, 
       oxphos_name = oxphos_name, apop_name = apop_name, dna_repair_name = dna_repair_name, 
       assay = assay, overwrite = overwrite, ensembl_ids = ensembl_ids) at QC_Utilities_Seurat.R#170
2: Add_Cell_QC_Metrics.Seurat(dual_seu_obj, species = "Gallus") at Generics.R#126
1: Add_Cell_QC_Metrics(dual_seu_obj, species = "Gallus")

Thank you,
Ishwar

sessionInfo() output
R version 4.4.2 (2024-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.3.1

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

time zone: America/Los_Angeles
tzcode source: internal

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

other attached packages:
 [1] hdf5r_1.3.12           future_1.34.0          dittoSeq_1.18.0        EnhancedVolcano_1.24.0
 [5] ggrepel_0.9.6          plotly_4.10.4          glmGamPoi_1.18.0       ggtree_3.14.0         
 [9] presto_1.0.0           data.table_1.16.4      Rcpp_1.0.14            clustree_0.5.1        
[13] ggraph_2.2.1           ggplot2_3.5.1          dplyr_1.1.4            scCustomize_3.0.1     
[17] SeuratWrappers_0.4.0   Seurat_5.2.1           SeuratObject_5.0.2     sp_2.2-0              
[21] Matrix_1.7-1          

loaded via a namespace (and not attached):
  [1] RcppAnnoy_0.0.22            splines_4.4.2               later_1.4.1                
  [4] ggplotify_0.1.2             tibble_3.2.1                R.oo_1.27.0                
  [7] polyclip_1.10-7             janitor_2.2.1               fastDummies_1.7.5          
 [10] lifecycle_1.0.4             globals_0.16.3              lattice_0.22-6             
 [13] MASS_7.3-61                 magrittr_2.0.3              yaml_2.3.10                
 [16] remotes_2.5.0               httpuv_1.6.15               sctransform_0.4.1          
 [19] spam_2.11-1                 spatstat.sparse_3.1-0       reticulate_1.40.0          
 [22] cowplot_1.1.3               pbapply_1.7-2               RColorBrewer_1.1-3         
 [25] lubridate_1.9.4             zlibbioc_1.52.0             abind_1.4-8                
 [28] GenomicRanges_1.58.0        Rtsne_0.17                  purrr_1.0.4                
 [31] R.utils_2.12.3              BiocGenerics_0.52.0         yulab.utils_0.2.0          
 [34] tweenr_2.0.3                GenomeInfoDbData_1.2.13     circlize_0.4.16            
 [37] IRanges_2.40.1              S4Vectors_0.44.0            irlba_2.3.5.1              
 [40] listenv_0.9.1               spatstat.utils_3.1-2        tidytree_0.4.6             
 [43] pheatmap_1.0.12             goftest_1.2-3               RSpectra_0.16-2            
 [46] spatstat.random_3.3-2       fitdistrplus_1.2-2          parallelly_1.42.0          
 [49] DelayedArray_0.32.0         codetools_0.2-20            scuttle_1.16.0             
 [52] ggforce_0.4.2               tidyselect_1.2.1            shape_1.4.6.1              
 [55] aplot_0.2.4                 UCSC.utils_1.2.0            farver_2.1.2               
 [58] viridis_0.6.5               stats4_4.4.2                matrixStats_1.5.0          
 [61] spatstat.explore_3.3-4      jsonlite_1.8.9              tidygraph_1.3.1            
 [64] progressr_0.15.1            ggridges_0.5.6              survival_3.7-0             
 [67] tools_4.4.2                 treeio_1.30.0               ica_1.0-3                  
 [70] glue_1.8.0                  SparseArray_1.6.1           gridExtra_2.3              
 [73] xfun_0.50                   MatrixGenerics_1.18.1       GenomeInfoDb_1.42.3        
 [76] withr_3.0.2                 BiocManager_1.30.25         fastmap_1.2.0              
 [79] digest_0.6.37               rsvd_1.0.5                  timechange_0.3.0           
 [82] R6_2.6.1                    mime_0.12                   gridGraphics_0.5-1         
 [85] ggprism_1.0.5               colorspace_2.1-1            scattermore_1.2            
 [88] tensor_1.5                  spatstat.data_3.1-4         R.methodsS3_1.8.2          
 [91] tidyr_1.3.1                 generics_0.1.3              renv_1.0.11                
 [94] S4Arrays_1.6.0              graphlayouts_1.2.2          httr_1.4.7                 
 [97] htmlwidgets_1.6.4           uwot_0.2.2                  pkgconfig_2.0.3            
[100] gtable_0.3.6                lmtest_0.9-40               SingleCellExperiment_1.28.1
[103] XVector_0.46.0              htmltools_0.5.8.1           dotCall64_1.2              
[106] Biobase_2.66.0              scales_1.3.0                png_0.1-8                  
[109] spatstat.univar_3.1-1       snakecase_0.11.1            ggfun_0.1.8                
[112] knitr_1.49                  rstudioapi_0.17.1           reshape2_1.4.4             
[115] nlme_3.1-166                zoo_1.8-12                  cachem_1.1.0               
[118] GlobalOptions_0.1.2         stringr_1.5.1               KernSmooth_2.23-24         
[121] parallel_4.4.2              miniUI_0.1.1.1              vipor_0.4.7                
[124] ggrastr_1.0.2               pillar_1.10.1               grid_4.4.2                 
[127] vctrs_0.6.5                 RANN_2.6.2                  promises_1.3.2             
[130] beachmat_2.22.0             xtable_1.8-4                cluster_2.1.6              
[133] beeswarm_0.4.0              paletteer_1.6.0             evaluate_1.0.3             
[136] cli_3.6.4                   compiler_4.4.2              crayon_1.5.3               
[139] rlang_1.1.5                 future.apply_1.11.3         rematch2_2.1.2             
[142] plyr_1.8.9                  forcats_1.0.0               fs_1.6.5                   
[145] ggbeeswarm_0.7.2            stringi_1.8.4               BiocParallel_1.40.0        
[148] viridisLite_0.4.2           deldir_2.0-4                munsell_0.5.1              
[151] lazyeval_0.2.2              spatstat.geom_3.3-5         RcppHNSW_0.6.0             
[154] patchwork_1.3.0             bit64_4.6.0-1               shiny_1.10.0               
[157] SummarizedExperiment_1.36.0 ROCR_1.0-11                 igraph_2.1.4               
[160] memoise_2.0.1               bit_4.5.0.1                 ape_5.8-1   

@samuel-marsh
Copy link
Owner

Hi Ishwar,

Yes apologies for this bug. I fixed it a little while back in dev branch but haven't pushed to full release yet. Installing the develop branch from GitHub should solve the issue. If not let me know and I'll reopen the issue.

Best,
Sam

@ishwarvh
Copy link
Author

Hi Sam,
Thank you for your quick reply as always.

I can add QC metrics for chicken data now, although there is still a small hitch in the process.

I see the following error if I try to add all the metrics using the unified Add_Cell_QC_Metrics() function:

cr_seu_obj <- Add_Cell_QC_Metrics(cr_seu_obj, species='Chicken', add_cell_cycle = F)
• Adding Mito/Ribo Percentages to meta.data.Adding Percent Mitochondrial genes for Chicken using gene symbol pattern:
.Adding Percent Ribosomal genes for Chicken using gene symbol pattern:
"^RP[SL]".Adding Percent Mito+Ribo by adding Mito & Ribo percentages.• Adding Cell Complexity #1 (log10GenesPerUMI) to meta.data.• Adding Cell Complexity #2 (Top 50 Percentages) to meta.data.Calculating percent expressing top 50 for layer: counts• Adding MSigDB Oxidative Phosphorylation, Apoptosis, and DNA Repair
  Percentages to meta.data.Warning: "Rat, Marmoset, Macaque, Zebrafish, Drosophila, Chicken" are not currently
supported.
ℹ No column will be added to object meta.data• Adding Hemoglobin Percentages to meta.data.Error in `Add_Hemo()`:
! No features or patterns provided for hemoglobin genes.
ℹ Please provide a default species name or pattern/features.
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
"Rat, Marmoset, Macaque, Zebrafish, Drosophila, Chicken" are not currently supported.
ℹ No column will be added to object meta.data 


> rlang::last_trace()
<error/rlang_error>
Error in `Add_Hemo()`:
! No features or patterns provided for hemoglobin genes.
ℹ Please provide a default species name or pattern/features.
---
Backtrace:
    ▆
 1. ├─scCustomize::Add_Cell_QC_Metrics(...)
 2. └─scCustomize:::Add_Cell_QC_Metrics.Seurat(...)
 3.   ├─scCustomize::Add_Hemo(...)
 4.   └─scCustomize:::Add_Hemo.Seurat(...)
Run rlang::last_trace(drop = FALSE) to see 2 hidden frames.

However, I am able to add the QC metrics if I run the individual functions, except for Add_Hemo() (I guess that is the reason for the above error)

Add_Hemocauses the following error, even when I pass a list of Hb genes using the hemo_features option:

cr_seu_obj <- Add_Hemo(cr_seu_obj, species = 'Chicken', hemo_features = Hb_genes)
Error in `lapply(text, glue_cmd, .envir = .envir)`:
! Could not evaluate cli `{}` expression: `species_use`.
Caused by error in `eval(expr, envir = envir)`:
! object 'species_use' not found
---
Backtrace:
 1. scCustomize::Add_Hemo(cr_seu_obj, species = "Chicken", hemo_features = Hb_genes)
 2. scCustomize:::Add_Hemo.Seurat(cr_seu_obj, species = "Chicken", hemo_features = Hb_genes)
 3. cli::cli_inform(message = "Adding Percent Hemoglobin for {.field {species_use}} using gene sym…
 4. rlang::inform(format_message(message, .envir = .envir), ...)
 5. message %||% ""
 6. cli::format_message(message, .envir = .envir)
 7. cli::cli_fmt((function() { …
 8. cli:::cli__rec(expr)
 9. (function() { …
10. cli::cli_bullets(message, .envir = .envir)
11. cli:::cli__message("bullets", list(text = structure(lapply(text, glue_cmd, …
12. "id" %in% names(args)
13. base::structure(lapply(text, glue_cmd, .envir = .envir), names = names(text))
14. base::lapply(text, glue_cmd, .envir = .envir)
15. local FUN(X[[i]], ...)
16. cli:::glue(str, .envir = .envir, .transformer = transformer, .cli = TRUE, …
17. (function (expr) …
18. .transformer(expr, .envir) %||% character()
19. local .transformer(expr, .envir)
20. cli:::glue(text, .envir = envir, .transformer = sys.function(), .cli = TRUE)
21. (function (expr) …
22. .transformer(expr, .envir) %||% character()
23. local .transformer(expr, .envir)
24. eval(expr, envir = envir) %??% cli_error(call. = caller, "Could not evaluate cli {.code {…
25. cli:::chain_error(expr, err, srcref = utils::getSrcref(sys.call()))
26. | base::withCallingHandlers({ …
27. base::eval(expr, envir = envir)
28. base::eval(expr, envir = envir)
29. base::.handleSimpleError(function (e) …
30. | local h(simpleError(msg, call))
31. | cli:::throw_error(err, parent = e)

Thank you,
Ishwar

@samuel-marsh
Copy link
Owner

whoops! My bad. Reopening and I'll take care of this early next week. Sorry for inconvenience!

Best,
Sam

@samuel-marsh samuel-marsh reopened this Feb 28, 2025
@samuel-marsh samuel-marsh self-assigned this Feb 28, 2025
@samuel-marsh samuel-marsh added the bug Something isn't working label Feb 28, 2025
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

2 participants