egeulgen / pathfindR

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

Error, cannot open the file connection #58

Closed travis-m-blimkie closed 3 years ago

travis-m-blimkie commented 3 years ago

Describe the bug When using run_pathfindR with the attached input genes, I receive an error that the function cannot open a file connection, when creating the subnetwork visualizations. I am able to run the function without issue using other input gene lists.

To reproduce:

  1. Use the attached gene list as input
  2. Run the following function:
    run_pathfindR(
    input_genes,
    gene_sets  = "Reactome",
    output_dir = "PathfindR_results/",
    iterations = 5
    )
  3. See the following output/error:
    
    ## Testing input
    The input looks OK
    ## Processing input. Converting gene symbols,
          if necessary (and if human gene symbols provided)
    Number of genes provided in input: 8426
    Number of genes in input after p-value filtering: 8426
    pathfindR cannot handle p values < 1e-13. These were changed to 1e-13

Could not find any interactions for 958 (12.75%) genes in the PIN Final number of genes in input: 6548

Performing Active Subnetwork Search and Enrichment

Processing the enrichment results over all iterations

Annotating involved genes and visualizing enriched terms

Error in file(con, "wb") : cannot open the connectionadditional cell death genes whose specific roles in p53-dependent apoptosis remain uncertain
In addition: Warning messages: 1: Duplicated genes found! The lowest p value for each gene was selected 2: In file(con, "wb") : cannot open file 'term_visualizations/TP53_regulates_transcription_of_several_additional_cell_death_genes_whose_specific_roles_in_p53-dependent_apoptosis_remain_uncertain.png': No such file or directory



**Expected behavior:**
As with other input gene lists, I should get a series of png files with subnetwork visualizations.

**Screenshot:**
![Screenshot 2020-10-19 105159](https://user-images.githubusercontent.com/18198620/96509386-c7745a00-1210-11eb-82c7-297a61f1ba74.png)

**Desktop:**
 - OS: Windows 10
 - Development (github) version of pathfindR, 1.6.0.9004

**R Session Information:**
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

Matrix products: default

locale:
[1] LC_COLLATE=English_Canada.1252  LC_CTYPE=English_Canada.1252    LC_MONETARY=English_Canada.1252 LC_NUMERIC=C                   
[5] LC_TIME=English_Canada.1252    

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

other attached packages:
 [1] forcats_0.5.0        stringr_1.4.0        dplyr_1.0.2          purrr_0.3.4          readr_1.4.0          tidyr_1.1.2         
 [7] tibble_3.0.4         ggplot2_3.3.2        tidyverse_1.3.0      tRavis_0.65.00       pathfindR_1.6.0.9004 pathfindR.data_1.1.0

loaded via a namespace (and not attached):
 [1] fs_1.5.0             lubridate_1.7.9      bit64_4.0.5          doParallel_1.0.16    httr_1.4.2           tools_4.0.3         
 [7] backports_1.1.10     R6_2.4.1             DBI_1.1.0            BiocGenerics_0.34.0  colorspace_1.4-1     withr_2.3.0         
[13] tidyselect_1.1.0     gridExtra_2.3        bit_4.0.4            compiler_4.0.3       cli_2.1.0            rvest_0.3.6         
[19] Biobase_2.48.0       xml2_1.3.2           scales_1.1.1         digest_0.6.26        rmarkdown_2.4        pkgconfig_2.0.3     
[25] htmltools_0.5.0      dbplyr_1.4.4         import_1.2.0         rlang_0.4.8          readxl_1.3.1         rstudioapi_0.11     
[31] RSQLite_2.2.1        farver_2.0.3         generics_0.0.2       jsonlite_1.7.1       magrittr_1.5         Rcpp_1.0.5          
[37] munsell_0.5.0        S4Vectors_0.26.1     fansi_0.4.1          viridis_0.5.1        lifecycle_0.2.0      stringi_1.5.3       
[43] ggraph_2.0.3         MASS_7.3-53          org.Hs.eg.db_3.11.4  grid_4.0.3           blob_1.2.1           parallel_4.0.3      
[49] ggrepel_0.8.2        crayon_1.3.4         graphlayouts_0.7.0   haven_2.3.1          hms_0.5.3            magick_2.5.0        
[55] knitr_1.30           pillar_1.4.6         igraph_1.2.6         codetools_0.2-16     stats4_4.0.3         reprex_0.3.0        
[61] glue_1.4.2           evaluate_0.14        modelr_0.1.8         vctrs_0.3.4          tweenr_1.0.1         foreach_1.5.1       
[67] cellranger_1.1.0     gtable_0.3.0         polyclip_1.10-0      assertthat_0.2.1     xfun_0.18            ggforce_0.3.2       
[73] broom_0.7.1          tidygraph_1.2.0      viridisLite_0.3.0    iterators_1.0.13     IRanges_2.22.2       tinytex_0.26        
[79] AnnotationDbi_1.50.3 memoise_1.1.0        ellipsis_0.3.1

**Additional context:**
I am on java runtime 1.8.0_141
I have been able to successfully run the function by setting `visualize_enriched_terms = FALSE`, which implies the issue is with the visualization/file saving step. 

**Input file:**
[input_genes.txt](https://github.com/egeulgen/pathfindR/files/5404369/input_genes.txt)

Any help would be greatly appreciated. Thanks!
egeulgen commented 3 years ago

hello @travis-m-blimkie,

can you make sure you have write privileges in the output directory?

I'm trying to reproduce the issue (but I'm on a mac) and will let you know if I can pinpoint the issue. I think it might be because of the long file name or some character prohibited by Windows (although I fixed that previously) in the file name.

Best, -E

egeulgen commented 3 years ago

I just added a (hopeful) fix, limiting the file name to 100 characters. Let me know if this does not fix the issue and I'll try to investigate further

travis-m-blimkie commented 3 years ago

Tested it this morning with the update, and it's resolved the issue for me. Thanks so much for the quick response, cheers!