####---- Most Differential Genes Table Function ----####

make_most_differential_genes_table <- function(top_10_genes,header_size,text_size,border_thickness)
{
  de_annotated_top_10 = de_annotated[top_10_genes,]
  de_annotated_top_10$Gene = row.names(de_annotated_top_10)
  de_annotated_top_10 = de_annotated_top_10[,c("Gene","log2fold","p","p.adj")]

  table_theme <- gridExtra::ttheme_minimal(core = list(fg_params=list(cex = text_size)),colhead = list(fg_params=list(cex = header_size)))

  gt = tableGrob(de_annotated_top_10, theme=table_theme, rows=NULL)
  gt = gtable_add_grob(gt,grobs = rectGrob(gp = gpar(fill = NA, lwd = border_thickness)),t = 2, b = nrow(gt), l = 1, r = ncol(gt))
  gt = gtable_add_grob(gt,grobs = rectGrob(gp = gpar(fill = NA, lwd = border_thickness)),t = 1, l = 1, r = ncol(gt))
  gt = gtable_add_grob(gt,grobs = rectGrob(gp = gpar(fill = NA, lwd = border_thickness)),t = 1, b = nrow(gt), l = 1, r = 1)
  
  return(gt)
}

