Skip to content

Commit

Permalink
All significant dimensions are plotted and double are formatted to sc…
Browse files Browse the repository at this point in the history
…ientifics
  • Loading branch information
JoseCorCab committed Jul 29, 2024
1 parent 0594244 commit c609d79
Showing 1 changed file with 20 additions and 19 deletions.
39 changes: 20 additions & 19 deletions inst/templates/pca_enr.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
top_GOs <- head(all_enr[[dimension]], 10)
if (nrow(top_GOs) != 0){
top_GOs <- top_GOs[,c("GO.ID","Term","p.value","fdr")]
top_GOs[,c("p.value","fdr")]<- format(top_GOs[,c("p.value","fdr")], scientific = TRUE, digits = 3)
print(htmltools::tagList(
DT::datatable(top_GOs, filter = 'top', rownames = FALSE, extensions = c('Buttons','ColReorder'),
options = list(
Expand All @@ -30,29 +31,29 @@ cat("\n## **{{funsys}} - Enrichments for Principal Components**\n")
cat("### **Functional enrichments of PCs using all genes**\n")
FactoMineR::plot.PCA(func_results$pca_data$all_genes$pca_data, invisible = "quali" , title = "")
last_dim <- 1
while (last_dim < func_results$pca_data$all_genes$dim_to_keep){
plot(FactoMineR::plot.PCA(func_results$pca_data$all_genes$pca_data,
invisible = "quali",
axis = c(last_dim, last_dim + 1),
title = paste0(last_dim, " and ", last_dim + 1, " PCs")))
last_dim <- last_dim + 2
}
print_go_tables(pca_enr_all)
cat("### **Functional enrichments of PCs using only DEGs**\n")
FactoMineR::plot.PCA(func_results$pca_data$DEGs$pca_data, invisible = "quali" , title = "")
last_dim <- 1
while (last_dim < func_results$pca_data$all_genes$dim_to_keep){
plot(FactoMineR::plot.PCA(func_results$pca_data$DEGs$pca_data,
invisible = "quali",
axis = c(last_dim, last_dim + 1),
title = paste0(last_dim, " and ", last_dim + 1, " PCs")))
last_dim <- last_dim + 2
}
print_go_tables(pca_enr_degs)
# for (dimension in names(pca_enr_degs)) {
# cat(paste0("\n**",dimension,"**\n"))
# top_GOs <- head(pca_enr_degs[[dimension]], 10)
# if (nrow(top_GOs) != 0){
# top_GOs <- top_GOs[,c("GO.ID","Term","p.value","fdr")]
# print(htmltools::tagList(
# DT::datatable(top_GOs, filter = 'top', rownames = FALSE, extensions = c('Buttons','ColReorder'),
# options = list(
# colReorder = TRUE,
# dom = 'lftBip',
# buttons = c('copy', 'csv', 'excel')))
# ))
# } else {
# cat("\n**No enrichments found**\n")
# }
# }
# pca_enr_degs
```

0 comments on commit c609d79

Please sign in to comment.