egeulgen / pathfindR

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

Error in strsplit(x, ", ") : non-character argument : For enrichment_chart() with custom input data as .csv, .txt #51

Closed choijamtsmunkhzul closed 4 years ago

choijamtsmunkhzul commented 4 years ago

Hello, thanks for this nice package, However I got into some problem. Here is the steps:

First here is the input file:

1. example <- read.table("example.txt", header=TRUE)
head(example)
#     GENE   CHANGE   P_VALUE
#1 Rnase2a 9.904846 1.56e-127
#2    Mgl2 9.435542  0.00e+00

Then I run runpathfindR()

2.  example_pathfindR_output <- run_pathfindR(input = example, p_val_threshold = 0.05,
                                                             convert2alias = FALSE,
                                                             gene_sets = "Custom",   
                                                             custom_genes = mmu_kegg_genes,
                                                             custom_descriptions = mmu_kegg_descriptions,
                                                             pin_name_path = "mmu_STRING",
                                                             min_gset_size = 100,  
                                                             max_gset_size = 200, 
                                                             max_to_plot = 20, 
                                                             visualize_enriched_terms = FALSE, 
                                                             output_dir = "my_pathway")    
  1. Then I got the KEGG pathways. But I WANT to remove pathways from pathfindR_output and Visualize with enrichment_chart() So i downloaded pathfindR dataframe as .csv file. Every neccessary column name were there.

write.csv(example_pathfindR_output, "example_pathfindR.csv")

  1. Then from .csv file I REMOVED some pathways and try to put into enrichment_chart()

    aa1 <-read.csv(file="example_pathfindR.csv", header=TRUE) 
    bb1 <- enrichment_chart(aa1)
  2. Finally I got these ERRORs:

Error in strsplit(x, ", ") : non-character argument

Is it even possible to modify output of pathfindR pathways and visualize with enrichment_chart()?

Thank you so much

egeulgen commented 4 years ago

It is possible to modify the output of run_pathfindR() and perform downstream analyses. However, it's better to just subset the data frame (in your case, example_pathfindR_output) within R.

The issue is most probably as follows: As you save with row names (numbers, by default), you may be adding an additional column erroneously while reading. To fix this, modify the read command as follows:

aa1 <-read.csv(file="example_pathfindR.csv", header=TRUE, row.names = TRUE)