## Cluster plot again
clusterHeatmap(xCentered, param, clusterResult, file=NULL,
               colColors=sampleColors, 
               lim=c(-param$logColorRange, param$logColorRange))
## The detailed table
ktables <- goTables$ktables
ngroups <- sapply(ktables, nrow)
ktables <- do.call(rbind, ktables)
stopifnot(identical(names(clusterResult$GO), c("BP", "MF", "CC"))) ## The order matters
p <- kable(ktables, escape=FALSE, row.names=FALSE, format = "html", digits=4,
          caption="GO categories of feature clusters") %>%
  kable_styling(bootstrap_options = "striped",
                full_width = F, position = "float_right") %>%
  footnote(general="Cluster font color corresponds to the row colors in the heatmap plot.") %>%
  add_header_above(c("Biological Proc. (BP)" = 4, "Molecular Func. (MF)" = 4, "Cellular Comp. (CC)" = 4))
stopifnot(length(bgColors) == length(ngroups)) ## The colour and clusters should match.
indices <- c(0,cumsum(ngroups))
for(i in 1:length(ngroups)){
  p <- p %>% 
    kableExtra::group_rows(paste("Cluster", i), indices[i]+1, indices[i+1],
               label_row_css = paste("background-color:", bgColors[i], 
                                     "; color: #fff;"))
}
p


uzh/ezRun documentation built on April 24, 2024, 4:01 p.m.