```{r  "{{funsys}}_compareCluster", echo=TRUE, results='asis', message=FALSE, echo=FALSE}
default_width <- set_default_width(enrich_obj = enrich_obj, showCategory = n_category)

cat(paste0("## **", funsys, " Over Representation Analysis**"), "\n",
	"The ORA method takes a group of significative DEGs (only DEGs, upregulated DEGs or downregulated DEGs) and performs a hypergeometric test for each term of the selected functional category.\n\n")

plot_enrResult_DT(enrich_obj)


cat("\n\n**Dotplot**\n\n",
        "The most highly signficant categories in descending in categories of gene ratio, defined as the proportion of significant genes that are found in the functional category.
         The x-axis represents the gene ratio and the dot size the number of genes associated with the functional category.\n\n"
)
pp <- enrichplot::dotplot(enrich_obj, showCategory=showCategories) 

pp <- set_standard_size(pp)
invisible(plot_in_div(pp, calc_height(enrich_obj), calc_width(enrich_obj)))

cat("\n\n**Heatplot**\n\n", 
	  "Significant genes (x-axis) and the functional categories in which they appear." 
)
width_size <- calc_width(enrich_obj)
height_size <- calc_height(enrich_obj) 
pp <- clusters_heatplot(enrich_obj@compareClusterResult) 
invisible(plot_in_div(pp, height_size, width_size))

cat("\n\n**Gene-Concept Network**\n\n", 
	  "The network connects the top functional categories (brown nodes) to their associated genes (grey or colored nodes).
 	   The size of the functional category nodes shows the number of connected genes.\n\n"
)
if (nrow(as.data.frame(enrich_obj)) > 2) {

 cnet_pp <- enrichplot::cnetplot(enrich_obj, showCategory=showCategories) 
 invisible(plot_in_div(cnet_pp, fig_width = 15, fig_height = 15))
} else {
	cat("\nThis graph can not be plotted because fewer than two functional categories were enriched\n")
}


cat("\n\n**Enrich Map plot**\n\n", 
  "The top functional categories (nodes), connected if they share genes. Edge thickness represents the number of shared genes.
	  Nodes size represents the number of significant genes within the category. Pies proportion represent the proportion of genes belonging to each cluster.\n\n"
)


if (nrow(as.data.frame(enrich_obj)) > 2) {
	if(group_results == TRUE)
	  pp <- enrichplot::emapplot(enrich_obj, showCategory=showCategories, pie.params = list(pie ="Count"),  layout.params = list(layout = "nicely"), 
                  shadowtext = FALSE, node_label = "group",  edge.params = list(min = 0.0000000000000001), group_category = TRUE, 
                  nCluster = min(floor(nrow(enrich_obj)/7), 20), nWords = 6, repel = TRUE)
	else 
	  pp <- enrichplot::emapplot(enrich_obj, showCategory= showCategories, pie.params = list(pie ="Count"), layout.params = list(layout = "nicely"), 
                  shadowtext = FALSE, repel = TRUE, edge.params = list(min = 0.0000000000000001))
	invisible(plot_in_div(pp, fig_width = calc_width(enrich_obj)))

} else {
	cat("\nThis graph can not be plotted because fewer than two functional categories were enriched\n")
}

if (nrow(as.data.frame(enrich_obj)) > 1000000000000) {

cat("\n\n**Cluster concept network plot**\n\n", 
  "The top functional categories (nodes), connected if they are shared among clusters. Edge thickness represents the number of shared genes.
	  Nodes size represents the number of clusters sharing the functional category. Pies proportion represent the proportion of clusters with that enriched category.\n\n"
)


# clnetplot_pp <- clnetplot(enrich_obj, showCategory=showCategories) 

# invisible(plot_in_div(clnetplot_pp, fig_width = 15, fig_height = 15))
} else {
	cat("\nThis graph can not be plotted because fewer than two functional categories were enriched\n")
}
```

