Question: How to export enrichGO results for future visualization with barplot, dotplot, emapplot...
gravatar for MAP
4 months ago by
MAP0 wrote:


I am using a super useful package called clusterProfiler (v3.8.1) for some GO enrichment analysis. I already read the vignettes and they were super useful to better understand how it works.

For the GO enrichment this is what I am running:

> GO_BP_test <- enrichGO(gene = names_all_down_uniprot, OrgDb = "" , keyType = "UNIPROT", ont = "BP",pvalueCutoff = 0.05, pAdjustMethod = "fdr", universe = background_uniprot, qvalueCutoff = 0.25, minGSSize = 10, maxGSSize = 500, readable = FALSE, pool = FALSE)

The results looks as expected and I can visualize them using any of the functions included in the package (barplot, dotplot, emapplot...) 

The problem is when I try to save the results from enrichGO() in order to use them for visualization with the same functions.

I save the results as a data.frame in a .cvs file.

> cluster_summary <- data.frame(GO_BP_test )
> write.csv(cluster_summary , file = "GO_BP_test.csv", row.names=FALSE)

This is what I do to load the results and plot them using barplot():

> test_analysis <- read.csv(file = "GO_BP_test.csv", header=TRUE)
> barplot(test_analysis, showCategory=8)

Then, this error appears:

"Error in barplot.default(test_analysis, showCategory = 8) :  'height' must be a vector or a matrix"

Does anyone know how to save the results from enrichGO in a way that would be possible to use for future visualizations using the functions included in the package?

Thanks in advance for any help,


ADD COMMENTlink modified 4 months ago • written 4 months ago by MAP0
gravatar for James W. MacDonald
4 months ago by
United States
James W. MacDonald48k wrote:
save(cluster_summary, file = "whatevs.Rdata")
## time passes...
ADD COMMENTlink written 4 months ago by James W. MacDonald48k

Nice!!! Simple and works!!! Thanks a bunch!!!

ADD REPLYlink written 4 months ago by MAP0
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 321 users visited in the last hour