Contents

About this vignette

This vignette describes how to perform F-informed multidimensional scaling using the FinfoMDS package. FinfoMDS was developed by Soobin Kim (). A proposal of the method and its full description can be found at:

This vignette was updated in August 2025.

1 Introduction

Multidimensional scaling (MDS) is a dimensionality reduction technique used in microbial ecology data analysis to represent multivariate structures while preserving pairwise distances between samples. While its improvement has enhanced the ability to reveal data patterns by sample groups, these MDS-based methods often require prior assumptions for inference, limiting their broader application in general microbiome analysis.

Here, we introduce a new MDS-based ordination, F-informed MDS (implemented in the R package FinfoMDS), which configures data distribution based on the F-statistic, the ratio of dispersion between groups that share common and different labels. Our approach offers a well-founded refinement of MDS that aligns with statistical test results, which can be beneficial for broader compositional data analyses in microbiology and ecology.

2 Installation

2.1 Bioconductor official release

To install the official release version of this package, start R (version “4.5”) and enter:

BiocManager::install("FinfoMDS")

For older R versions, please refer to the appropriate Bioconductor release.

2.2 GitHub development version

The package may be updated before changes are migrated to the official release. To install the development version, enter:

devtools::install_github("soob-kim/FinfoMDS")

3 Operation

As introduced earlier, F-informed MDS is a microbiome data visualization tool designed to display statistical significance. The visualization (a 2D representation) output is obtained by iterating an optimization algorithm at each epoch. The procedure is summarized in the diagram below and is implemented in the fmds() function.

For fmds() function to operate, the following arguments are required: 1) labels y, 2) either a distance matrix D or a design matrix X (if both are provided, D takes precedence). Additionally, the following optional arguments can be adjusted according to user preference: 1) hyperparameter lambda, 2) initial representation z0, 3) maximum epoch number nit, and 4) stopping criterion threshold_p. Upon completion, fmds() returns a two-column matrix containing the coordinates representing the distance matrix D.

4 Example

As an example, we use an algal-associated bacterial community (Kim et al., 2022). First, load a phyloseq-class object by typing:

library(FinfoMDS)
data("microbiome", package = "FinfoMDS")

Next, compute the weighted UniFrac distance from this dataset and obtain its label set:

require(phyloseq)
#> Loading required package: phyloseq
D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package
y <- sample_data(microbiome)$Treatment

Then, compute the F-informed MDS by running:

result <- fmds(D = D, y = y, lambda = 0.3, threshold_p = 0.05)
#> epoch 0   lambda 0.3   total 0.11   mds 0.02   conf 0.28   p_z 0.474   p_0 0.079
#> epoch 1   lambda 0.3   total 0.14   mds 0.01   conf 0.41   p_z 0.409   p_0 0.079
#> epoch 2   lambda 0.3   total 0.09   mds 0.01   conf 0.25   p_z 0.282   p_0 0.079
#> epoch 3   lambda 0.3   total 0.08   mds 0.01   conf 0.22   p_z 0.195   p_0 0.079
#> epoch 4   lambda 0.3   total 0.02   mds 0.01   conf 0.03   p_z 0.091   p_0 0.079
#> Lambda 0.30 ...halt iteration

This procedure will iterate until the 2D distributions converge, as long as the p-value does not deviate more than threshold_p, or until reaching the default maximum of 100 iterations, whichever occurs first. We have observed that setting lambda between 0.3 and 0.5 typically yields optimal results; however, this hyperparameter can be adjusted as long as it does not exceed 1.

The 2D representation of the community dataset is returned as a matrix and can be visualized by typing:

plot(result, pch = y)

5 Reference

H Kim, JA Kimbrel, CA Vaiana, JR Wollard, X Mayali, and CR Buie (2022). Bacterial response to spatial gradients of algal-derived nutrients in a porous microplate. The ISME Journal, 16(4):1036–1045.

6 Session information

sessionInfo()
#> R version 4.5.1 Patched (2025-08-23 r88802)
#> Platform: x86_64-pc-linux-gnu
#> Running under: Ubuntu 24.04.3 LTS
#> 
#> Matrix products: default
#> BLAS:   /home/biocbuild/bbs-3.22-bioc/R/lib/libRblas.so 
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0  LAPACK version 3.12.0
#> 
#> 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       
#> 
#> time zone: America/New_York
#> tzcode source: system (glibc)
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] phyloseq_1.53.0  FinfoMDS_0.99.2  BiocStyle_2.37.1
#> 
#> loaded via a namespace (and not attached):
#>  [1] gtable_0.3.6        xfun_0.53           bslib_0.9.0        
#>  [4] ggplot2_4.0.0       rhdf5_2.53.4        Biobase_2.69.1     
#>  [7] lattice_0.22-7      rhdf5filters_1.21.0 vctrs_0.6.5        
#> [10] tools_4.5.1         generics_0.1.4      biomformat_1.37.0  
#> [13] stats4_4.5.1        parallel_4.5.1      tibble_3.3.0       
#> [16] cluster_2.1.8.1     pkgconfig_2.0.3     Matrix_1.7-4       
#> [19] data.table_1.17.8   RColorBrewer_1.1-3  S7_0.2.0           
#> [22] S4Vectors_0.47.1    lifecycle_1.0.4     compiler_4.5.1     
#> [25] farver_2.1.2        stringr_1.5.2       Biostrings_2.77.2  
#> [28] tinytex_0.57        Seqinfo_0.99.2      codetools_0.2-20   
#> [31] permute_0.9-8       htmltools_0.5.8.1   sass_0.4.10        
#> [34] yaml_2.3.10         pillar_1.11.0       crayon_1.5.3       
#> [37] jquerylib_0.1.4     MASS_7.3-65         cachem_1.1.0       
#> [40] vegan_2.7-1         magick_2.9.0        iterators_1.0.14   
#> [43] foreach_1.5.2       nlme_3.1-168        tidyselect_1.2.1   
#> [46] digest_0.6.37       stringi_1.8.7       dplyr_1.1.4        
#> [49] reshape2_1.4.4      bookdown_0.44       splines_4.5.1      
#> [52] ade4_1.7-23         fastmap_1.2.0       grid_4.5.1         
#> [55] cli_3.6.5           magrittr_2.0.4      dichromat_2.0-0.1  
#> [58] survival_3.8-3      ape_5.8-1           scales_1.4.0       
#> [61] rmarkdown_2.29      XVector_0.49.1      igraph_2.1.4       
#> [64] multtest_2.65.0     evaluate_1.0.5      knitr_1.50         
#> [67] IRanges_2.43.1      mgcv_1.9-3          rlang_1.1.6        
#> [70] Rcpp_1.1.0          glue_1.8.0          BiocManager_1.30.26
#> [73] BiocGenerics_0.55.1 jsonlite_2.0.0      R6_2.6.1           
#> [76] Rhdf5lib_1.31.0     plyr_1.8.9