Skip to content

Error in test_classfier() #14

@rdavis7559

Description

@rdavis7559

Hello,

Thank you very much for developing this great package! I am trying to generate a classifier for detecting CD4 T cells in my data using a custom classifier I created with train_classifier(). However, I am running into issues with the test_classifier() and classify_cells() functions. I am using Seurat5 objects for this analysis as well. Any assistance would be greatly appreciated! The error output is below:

classifier_top100_logFC_cd4_test <- test_classifier(classifier = classifier_top100_logFC_cd4, test_obj = query, assay = "RNA",tag_slot = 'CD4_T_Cell')
Error in `dplyr::mutate()`:
ℹ In argument: `class = apply(...)`.
Caused by error in `if (x[1] >= thres) ...`:
! missing value where TRUE/FALSE needed
Run `rlang::last_trace()` to see where the error occurred.
Warning message:
In method$prob(modelFit = modelFit, newdata = newdata, submodels = param) :
  kernlab class probability calculations failed; returning NAs

rlang::last_trace(drop = FALSE)
<error/dplyr:::mutate_error>
Error in `dplyr::mutate()`:
ℹ In argument: `class = apply(...)`.
Caused by error in `if (x[1] >= thres) ...`:
! missing value where TRUE/FALSE needed
---
Backtrace:
     ▆
  1. ├─scAnnotatR::test_classifier(...)
  2. ├─scAnnotatR::test_classifier(...)
  3. │ └─scAnnotatR:::test_classifier_seurat(...)
  4. │   └─scAnnotatR:::test_classifier_from_mat(...)
  5. │     └─scAnnotatR:::test_performance(test_mat, classifier, test_tag)
  6. │       └─... %>% ...
  7. ├─dplyr::mutate(...)
  8. ├─dplyr:::mutate.data.frame(...)
  9. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
 10. │   ├─base::withCallingHandlers(...)
 11. │   └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
 12. │     └─mask$eval_all_mutate(quo)
 13. │       └─dplyr (local) eval()
 14. ├─base::apply(...)
 15. │ └─scAnnotatR (local) FUN(newX[, i], ...)
 16. └─base::.handleSimpleError(...)
 17.   └─dplyr (local) h(simpleError(msg, call))
 18.     └─rlang::abort(message, class = error_class, parent = parent, call = error_call)
sessionInfo()
R version 4.1.2 (2021-11-01)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8    LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

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

other attached packages:
 [1] scAnnotatR_1.0.0            tidytext_0.4.1              ggrepel_0.9.4               caret_6.0-94                lattice_0.20-45             dplyr_1.1.3                 ggpubr_0.6.0                ggsci_3.0.0                 BPCells_0.1.0              
[10] ggplot2_3.4.4               SingleCellExperiment_1.16.0 SummarizedExperiment_1.24.0 Biobase_2.54.0              GenomicRanges_1.46.1        GenomeInfoDb_1.30.1         IRanges_2.28.0              S4Vectors_0.32.4            BiocGenerics_0.40.0        
[19] MatrixGenerics_1.6.0        matrixStats_1.0.0           reticulate_1.34.0           Seurat_4.9.9.9067           SeuratObject_4.9.9.9091     sp_2.1-1                    SeuratDisk_0.0.0.9020      

loaded via a namespace (and not attached):
  [1] utf8_1.2.3                    spatstat.explore_3.2-3        tidyselect_1.2.0              RSQLite_2.3.4                 AnnotationDbi_1.56.2          htmlwidgets_1.6.2             grid_4.1.2                    Rtsne_0.16                    pROC_1.18.5                  
 [10] munsell_0.5.0                 codetools_0.2-18              ica_1.0-3                     future_1.33.0                 miniUI_0.1.1.1                withr_2.5.1                   spatstat.random_3.1-6         colorspace_2.1-0              progressr_0.14.0             
 [19] filelock_1.0.3                rstudioapi_0.15.0             ROCR_1.0-11                   ggsignif_0.6.4                tensor_1.5                    listenv_0.9.0                 GenomeInfoDbData_1.2.7        polyclip_1.10-6               bit64_4.0.5                  
 [28] parallelly_1.36.0             vctrs_0.6.4                   generics_0.1.3                ipred_0.9-14                  timechange_0.2.0              BiocFileCache_2.2.1           R6_2.5.1                      hdf5r_1.3.8                   DelayedArray_0.20.0          
 [37] bitops_1.0-7                  spatstat.utils_3.0-3          cachem_1.0.8                  promises_1.2.1                scales_1.2.1                  nnet_7.3-17                   gtable_0.3.4                  globals_0.16.2                goftest_1.2-3                
 [46] spam_2.9-1                    timeDate_4032.109             rlang_1.1.1                   splines_4.1.2                 rstatix_0.7.2                 lazyeval_0.2.2                ModelMetrics_1.2.2.2          broom_1.0.5                   spatstat.geom_3.2-5          
 [55] BiocManager_1.30.22           yaml_2.3.7                    reshape2_1.4.4                abind_1.4-5                   backports_1.4.1               httpuv_1.6.11                 tokenizers_0.3.0              tools_4.1.2                   lava_1.7.3                   
 [64] ellipsis_0.3.2                RColorBrewer_1.1-3            proxy_0.4-27                  ggridges_0.5.4                Rcpp_1.0.11                   plyr_1.8.9                    zlibbioc_1.40.0               purrr_1.0.2                   RCurl_1.98-1.13              
 [73] rpart_4.1.16                  deldir_1.0-9                  pbapply_1.7-2                 cowplot_1.1.1                 zoo_1.8-12                    cluster_2.1.2                 magrittr_2.0.3                data.table_1.14.8             RSpectra_0.16-1              
 [82] scattermore_1.2               lmtest_0.9-40                 RANN_2.6.1                    SnowballC_0.7.1               fitdistrplus_1.1-11           patchwork_1.1.3               mime_0.12                     xtable_1.8-4                  fastDummies_1.7.3            
 [91] gridExtra_2.3                 compiler_4.1.2                tibble_3.2.1                  KernSmooth_2.23-20            crayon_1.5.2                  htmltools_0.5.6.1             later_1.3.1                   tidyr_1.3.0                   lubridate_1.9.3              
[100] DBI_1.2.0                     dbplyr_2.4.0                  MASS_7.3-55                   rappdirs_0.3.3                data.tree_1.1.0               car_3.1-2                     Matrix_1.6-1.1                cli_3.6.1                     parallel_4.1.2               
[109] dotCall64_1.1-0               gower_1.0.1                   igraph_1.5.1                  pkgconfig_2.0.3               plotly_4.10.2                 spatstat.sparse_3.0-2         recipes_1.0.9                 foreach_1.5.2                 hardhat_1.3.0                
[118] XVector_0.34.0                prodlim_2023.08.28            janeaustenr_1.0.0             stringr_1.5.0                 digest_0.6.33                 sctransform_0.4.0             RcppAnnoy_0.0.21              spatstat.data_3.0-1           Biostrings_2.62.0            
[127] leiden_0.4.3                  uwot_0.1.16                   curl_5.1.0                    kernlab_0.9-32                shiny_1.7.5.1                 lifecycle_1.0.3               nlme_3.1-155                  jsonlite_1.8.7                carData_3.0-5                
[136] viridisLite_0.4.2             fansi_1.0.5                   pillar_1.9.0                  KEGGREST_1.34.0               fastmap_1.1.1                 httr_1.4.7                    survival_3.2-13               interactiveDisplayBase_1.32.0 glue_1.6.2                   
[145] png_0.1-8                     iterators_1.0.14              BiocVersion_3.14.0            bit_4.0.5                     class_7.3-20                  stringi_1.7.12                blob_1.2.4                    RcppHNSW_0.5.0                AnnotationHub_3.2.2          
[154] memoise_2.0.1                 renv_1.0.3                    e1071_1.7-14                  ape_5.7-1                     irlba_2.3.5.1                 future.apply_1.11.0  

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions