library(org.Mm.eg.db) #mouse genome
## Loading required package: AnnotationDbi
## Loading required package: stats4
## Loading required package: BiocGenerics
##
## Attaching package: 'BiocGenerics'
## The following objects are masked from 'package:stats':
##
## IQR, mad, sd, var, xtabs
## The following objects are masked from 'package:base':
##
## anyDuplicated, append, as.data.frame, basename, cbind, colnames,
## dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
## grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
## order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
## rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
## union, unique, unsplit, which.max, which.min
## Loading required package: Biobase
## Welcome to Bioconductor
##
## Vignettes contain introductory material; view with
## 'browseVignettes()'. To cite Bioconductor, see
## 'citation("Biobase")', and for packages 'citation("pkgname")'.
## Loading required package: IRanges
## Loading required package: S4Vectors
##
## Attaching package: 'S4Vectors'
## The following objects are masked from 'package:base':
##
## expand.grid, I, unname
##
library(clusterProfiler) #for annotation
##
## clusterProfiler v4.4.4 For help: https://yulab-smu.top/biomedical-knowledge-mining-book/
##
## If you use clusterProfiler in published research, please cite:
## T Wu, E Hu, S Xu, M Chen, P Guo, Z Dai, T Feng, L Zhou, W Tang, L Zhan, X Fu, S Liu, X Bo, and G Yu. clusterProfiler 4.0: A universal enrichment tool for interpreting omics data. The Innovation. 2021, 2(3):100141
##
## Attaching package: 'clusterProfiler'
## The following object is masked from 'package:AnnotationDbi':
##
## select
## The following object is masked from 'package:IRanges':
##
## slice
## The following object is masked from 'package:S4Vectors':
##
## rename
## The following object is masked from 'package:stats':
##
## filter
library(enrichplot) # for ploting
library(DOSE) # for annotation and ploting
## DOSE v3.22.1 For help: https://yulab-smu.top/biomedical-knowledge-mining-book/
##
## If you use DOSE in published research, please cite:
## Guangchuang Yu, Li-Gen Wang, Guang-Rong Yan, Qing-Yu He. DOSE: an R/Bioconductor package for Disease Ontology Semantic and Enrichment analysis. Bioinformatics 2015, 31(4):608-609
library(dplyr) # for file handling if requried
##
## Attaching package: 'dplyr'
## The following object is masked from 'package:AnnotationDbi':
##
## select
## The following objects are masked from 'package:IRanges':
##
## collapse, desc, intersect, setdiff, slice, union
## The following objects are masked from 'package:S4Vectors':
##
## first, intersect, rename, setdiff, setequal, union
## The following object is masked from 'package:Biobase':
##
## combine
## The following objects are masked from 'package:BiocGenerics':
##
## combine, intersect, setdiff, union
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(readxl) # import your excel file
#import your data ### set your working directory before running this command using setwd(“your_location”)
input_df <- read_excel("venn_diagram.xlsx",sheet = "Embryo") # import your data
my.symbols = input_df$Gene_name # my excel file has a header Gene_name, convert it to your column name
Entrezid=AnnotationDbi::select(org.Mm.eg.db, keys = my.symbols,columns = c("ENTREZID", "SYMBOL"),keytype = "SYMBOL") # converting your gene name to ENTREZID
## 'select()' returned 1:1 mapping between keys and columns
Embryo_annotation=Entrezid$ENTREZID #extrating only your entrezid for the input
genelist=sort(Embryo_annotation,decreasing = TRUE) #sorting the ID
genelist=na.omit(genelist) # removing the Null values
ego=enrichGO(gene = genelist,universe = names(Entrezid$ENTREZID),OrgDb = org.Mm.eg.db, ont = "BP", readable = TRUE, minGSSize = 3, maxGSSize = 500) # change the paramter of minimum and maximum gene size upon your data
write.csv(ego@result,"Annotation.csv",row.names = F) # Export your data as csv format
#for ploting your data (Dotplot)
png(file="dot_plot.png",width=1980, height=1080) # change the name and your height and width based on your requirement
dotplot(ego, showCategory=30) # change the category number based on your output this will show you the first 30 pathway. if you want manualy change it into showCategory= ego@result$Description[c(1,10,11,13,14,16,26,27,30,37,39,74,103,166)]) choose your row number based on your selected pathway
dev.off()
## quartz_off_screen
## 2
#for ploting your data (for goplot)
png(file="go_plot.png",width=1980, height=1080) # change the name and your height and width based on your requirement
goplot(ego,showCategory = 10) # change the category number based on your output this will show you the first 30 pathway. if you want manualy change it into showCategory= ego@result$Description[c(1,10,11,13,14,16,26,27,30,37,39,74,103,166)]) choose your row number based on your selected pathway
dev.off()
## quartz_off_screen
## 2
#for ploting your data (Emapplot) For pawirwise aligmnet and group your pathway
gse = pairwise_termsim(ego)
png(file="emapplot_plot.png",width=1980, height=1080) # change the name and your height and width based on your requirement
emapplot(gse, showCategory =30) # change the category number based on your output this will show you the first 30 pathway. if you want manualy change it into showCategory= ego@result$Description[c(1,10,11,13,14,16,26,27,30,37,39,74,103,166)]) choose your row number based on your selected pathway
dev.off()
## quartz_off_screen
## 2
#example images
emapplot(gse, showCategory =30)
goplot(ego,showCategory = 10)
## Warning: ggrepel: 39 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
dotplot(ego, showCategory=30)