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(bugSigDB)
library (bugSigSimple)

Read curation file

dat <- bugsigdbr::importBugSigDB()
## Using cached version from 2025-01-30 21:57:36
dim(dat)
## [1] 5520   50

Subset all signatures by curator and condition

my.dat <- subsetByCurator(dat, curator="Fatima Zohra")
table(my.dat[,"Condition"])
## 
##                         Alcohol drinking 
##                                        4 
##                      Alzheimer's disease 
##                                        2 
##                         Anorexia nervosa 
##                                       10 
##                         Anxiety disorder 
##                                        5 
## Attention deficit hyperactivity disorder 
##                                        6 
##                                   Autism 
##                                        5 
##                         Bipolar disorder 
##                                       18 
##                          Cervical cancer 
##                                        4 
##      Chronic hepatitis C virus infection 
##                                        4 
##                   Chronic kidney disease 
##                                        8 
##    Chronic obstructive pulmonary disease 
##                                        2 
##                        Colorectal cancer 
##                                        7 
##                          Crohn's disease 
##                                        3 
##                       Endometrial cancer 
##                                        2 
##                                 Epilepsy 
##                                        2 
##                   Gastric adenocarcinoma 
##                                        4 
##                           Gastric cancer 
##                                       13 
##                 Genital neoplasm, female 
##                                        2 
##                     Gestational diabetes 
##                                        2 
##                     Hepatitis, Alcoholic 
##                                        8 
##                 Hepatocellular carcinoma 
##                                        4 
##                            HIV infection 
##                                       17 
##          Human papilloma virus infection 
##                                        4 
##      Human papilloma virus infection,Age 
##                                        2 
##               Inflammatory bowel disease 
##                                        2 
##                                 Leukemia 
##                                        4 
##                              Lung cancer 
##                                       16 
##                       Multiple sclerosis 
##                                        4 
##                Necrotizing enterocolitis 
##                                        2 
##        Non-alcoholic fatty liver disease 
##                                        2 
##            Obsessive-compulsive disorder 
##                                        1 
##                           Ovarian cancer 
##                                        4 
##                     Pancreatic carcinoma 
##                                        8 
##                      Parkinson's disease 
##                                        2 
##                                Pneumonia 
##                                        2 
##                Polycystic ovary syndrome 
##                                        6 
##                           Postmenopausal 
##                                        1 
##                                Psychosis 
##                                        4 
##                     Rheumatoid arthritis 
##                                        2 
##                            Sampling site 
##                                        1 
##                            Schizophrenia 
##                                       19 
##                Stimulus or stress design 
##                                        3 
##               Substance-related disorder 
##                                        4 
##                       Ulcerative colitis 
##                                        2 
##                      Unipolar depression 
##                                       17 
##                           Vulvovaginitis 
##                                        3
condsnew <-c("bipolar disorder","major depressive disorder")
condsnew <-c("bipolar disorder")

efo <- bugsigdbr::getOntology("efo")
## Loading required namespace: ontologyIndex
## Using cached version from 2025-01-30 21:55:38
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"])
## 
##          Bipolar disorder Major depressive disorder 
##                        21                        13

Overall frequencies of taxa increased and decreased in cases

getMostFrequentTaxa(my.dat.cond,n=30)
## 
##                      k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                             6 
##                                     k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                             6 
##               k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                             5 
##                                    k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                                             4 
##                   k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                                             4 
##                      k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                                             4 
##                       k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                                             4 
##                                    k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                                             3 
##                   k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                             3 
##                                   k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                             3 
##                                   k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae 
##                                                                                                             3 
##                                 k__Bacteria|p__Bacteroidota|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae 
##                                                                                                             3 
##                                                                                 k__Bacteria|p__Actinomycetota 
##                                                                                                             2 
##                                                               k__Bacteria|p__Actinomycetota|c__Coriobacteriia 
##                                                                                                             2 
##                                           k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                                             2 
##           k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Eggerthellales|f__Eggerthellaceae|g__Eggerthella 
##                                                                                                             2 
##                      k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium 
##                                                                                                             2 
##   k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium|s__Clostridium sp. 
##                                                                                                             2 
##                      k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Eubacteriaceae|g__Eubacterium 
##                                                                                                             2 
##                 k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Flavonifractor 
##                                                                                                             2 
##                   k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Anaerostipes 
##                                                                                                             2 
##       k__Bacteria|p__Bacillota|c__Erysipelotrichia|o__Erysipelotrichales|f__Turicibacteraceae|g__Turicibacter 
##                                                                                                             2 
##                          k__Bacteria|p__Bacillota|c__Negativicutes|o__Acidaminococcales|f__Acidaminococcaceae 
##                                                                                                             2 
## k__Bacteria|p__Bacillota|c__Negativicutes|o__Acidaminococcales|f__Acidaminococcaceae|g__Phascolarctobacterium 
##                                                                                                             2 
##                 k__Bacteria|p__Bacillota|c__Negativicutes|o__Selenomonadales|f__Selenomonadaceae|g__Megamonas 
##                                                                                                             2 
##                 k__Bacteria|p__Bacillota|c__Negativicutes|o__Veillonellales|f__Veillonellaceae|g__Veillonella 
##                                                                                                             2 
##                                                                                   k__Bacteria|p__Bacteroidota 
##                                                                                                             2 
##                  k__Bacteria|p__Bacteroidota|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides 
##                                                                                                             2 
##                   k__Bacteria|p__Bacteroidota|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae|g__Prevotella 
##                                                                                                             2 
##                         k__Bacteria|p__Actinomycetota|c__Actinomycetes|o__Actinomycetales|f__Actinomycetaceae 
##                                                                                                             1
getMostFrequentTaxa(my.dat.cond,, direction="increased")
## 
##        k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                               6 
##                       k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                               6 
## k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                               5 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                               4 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                               4 
##        k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                               4 
##         k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                               4 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                               3 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                               3 
##                     k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                               3
getMostFrequentTaxa(my.dat.cond,, direction="decreased")
## 
##        k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                               6 
##                       k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                               6 
## k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                               5 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                               4 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                               4 
##        k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                               4 
##         k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                               4 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                               3 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                               3 
##                     k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                               3

Binomial test “Increased in Cases”

binom.test(x=4, n=6)
## 
##  Exact binomial test
## 
## data:  4 and 6
## number of successes = 4, number of trials = 6, p-value = 0.6875
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2227781 0.9567281
## sample estimates:
## probability of success 
##              0.6666667
binom.test(x=4, n=4)
## 
##  Exact binomial test
## 
## data:  4 and 4
## number of successes = 4, number of trials = 4, p-value = 0.125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3976354 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=4, n=4)
## 
##  Exact binomial test
## 
## data:  4 and 4
## number of successes = 4, number of trials = 4, p-value = 0.125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3976354 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=3, n=4)
## 
##  Exact binomial test
## 
## data:  3 and 4
## number of successes = 3, number of trials = 4, p-value = 0.625
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1941204 0.9936905
## sample estimates:
## probability of success 
##                   0.75
binom.test(x=3, n=5)
## 
##  Exact binomial test
## 
## data:  3 and 5
## number of successes = 3, number of trials = 5, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1466328 0.9472550
## sample estimates:
## probability of success 
##                    0.6
binom.test(x=3, n=3)
## 
##  Exact binomial test
## 
## data:  3 and 3
## number of successes = 3, number of trials = 3, p-value = 0.25
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2924018 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=3, n=3)
## 
##  Exact binomial test
## 
## data:  3 and 3
## number of successes = 3, number of trials = 3, p-value = 0.25
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2924018 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=3, n=4)
## 
##  Exact binomial test
## 
## data:  3 and 4
## number of successes = 3, number of trials = 4, p-value = 0.625
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1941204 0.9936905
## sample estimates:
## probability of success 
##                   0.75

Binomial test “Decreased in Cases”

binom.test(x=7, n=8)
## 
##  Exact binomial test
## 
## data:  7 and 8
## number of successes = 7, number of trials = 8, p-value = 0.07031
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.4734903 0.9968403
## sample estimates:
## probability of success 
##                  0.875
binom.test(x=6, n=6)
## 
##  Exact binomial test
## 
## data:  6 and 6
## number of successes = 6, number of trials = 6, p-value = 0.03125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.5407419 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=3, n=5)
## 
##  Exact binomial test
## 
## data:  3 and 5
## number of successes = 3, number of trials = 5, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1466328 0.9472550
## sample estimates:
## probability of success 
##                    0.6
binom.test(x=3, n=5)
## 
##  Exact binomial test
## 
## data:  3 and 5
## number of successes = 3, number of trials = 5, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1466328 0.9472550
## sample estimates:
## probability of success 
##                    0.6
binom.test(x=2, n=6)
## 
##  Exact binomial test
## 
## data:  2 and 6
## number of successes = 2, number of trials = 6, p-value = 0.6875
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.04327187 0.77722190
## sample estimates:
## probability of success 
##              0.3333333
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=3)
## 
##  Exact binomial test
## 
## data:  2 and 3
## number of successes = 2, number of trials = 3, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.09429932 0.99159624
## sample estimates:
## probability of success 
##              0.6666667
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1

Adjusting p value by Bonferroni correction

pvals <- c(0.6875, 0.125, 0.375, 0.625, 1, 0.25, 0.07031, 0.03125, 0.6875, 0.5)
adj.pvals <- p.adjust(pvals, method="bonferroni")
adj.pvals
##  [1] 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 0.7031 0.3125 1.0000 1.0000

Subset only on bipolar disorder

ind <- my.dat.cond[,"Condition"] %in% c("bipolar disorder")
my.dat.mdd <- my.dat.cond[!ind,]
dim(my.dat.mdd)
## [1] 34 50
table(my.dat.mdd[,"Condition"])
## 
##          Bipolar disorder Major depressive disorder 
##                        21                        13
getMostFrequentTaxa(my.dat.mdd, n= 20)
## 
##                    k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                           6 
##                                   k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                           6 
##             k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                           5 
##                                  k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                                           4 
##                 k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                                           4 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                                           4 
##                     k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                                           4 
##                                  k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                                           3 
##                 k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                           3 
##                                 k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                           3 
##                                 k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae 
##                                                                                                           3 
##                               k__Bacteria|p__Bacteroidota|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae 
##                                                                                                           3 
##                                                                               k__Bacteria|p__Actinomycetota 
##                                                                                                           2 
##                                                             k__Bacteria|p__Actinomycetota|c__Coriobacteriia 
##                                                                                                           2 
##                                         k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                                           2 
##         k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Eggerthellales|f__Eggerthellaceae|g__Eggerthella 
##                                                                                                           2 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium 
##                                                                                                           2 
## k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium|s__Clostridium sp. 
##                                                                                                           2 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Eubacteriaceae|g__Eubacterium 
##                                                                                                           2 
##               k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Flavonifractor 
##                                                                                                           2
getMostFrequentTaxa(my.dat.mdd,, "increased")
## 
##                                               k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                                                      4 
##                                                             k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                                                                      4 
##                                            k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                                                                      4 
##                                                                                                          k__Bacteria|p__Actinomycetota 
##                                                                                                                                      2 
##                                                                                        k__Bacteria|p__Actinomycetota|c__Coriobacteriia 
##                                                                                                                                      2 
##                                                                    k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                                                                      2 
##                                                              k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                                                      2 
##                                          k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Flavonifractor 
##                                                                                                                                      2 
##                                                            k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae 
##                                                                                                                                      2 
## k__Bacteria|p__Actinomycetota|c__Actinomycetes|o__Actinomycetales|f__Actinomycetaceae|g__Actinomyces|s__Actinomyces bouchesdurhonensis 
##                                                                                                                                      1
getMostFrequentTaxa(my.dat.mdd,, "decreased")
## 
##                                   k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                           4 
##             k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                           4 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                                           4 
##                     k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                                           3 
##                    k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                           2 
##                                  k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                                           2 
##                 k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                           2 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium 
##                                                                                                           2 
## k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium|s__Clostridium sp. 
##                                                                                                           2 
##                                 k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                           2

Binomial test “Increased in bipolar”

binom.test(x=3, n=3)
## 
##  Exact binomial test
## 
## data:  3 and 3
## number of successes = 3, number of trials = 3, p-value = 0.25
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2924018 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=3, n=3)
## 
##  Exact binomial test
## 
## data:  3 and 3
## number of successes = 3, number of trials = 3, p-value = 0.25
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2924018 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=3, n=4)
## 
##  Exact binomial test
## 
## data:  3 and 4
## number of successes = 3, number of trials = 4, p-value = 0.625
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1941204 0.9936905
## sample estimates:
## probability of success 
##                   0.75
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=3)
## 
##  Exact binomial test
## 
## data:  2 and 3
## number of successes = 2, number of trials = 3, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.09429932 0.99159624
## sample estimates:
## probability of success 
##              0.6666667
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=3)
## 
##  Exact binomial test
## 
## data:  2 and 3
## number of successes = 2, number of trials = 3, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.09429932 0.99159624
## sample estimates:
## probability of success 
##              0.6666667
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1

Binomial test “decreased in bipolar”

binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=4, n=4)
## 
##  Exact binomial test
## 
## data:  4 and 4
## number of successes = 4, number of trials = 4, p-value = 0.125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3976354 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=3, n=5)
## 
##  Exact binomial test
## 
## data:  3 and 5
## number of successes = 3, number of trials = 5, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1466328 0.9472550
## sample estimates:
## probability of success 
##                    0.6
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1

Adjusting p value by FDR correction for BD

pvals <- c(0.6875, 0.125, 0.375, 0.625, 1, 0.25, 0.07031, 0.03125, 0.6875, 0.5)
adj.pvals <- p.adjust(pvals, method="fdr")
adj.pvals
##  [1] 0.7638889 0.4166667 0.7500000 0.7638889 1.0000000 0.6250000 0.3515500
##  [8] 0.3125000 0.7638889 0.7638889

Subset only on MDD

ind <- my.dat.cond[,"Condition"] %in% c("unipolar depression")
my.dat.bd <- my.dat.cond[!ind,]
dim(my.dat.bd)
## [1] 34 50
table(my.dat.bd[,"Condition"])
## 
##          Bipolar disorder Major depressive disorder 
##                        21                        13
getMostFrequentTaxa(my.dat.bd, n=20)
## 
##                    k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                           6 
##                                   k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                           6 
##             k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                           5 
##                                  k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                                           4 
##                 k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                                           4 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                                           4 
##                     k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                                           4 
##                                  k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                                           3 
##                 k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                           3 
##                                 k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                           3 
##                                 k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae 
##                                                                                                           3 
##                               k__Bacteria|p__Bacteroidota|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae 
##                                                                                                           3 
##                                                                               k__Bacteria|p__Actinomycetota 
##                                                                                                           2 
##                                                             k__Bacteria|p__Actinomycetota|c__Coriobacteriia 
##                                                                                                           2 
##                                         k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                                           2 
##         k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Eggerthellales|f__Eggerthellaceae|g__Eggerthella 
##                                                                                                           2 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium 
##                                                                                                           2 
## k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium|s__Clostridium sp. 
##                                                                                                           2 
##                    k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Eubacteriaceae|g__Eubacterium 
##                                                                                                           2 
##               k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Flavonifractor 
##                                                                                                           2
getMostFrequentTaxa(my.dat.bd,, direction="increased")
## 
##        k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                               6 
##                       k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                               6 
## k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                               5 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                               4 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                               4 
##        k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                               4 
##         k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                               4 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                               3 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                               3 
##                     k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                               3
getMostFrequentTaxa(my.dat.bd,, direction="decreased")
## 
##        k__Bacteria|p__Actinomycetota|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                               6 
##                       k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                               6 
## k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                               5 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                               4 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                               4 
##        k__Bacteria|p__Bacillota|c__Clostridia|o__Lachnospirales|f__Lachnospiraceae|g__Roseburia 
##                                                                                               4 
##         k__Bacteria|p__Bacillota|c__Clostridia|o__Peptostreptococcales|f__Peptostreptococcaceae 
##                                                                                               4 
##                      k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                               3 
##     k__Bacteria|p__Bacillota|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                               3 
##                     k__Bacteria|p__Bacillota|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                               3

Binomial test increased in MDD w/out MHT

binom.test(x=4, n=4)
## 
##  Exact binomial test
## 
## data:  4 and 4
## number of successes = 4, number of trials = 4, p-value = 0.125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3976354 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=4, n=4)
## 
##  Exact binomial test
## 
## data:  4 and 4
## number of successes = 4, number of trials = 4, p-value = 0.125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3976354 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=4, n=4)
## 
##  Exact binomial test
## 
## data:  4 and 4
## number of successes = 4, number of trials = 4, p-value = 0.125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3976354 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=3)
## 
##  Exact binomial test
## 
## data:  2 and 3
## number of successes = 2, number of trials = 3, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.09429932 0.99159624
## sample estimates:
## probability of success 
##              0.6666667
binom.test(x=1, n=2)
## 
##  Exact binomial test
## 
## data:  1 and 2
## number of successes = 1, number of trials = 2, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.01257912 0.98742088
## sample estimates:
## probability of success 
##                    0.5

Binomial test decreased in MDD w/out MHT

binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=4, n=4)
## 
##  Exact binomial test
## 
## data:  4 and 4
## number of successes = 4, number of trials = 4, p-value = 0.125
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3976354 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=4, n=5)
## 
##  Exact binomial test
## 
## data:  4 and 5
## number of successes = 4, number of trials = 5, p-value = 0.375
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.2835821 0.9949492
## sample estimates:
## probability of success 
##                    0.8
binom.test(x=3, n=5)
## 
##  Exact binomial test
## 
## data:  3 and 5
## number of successes = 3, number of trials = 5, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1466328 0.9472550
## sample estimates:
## probability of success 
##                    0.6
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=4)
## 
##  Exact binomial test
## 
## data:  2 and 4
## number of successes = 2, number of trials = 4, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.06758599 0.93241401
## sample estimates:
## probability of success 
##                    0.5
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1
binom.test(x=2, n=2)
## 
##  Exact binomial test
## 
## data:  2 and 2
## number of successes = 2, number of trials = 2, p-value = 0.5
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.1581139 1.0000000
## sample estimates:
## probability of success 
##                      1

Faecalibacterium plot

taxa.mdd <- c(up=1/7, down=4/7)
taxa.bd <- c(up=0/4, down=3/4)
barplot(rbind(taxa.mdd, taxa.bd), beside=TRUE, col=c("red","blue"), legend=TRUE, args.legend=list(x="topleft", legend=c("major depressive disorder", "bipolar disorder")), ylab="relative frequency", main="Frequency of Faecalibacterium")

Actinobacteria plot

taxa.mdd <- c(up=2/7, down=2/7)
taxa.bd <- c(up=2/4, down=0/4)
barplot(rbind(taxa.mdd, taxa.bd), beside=TRUE, col=c("red","blue"), legend=TRUE, args.legend=list(x="topright", cex = 0.70, legend=c("major depressive disorder", "bipolar disorder")), ylab="relative frequency", main="Frequency of Actinobacteria")

Bacteroides plot

taxa.mdd <- c(up=2/7, down=2/7)
taxa.bd <- c(up=0/4, down=2/4)
barplot(rbind(taxa.mdd, taxa.bd), beside=TRUE, col=c("red","blue"), legend=TRUE, args.legend=list(x="topleft", cex = 0.80, legend=c("major depressive disorder", "bipolar disorder")), ylab="relative frequency", main="Frequency of Bacteroides")

Ruminococcaceae plot

taxa.mdd <- c(up=0/7, down=4/7)
taxa.bd <- c(up=0/4, down=2/4)
barplot(rbind(taxa.mdd, taxa.bd), beside=TRUE, col=c("red","blue"), legend=TRUE, args.legend=list(x="topleft", cex = 0.75, legend=c("major depressive disorder", "bipolar disorder")), ylab="relative frequency", main="Frequency of Ruminococcaceae")