nichenetr icon indicating copy to clipboard operation
nichenetr copied to clipboard

Warning message in `predict_ligand_activities`

Open csangara opened this issue 1 year ago • 3 comments

When the regulatory potential of all genes in the gene set of interest is zero (for a certain ligand), this warning pops up:

Warning messages:
1: In evaluate_target_prediction(setting, ligand_target_matrix, ligands_position) :
all target gene probability score predictions have same value
2: In cor(prediction, response) : the standard deviation is zero
3: In cor(prediction, response, method = "s") :
the standard deviation is zero

In that case, the ligand should be removed from the output dataframe, along with a message to the user informing that the ligand has been removed.

csangara avatar May 30 '24 14:05 csangara

Hello there, When I run the function predict_ligand_activities with the following code:

ligand_activities <- predict_ligand_activities(geneset = geneset_oi,
                                               background_expressed_genes = background_expressed_genes,
                                               ligand_target_matrix = ligand_target_matrix,
                                               potential_ligands = potential_ligands)

There were some Warning messages and Error messages:

Warning message in evaluate_target_prediction(setting, ligand_target_matrix, ligands_position):
“all target gene probability score predictions have same value”
Warning message in cor(prediction, response):
“Standard deviation is zero”
Warning message in cor(prediction, response, method = "s"):
“Standard deviation is zero”
Error in if (cor_p_pval < min_pval) {: missing value where TRUE/FALSE needed
Traceback:

1. predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, 
 .     ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands)
2. settings_ligand_prediction %>% lapply(get_single_ligand_importances, 
 .     ligand_target_matrix = ligand_target_matrix, known = FALSE) %>% 
 .     bind_rows()
3. bind_rows(.)
4. list2(...)
5. lapply(., get_single_ligand_importances, ligand_target_matrix = ligand_target_matrix, 
 .     known = FALSE)
6. FUN(X[[i]], ...)
7. evaluate_target_prediction(setting, ligand_target_matrix, ligands_position)
8. evaluate_target_prediction_strict(response_vector, prediction_vector, 
 .     is.double(prediction_vector))
9. classification_evaluation_continuous_pred(prediction_vector, 
 .     response_vector)

Is the Error message related to this enhancement ? How can I fix it ?

Best wishes Wang

R version 4.2.3 (2023-03-15)
Platform: x86_64-conda-linux-gnu (64-bit)
Running under: CentOS Linux 7 (Core)

locale:
 [1] LC_CTYPE=zh_CN.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=zh_CN.UTF-8        LC_COLLATE=zh_CN.UTF-8    
 [5] LC_MONETARY=zh_CN.UTF-8    LC_MESSAGES=zh_CN.UTF-8   
 [7] LC_PAPER=zh_CN.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C       

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

other attached packages:
 [1] nichenetr_2.2.0             CellChat_1.6.1             
 [3] igraph_1.5.0.1              scDblFinder_1.12.0         
 [5] SoupX_1.6.2                 forcats_1.0.0              
 [7] stringr_1.5.0               dplyr_1.1.2                
 [9] purrr_1.0.1                 readr_2.1.4                
[11] tidyr_1.3.0                 tibble_3.2.1               
[13] tidyverse_1.3.1             DESeq2_1.38.0              
[15] scater_1.26.1               scuttle_1.8.0              
[17] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0
[19] Biobase_2.58.0              GenomicRanges_1.50.0       
[21] GenomeInfoDb_1.34.9         IRanges_2.32.0             
[23] S4Vectors_0.36.0            BiocGenerics_0.44.0        
[25] MatrixGenerics_1.10.0       matrixStats_0.63.0         
[27] ggpubr_0.6.0                ggplot2_3.4.2              
[29] presto_1.0.0                data.table_1.14.8          
[31] harmony_0.1.1               Rcpp_1.0.11                
[33] SeuratObject_4.1.4          Seurat_4.4.0               

loaded via a namespace (and not attached):
  [1] statnet.common_4.9.0      rsvd_1.0.5               
  [3] Hmisc_5.2-1               ica_1.0-3                
  [5] svglite_2.1.1             class_7.3-21             
  [7] Rsamtools_2.14.0          foreach_1.5.2            
  [9] lmtest_0.9-40             crayon_1.5.2             
 [11] MASS_7.3-58.3             nlme_3.1-162             
 [13] backports_1.4.1           reprex_2.0.2             
 [15] rlang_1.1.1               caret_6.0-93             
 [17] XVector_0.38.0            ROCR_1.0-11              
 [19] readxl_1.4.2              irlba_2.3.5.1            
 [21] limma_3.54.0              xgboost_1.6.0.1          
 [23] BiocParallel_1.32.5       rjson_0.2.21             
 [25] bit64_4.0.5               glue_1.6.2               
 [27] rngtools_1.5.2            sctransform_0.4.1        
 [29] parallel_4.2.3            vipor_0.4.5              
 [31] spatstat.sparse_3.0-1     AnnotationDbi_1.60.0     
 [33] spatstat.geom_3.1-0       haven_2.5.2              
 [35] tidyselect_1.2.0          fitdistrplus_1.1-8       
 [37] XML_3.99-0.14             zoo_1.8-12               
 [39] GenomicAlignments_1.34.0  xtable_1.8-4             
 [41] ggnetwork_0.5.12          magrittr_2.0.3           
 [43] evaluate_0.21             cli_3.6.1                
 [45] zlibbioc_1.44.0           rstudioapi_0.14          
 [47] miniUI_0.1.1.1            sp_1.6-0                 
 [49] rpart_4.1.19              shiny_1.7.4              
 [51] xfun_0.49                 BiocSingular_1.14.0      
 [53] clue_0.3-64               cluster_2.1.4            
 [55] caTools_1.18.2            pbdZMQ_0.3-8             
 [57] KEGGREST_1.38.0           ggrepel_0.9.6            
 [59] listenv_0.9.0             Biostrings_2.66.0        
 [61] png_0.1-8                 future_1.33.2            
 [63] ipred_0.9-14              withr_2.5.0              
 [65] ggforce_0.4.1             bitops_1.0-7             
 [67] plyr_1.8.8                cellranger_1.1.0         
 [69] hardhat_1.4.0             e1071_1.7-13             
 [71] pROC_1.18.0               dqrng_0.3.0              
 [73] coda_0.19-4               pillar_1.9.0             
 [75] GlobalOptions_0.1.2       cachem_1.0.7             
 [77] fs_1.6.3                  GetoptLong_1.0.5         
 [79] DelayedMatrixStats_1.20.0 vctrs_0.6.3              
 [81] ellipsis_0.3.2            generics_0.1.3           
 [83] lava_1.7.2.1              NMF_0.26                 
 [85] tools_4.2.3               foreign_0.8-84           
 [87] beeswarm_0.4.0            tweenr_2.0.2             
 [89] munsell_0.5.0             proxy_0.4-27             
 [91] DelayedArray_0.24.0       fastmap_1.1.1            
 [93] compiler_4.2.3            abind_1.4-5              
 [95] httpuv_1.6.9              rtracklayer_1.58.0       
 [97] plotly_4.10.1             prodlim_2019.11.13       
 [99] GenomeInfoDbData_1.2.9    gridExtra_2.3            
[101] edgeR_3.40.1              ggnewscale_0.4.9         
[103] lattice_0.20-45           deldir_1.0-6             
[105] visNetwork_2.1.2          utf8_1.2.3               
[107] later_1.4.1               recipes_1.0.5            
[109] jsonlite_1.8.7            scales_1.2.1             
[111] ScaledMatrix_1.6.0        pbapply_1.7-2            
[113] carData_3.0-5             sparseMatrixStats_1.10.0 
[115] genefilter_1.80.0         lazyeval_0.2.2           
[117] promises_1.3.2            car_3.1-2                
[119] doParallel_1.0.17         goftest_1.2-3            
[121] checkmate_2.1.0           spatstat.utils_3.1-1     
[123] reticulate_1.39.0         sna_2.7-1                
[125] rmarkdown_2.20            cowplot_1.1.1            
[127] statmod_1.5.0             Rtsne_0.16               
[129] uwot_0.1.14               survival_3.5-5           
[131] yaml_2.3.7                systemfonts_1.0.4        
[133] htmltools_0.5.4           memoise_2.0.1            
[135] BiocIO_1.8.0              locfit_1.5-9.8           
[137] viridisLite_0.4.2         digest_0.6.33            
[139] mime_0.12                 repr_1.1.4               
[141] registry_0.5-1            RSQLite_2.3.1            
[143] future.apply_1.11.0       blob_1.2.4               
[145] DiagrammeR_1.0.9          Formula_1.2-4            
[147] splines_4.2.3             labeling_0.4.2           
[149] RCurl_1.98-1.12           broom_1.0.5              
[151] hms_1.1.2                 modelr_0.1.10            
[153] colorspace_2.1-0          base64enc_0.1-3          
[155] BiocManager_1.30.21.1     ggbeeswarm_0.7.1         
[157] shape_1.4.6               nnet_7.3-18              
[159] RANN_2.6.1                circlize_0.4.15          
[161] fansi_1.0.4               tzdb_0.3.0               
[163] ModelMetrics_1.2.2.2      parallelly_1.36.0        
[165] IRdisplay_1.1             R6_2.5.1                 
[167] grid_4.2.3                ggridges_0.5.5           
[169] lifecycle_1.0.3           bluster_1.8.0            
[171] ggsignif_0.6.4            leiden_0.4.3             
[173] Matrix_1.6-5              RcppAnnoy_0.0.20         
[175] RColorBrewer_1.1-3        iterators_1.0.14         
[177] spatstat.explore_3.1-0    gower_1.0.1              
[179] htmlwidgets_1.6.2         beachmat_2.14.0          
[181] polyclip_1.10-4           network_1.18.1           
[183] shadowtext_0.1.2          timechange_0.2.0         
[185] rvest_1.0.3               ComplexHeatmap_2.14.0    
[187] globals_0.16.2            htmlTable_2.4.3          
[189] patchwork_1.1.2           spatstat.random_3.1-4    
[191] progressr_0.13.0          codetools_0.2-19         
[193] lubridate_1.9.2           randomForest_4.7-1.2     
[195] FNN_1.1.3.2               metapod_1.6.0            
[197] dbplyr_2.3.1              gridBase_0.4-7           
[199] RSpectra_0.16-1           gtable_0.3.3             
[201] DBI_1.1.3                 ggalluvial_0.12.5        
[203] tensor_1.5                httr_1.4.5               
[205] KernSmooth_2.23-20        stringi_1.7.12           
[207] reshape2_1.4.4            farver_2.1.1             
[209] uuid_1.1-0                annotate_1.76.0          
[211] viridis_0.6.2             fdrtool_1.2.18           
[213] timeDate_4022.108         magick_2.7.4             
[215] xml2_1.3.5                IRkernel_1.3.1           
[217] BiocNeighbors_1.16.0      restfulr_0.0.15          
[219] geneplotter_1.76.0        scattermore_1.2          
[221] scran_1.26.1              bit_4.0.5                
[223] spatstat.data_3.0-1       pkgconfig_2.0.3          
[225] rstatix_0.7.2             knitr_1.42        

LeeWang21 avatar Jun 14 '25 09:06 LeeWang21

Hello there, When I run the function predict_ligand_activities with the following code:

ligand_activities <- predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands) There were some Warning messages and Error messages:

Warning message in evaluate_target_prediction(setting, ligand_target_matrix, ligands_position): “all target gene probability score predictions have same value” Warning message in cor(prediction, response): “Standard deviation is zero” Warning message in cor(prediction, response, method = "s"): “Standard deviation is zero” Error in if (cor_p_pval < min_pval) {: missing value where TRUE/FALSE needed Traceback:

  1. predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, . ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands)
  2. settings_ligand_prediction %>% lapply(get_single_ligand_importances, . ligand_target_matrix = ligand_target_matrix, known = FALSE) %>% . bind_rows()
  3. bind_rows(.)
  4. list2(...)
  5. lapply(., get_single_ligand_importances, ligand_target_matrix = ligand_target_matrix, . known = FALSE)
  6. FUN(X[[i]], ...)
  7. evaluate_target_prediction(setting, ligand_target_matrix, ligands_position)
  8. evaluate_target_prediction_strict(response_vector, prediction_vector, . is.double(prediction_vector))
  9. classification_evaluation_continuous_pred(prediction_vector, . response_vector) Is the Error message related to this enhancement ? How can I fix it ?

Best wishes Wang

R version 4.2.3 (2023-03-15) Platform: x86_64-conda-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core)

locale: [1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C
[3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8
[5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8
[7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C

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

other attached packages: [1] nichenetr_2.2.0 CellChat_1.6.1
[3] igraph_1.5.0.1 scDblFinder_1.12.0
[5] SoupX_1.6.2 forcats_1.0.0
[7] stringr_1.5.0 dplyr_1.1.2
[9] purrr_1.0.1 readr_2.1.4
[11] tidyr_1.3.0 tibble_3.2.1
[13] tidyverse_1.3.1 DESeq2_1.38.0
[15] scater_1.26.1 scuttle_1.8.0
[17] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0 [19] Biobase_2.58.0 GenomicRanges_1.50.0
[21] GenomeInfoDb_1.34.9 IRanges_2.32.0
[23] S4Vectors_0.36.0 BiocGenerics_0.44.0
[25] MatrixGenerics_1.10.0 matrixStats_0.63.0
[27] ggpubr_0.6.0 ggplot2_3.4.2
[29] presto_1.0.0 data.table_1.14.8
[31] harmony_0.1.1 Rcpp_1.0.11
[33] SeuratObject_4.1.4 Seurat_4.4.0

loaded via a namespace (and not attached): [1] statnet.common_4.9.0 rsvd_1.0.5
[3] Hmisc_5.2-1 ica_1.0-3
[5] svglite_2.1.1 class_7.3-21
[7] Rsamtools_2.14.0 foreach_1.5.2
[9] lmtest_0.9-40 crayon_1.5.2
[11] MASS_7.3-58.3 nlme_3.1-162
[13] backports_1.4.1 reprex_2.0.2
[15] rlang_1.1.1 caret_6.0-93
[17] XVector_0.38.0 ROCR_1.0-11
[19] readxl_1.4.2 irlba_2.3.5.1
[21] limma_3.54.0 xgboost_1.6.0.1
[23] BiocParallel_1.32.5 rjson_0.2.21
[25] bit64_4.0.5 glue_1.6.2
[27] rngtools_1.5.2 sctransform_0.4.1
[29] parallel_4.2.3 vipor_0.4.5
[31] spatstat.sparse_3.0-1 AnnotationDbi_1.60.0
[33] spatstat.geom_3.1-0 haven_2.5.2
[35] tidyselect_1.2.0 fitdistrplus_1.1-8
[37] XML_3.99-0.14 zoo_1.8-12
[39] GenomicAlignments_1.34.0 xtable_1.8-4
[41] ggnetwork_0.5.12 magrittr_2.0.3
[43] evaluate_0.21 cli_3.6.1
[45] zlibbioc_1.44.0 rstudioapi_0.14
[47] miniUI_0.1.1.1 sp_1.6-0
[49] rpart_4.1.19 shiny_1.7.4
[51] xfun_0.49 BiocSingular_1.14.0
[53] clue_0.3-64 cluster_2.1.4
[55] caTools_1.18.2 pbdZMQ_0.3-8
[57] KEGGREST_1.38.0 ggrepel_0.9.6
[59] listenv_0.9.0 Biostrings_2.66.0
[61] png_0.1-8 future_1.33.2
[63] ipred_0.9-14 withr_2.5.0
[65] ggforce_0.4.1 bitops_1.0-7
[67] plyr_1.8.8 cellranger_1.1.0
[69] hardhat_1.4.0 e1071_1.7-13
[71] pROC_1.18.0 dqrng_0.3.0
[73] coda_0.19-4 pillar_1.9.0
[75] GlobalOptions_0.1.2 cachem_1.0.7
[77] fs_1.6.3 GetoptLong_1.0.5
[79] DelayedMatrixStats_1.20.0 vctrs_0.6.3
[81] ellipsis_0.3.2 generics_0.1.3
[83] lava_1.7.2.1 NMF_0.26
[85] tools_4.2.3 foreign_0.8-84
[87] beeswarm_0.4.0 tweenr_2.0.2
[89] munsell_0.5.0 proxy_0.4-27
[91] DelayedArray_0.24.0 fastmap_1.1.1
[93] compiler_4.2.3 abind_1.4-5
[95] httpuv_1.6.9 rtracklayer_1.58.0
[97] plotly_4.10.1 prodlim_2019.11.13
[99] GenomeInfoDbData_1.2.9 gridExtra_2.3
[101] edgeR_3.40.1 ggnewscale_0.4.9
[103] lattice_0.20-45 deldir_1.0-6
[105] visNetwork_2.1.2 utf8_1.2.3
[107] later_1.4.1 recipes_1.0.5
[109] jsonlite_1.8.7 scales_1.2.1
[111] ScaledMatrix_1.6.0 pbapply_1.7-2
[113] carData_3.0-5 sparseMatrixStats_1.10.0 [115] genefilter_1.80.0 lazyeval_0.2.2
[117] promises_1.3.2 car_3.1-2
[119] doParallel_1.0.17 goftest_1.2-3
[121] checkmate_2.1.0 spatstat.utils_3.1-1
[123] reticulate_1.39.0 sna_2.7-1
[125] rmarkdown_2.20 cowplot_1.1.1
[127] statmod_1.5.0 Rtsne_0.16
[129] uwot_0.1.14 survival_3.5-5
[131] yaml_2.3.7 systemfonts_1.0.4
[133] htmltools_0.5.4 memoise_2.0.1
[135] BiocIO_1.8.0 locfit_1.5-9.8
[137] viridisLite_0.4.2 digest_0.6.33
[139] mime_0.12 repr_1.1.4
[141] registry_0.5-1 RSQLite_2.3.1
[143] future.apply_1.11.0 blob_1.2.4
[145] DiagrammeR_1.0.9 Formula_1.2-4
[147] splines_4.2.3 labeling_0.4.2
[149] RCurl_1.98-1.12 broom_1.0.5
[151] hms_1.1.2 modelr_0.1.10
[153] colorspace_2.1-0 base64enc_0.1-3
[155] BiocManager_1.30.21.1 ggbeeswarm_0.7.1
[157] shape_1.4.6 nnet_7.3-18
[159] RANN_2.6.1 circlize_0.4.15
[161] fansi_1.0.4 tzdb_0.3.0
[163] ModelMetrics_1.2.2.2 parallelly_1.36.0
[165] IRdisplay_1.1 R6_2.5.1
[167] grid_4.2.3 ggridges_0.5.5
[169] lifecycle_1.0.3 bluster_1.8.0
[171] ggsignif_0.6.4 leiden_0.4.3
[173] Matrix_1.6-5 RcppAnnoy_0.0.20
[175] RColorBrewer_1.1-3 iterators_1.0.14
[177] spatstat.explore_3.1-0 gower_1.0.1
[179] htmlwidgets_1.6.2 beachmat_2.14.0
[181] polyclip_1.10-4 network_1.18.1
[183] shadowtext_0.1.2 timechange_0.2.0
[185] rvest_1.0.3 ComplexHeatmap_2.14.0
[187] globals_0.16.2 htmlTable_2.4.3
[189] patchwork_1.1.2 spatstat.random_3.1-4
[191] progressr_0.13.0 codetools_0.2-19
[193] lubridate_1.9.2 randomForest_4.7-1.2
[195] FNN_1.1.3.2 metapod_1.6.0
[197] dbplyr_2.3.1 gridBase_0.4-7
[199] RSpectra_0.16-1 gtable_0.3.3
[201] DBI_1.1.3 ggalluvial_0.12.5
[203] tensor_1.5 httr_1.4.5
[205] KernSmooth_2.23-20 stringi_1.7.12
[207] reshape2_1.4.4 farver_2.1.1
[209] uuid_1.1-0 annotate_1.76.0
[211] viridis_0.6.2 fdrtool_1.2.18
[213] timeDate_4022.108 magick_2.7.4
[215] xml2_1.3.5 IRkernel_1.3.1
[217] BiocNeighbors_1.16.0 restfulr_0.0.15
[219] geneplotter_1.76.0 scattermore_1.2
[221] scran_1.26.1 bit_4.0.5
[223] spatstat.data_3.0-1 pkgconfig_2.0.3
[225] rstatix_0.7.2 knitr_1.42

Hello, may I ask if your issue has been resolved? I'm encountering a similar problem when I run ligand_activities <- predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands). Warning message in evaluate_target_prediction(setting, ligand_target_matrix, ligands_position): “all target gene probability score predictions have same value” Warning message in cor(prediction, response): “the standard deviation is zero” Warning message in cor(prediction, response, method = "s"): “the standard deviation is zero” Error in if (cor_p_pval < min_pval) {: missing value where TRUE/FALSE needed Traceback:

  1. settings_ligand_prediction %>% lapply(get_single_ligand_importances, . ligand_target_matrix = ligand_target_matrix, known = FALSE) %>% . bind_rows()
  2. bind_rows(.)
  3. list2(...)
  4. lapply(., get_single_ligand_importances, ligand_target_matrix = ligand_target_matrix, . known = FALSE)
  5. FUN(X[[i]], ...)
  6. evaluate_target_prediction(setting, ligand_target_matrix, ligands_position)
  7. evaluate_target_prediction_strict(response_vector, prediction_vector, . is.double(prediction_vector))
  8. classification_evaluation_continuous_pred(prediction_vector, . response_vector)
  9. .handleSimpleError(function (cnd) . { . watcher$capture_plot_and_output() . cnd <- sanitize_call(cnd) . watcher$push(cnd) . switch(on_error, continue = invokeRestart("eval_continue"), . stop = invokeRestart("eval_stop"), error = invokeRestart("eval_error", . cnd)) . }, "missing value where TRUE/FALSE needed", base::quote(if (cor_p_pval < . min_pval) { . message("Warning: Pearson p-value was below ", min_pval, . " and has been capped at this value to avoid Inf values when taking the log10.") . cor_p_pval = min_pval . }))

lupin90 avatar Jun 17 '25 08:06 lupin90

Hello there, When I run the function predict_ligand_activities with the following code: ligand_activities <- predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands) There were some Warning messages and Error messages: Warning message in evaluate_target_prediction(setting, ligand_target_matrix, ligands_position): “all target gene probability score predictions have same value” Warning message in cor(prediction, response): “Standard deviation is zero” Warning message in cor(prediction, response, method = "s"): “Standard deviation is zero” Error in if (cor_p_pval < min_pval) {: missing value where TRUE/FALSE needed Traceback:

  1. predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, . ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands)
  2. settings_ligand_prediction %>% lapply(get_single_ligand_importances, . ligand_target_matrix = ligand_target_matrix, known = FALSE) %>% . bind_rows()
  3. bind_rows(.)
  4. list2(...)
  5. lapply(., get_single_ligand_importances, ligand_target_matrix = ligand_target_matrix, . known = FALSE)
  6. FUN(X[[i]], ...)
  7. evaluate_target_prediction(setting, ligand_target_matrix, ligands_position)
  8. evaluate_target_prediction_strict(response_vector, prediction_vector, . is.double(prediction_vector))
  9. classification_evaluation_continuous_pred(prediction_vector, . response_vector) Is the Error message related to this enhancement ? How can I fix it ?

Best wishes Wang R version 4.2.3 (2023-03-15) Platform: x86_64-conda-linux-gnu (64-bit) Running under: CentOS Linux 7 (Core) locale: [1] LC_CTYPE=zh_CN.UTF-8 LC_NUMERIC=C [3] LC_TIME=zh_CN.UTF-8 LC_COLLATE=zh_CN.UTF-8 [5] LC_MONETARY=zh_CN.UTF-8 LC_MESSAGES=zh_CN.UTF-8 [7] LC_PAPER=zh_CN.UTF-8 LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=zh_CN.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats4 stats graphics grDevices utils datasets methods [8] base other attached packages: [1] nichenetr_2.2.0 CellChat_1.6.1 [3] igraph_1.5.0.1 scDblFinder_1.12.0 [5] SoupX_1.6.2 forcats_1.0.0 [7] stringr_1.5.0 dplyr_1.1.2 [9] purrr_1.0.1 readr_2.1.4 [11] tidyr_1.3.0 tibble_3.2.1 [13] tidyverse_1.3.1 DESeq2_1.38.0 [15] scater_1.26.1 scuttle_1.8.0 [17] SingleCellExperiment_1.20.0 SummarizedExperiment_1.28.0 [19] Biobase_2.58.0 GenomicRanges_1.50.0 [21] GenomeInfoDb_1.34.9 IRanges_2.32.0 [23] S4Vectors_0.36.0 BiocGenerics_0.44.0 [25] MatrixGenerics_1.10.0 matrixStats_0.63.0 [27] ggpubr_0.6.0 ggplot2_3.4.2 [29] presto_1.0.0 data.table_1.14.8 [31] harmony_0.1.1 Rcpp_1.0.11 [33] SeuratObject_4.1.4 Seurat_4.4.0 loaded via a namespace (and not attached): [1] statnet.common_4.9.0 rsvd_1.0.5 [3] Hmisc_5.2-1 ica_1.0-3 [5] svglite_2.1.1 class_7.3-21 [7] Rsamtools_2.14.0 foreach_1.5.2 [9] lmtest_0.9-40 crayon_1.5.2 [11] MASS_7.3-58.3 nlme_3.1-162 [13] backports_1.4.1 reprex_2.0.2 [15] rlang_1.1.1 caret_6.0-93 [17] XVector_0.38.0 ROCR_1.0-11 [19] readxl_1.4.2 irlba_2.3.5.1 [21] limma_3.54.0 xgboost_1.6.0.1 [23] BiocParallel_1.32.5 rjson_0.2.21 [25] bit64_4.0.5 glue_1.6.2 [27] rngtools_1.5.2 sctransform_0.4.1 [29] parallel_4.2.3 vipor_0.4.5 [31] spatstat.sparse_3.0-1 AnnotationDbi_1.60.0 [33] spatstat.geom_3.1-0 haven_2.5.2 [35] tidyselect_1.2.0 fitdistrplus_1.1-8 [37] XML_3.99-0.14 zoo_1.8-12 [39] GenomicAlignments_1.34.0 xtable_1.8-4 [41] ggnetwork_0.5.12 magrittr_2.0.3 [43] evaluate_0.21 cli_3.6.1 [45] zlibbioc_1.44.0 rstudioapi_0.14 [47] miniUI_0.1.1.1 sp_1.6-0 [49] rpart_4.1.19 shiny_1.7.4 [51] xfun_0.49 BiocSingular_1.14.0 [53] clue_0.3-64 cluster_2.1.4 [55] caTools_1.18.2 pbdZMQ_0.3-8 [57] KEGGREST_1.38.0 ggrepel_0.9.6 [59] listenv_0.9.0 Biostrings_2.66.0 [61] png_0.1-8 future_1.33.2 [63] ipred_0.9-14 withr_2.5.0 [65] ggforce_0.4.1 bitops_1.0-7 [67] plyr_1.8.8 cellranger_1.1.0 [69] hardhat_1.4.0 e1071_1.7-13 [71] pROC_1.18.0 dqrng_0.3.0 [73] coda_0.19-4 pillar_1.9.0 [75] GlobalOptions_0.1.2 cachem_1.0.7 [77] fs_1.6.3 GetoptLong_1.0.5 [79] DelayedMatrixStats_1.20.0 vctrs_0.6.3 [81] ellipsis_0.3.2 generics_0.1.3 [83] lava_1.7.2.1 NMF_0.26 [85] tools_4.2.3 foreign_0.8-84 [87] beeswarm_0.4.0 tweenr_2.0.2 [89] munsell_0.5.0 proxy_0.4-27 [91] DelayedArray_0.24.0 fastmap_1.1.1 [93] compiler_4.2.3 abind_1.4-5 [95] httpuv_1.6.9 rtracklayer_1.58.0 [97] plotly_4.10.1 prodlim_2019.11.13 [99] GenomeInfoDbData_1.2.9 gridExtra_2.3 [101] edgeR_3.40.1 ggnewscale_0.4.9 [103] lattice_0.20-45 deldir_1.0-6 [105] visNetwork_2.1.2 utf8_1.2.3 [107] later_1.4.1 recipes_1.0.5 [109] jsonlite_1.8.7 scales_1.2.1 [111] ScaledMatrix_1.6.0 pbapply_1.7-2 [113] carData_3.0-5 sparseMatrixStats_1.10.0 [115] genefilter_1.80.0 lazyeval_0.2.2 [117] promises_1.3.2 car_3.1-2 [119] doParallel_1.0.17 goftest_1.2-3 [121] checkmate_2.1.0 spatstat.utils_3.1-1 [123] reticulate_1.39.0 sna_2.7-1 [125] rmarkdown_2.20 cowplot_1.1.1 [127] statmod_1.5.0 Rtsne_0.16 [129] uwot_0.1.14 survival_3.5-5 [131] yaml_2.3.7 systemfonts_1.0.4 [133] htmltools_0.5.4 memoise_2.0.1 [135] BiocIO_1.8.0 locfit_1.5-9.8 [137] viridisLite_0.4.2 digest_0.6.33 [139] mime_0.12 repr_1.1.4 [141] registry_0.5-1 RSQLite_2.3.1 [143] future.apply_1.11.0 blob_1.2.4 [145] DiagrammeR_1.0.9 Formula_1.2-4 [147] splines_4.2.3 labeling_0.4.2 [149] RCurl_1.98-1.12 broom_1.0.5 [151] hms_1.1.2 modelr_0.1.10 [153] colorspace_2.1-0 base64enc_0.1-3 [155] BiocManager_1.30.21.1 ggbeeswarm_0.7.1 [157] shape_1.4.6 nnet_7.3-18 [159] RANN_2.6.1 circlize_0.4.15 [161] fansi_1.0.4 tzdb_0.3.0 [163] ModelMetrics_1.2.2.2 parallelly_1.36.0 [165] IRdisplay_1.1 R6_2.5.1 [167] grid_4.2.3 ggridges_0.5.5 [169] lifecycle_1.0.3 bluster_1.8.0 [171] ggsignif_0.6.4 leiden_0.4.3 [173] Matrix_1.6-5 RcppAnnoy_0.0.20 [175] RColorBrewer_1.1-3 iterators_1.0.14 [177] spatstat.explore_3.1-0 gower_1.0.1 [179] htmlwidgets_1.6.2 beachmat_2.14.0 [181] polyclip_1.10-4 network_1.18.1 [183] shadowtext_0.1.2 timechange_0.2.0 [185] rvest_1.0.3 ComplexHeatmap_2.14.0 [187] globals_0.16.2 htmlTable_2.4.3 [189] patchwork_1.1.2 spatstat.random_3.1-4 [191] progressr_0.13.0 codetools_0.2-19 [193] lubridate_1.9.2 randomForest_4.7-1.2 [195] FNN_1.1.3.2 metapod_1.6.0 [197] dbplyr_2.3.1 gridBase_0.4-7 [199] RSpectra_0.16-1 gtable_0.3.3 [201] DBI_1.1.3 ggalluvial_0.12.5 [203] tensor_1.5 httr_1.4.5 [205] KernSmooth_2.23-20 stringi_1.7.12 [207] reshape2_1.4.4 farver_2.1.1 [209] uuid_1.1-0 annotate_1.76.0 [211] viridis_0.6.2 fdrtool_1.2.18 [213] timeDate_4022.108 magick_2.7.4 [215] xml2_1.3.5 IRkernel_1.3.1 [217] BiocNeighbors_1.16.0 restfulr_0.0.15 [219] geneplotter_1.76.0 scattermore_1.2 [221] scran_1.26.1 bit_4.0.5 [223] spatstat.data_3.0-1 pkgconfig_2.0.3 [225] rstatix_0.7.2 knitr_1.42

Hello, may I ask if your issue has been resolved? I'm encountering a similar problem when I run ligand_activities <- predict_ligand_activities(geneset = geneset_oi, background_expressed_genes = background_expressed_genes, ligand_target_matrix = ligand_target_matrix, potential_ligands = potential_ligands). Warning message in evaluate_target_prediction(setting, ligand_target_matrix, ligands_position): “all target gene probability score predictions have same value” Warning message in cor(prediction, response): “the standard deviation is zero” Warning message in cor(prediction, response, method = "s"): “the standard deviation is zero” Error in if (cor_p_pval < min_pval) {: missing value where TRUE/FALSE needed Traceback:

  1. settings_ligand_prediction %>% lapply(get_single_ligand_importances, . ligand_target_matrix = ligand_target_matrix, known = FALSE) %>% . bind_rows()
  2. bind_rows(.)
  3. list2(...)
  4. lapply(., get_single_ligand_importances, ligand_target_matrix = ligand_target_matrix, . known = FALSE)
  5. FUN(X[[i]], ...)
  6. evaluate_target_prediction(setting, ligand_target_matrix, ligands_position)
  7. evaluate_target_prediction_strict(response_vector, prediction_vector, . is.double(prediction_vector))
  8. classification_evaluation_continuous_pred(prediction_vector, . response_vector)
  9. .handleSimpleError(function (cnd) . { . watcher$capture_plot_and_output() . cnd <- sanitize_call(cnd) . watcher$push(cnd) . switch(on_error, continue = invokeRestart("eval_continue"), . stop = invokeRestart("eval_stop"), error = invokeRestart("eval_error", . cnd)) . }, "missing value where TRUE/FALSE needed", base::quote(if (cor_p_pval < . min_pval) { . message("Warning: Pearson p-value was below ", min_pval, . " and has been capped at this value to avoid Inf values when taking the log10.") . cor_p_pval = min_pval . }))

Hi, I guess this bug is related to the update in version v2.2.0. While there was the warning message, the code worked well when I used the v2.1.0 version ~

Wang

LeeWang21 avatar Jun 18 '25 06:06 LeeWang21