I want to draw the standard plot of GSEA on Rstudio. I have a data frame that consists of a list of DEGs as below. Structure

Actually, I put the DEG list directly to PANTHER that resulted in the GO or pathway analysis data. However, I want to use GSEA.

Meanwhile, I found nice online site and follow their codes for the GSEA analysis(https://bioinformaticsbreakdown.com/how-to-gsea/).

And, here is the my code.

tmp = read.csv("/data/directory/DEGs_HCvsJSS_DC.csv", header = TRUE) %>% filter(Gene.Symbol !="")

GO_file = "/blue/zhangw/my.kim/HCvsJSS/c5.all.v7.4.symbols.gmt" # got this from http://www.gsea-msigdb.org/gsea/msigdb/collections.jsp

gene_list = tmp$avg_log2FC

names(gene_list) = tmp$Gene.Symbol

gene_list = sort(gene_list, decreasing = TRUE)

gene_list = gene_list[!duplicated(names(gene_list))]


res = GSEA(gene_list, GO_file, pval = 0.05) # this caused the error as follows. Error in build_Anno(TERM2GENE, TERM2NAME) :  argument "TERM2GENE" is missing, with no default

It's really dissapointing because I found this relatively easy protocol for GSEA, but found the error, lol.

Do you guys have any suggests for this troubles? or any recommendations for GSEA analysis that can be done with DEG list generated from seruat scRNAseq data?


1 Answer 1


I'd probably just use fgsea. Your code won't have to change much, it also just uses a ranked list.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.