egeulgen / pathfindR

pathfindR: Enrichment Analysis Utilizing Active Subnetworks
https://egeulgen.github.io/pathfindR/
Other
177 stars 25 forks source link

All p_values must be numeric error #208

Closed hurasafe closed 2 months ago

hurasafe commented 2 months ago

Hi, new to coding and Rstudio but this error is driving me crazy and i've checked the data and don't know what else to do. I have a set of genes and respective p_values but when I try to run run_pathfindR ( or input_testing) i get the error that all p_values must be numeric.

Below is my code and my atempts at resolving this issue:

> input_data <- input_processing(data,
+                                p_val_threshold = 0.05,
+                                pin_name_path = "Biogrid",
+                                convert2alias = T)
## Processing input. Converting gene symbols,
          if necessary (and if human gene symbols provided)
Number of genes provided in input: 2462
Number of genes in input after p-value filtering: 383
pathfindR cannot handle p values < 1e-13. These were changed to 1e-13
Could not find any interactions for 1 (0.26%) genes in the PIN
Final number of genes in input: 382
> input_data <- input_data[, -c(1)]
> head(input_data)
# A tibble: 6 × 3
  GENE      CHANGE P_VALUE
  <chr>      <dbl>   <dbl>
1 MMP1        6.64   1e-13
2 FBN1       -6.64   1e-13
3 HSPA2       6.64   1e-13
4 COL2A1     -6.64   1e-13
5 HIST2H2AC  -6.64   1e-13
6 HLA-H       6.64   1e-13
> anyNA(input_data)
[1] FALSE
> is.numeric(input_data$P_VALUE)
[1] TRUE
> input_testing(input = input_data, p_val_threshold = 0.05)
## Testing input
Error in input_testing(input = input_data, p_val_threshold = 0.05) : 
  p values must all be numeric
> output <- run_pathfindR(input = input_data,
                        pin_name_path = "Biogrid",
                     gene_sets = "Reactome",
+                         p_val_threshold = 0.05,
+                         enrichment_threshold = 0.05,
+                         plot_enrichment_chart = T,
+                         list_active_snw_genes = T)
## Testing input
Error in input_testing(input, p_val_threshold) : 
  p values must all be numeric

Anexed the full table. What am I missing? input_table.csv

hurasafe commented 2 months ago

Forgot to append session info.

<html>
<body>
<!--StartFragment-->
sessionInfo() R version 4.3.2 (2023-10-31 ucrt) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 19045)  Matrix products: default   locale: [1] LC_COLLATE=Portuguese_Portugal.utf8  LC_CTYPE=Portuguese_Portugal.utf8    LC_MONETARY=Portuguese_Portugal.utf8 [4] LC_NUMERIC=C                         LC_TIME=Portuguese_Portugal.utf8      time zone: Europe/Lisbon tzcode source: internal  attached base packages: [1] stats     graphics  grDevices utils     datasets  methods   base       other attached packages:  [1] pathfindR_2.4.1      pathfindR.data_2.1.0 lubridate_1.9.3      forcats_1.0.0        stringr_1.5.1         [6] dplyr_1.1.4          purrr_1.0.2          readr_2.1.5          tidyr_1.3.1          tibble_3.2.1         [11] ggplot2_3.5.1        tidyverse_2.0.0      readxl_1.4.3          loaded via a namespace (and not attached):  [1] tidyselect_1.2.1        viridisLite_0.4.2       farver_2.1.1            blob_1.2.4               [5] bitops_1.0-7            viridis_0.6.5           Biostrings_2.70.3       RCurl_1.98-1.14          [9] ggraph_2.2.1            fastmap_1.1.1           tweenr_2.0.3            digest_0.6.35           [13] timechange_0.3.0        lifecycle_1.0.4         KEGGREST_1.42.0         RSQLite_2.3.6           [17] magrittr_2.0.3          compiler_4.3.2          rlang_1.1.3             tools_4.3.2             [21] igraph_2.0.3            utf8_1.2.4              knitr_1.46              graphlayouts_1.1.1      [25] bit_4.0.5               withr_3.0.0             BiocGenerics_0.48.1     grid_4.3.2              [29] polyclip_1.10-6         stats4_4.3.2            fansi_1.0.6             colorspace_2.1-0        [33] scales_1.3.0            iterators_1.0.14        MASS_7.3-60.0.1         cli_3.6.2               [37] rmarkdown_2.26          crayon_1.5.2            generics_0.1.3          rstudioapi_0.16.0       [41] httr_1.4.7              tzdb_0.4.0              DBI_1.2.2               cachem_1.0.8            [45] ggforce_0.4.2           zlibbioc_1.48.2         parallel_4.3.2          AnnotationDbi_1.64.1    [49] XVector_0.42.0          cellranger_1.1.0        vctrs_0.6.5             IRanges_2.36.0          [53] hms_1.1.3               S4Vectors_0.40.2        bit64_4.0.5             ggrepel_0.9.5           [57] foreach_1.5.2           glue_1.7.0              codetools_0.2-20        stringi_1.8.4           [61] gtable_0.3.5            GenomeInfoDb_1.38.8     munsell_0.5.1           pillar_1.9.0            [65] htmltools_0.5.8.1       GenomeInfoDbData_1.2.11 R6_2.5.1                doParallel_1.0.17       [69] tidygraph_1.3.1         evaluate_0.23           Biobase_2.62.0          png_0.1-8               [73] memoise_2.0.1           Rcpp_1.0.12             gridExtra_2.3           org.Hs.eg.db_3.18.0     [77] xfun_0.43               pkgconfig_2.0.3
--
 
> | >
>

<!--EndFragment-->
</body>
</html>
egeulgen commented 2 months ago

You are reading as a tibble object, which pathfindR doesn’t support. Try “data <-as.data.frame(data)” or simply use “read.csv” instead. -EOn 17 May 2024, at 18:35, hurasafe @.***> wrote: Hi, new to coding and Rstudio but this error is driving me crazy and i've checked the data and don't know what else to do. I have a set of genes and respective p_values but when I try to run run_pathfindR ( or input_testing) i get the error that all p_values must be numeric. Below is my code and my atempts at resolving this issue:

input_data <- input_processing(data,

  • p_val_threshold = 0.05,
  • pin_name_path = "Biogrid",
  • convert2alias = T)

    Processing input. Converting gene symbols,

    if necessary (and if human gene symbols provided) Number of genes provided in input: 2462 Number of genes in input after p-value filtering: 383 pathfindR cannot handle p values < 1e-13. These were changed to 1e-13 Could not find any interactions for 1 (0.26%) genes in the PIN Final number of genes in input: 382 input_data <- input_data[, -c(1)] head(input_data)

    A tibble: 6 × 3

    GENE CHANGE P_VALUE

    1 MMP1 6.64 1e-13 2 FBN1 -6.64 1e-13 3 HSPA2 6.64 1e-13 4 COL2A1 -6.64 1e-13 5 HIST2H2AC -6.64 1e-13 6 HLA-H 6.64 1e-13 anyNA(input_data) [1] FALSE is.numeric(input_data$P_VALUE) [1] TRUE input_testing(input = input_data, p_val_threshold = 0.05) ## Testing input Error in input_testing(input = input_data, p_val_threshold = 0.05) : p values must all be numeric output <- run_pathfindR(input = input_data, pin_name_path = "Biogrid", gene_sets = "Reactome",
  • p_val_threshold = 0.05,
  • enrichment_threshold = 0.05,
  • plot_enrichment_chart = T,
  • list_active_snw_genes = T)

    Testing input

    Error in input_testing(input, p_val_threshold) : p values must all be numeric

Anexed the full table. What am I missing? input_table.csv

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

egeulgen commented 2 months ago

@hurasafe did that resolve the issue? closing this, feel free to open if it persists

hurasafe commented 1 month ago

@egeulgen , yep solved it. Such an overlook on my side. Thank you.