How to sort graph based on fold change and instead of activated and suppressed, how to add up and downregulated in graph header?
0
0
Entering edit mode
20 months ago
BiocManager::install("clusterProfiler", version = "3.16")
BiocManager::install("pathview")
BiocManager::install("enrichplot")
library(clusterProfiler)
library(enrichplot)
# we use ggplot2 to add x axis labels (ex: ridgeplot)
library(ggplot2)

# reading in data from deseq2
df = read.csv("C:/DE_gene_downregulated_clusterprofiler.csv", header=TRUE)
View(df)
organism = "org.Hs.eg.db" #set the desired organism here, # org.Hs.eg.db for human
BiocManager::install(organism, character.only = TRUE)
library(organism, character.only = TRUE)
# we want the log2 fold change 
original_gene_list <- df$PostFC
original_gene_list
# name the vector
names(original_gene_list) <- df$X
# omit any NA values 
gene_list<-na.omit(original_gene_list)
# sort the list in decreasing order (required for clusterProfiler)
gene_list = sort(gene_list, decreasing = TRUE)
gene_list

gse <- gseGO(geneList=gene_list, 
              ont ="BP", 
              keyType = "ENSEMBL", 
              minGSSize = 1, 
              maxGSSize = 450, 
              pvalueCutoff = 0.05, 
              verbose = TRUE, 
              OrgDb = organism, 
              pAdjustMethod = "none")

cluster_summary <- data.frame(gse)
write.csv(cluster_summary, "C:/DE_gene/clusterProfiler_out.csv")
require(DOSE)
dotplot(gse, showCategory=10, orderBy = "setSize", split=".sign") + facet_grid(.~.sign)
clusterprofiler • 560 views
ADD COMMENT

Login before adding your answer.

Traffic: 2541 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6