Setup phase: Install and load relevant packages

if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install()
BiocManager::version()
BiocManager::install("remotes", dependencies = TRUE)
BiocManager::install("waldronlab/bugSigSimple")

Load bugSigSimple and bugSigDB

library(bugSigSimple)
library(bugsigdbr)
library(kableExtra)
library(tidyverse)

Load latest BugSigDB data

dat <- importBugSigDB()
dim(dat)

Subset all signatures by curator and condition

curatorName <- "Fatima Zohra"

caption <- paste0("Overview of the studies initially selected based on curator name: ", curatorName, ". For convenience, only top 20 most frequently reported conditions are shown")
my.dat <- subsetByCurator(dat, curator = curatorName)

table(my.dat[,"Condition"]) %>% 
  sort(decreasing = TRUE) %>% 
  as.data.frame() %>% 
  head(20) %>% 
  kbl(caption = caption) %>% 
  kable_styling()
efo <- bugsigdbr::getOntology("efo")
dat.bpd <- bugsigdbr::subsetByOntology(dat, column = "Condition", "bipolar disorder", efo)
dat.upd <- bugsigdbr::subsetByOntology(dat, column = "Condition", "major depressive disorder", efo)
my.dat.cond <- rbind(dat.bpd, dat.upd)
table(my.dat.cond[,"Condition"])

Tables for selected conditions together

Studies table

createStudyTable(my.dat.cond) %>% 
  kbl() %>% 
  kable_styling()

Taxa table

createTaxonTable(my.dat.cond, n = 20) %>% 
  kbl() %>% 
  kable_styling()

Tables of only bipolar disorder

ind <- my.dat.cond[,"Condition"] %in% c("bipolar disorder")
my.dat.bd <- my.dat.cond[!ind,]
dim(my.dat.bd)
table(my.dat.bd[,"Condition"])

Studies table

createStudyTable(my.dat.bd) %>% 
  kbl() %>% 
  kable_styling()

Taxa table

createTaxonTable(my.dat.bd, n = 20) %>% 
  kbl() %>% 
  kable_styling()

Tables only on major depressive disorder

ind <- my.dat.cond[,"Condition"] %in% c("major depressive disorder")
my.dat.mdd <- my.dat.cond[!ind,]
dim(my.dat.mdd)
table(my.dat.mdd[,"Condition"])

Studies table

createStudyTable(my.dat.mdd) %>% 
  kbl() %>% 
  kable_styling()

Taxa table

createTaxonTable(my.dat.mdd, n = 20) %>% 
  kbl() %>% 
  kable_styling()


waldronlab/bugSigSimple documentation built on June 9, 2025, 4:05 p.m.