Setup phase: Install and load relevant packages

install.packages("devtools")
devtools::install_github("waldronlab/bugSigSimple")
devtools::install_github("waldronlab/bugSigDB")

Load bugSigSimple and bugSigDB

#library(bugSigDB)
library (bugSigSimple)

Read curation file

dat <- bugsigdbr::importBugSigDB()
## Using cached version from 2022-03-31 12:35:22
dim(dat)
## [1] 2098   48

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 
##                                       17 
##                          cervical cancer 
##                                        4 
##      chronic hepatitis C virus infection 
##                                        4 
##                   chronic kidney disease 
##                                        9 
##    chronic obstructive pulmonary disease 
##                                        2 
##                        colorectal cancer 
##                                        7 
##                          Crohn's disease 
##                                        3 
##                       endometrial cancer 
##                                        4 
##                                 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 
##                                        6 
##               inflammatory bowel disease 
##                                        2 
##                                 leukemia 
##                                        4 
##                              lung cancer 
##                                       19 
##                       multiple sclerosis 
##                                        4 
##                necrotizing enterocolitis 
##                                        3 
##        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 
##                          prostate cancer 
##                                        2 
##                                psychosis 
##                                        4 
##                     rheumatoid arthritis 
##                                        2 
##                            schizophrenia 
##                                       20 
##                stimulus or stress design 
##                                        3 
##               substance-related disorder 
##                                        4 
##                       ulcerative colitis 
##                                        2 
##                      unipolar depression 
##                                       19 
##                           vulvovaginitis 
##                                        3
condsnew <-c("bipolar disorder","unipolar depression")
condsnew <-c("bipolar disorder")

efo <- bugsigdbr::getOntology("efo")
## Loading required namespace: ontologyIndex
## Using cached version from 2022-03-31 12:34:11
dat.bpd <- bugsigdbr::subsetByOntology(dat, column = "Condition", "bipolar disorder", efo)
dat.upd <- bugsigdbr::subsetByOntology(dat, column = "Condition", "unipolar depression", efo)
my.dat.cond <- rbind(dat.bpd, dat.upd)
table(my.dat.cond[,"Condition"])
## 
##    bipolar disorder unipolar depression 
##                  18                  23

Overall frequencies of taxa increased and decreased in cases

getMostFrequentTaxa(my.dat.cond,n=30)
## 
##                                             k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                                                            7 
##                                                     k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                                                            6 
##                                                                                                                k__Bacteria|p__Actinobacteria 
##                                                                                                                                            5 
##                                                                                                                 k__Bacteria|p__Bacteroidetes 
##                                                                                                                                            5 
##                                                                                                                    k__Bacteria|p__Firmicutes 
##                                                                                                                                            5 
##                                                                   k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                                                            5 
##                                                 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae|g__Prevotella 
##                                                                                                                                            4 
##                                                                  k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                                                                            4 
##                                                 k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                                                                            4 
##                                                 k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                                                            4 
##                                                                 k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                                                            4 
##                                 k__Bacteria|p__Actinobacteria|c__Actinomycetia|o__Bifidobacteriales|f__Bifidobacteriaceae|g__Bifidobacterium 
##                                                                                                                                            3 
##                                                                          k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                                                                            3 
##                                                k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides 
##                                                                                                                                            3 
##                                                                  k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Lachnospiraceae 
##                                                                                                                                            3 
##                                               k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Flavonifractor 
##                                                                                                                                            3 
##                                                 k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Ruminococcus 
##                                                                                                                                            3 
##                                               k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Enterobacterales|f__Enterobacteriaceae 
##                                                                                                                                            3 
##                                                                       k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales 
##                                                                                                                                            3 
##                                                    k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales|f__Pasteurellaceae 
##                                                                                                                                            3 
## k__Bacteria|p__Actinobacteria|c__Actinomycetia|o__Bifidobacteriales|f__Bifidobacteriaceae|g__Bifidobacterium|s__Bifidobacterium adolescentis 
##                                                                                                                                            2 
##                                                                                              k__Bacteria|p__Actinobacteria|c__Coriobacteriia 
##                                                                                                                                            2 
##                                             k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Atopobiaceae|g__Atopobium 
##                                                                                                                                            2 
##                                        k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Eggerthellales|f__Eggerthellaceae|g__Gordonibacter 
##                                                                                                                                            2 
##                                            k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Odoribacteraceae|g__Butyricimonas 
##                                                                                                                                            2 
##                                              k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Odoribacteraceae|g__Odoribacter 
##                                                                                                                                            2 
##                                                           k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae 
##                                                                                                                                            2 
##                                                 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Tannerellaceae|g__Tannerella 
##                                                                                                                                            2 
##                                                    k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium 
##                                                                                                                                            2 
##                                                    k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Eubacteriaceae|g__Eubacterium 
##                                                                                                                                            2
getMostFrequentTaxa(my.dat.cond,sig.type="increased")
## 
##       k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                              5 
##                                                                  k__Bacteria|p__Actinobacteria 
##                                                                                              4 
##                                                                      k__Bacteria|p__Firmicutes 
##                                                                                              4 
##                    k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                              4 
##   k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                              4 
##   k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                              4 
##                            k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                              3 
##   k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae|g__Prevotella 
##                                                                                              3 
## k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Flavonifractor 
##                                                                                              3 
## k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Enterobacterales|f__Enterobacteriaceae 
##                                                                                              3
getMostFrequentTaxa(my.dat.cond,sig.type="decreased")
## 
## k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                6 
##                                                                     k__Bacteria|p__Bacteroidetes 
##                                                                                                5 
##                     k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                4 
##                       k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                3 
##    k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides 
##                                                                                                2 
##  k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Odoribacteraceae|g__Odoribacter 
##                                                                                                2 
##     k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Tannerellaceae|g__Tannerella 
##                                                                                                2 
##     k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Ruminococcus 
##                                                                                                2 
##                           k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales 
##                                                                                                2 
##        k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales|f__Pasteurellaceae 
##                                                                                                2

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] 23 48
table(my.dat.mdd[,"Condition"])
## 
## unipolar depression 
##                  23
getMostFrequentTaxa(my.dat.mdd, n=20)
## 
##                                                                                                                    k__Bacteria|p__Firmicutes 
##                                                                                                                                            5 
##                                                                                                                 k__Bacteria|p__Bacteroidetes 
##                                                                                                                                            4 
##                                             k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                                                            4 
##                                                                                                                k__Bacteria|p__Actinobacteria 
##                                                                                                                                            3 
##                                 k__Bacteria|p__Actinobacteria|c__Actinomycetia|o__Bifidobacteriales|f__Bifidobacteriaceae|g__Bifidobacterium 
##                                                                                                                                            3 
##                                                 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae|g__Prevotella 
##                                                                                                                                            3 
##                                                 k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                                                            3 
##                                                 k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Ruminococcus 
##                                                                                                                                            3 
##                                                                       k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales 
##                                                                                                                                            3 
##                                                    k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales|f__Pasteurellaceae 
##                                                                                                                                            3 
## k__Bacteria|p__Actinobacteria|c__Actinomycetia|o__Bifidobacteriales|f__Bifidobacteriaceae|g__Bifidobacterium|s__Bifidobacterium adolescentis 
##                                                                                                                                            2 
##                                             k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Atopobiaceae|g__Atopobium 
##                                                                                                                                            2 
##                                                     k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                                                            2 
##                                        k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Eggerthellales|f__Eggerthellaceae|g__Gordonibacter 
##                                                                                                                                            2 
##                                                k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides 
##                                                                                                                                            2 
##                                            k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Odoribacteraceae|g__Butyricimonas 
##                                                                                                                                            2 
##                                                           k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae 
##                                                                                                                                            2 
##                                                                   k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                                                            2 
##                                                    k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae|g__Clostridium 
##                                                                                                                                            2 
##                                                                  k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Lachnospiraceae 
##                                                                                                                                            2
getMostFrequentTaxa(my.dat.mdd,sig.type= "increased")
## 
##                                                                                    k__Bacteria|p__Firmicutes 
##                                                                                                            4 
##                 k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae|g__Prevotella 
##                                                                                                            3 
##                 k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                            3 
##                                                                                k__Bacteria|p__Actinobacteria 
##                                                                                                            2 
## k__Bacteria|p__Actinobacteria|c__Actinomycetia|o__Bifidobacteriales|f__Bifidobacteriaceae|g__Bifidobacterium 
##                                                                                                            2 
##             k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Atopobiaceae|g__Atopobium 
##                                                                                                            2 
##            k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Odoribacteraceae|g__Butyricimonas 
##                                                                                                            2 
##                           k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Porphyromonadaceae 
##                                                                                                            2 
##               k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Flavonifractor 
##                                                                                                            2 
##               k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Enterobacterales|f__Enterobacteriaceae 
##                                                                                                            2
getMostFrequentTaxa(my.dat.mdd,sig.type= "decreased")
## 
##                                                                             k__Bacteria|p__Bacteroidetes 
##                                                                                                        4 
##         k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                        3 
##                               k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                        2 
##                             k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                        2 
##             k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Ruminococcus 
##                                                                                                        2 
##                                   k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales 
##                                                                                                        2 
##                k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales|f__Pasteurellaceae 
##                                                                                                        2 
## k__Bacteria|p__Proteobacteria|c__Gammaproteobacteria|o__Pasteurellales|f__Pasteurellaceae|g__Haemophilus 
##                                                                                                        2 
##         k__Bacteria|p__Synergistetes|c__Synergistia|o__Synergistales|f__Synergistaceae|g__Pyramidobacter 
##                                                                                                        2 
##                                                                            k__Bacteria|p__Actinobacteria 
##                                                                                                        1

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] 18 48
table(my.dat.bd[,"Condition"])
## 
## bipolar disorder 
##               18
getMostFrequentTaxa(my.dat.bd, n=20)
## 
##                                k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                                                       4 
##                                             k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                                                       4 
##                            k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                                                       4 
##                                              k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                                       3 
##                        k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                                       3 
##                                                                                           k__Bacteria|p__Actinobacteria 
##                                                                                                                       2 
##                                                                         k__Bacteria|p__Actinobacteria|c__Coriobacteriia 
##                                                                                                                       2 
##                                                     k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                                                       2 
##                                            k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                                       2 
##                                                                                            k__Bacteria|p__Bacteroidetes 
##                                                                                                                       1 
##                           k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides 
##                                                                                                                       1 
## k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides|s__Bacteroides helcogenes 
##                                                                                                                       1 
##                         k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Odoribacteraceae|g__Odoribacter 
##                                                                                                                       1 
##                                          k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae 
##                                                                                                                       1 
##                            k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae|g__Prevotella 
##                                                                                                                       1 
##                            k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Tannerellaceae|g__Tannerella 
##                                                                                                                       1 
##                                                                                    k__Bacteria|p__Firmicutes|c__Bacilli 
##                                                                                                                       1 
##                                                                 k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales 
##                                                                                                                       1 
##                                             k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                                                       1 
##                            k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Streptococcaceae|g__Streptococcus 
##                                                                                                                       1
getMostFrequentTaxa(my.dat.bd,sig.type= "increased")
## 
##     k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales|f__Coriobacteriaceae 
##                                                                                            4 
##                  k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae 
##                                                                                            4 
## k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Lactobacillaceae|g__Lactobacillus 
##                                                                                            4 
##                                                                k__Bacteria|p__Actinobacteria 
##                                                                                            2 
##                                              k__Bacteria|p__Actinobacteria|c__Coriobacteriia 
##                                                                                            2 
##                          k__Bacteria|p__Actinobacteria|c__Coriobacteriia|o__Coriobacteriales 
##                                                                                            2 
##                   k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                            2 
##                                                         k__Bacteria|p__Firmicutes|c__Bacilli 
##                                                                                            1 
##                                      k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales 
##                                                                                            1 
##                  k__Bacteria|p__Firmicutes|c__Bacilli|o__Lactobacillales|f__Streptococcaceae 
##                                                                                            1
getMostFrequentTaxa(my.dat.bd,sig.type= "decreased")
## 
##                        k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae|g__Faecalibacterium 
##                                                                                                                       3 
##                                            k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Oscillospiraceae 
##                                                                                                                       2 
##                                                                                            k__Bacteria|p__Bacteroidetes 
##                                                                                                                       1 
##                           k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides 
##                                                                                                                       1 
## k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Bacteroidaceae|g__Bacteroides|s__Bacteroides helcogenes 
##                                                                                                                       1 
##                         k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Odoribacteraceae|g__Odoribacter 
##                                                                                                                       1 
##                                          k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae 
##                                                                                                                       1 
##                            k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Prevotellaceae|g__Prevotella 
##                                                                                                                       1 
##                            k__Bacteria|p__Bacteroidetes|c__Bacteroidia|o__Bacteroidales|f__Tannerellaceae|g__Tannerella 
##                                                                                                                       1 
##                                              k__Bacteria|p__Firmicutes|c__Clostridia|o__Eubacteriales|f__Clostridiaceae 
##                                                                                                                       1

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")