1. Load TrendCatcher R package.

library(TrendCatcher)

2. Now read the demo master.list.

demo.master.list.path<-system.file("extdata", "BrainMasterList_Symbol.rda", package = "TrendCatcher")
load(demo.master.list.path)

3. Use GO enrichment analysis to construct TimeHeatmap

To draw TimeHeatmap using GO database, please use draw_TimeHeatmap_GO function. This function will return a list composed of a TimeHeatmap plot and a merge.df dataframe. Due to the limited size of TimeHeatmap for visualization, users can play with merge.df which includes all the GO enrichment analysis for each time window.

#time_heatmap<-draw_TimeHeatmap_GO(master.list = master.list, logFC.thres = 0, top.n = 10, dyn.gene.p.thres = 0.05, keyType = "SYMBOL", OrgDb = "org.Mm.eg.db", ont = "BP", term.width = 80, GO.enrich.p = 0.05, figure.title = "TimeHeatmap")  

You can also load the demo TimeHeatmap object to see the what elements it contains. It has 3 elements, a ComplexHeatmap object time.heatmap, a data.frame merge.df and a data.frame GO.df.

# To save time, directely load from extdata
demo.time.heatmap.path<-system.file("extdata", "Brain_TimeHeatmap.rda", package = "TrendCatcher")
load(demo.time.heatmap.path)
names(time_heatmap)

Print out TimeHeatmap from the time_heatmap list object.

require("ComplexHeatmap")
print(time_heatmap$time.heatmap)

Check all the enriched GO terms.

head(time_heatmap$merge.df[,1:5])

Check top enriched GO terms average log2FC within each time window.

head(time_heatmap$GO.df[,1:5])

4. TimeHeatmap with non-redundant GO terms.

Sometimes GO terms are redundant, users can select manually non-redundant GOs using function below.

go.terms<-unique(time_heatmap$GO.df$Description)[1:5]
time_heatmap_selGO<-draw_TimeHeatmap_selGO(time_heatmap = time_heatmap, sel.go = go.terms, master.list = master.list, GO.perc.thres = 0, nDDEG.thres = 0, save.tiff.path = NA)

5. Look at Genes candidates from picked enriched GO terms.

To look at which genes are involved within the TimeHeatmap above. We can call draw_GOHeatmap function. This function is useful when one is comparing multiple projects.

go.terms<-c("response to lipopolysaccharide",
            "response to interferon-beta",
            "cytokine-mediated signaling pathway",
            "response to interferon-gamma",
            "response to virus",
            "leukocyte migration",
            "mitotic nuclear division",
            "regulation of vasculature development",
            "extracellular structure organization",
            "regulation of epithelial cell proliferation")
gene.GO.df<-draw_GOHeatmap(master.list = master.list, time.window = "0h-6h", 
                           go.terms = go.terms,  merge.df = time_heatmap$merge.df, 
                           logFC.thres = 5)

The data.frame gene.GO.df contains all the genes we found through TrendCatcher without logFC threshold.

head(gene.GO.df$GOheatmapDat)


jaleesr/TrendCatcher_1.0.0 documentation built on Jan. 29, 2024, 9:34 p.m.