Basic Workflow
This is a minimal example. For details, please see following articles on the left of website.
Basic enrichment analysis involves performing a batch “dictionary lookup” for a set of genes to determine their associations. The most commonly used method is over-representation analysis (ORA). If you also have information on weights, then Gene Set Enrichment Analysis (GSEA) is another classic choice. After getting enriched result, a re-enrich analysis may help you to get more insightful result.
ORA
library(dplyr)
library(tibble)
1library(org.Hs.eg.db)
library(gt)
library(EnrichGT)
library(readr)
<- read_csv("~/Documents/4Fun/EGTFun/DEG.csv")
DEGexample <- DEGexample |> dplyr::filter(pvalue<0.05)
DEGexample2 <- DEGexample |> dplyr::filter(pvalue<0.05,log2FoldChange>0.7)
DEGexample_UpReg <- DEGexample_UpReg$...1
DEGs # The first example:
<- egt_enrichment_analysis(
ora_result 2genes = DEGs,
3database = database_Reactome(OrgDB = org.Hs.eg.db)
)# The second example:
<- egt_enrichment_analysis(
another_example 4genes = genes_with_weights(DEGexample2$...1,DEGexample2$log2FoldChange),
5database = database_GO_BP(org.Hs.eg.db))
# Ploting
6egt_plot_results(ora_result,showIDs = T,ntop = 20)
- 1
-
EnrichGT use
AnnotationDbi
for fetching most of databases and gene annotations. If throwing an error, please re-check this step; - 2
-
ORA just need 2 input. The first is a character vector containg gene symbols like
c("TP53","PLP1","FABP1","VCAM1")
; - 3
- The second is your favourite database. EnrichGT supports many. See Database usage;
- 4
- Or you want input genes with direction. See enrichment details;
- 5
- Enriching using Gene Ontology BP;
- 6
- Showing enrichment result as figure. See more in visualization help.
Re-enrichment
This support the ORA output from both EnrichGT
and clusterProfiler
. So you can use your favourite tool to achieve this.
1<- egt_recluster_analysis(ora_result)
re_enrichment_results 2
re_enrichment_results3egt_plot_results(re_enrichment_results,ntop = 3)
4egt_plot_umap(re_enrichment_results)
5|> egt_infer_act(DB = "collectri", species = "human") re_enrichment_results
- 1
- Doing re-enrichment analysis (See Re-enrichment usage);
- 2
- Showing GT HTML report, see more in visualization help;
- 3
- Viewing re-enrichment result as dot plot, see more in visualization help;
- 4
- Viewing re-enrichment result as UMAP plot, see more in visualization help;
- 5
- Infering TF/pathway activity, experimential, might not be correct, see more in re-enrichment help.
GSEA
If you have a set of genes with known weight like log2FC
, or the loading from PCA
or NMF
…
<- egt_gsea_analysis(
GSEAexample genes =
1genes_with_weights(DEGexample2$...1,DEGexample2$log2FoldChange),
database =
2database_from_gmt("gmt_file.gmt")
)egt_plot_results(GSEAexample) # showing GSEA result
- 1
-
GSEA is also supported, see enrichment details.
genes_with_weights()
is used to generate weighted genes; - 2
- Additional pathway information like GMT file or table is also supported. See Database usage.
Fusing ORA results
This function support the ORA output from both EnrichGT
and clusterProfiler
. So you can use your favourite tool to achieve this.
# Fusing results:
1<- egt_enrichment_analysis(genes = DEGs, database = database_Reactome(OrgDB = org.Hs.eg.db))
ora_result_A 2<- egt_enrichment_analysis(genes = DEGs, database = database_kegg(kegg_organism = "hsa",OrgDB = org.Hs.eg.db))
ora_result_B 3<- egt_recluster_analysis(list(ora_result_A,ora_result_B)) fused_result
- 1
- ORA result 1 with Reactome;
- 2
- ORA result 2 with KEGG;
- 3
- Fuse together.
Only same source of enrichment results can be merge.
For example, the result of
egt_enrichment_analysis(genes = DEGs, database = database_Reactome(OrgDB = org.Hs.eg.db))
and
egt_enrichment_analysis(genes = DEGs, database = database_kegg(OrgDB = org.Hs.eg.db))
can be merged,
but the result of
egt_enrichment_analysis(genes = DEGs, database = database_Reactome(OrgDB = org.Hs.eg.db))
and
egt_enrichment_analysis(genes = genes_with_weights(DEGexample2$...1,DEGexample2$log2FoldChange), database = database_kegg(OrgDB = org.Hs.eg.db))
CAN’T be merged.
If you have ORA results that want to compare, please use egt_compare_groups()
.
Gene Annotation Converter
1<- convert_annotations_genes(DEGexample$...1[1:10], from_what="SYMBOL", to_what=c("ENTREZID","ENSEMBL","GENENAME"), OrgDB=org.Hs.eg.db) IDs_of_genes
- 1
- Just told it from what and to what :)