combi package: vignette

Introduction

This package implements a novel data integration model for sample-wise integration of different views. It accounts for compositionality and employs a non-parametric mean-variance trend for sequence count data. The resulting model can be conveniently plotted to allow for explorative visualization of variability shared over different views.

Installation

The package can be installed and loaded using the following commands:

library(BiocManager)
BiocManager::install("combi", update = FALSE)
library(devtools)
install_github("CenterForStatistics-UGent/combi")
suppressPackageStartupMessages(library(combi))
cat("combi package version", as.character(packageVersion("combi")), "\n")
## combi package version 1.8.0
data(Zhang)

Unconstrained integration

For an unconstrained ordination, a named list of datasets with overlapping samples must be supplied. The datasets can currently be supplied as a raw data matrix (with features in the columns), or as a phyloseq, SummarizedExperiment or ExpressionSet object. In addition, information on the required distribution (“quasi” for quasi-likelihood fitting, “gaussian” for normal data) and compositional nature (TRUE/FALSE) should be supplied

One can print basic infor about the ordination

## Unconstrained combi ordination of 2 dimensions on 2 views with 42 samples.
## Views and number of features were:
##  microbiome: 130
##  metabolomics: 174
##  Importance parameters of dimensions 1 to 2 are 117 and 44.9

A simple plot function is available for the result, for samples and shapes, a data frame should also be supplied

By default, only the most important features (furthest away from the origin) are shown. To show all features, one can resort to point cloud plots or density plots as follows:

The drawback is that now no feature labels are shown.

Adding projections

As an aid to interpretation of compositional views, links between features can be plotted and projected onto samples by providing their names or approximate coordinates

Coordinates

Finally, one can extract the coordinates for use in third-party software

Constrained integration

For a constrained ordination also a data frame of sample variables should be supplied

Also here we can get a quick overview

## Constrained combi ordination of 2 dimensions on 2 views with 42 samples.
## Views and number of features were:
##  microbiome: 130
##  metabolomics: 174
##  Number of sample variables included was 4,
## for which 6 parameters were estimated per dimension.
##  Importance parameters of dimensions 1 to 2 are 34.2 and 21.4

and plot the ordination

Diagnostics

Convergence of the iterative algorithm can be assessed as follows:

Influence of the different views can be investigated through

FAQ

Why are not all my samples shown in the constrained ordination?

Confusion often arises as to why less distinct sample dots are shown than there are samples in the constrained ordination. This occurs when few, categorical constraining variables are supplied as below.

Every constrained sample score is a linear combination of constraining variables, and in this case there are only 2x2=4 distinct sample scores possible, leading to the sample dots from the same gender and treatment to be plotted on top of each other.

In general, it is best to include all measured sample variables in a constrained analysis, and let the combi-algorithm find out which ones are the most important drivers of variability.

The combi function crashes, what should I do

The combi method works by iteratively solving systems of non-linear equations through Newton-Raphson. This can lead to numerical instability, with errors like “infinite values returned by jacobian” in the nleqslv function. This class of problems has no general solution, but is mainly a matter of trial and error. Following two things can be tried:

  1. Tweaking the prevCutOff and minFraction parameters to remove more sparse features.
  2. Tweaking the initPower parameter, which will lead to different starting values, and hopefully a solution path that is numerically more stable.

Session info

This vignette was generated with following version of R:

sessionInfo()
## R version 4.2.0 RC (2022-04-19 r82224)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 20.04.4 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.15-bioc/R/lib/libRblas.so
## LAPACK: /home/biocbuild/bbs-3.15-bioc/R/lib/libRlapack.so
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] combi_1.8.0 DBI_1.1.2  
## 
## loaded via a namespace (and not attached):
##   [1] nlme_3.1-157                bitops_1.0-7               
##   [3] matrixStats_0.62.0          phyloseq_1.40.0            
##   [5] GenomeInfoDb_1.32.0         numDeriv_2016.8-1.1        
##   [7] tools_4.2.0                 bslib_0.3.1                
##   [9] utf8_1.2.2                  R6_2.5.1                   
##  [11] vegan_2.6-2                 mgcv_1.8-40                
##  [13] BiocGenerics_0.42.0         colorspace_2.0-3           
##  [15] permute_0.9-7               rhdf5filters_1.8.0         
##  [17] ade4_1.7-19                 tidyselect_1.1.2           
##  [19] compiler_4.2.0              cli_3.3.0                  
##  [21] quantreg_5.88               Biobase_2.56.0             
##  [23] formatR_1.12                SparseM_1.81               
##  [25] alabama_2022.4-1            isoband_0.2.5              
##  [27] DelayedArray_0.22.0         labeling_0.4.2             
##  [29] sass_0.4.1                  scales_1.2.0               
##  [31] quadprog_1.5-8              stringr_1.4.0              
##  [33] digest_0.6.29               rmarkdown_2.14             
##  [35] XVector_0.36.0              pkgconfig_2.0.3            
##  [37] htmltools_0.5.2             MatrixGenerics_1.8.0       
##  [39] highr_0.9                   fastmap_1.1.0              
##  [41] limma_3.52.0                rlang_1.0.2                
##  [43] farver_2.1.0                jquerylib_0.1.4            
##  [45] generics_0.1.2              jsonlite_1.8.0             
##  [47] dplyr_1.0.8                 RCurl_1.98-1.6             
##  [49] magrittr_2.0.3              GenomeInfoDbData_1.2.8     
##  [51] biomformat_1.24.0           Matrix_1.4-1               
##  [53] Rcpp_1.0.8.3                munsell_0.5.0              
##  [55] S4Vectors_0.34.0            Rhdf5lib_1.18.0            
##  [57] fansi_1.0.3                 ape_5.6-2                  
##  [59] lifecycle_1.0.1             stringi_1.7.6              
##  [61] yaml_2.3.5                  nleqslv_3.3.2              
##  [63] MASS_7.3-57                 SummarizedExperiment_1.26.0
##  [65] zlibbioc_1.42.0             BB_2019.10-1               
##  [67] rhdf5_2.40.0                plyr_1.8.7                 
##  [69] grid_4.2.0                  parallel_4.2.0             
##  [71] crayon_1.5.1                lattice_0.20-45            
##  [73] Biostrings_2.64.0           splines_4.2.0              
##  [75] tensor_1.5                  multtest_2.52.0            
##  [77] knitr_1.38                  pillar_1.7.0               
##  [79] igraph_1.3.1                GenomicRanges_1.48.0       
##  [81] reshape2_1.4.4              codetools_0.2-18           
##  [83] stats4_4.2.0                glue_1.6.2                 
##  [85] evaluate_0.15               cobs_1.3-4                 
##  [87] data.table_1.14.2           vctrs_0.4.1                
##  [89] foreach_1.5.2               MatrixModels_0.5-0         
##  [91] gtable_0.3.0                purrr_0.3.4                
##  [93] assertthat_0.2.1            ggplot2_3.3.5              
##  [95] xfun_0.30                   survival_3.3-1             
##  [97] tibble_3.1.6                iterators_1.0.14           
##  [99] IRanges_2.30.0              cluster_2.1.3              
## [101] ellipsis_0.3.2