| Title: | Multidimensional Scaling with F-ratio for microbiome visualization |
|---|---|
| Description: | F-informed MDS is a new multidimensional scaling-based ordination method that configures data distribution based on the F-statistic (i.e., the ratio of dispersion between groups with shared or differing labels). |
| Authors: | Soobin Kim [aut, cre], Hyungseok Kim [aut] |
| Maintainer: | Soobin Kim <[email protected]> |
| License: | GPL-3 |
| Version: | 1.3.0 |
| Built: | 2026-05-30 08:28:29 UTC |
| Source: | https://github.com/bioc/FinfoMDS |
FMDS calculation using MM algorithm
fmds(D = NULL, y, X, nit = 100, lambda = 0.5, threshold_p = 0.05, z0 = NULL)fmds(D = NULL, y, X, nit = 100, lambda = 0.5, threshold_p = 0.05, z0 = NULL)
D |
Square matrix of pairwise distance, size of N by N |
y |
Vector of label or group set, size of N |
X |
Object matrix; used to build distance matrix D; D is prioritized |
nit |
Number of iterations; 100 by default |
lambda |
Hyperparameter; 0.5 by default |
threshold_p |
Lower limit of p-value difference that allows iteration |
z0 |
Initialization of configuration; NULL by default |
2D representation vector, size of N by 2
set.seed(100) require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment z0 <- cmdscale(d = D) fmds(z0 = z0, D = D, y = y)set.seed(100) require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment z0 <- cmdscale(d = D) fmds(z0 = z0, D = D, y = y)
Distance between vectors
getDistMat(z)getDistMat(z)
z |
Matrix or vector of observations |
Distance matrix
set.seed(100) z <- rbind(matrix(rnorm(100), ncol=4), matrix(rnorm(100, 2), ncol=4)) getDistMat(z)set.seed(100) z <- rbind(matrix(rnorm(100), ncol=4), matrix(rnorm(100, 2), ncol=4)) getDistMat(z)
Get index matrix
getIndMat(y)getIndMat(y)
y |
a vector of treatments of length N |
A N by N matrix of indicators of equal treatment
require(phyloseq) data(microbiome) y <- sample_data(microbiome)$Treatment getIndMat(y)require(phyloseq) data(microbiome) y <- sample_data(microbiome)$Treatment getIndMat(y)
Compute p-value from PERMANOVA test
getP(z = NULL, D = NULL, y, n_iter = 999)getP(z = NULL, D = NULL, y, n_iter = 999)
z |
Object matrix; used to build distance matrix d; d is prioritized |
D |
Distance matrix; if NULL, obtain from mat using Euclidean distance |
y |
Vector of treatments |
n_iter |
Number of iterations; defaults to 999 |
list of ratio_all: vector of obtained pseudo-F values from permutations, ratio: pseudo-F value, p: p-value from PERMANOVA
require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment getP(D = D, y = y)require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment getP(D = D, y = y)
Objective term of MDS
mdsObj(D, z, N)mdsObj(D, z, N)
D |
Original distance matrix |
z |
Lower dimension representation |
N |
Number of observations–scaling factors |
Scalar of objective function value of MDS
require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package z0 <- cmdscale(d = D) N <- dim(z0)[1] mdsObj(D = D, z = z0, N = N)require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package z0 <- cmdscale(d = D) N <- dim(z0)[1] mdsObj(D = D, z = z0, N = N)
A phyloseq-class object representing an example microbial community dataset. The dataset consists of 36 microbiome samples, half of which were co-cultured with their diatom host (Phaeodactylum tricornutum). Each microbiome comprises 72 bacterial taxa identified by amplicon sequence variants (ASVs) of the 16S rRNA gene. ASV counts represent relative abundances after applying the cumulative sum scaling (CSS) method.
data(microbiome)data(microbiome)
A phyloseq-class object.
A phyloseq-class object consisting of relative abundance table, taxonomy table, sample dataframe, and phylogenetic tree
Data derived from an experimental study on host-microbe interactions.
Kim H., Kimbrel J.A., Vaiana C.A., Wollard J.R., Mayali X., Buie C.R. (2022). Bacterial response to spatial gradients of algal-derived nutrients in a porous microplate. The ISME Journal, 16(4), 1036–1045. doi:10.1038/s41396-021-01163-4
Get p-value matrix
pairByRank(z, D, y)pairByRank(z, D, y)
z |
Lower dimension representation |
D |
Original distance matrix |
y |
Treatment vector |
pseudo-F values matrix 1st col of original data, 2nd col of reduced dim
require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment z0 <- cmdscale(d = D) pairByRank(z = z0, D = D, y = y)require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment z0 <- cmdscale(d = D) pairByRank(z = z0, D = D, y = y)
Compute pseudo-F statistic for PERMANOVA
pseudoF(z = NULL, D = NULL, y)pseudoF(z = NULL, D = NULL, y)
z |
Object matrix; used to build distance matrix d; d is prioritized |
D |
Distance matrix; if NULL, obtain from mat using Euclidean distance |
y |
Vector of treatments |
pseudo-F value
require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment pseudoF(D = D, y = y)require(phyloseq) data(microbiome) D <- distance(microbiome, method = 'wunifrac') # requires phyloseq package y <- sample_data(microbiome)$Treatment pseudoF(D = D, y = y)