| treeplot {enrichplot} | R Documentation |
Functional grouping tree diagram for enrichment result of over-representation test or gene set enrichment analysis.
treeplot(x, showCategory = 30, color = "p.adjust", label_format = 30, ...) ## S4 method for signature 'enrichResult' treeplot(x, showCategory = 30, color = "p.adjust", label_format = 30, ...) ## S4 method for signature 'gseaResult' treeplot(x, showCategory = 30, color = "p.adjust", label_format = 30, ...) ## S4 method for signature 'compareClusterResult' treeplot(x, showCategory = 5, color = "p.adjust", label_format = 30, ...) treeplot.enrichResult( x, showCategory = 30, color = "p.adjust", nWords = 4, nCluster = 5, cex_category = 1, label_format = 30, fontsize = 4, offset = 1, offset_tiplab = 1, hclust_method = "ward.D", group_color = NULL, extend = 0.3, hilight = TRUE, hexpand = 0.1, align = "both", ... ) treeplot.compareClusterResult( x, showCategory = 5, color = "p.adjust", nWords = 4, nCluster = 5, cex_category = 1, split = NULL, label_format = 30, fontsize = 4, offset = 1, pie = "equal", legend_n = 3, offset_tiplab = 1, hclust_method = "ward.D", group_color = NULL, extend = 0.3, hilight = TRUE, geneClusterPanel = "heatMap", hexpand = 0.1, align = "both", ... )
x |
enrichment result. |
showCategory |
number of enriched terms to display |
color |
variable that used to color enriched terms, e.g. pvalue, p.adjust or qvalue |
label_format |
a numeric value sets wrap length, alternatively a custom function to format axis labels. |
... |
additional parameters |
nWords |
The number of words in the cluster tags. |
nCluster |
The number of clusters, the default value is 5. |
cex_category |
Number indicating the amount by which plotting category. nodes should be scaled relative to the default. displayed completely, the user can increase this value. |
fontsize |
The size of text, default is 4. |
offset |
numeric, distance bar and tree, offset of bar and text from the clade, default is 1, meaning 1 * 1.2 * x_range_of_tree plus distance_between_tree_and_tiplab (1 * (1.2 * x_range_of_tree + distance_between_tree_and_tiplab)). |
offset_tiplab |
tiplab offset, the bigger the number, the farther the distance between the node and the branch. The default is 1, when geneClusterPanel = "pie", meaning 1 * max_radius_of_the_pies; when geneClusterPanel = "heatMap", meaning 1 * 0.16 * column_number_of_heatMap * x_range_of_tree; when geneClusterPanel = "dotplot", meaning 1 * 0.09 * column_number_of_dotplot * x_range_of_tree. |
hclust_method |
Method of hclust. This should be (an unambiguous abbreviation of) one of "ward.D", "ward.D2", "single", "complete", "average" (= UPGMA), "mcquitty" (= WPGMA), "median" (= WPGMC) or "centroid" (= UPGMC). |
group_color |
A vector of group colors, the length of the vector should be the same as nCluster. |
extend |
Numeric, extend the length of bar, default is 0.3. |
hilight |
Logical value, if TRUE(default), add ggtree::geom_hilight() layer. |
hexpand |
expand x limits by amount of xrange * hexpand. |
align |
control the align direction of the edge of high light rectangular. Options is 'none', 'left', 'right', 'both (default)'. |
split |
Separate result by 'category' variable. |
pie |
Used only when geneClusterPanel = "pie", proportion of clusters in the pie chart, one of 'equal' (default) and 'Count'. |
legend_n |
Number of circle in legend, the default value is 3. |
geneClusterPanel |
one of "heatMap"(default), "dotplot", "pie". |
This function visualizes gene sets as a tree. Gene sets with high similarity tend to cluster together, making it easier for interpretation.
ggplot object
## Not run:
library(clusterProfiler)
library(org.Hs.eg.db)
library(enrichplot)
library(GOSemSim)
library(ggplot2)
library(DOSE)
data(geneList)
gene <- names(geneList)[abs(geneList) > 2]
ego <- enrichGO(gene = gene,
universe = names(geneList),
OrgDb = org.Hs.eg.db,
ont = "BP",
pAdjustMethod = "BH",
pvalueCutoff = 0.01,
qvalueCutoff = 0.05,
readable = TRUE)
d <- godata('org.Hs.eg.db', ont="BP")
ego2 <- pairwise_termsim(ego, method = "Wang", semData = d)
treeplot(ego2, showCategory = 30)
# use `hilight = FALSE` to remove ggtree::geom_hilight() layer.
treeplot(ego2, showCategory = 30, hilight = FALSE)
# use `offset` parameter to adjust the distance of bar and tree.
treeplot(ego2, showCategory = 30, hilight = FALSE, offset = 1.5)
# use `offset_tiplab` parameter to adjust the distance of nodes and branches.
treeplot(ego2, showCategory = 30, hilight = FALSE, offset_tiplab = 1.5)
keep <- rownames(ego2@termsim)[c(1:10, 16:20)]
keep
treeplot(ego2, showCategory = keep)
treeplot(ego2, showCategory = 20,
group_color = c("#999999", "#E69F00", "#56B4E9", "#009E73", "#F0E442"))
# It can also graph compareClusterResult
data(gcSample)
xx <- compareCluster(gcSample, fun="enrichKEGG",
organism="hsa", pvalueCutoff=0.05)
xx <- pairwise_termsim(xx)
treeplot(xx)
# use `geneClusterPanel` to change the gene cluster panel.
treeplot(xx, geneClusterPanel = "dotplot")
treeplot(xx, geneClusterPanel = "pie")
## End(Not run)