# How to run GSEA analysis on R studio using DEG file list generated from scRNAseq analysis

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.

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))]