Introduction

MetaLonDA (METAgenomic LONgitudinal Differential Abundance method) is a method that identifies the significant time intervals of microbial features in longitudinal studies. MetaLonDA has the ability to handle the inconsistencies and common challenges associated with human studies, such as variable sample collection times and uneven number of time points along the subjects’ longitudinal study. The method employs a negative binomial distribution in conjunction with a semi-parametric SS-ANOVA to model the count reads. Then, it performs the significance testing based on unit time intervals using permutation testing procedure.

Example

An example dataset derived from a subset of stress-induced Yeast is available by running

library(MetaLonDA)

## Load read counts of 8 features from 100 samples. Samples are from 2 groups, 5 subjects per group, and 10 time points per subject.
data(metalonda_test_data)
#View(metalonda_test_data[,1:20])
## Create Group, Time, and ID annotation vectors
n.group = 2
n.sample = 5 
n.timepoints = 10
Group = factor(c(rep("A", n.sample*n.timepoints), rep("B",n.sample*n.timepoints)))
Time = rep(rep(1:n.timepoints, times = n.sample), 2)
ID = factor(rep(1:(2*n.sample), each = n.timepoints))

## Define the prediction timeponits 
points = seq(1, 10, length.out = 100)

Test one feature

## Create Group, Time, and ID annotation vectors
n.group = 2
n.sample = 5 
n.timepoints = 10
Group = factor(c(rep("A", n.sample*n.timepoints), rep("B",n.sample*n.timepoints)))
Time = rep(rep(1:n.timepoints, times = n.sample), 2)
ID = factor(rep(1:(2*n.sample), each = n.timepoints))

## Define the prediction timeponits 
points = seq(1, 10, length.out = 100)

In our example, we used 20 permutations just to showcase how MetaLonDA works. In real analysis, this number should be much higher.

Test all features

## Identify significant time intervals for all features: 
output.metalonda.all = metalondaAll(Count = metalonda_test_data, Time = Time, Group = Group,
  ID = ID, n.perm = 20, fit.method = "nbinomial", num.intervals = 100, 
  parall = FALSE, pvalue.threshold = 0.05, adjust.method = "BH", time.unit = "hours", norm.method = "none",
  prefix = "Test")
## Dimensionality check passed
## Prediction Points =   [1]  1.00  1.09  1.18  1.27  1.36  1.45  1.54  1.63  1.72  1.81  1.90
##  [12]  1.99  2.08  2.17  2.26  2.35  2.44  2.53  2.62  2.71  2.80  2.89
##  [23]  2.98  3.07  3.16  3.25  3.34  3.43  3.52  3.61  3.70  3.79  3.88
##  [34]  3.97  4.06  4.15  4.24  4.33  4.42  4.51  4.60  4.69  4.78  4.87
##  [45]  4.96  5.05  5.14  5.23  5.32  5.41  5.50  5.59  5.68  5.77  5.86
##  [56]  5.95  6.04  6.13  6.22  6.31  6.40  6.49  6.58  6.67  6.76  6.85
##  [67]  6.94  7.03  7.12  7.21  7.30  7.39  7.48  7.57  7.66  7.75  7.84
##  [78]  7.93  8.02  8.11  8.20  8.29  8.38  8.47  8.56  8.65  8.74  8.83
##  [89]  8.92  9.01  9.10  9.19  9.28  9.37  9.46  9.55  9.64  9.73  9.82
## [100]  9.91 10.00
## 
## Feature  =  OTU_1 
## Start MetaLonDA 
## Visualizing Feature =  OTU_1
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_1
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## Visualizing Significant Intervals of Feature =  OTU_1
## 
## 
## Feature  =  OTU_2 
## Start MetaLonDA 
## Visualizing Feature =  OTU_2
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_2
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## Visualizing Significant Intervals of Feature =  OTU_2
## 
## 
## Feature  =  OTU_3 
## Start MetaLonDA 
## Visualizing Feature =  OTU_3
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_3
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## Visualizing Significant Intervals of Feature =  OTU_3
## 
## 
## Feature  =  OTU_4 
## Start MetaLonDA 
## Visualizing Feature =  OTU_4
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_4
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## Visualizing Significant Intervals of Feature =  OTU_4
## 
## 
## Feature  =  OTU_5 
## Start MetaLonDA 
## Visualizing Feature =  OTU_5
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_5
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## Visualizing Significant Intervals of Feature =  OTU_5
## 
## 
## Feature  =  OTU_6 
## Start MetaLonDA 
## Visualizing Feature =  OTU_6
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_6
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## Visualizing Significant Intervals of Feature =  OTU_6
## 
## 
## Feature  =  OTU_7 
## Start MetaLonDA 
## Visualizing Feature =  OTU_7
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_7
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## No Significant Intevals Found 
## 
## 
## Feature  =  OTU_8 
## Start MetaLonDA 
## Visualizing Feature =  OTU_8
## Start Curve Fitting 
## Fitting: NB SS 
## Visualizing Splines of Feature =  OTU_8
## Calculate Area Under the Fitted Curves 
## Start Permutation 
## # of Subjects =  10 
## Permutation # 1 
## Permutation # 2 
## Permutation # 3 
## Permutation # 4 
## Permutation # 5 
## Permutation # 6 
## Permutation # 7 
## Permutation # 8 
## Permutation # 9 
## Permutation # 10 
## Permutation # 11 
## Permutation # 12 
## Permutation # 13 
## Permutation # 14 
## Permutation # 15 
## Permutation # 16 
## Permutation # 17 
## Permutation # 18 
## Permutation # 19 
## Permutation # 20 
## p-value Adjustment Method =  BH 
## No Significant Intevals Found

Session information

sessionInfo()
## R version 3.3.2 (2016-10-31)
## Platform: x86_64-apple-darwin13.4.0 (64-bit)
## Running under: macOS Sierra 10.12.4
## 
## locale:
## [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
## 
## attached base packages:
## [1] parallel  stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
## [1] rmarkdown_1.6     MetaLonDA_1.1.0   doParallel_1.0.11 iterators_1.0.9  
## [5] foreach_1.4.4     caTools_1.17.1    plyr_1.8.4        gss_2.1-7        
## [9] ggplot2_2.2.1    
## 
## loaded via a namespace (and not attached):
##  [1] Biobase_2.34.0             edgeR_3.16.5              
##  [3] splines_3.3.2              gtools_3.5.0              
##  [5] assertthat_0.1             Formula_1.2-1             
##  [7] stats4_3.3.2               latticeExtra_0.6-28       
##  [9] yaml_2.1.14                RSQLite_1.1-2             
## [11] backports_1.0.5            lattice_0.20-34           
## [13] limma_3.30.11              digest_0.6.12             
## [15] GenomicRanges_1.26.3       RColorBrewer_1.1-2        
## [17] XVector_0.14.0             checkmate_1.8.2           
## [19] colorspace_1.3-2           htmltools_0.3.5           
## [21] Matrix_1.2-7.1             DESeq2_1.14.1             
## [23] XML_3.98-1.5               devtools_1.12.0           
## [25] genefilter_1.56.0          zlibbioc_1.20.0           
## [27] xtable_1.8-2               scales_0.5.0              
## [29] gdata_2.17.0               BiocParallel_1.8.1        
## [31] git2r_0.18.0               htmlTable_1.9             
## [33] tibble_1.3.3               annotate_1.52.1           
## [35] IRanges_2.8.1              withr_1.0.2               
## [37] SummarizedExperiment_1.4.0 nnet_7.3-12               
## [39] BiocGenerics_0.20.0        lazyeval_0.2.0            
## [41] crayon_1.3.2               survival_2.40-1           
## [43] magrittr_1.5               evaluate_0.10             
## [45] memoise_1.0.0              gplots_3.0.1              
## [47] xml2_1.1.1                 foreign_0.8-67            
## [49] BiocInstaller_1.24.0       tools_3.3.2               
## [51] data.table_1.10.0          matrixStats_0.51.0        
## [53] stringr_1.2.0              S4Vectors_0.12.1          
## [55] locfit_1.5-9.1             munsell_0.4.3             
## [57] glmnet_2.0-5               cluster_2.0.5             
## [59] rversions_1.0.3            AnnotationDbi_1.36.2      
## [61] GenomeInfoDb_1.10.3        rlang_0.1.1               
## [63] grid_3.3.2                 RCurl_1.95-4.8            
## [65] rstudioapi_0.6             htmlwidgets_0.8           
## [67] bitops_1.0-6               base64enc_0.1-3           
## [69] labeling_0.3               metagenomeSeq_1.16.0      
## [71] gtable_0.2.0               codetools_0.2-15          
## [73] curl_3.1                   DBI_0.5-1                 
## [75] roxygen2_6.0.1             R6_2.2.2                  
## [77] gridExtra_2.2.1            knitr_1.15.1              
## [79] rprojroot_1.2              commonmark_1.2            
## [81] Hmisc_4.0-2                desc_1.1.0                
## [83] KernSmooth_2.23-15         stringi_1.1.2             
## [85] Rcpp_0.12.14               geneplotter_1.52.0        
## [87] rpart_4.1-10               acepack_1.4.1

References

Metwally, Ahmed A., Jie Yang, Christian Ascoli, Yang Dai, Patricia W. Finn, and David L. Perkins. “MetaLonDA: a flexible R package for identifying time intervals of differentially abundant features in metagenomic longitudinal studies”, Microbiome, 2018.

Metwally, Ahmed A., Patricia W. Finn, Yang Dai, and David L. Perkins. “Detection of Differential Abundance Intervals in Longitudinal Metagenomic Data Using Negative Binomial Smoothing Spline ANOVA.” ACM BCB, 2017.

Bugs and Suggestions

MetaLonDA is under active research development. Please report any bugs/suggestions to Ahmed Metwally (ametwa2@uic.edu).