Title: | Microbial community dIversity and Network Analysis |
---|---|
Description: | An increasing number of microbiome datasets have been generated and analyzed with the help of rapidly developing sequencing technologies. At present, analysis of taxonomic profiling data is mainly conducted using composition-based methods, which ignores interactions between community members. Besides this, a lack of efficient ways to compare microbial interaction networks limited the study of community dynamics. To better understand how community diversity is affected by complex interactions between its members, we developed a framework (Microbial community dIversity and Network Analysis, mina), a comprehensive framework for microbial community diversity analysis and network comparison. By defining and integrating network-derived community features, we greatly reduce noise-to-signal ratio for diversity analyses. A bootstrap and permutation-based method was implemented to assess community network dissimilarities and extract discriminative features in a statistically principled way. |
Authors: | Rui Guan [aut, cre], Ruben Garrido-Oter [ctb] |
Maintainer: | Rui Guan <[email protected]> |
License: | GPL |
Version: | 1.15.0 |
Built: | 2024-10-30 08:51:28 UTC |
Source: | https://github.com/bioc/mina |
Calculate the correlation adjacacency matrix.
adj(x, method, ...)
adj(x, method, ...)
x |
An object of the class mina with 'norm' defined or a 'norm' matrix. |
method |
The correlation coeffient used for adjacacency matrix. |
... |
Additional parameters. |
Adjacency matrix.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman", sig = FALSE)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman", sig = FALSE)
adj
Correlation methods should be specified by exact string match.
adj_method_list
adj_method_list
A list of character vectors.
Pearson correlation.
Spearman correlation.
SparCC correlation by spearman.
? adj_method_list
? adj_method_list
Calculate the adjacency matrix of 'norm' by correlation with matrix as input.
## S4 method for signature 'matrix,ANY' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...) ## S4 method for signature 'matrix,character' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)
## S4 method for signature 'matrix,ANY' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...) ## S4 method for signature 'matrix,character' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)
x |
An object of the class mina with 'norm' defined or a 'norm' matrix. |
method |
The correlation coeffient used for adjacacency matrix. |
sig |
(optional) The asymtotic P-values, only applicable for Pearson and Spearman methods with 'mina' object as input, alwasy FALSE here. |
threads |
The number of threads used for parallel running, 80 by default. |
nblocks |
The number of row/column for splitting sub-matrix, 400 by default. |
... |
Additional parameters. |
y The adjacency matrix.
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_adj <- adj(asv_norm, method = "pearson")
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_adj <- adj(asv_norm, method = "pearson")
Calculate the adjacency matrix of 'norm' by correlation with 'mina' class object as input.
## S4 method for signature 'mina,ANY' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...) ## S4 method for signature 'mina,character' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)
## S4 method for signature 'mina,ANY' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...) ## S4 method for signature 'mina,character' adj(x, method, sig = FALSE, threads = 80, nblocks = 400, ...)
x |
An object of the class mina with 'norm' defined or a 'norm' matrix. |
method |
The correlation coeffient used for adjacacency matrix. |
sig |
The asymtotic P-values, only applicable for Pearson and Spearman methods, FALSE by default. |
threads |
The number of threads used for parallel running, 80 by default. |
nblocks |
The number of row/column for splitting sub-matrix, 400 by default. |
... |
Additional parameters. |
x The same 'mina' object with 'adj' added.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman", sig = FALSE)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman", sig = FALSE)
Inferring the network of different group of samples and test significance by permutation.
bs_pm(x, group, ...)
bs_pm(x, group, ...)
x |
An object of class 'mina' with 'norm' and 'des' defined. |
group |
The column name of descriptive file 'des' for comparison. |
... |
Additional parameters. |
The network bootstrap and permutation result.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment", per = 0.5)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment", per = 0.5)
Inferring the network of different group of samples and test significance by permutation.
## S4 method for signature 'mina,ANY' bs_pm( x, group, g_size = 88, s_size = 30, rm = TRUE, per = 0.1, sig = TRUE, bs = 6, pm = 6, individual = FALSE, out_dir = "./", ... ) ## S4 method for signature 'mina,character' bs_pm( x, group, g_size = 88, s_size = 30, rm = TRUE, per = 0.1, sig = TRUE, bs = 6, pm = 6, individual = FALSE, out_dir = "./", ... )
## S4 method for signature 'mina,ANY' bs_pm( x, group, g_size = 88, s_size = 30, rm = TRUE, per = 0.1, sig = TRUE, bs = 6, pm = 6, individual = FALSE, out_dir = "./", ... ) ## S4 method for signature 'mina,character' bs_pm( x, group, g_size = 88, s_size = 30, rm = TRUE, per = 0.1, sig = TRUE, bs = 6, pm = 6, individual = FALSE, out_dir = "./", ... )
x |
An object of class 'mina' with @norm and @des defined. |
group |
The column name of descriptive file @des for comparison. |
g_size |
The cutoff of group size used for filtering, default is 88. |
s_size |
The number of samples used for network inference during bootstrap and permutation (when 'sig' is TRUE), it should be smaller than g_size / 2 to make sure the randomness; default is 30. |
rm |
Filtering the components present in less than 'per' of the samples from compared groups, default TRUE. |
per |
The percentage of present samples for filtering, default is 0.1. |
sig |
Whether to test the significance, skip the permutation when set as FALSE, default is TRUE. |
bs |
The times for bootstrap network inference, default is 6. |
pm |
The times for permuatated samples network inference, default is 6. |
individual |
Whether to output the bootstrap and permutation results of each comparison individually, default is FALSE. |
out_dir |
The output directory if 'individual' is TRUE, default is the current working directory |
... |
Additional parameters. |
x The same object with @multi and @perm defined.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment", per = 0.5)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment", per = 0.5)
Check the tab and des file. Return TRUE if they are NULL or both quantitative and descriptive files of same samples are included (i.e. the object is valid).
check_mina(x)
check_mina(x)
x |
An object of class mina. |
TRUE if the object is valid.
data(maize) check_mina(maize)
data(maize) check_mina(maize)
Check the object and return TRUE if the object includes descriptive table contains the same samples as quantitative table.
check_mina_de(x)
check_mina_de(x)
x |
An object of class mina with 'tab' and 'des' defined. |
TRUE if the object contains non-empty descriptive table and has the same samples as quantitative table.
data(maize) check_mina_de(maize)
data(maize) check_mina_de(maize)
Check the object and return TRUE if the object includes quantitative table.
check_mina_qu(x)
check_mina_qu(x)
x |
An object of class mina with 'tab' defined. |
TRUE if the object contains quantitative table and is not empty.
data(maize) check_mina_qu(maize)
data(maize) check_mina_qu(maize)
Get the slot 'cls_tab'.
cls_tab(x)
cls_tab(x)
x |
The 'mina' object. |
The 'cls_tab' slot of the object.
cls_tab(maize)
cls_tab(maize)
Calculate the community dissimilarity / distance matrix.
com_dis(x, method = "bray", ...)
com_dis(x, method = "bray", ...)
x |
An object of the class mina with 'norm' defined or any quantitative matrix. |
method |
The dissimilarity / distance method used, default 'bray'. |
... |
Additional parameters. |
The distance / dissimilarity matrix.
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray")
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray")
com_dis
.
Dissimilarity / distance should be specified by exact string match.List of dissimilarity / distance supported in com_dis
.
Dissimilarity / distance should be specified by exact string match.
com_dis_list
com_dis_list
A list of character vectors indicate the dissimilarity / distance method used.
tina
TINA from Schmidt_et_al_2016
Jaccard
Jaccard defined by vegdist
Dissimilarity / distance method for weighted matrix:
bhjattacharyya
from parDist
canberra
from parDist
bray
from parDist
chord
from parDist
divergence
from parDist
euclidean
from parDist
fJaccard
from parDist
geodesic
from parDist
hellinger
from parDist
kullback
from parDist
manhattan
from parDist
maximum
from parDist
minkowski
from parDist
podani
from parDist
soergel
from parDist
wave
from parDist
whittaker
from parDist
Dissimilarity / Distance for unweighted matrix:
binary
from parDist
braun-blanquet
from parDist
consine
from parDist
dice
from parDist
fager
from parDist
faith
from parDist
hamman
from parDist
hamming
from parDist
kulczynski1
from parDist
kulczynski2
from parDist
michael
from parDist
mountford
from parDist
mozley
from parDist
ochiai
from parDist
phi
from parDist
russel
from parDist
simple matching
from parDist
simpson
from parDist
stiles
from parDist
tanimoto
from parDist
yule
from parDist
yule2
from parDist
? com_dis_list
? com_dis_list
Calculate the community dissimilarity / distance matrix of the input matrix.
## S4 method for signature 'matrix,ANY' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...) ## S4 method for signature 'matrix,character' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)
## S4 method for signature 'matrix,ANY' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...) ## S4 method for signature 'matrix,character' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)
x |
A matrix of the quantitative table. |
method |
The dissimilarity / distance method used, default 'bray'. |
threads |
(optional, only needed when method == "tina") The number of threads used for parallel running. |
nblocks |
(optional, only needed when method == "tina") The number of row / column for splitted sub-matrix. |
... |
Additional parameters. |
y The dissimilarity / distance matrix.
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray")
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray")
Calculate the community dissimilarity / distance matrix of 'norm' with 'mina' class object as input.
## S4 method for signature 'mina,ANY' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...) ## S4 method for signature 'mina,character' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)
## S4 method for signature 'mina,ANY' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...) ## S4 method for signature 'mina,character' com_dis(x, method = "bray", threads = 80, nblocks = 400, ...)
x |
An object of the class 'mina' with 'norm' defined. |
method |
The dissimilarity / distance method used, default 'bray'. |
threads |
(optional, only needed when method == "tina") The number of threads used for parallel running. |
nblocks |
(optional, only needed when method == "tina") The number of row / column for splitted sub-matrix. |
... |
Additional parameters. |
x The same 'mina' object with @dis added.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "total") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray")
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "total") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray")
Visulization of components distance / dissimilarity in k dimension.
com_plot(x, match, ...)
com_plot(x, match, ...)
x |
An object of class 'mina' with 'dmr' and 'des' defined. |
match |
The column name of the components IDs in 'des' which exactly the same indicated in 'dmr'. |
... |
Additional parameters. |
The PCoA plot.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 5000) maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) p1a <- com_plot(maize, match = "Sample_ID", color = "Compartment") p1b <- com_plot(maize, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- com_plot(maize, match = "Sample_ID", color = "Host_genotype") p2b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- com_plot(maize, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil")
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 5000) maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) p1a <- com_plot(maize, match = "Sample_ID", color = "Compartment") p1b <- com_plot(maize, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- com_plot(maize, match = "Sample_ID", color = "Host_genotype") p2b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- com_plot(maize, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil")
Visulization of components distance / dissimilarity in k dimension.
## S4 method for signature 'mina,ANY' com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...) ## S4 method for signature 'mina,character' com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...) ## S4 method for signature 'mina,character' com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...)
## S4 method for signature 'mina,ANY' com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...) ## S4 method for signature 'mina,character' com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...) ## S4 method for signature 'mina,character' com_plot(x, match, d1 = 1, d2 = 2, color, shape = NULL, ...)
x |
An object of 'mina' with list 'dmr' defined. |
match |
The column name of the components IDs in 'des' with exactly the same as rownames in x. |
d1 |
The dimension be visualized in x-axis, default '1'. |
d2 |
The dimension be visualized in y-axis, default '2'. |
color |
The column name in 'des' to be used for different color groups. |
shape |
The column name in 'des' to be used for different shape groups, default 'NULL'. |
... |
Additional parameters. |
p The plotted figure.
The PCoA plot.
maize <- new("mina", tab = maize_asv, des = maize_des) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) p1a <- com_plot(maize, match = "Sample_ID", color = "Compartment") p1b <- com_plot(maize, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- com_plot(maize, match = "Sample_ID", color = "Host_genotype") p2b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- com_plot(maize, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil")
maize <- new("mina", tab = maize_asv, des = maize_des) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) p1a <- com_plot(maize, match = "Sample_ID", color = "Compartment") p1b <- com_plot(maize, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- com_plot(maize, match = "Sample_ID", color = "Host_genotype") p2b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- com_plot(maize, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- com_plot(maize, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil")
Calculate the unexplained variance ratio using formula indicated in: Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.
com_r2(x, group)
com_r2(x, group)
x |
An object of class 'mina' with 'dis' and 'des' defined. |
group |
The name(s) of column(s) defined as experimental setup group(s). |
Unexplained variance ratio.
data(maize) maize <- norm_tab(maize, method = "raref", depth = 5000) maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") com_r2(maize, group = c("Compartment", "Soil", "Host_genotype"))
data(maize) maize <- norm_tab(maize, method = "raref", depth = 5000) maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") com_r2(maize, group = c("Compartment", "Soil", "Host_genotype"))
Function for unexplained variance ratio calculation indicated in Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.
## S4 method for signature 'mina,ANY' com_r2(x, group) ## S4 method for signature 'mina,character' com_r2(x, group)
## S4 method for signature 'mina,ANY' com_r2(x, group) ## S4 method for signature 'mina,character' com_r2(x, group)
x |
An mina object with 'dis' and 'des' defined. |
group |
The name(s) of column(s) defined as experimental setup group(s). |
r2 The variance ratio cannot be explained by given groups.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") com_r2(maize, group = c("Compartment", "Soil", "Host_genotype"))
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") com_r2(maize, group = c("Compartment", "Soil", "Host_genotype"))
Function for correlation coefficient calculation.
cp_cor(mat)
cp_cor(mat)
mat |
The input matrix for correlation calculation. |
The output correlation matrix.
Internal testing data of HMP project, including quantitative table (hmp_otu) and descriptive table (hmp_des) for testing.
data(hmp)
data(hmp)
Internal testing data of maize project, vegetative stage samples only, including quantitative table (maize_asv.rds) and descriptive table (maize_des.txt) for testing.
data(maize)
data(maize)
Setter and getter for the slot 'des', which is the description and meta data of rows in 'tab'.
des(x) <- value ## S4 replacement method for signature 'mina' des(x) <- value des(x) ## S4 method for signature 'mina' des(x)
des(x) <- value ## S4 replacement method for signature 'mina' des(x) <- value des(x) ## S4 method for signature 'mina' des(x)
x |
The 'mina' object. |
value |
The value to set for the slot of the 'mina' object 'x'. |
The 'des' slot of the 'mina' object.
des(maize) <- maize_des2 head(des(maize))
des(maize) <- maize_des2 head(des(maize))
Getter for the slots 'dis_bs', 'dis_pm' and 'dis_stat'.
dis_bs(x) dis_pm(x) dis_stat(x)
dis_bs(x) dis_pm(x) dis_stat(x)
x |
The 'mina' object. |
The 'dis_bs', 'dis_pm' and 'dis_stat' slots of the 'mina' object.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment", per = 0.5) maize <- net_dis(maize, method = "Jaccard") dis_bs(maize) dis_pm(maize) dis_stat(maize)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment", per = 0.5) maize <- net_dis(maize, method = "Jaccard") dis_bs(maize) dis_pm(maize) dis_stat(maize)
Setter and getter for the slot 'dis'.
Get the slot 'dis'
dis(x) <- value dis(x) ## S4 replacement method for signature 'mina' dis(x) <- value ## S4 method for signature 'mina' dis(x)
dis(x) <- value dis(x) ## S4 replacement method for signature 'mina' dis(x) <- value ## S4 method for signature 'mina' dis(x)
x |
The 'mina' object. |
value |
The value to set for the slot of the 'mina' object 'x'. |
The 'dis' slot of the 'mina' object.
maize_norm <- norm_tab(maize_asv2, method = "total") dis(maize) <- com_dis(maize_norm, method = "bray") dis(maize)[1:5, 1:5]
maize_norm <- norm_tab(maize_asv2, method = "total") dis(maize) <- com_dis(maize_norm, method = "bray") dis(maize)[1:5, 1:5]
Dimensionality reduction of community dissimilarity / distance for visulization.
dmr(x, k = 2)
dmr(x, k = 2)
x |
An object of class 'mina' with 'dis' defined or a distance matrix. |
k |
The dimension number after reduction. |
The dimentionality reduction results.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize)
Dimensionality reduction of the distance matrix.
## S4 method for signature 'matrix' dmr(x, k = 4)
## S4 method for signature 'matrix' dmr(x, k = 4)
x |
A distance matrix. |
k |
The number of dimensionality after reduction, 4 by default. |
y The coordinates of components indicated in distance matrix in k dimension.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") asv_dis <- dis(maize) asv_dis_dmr <- dmr(asv_dis, k = 4)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") asv_dis <- dis(maize) asv_dis_dmr <- dmr(asv_dis, k = 4)
Dimensionality reduction of the 'dis' included in mina.
## S4 method for signature 'mina' dmr(x, k = 4)
## S4 method for signature 'mina' dmr(x, k = 4)
x |
An object of the class 'mina' with 'dis' defined. |
k |
The number of dimensionality after reduction, 4 by default. |
x The same object with 'dmr' added.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize)
Filter the quantitative and descriptive table to make them have the same samples, the intersect samples will be remained.
fit_tabs(x)
fit_tabs(x)
x |
An object of the class mina with 'tab' and 'des' defined or a quantitative matrix(need parameter des in this case). |
Same 'mina' object but fitted 'tab' and 'des' (as well as 'norm' if defined)
data(maize) maize <- fit_tabs(maize) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize)
data(maize) maize <- fit_tabs(maize) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize)
Filter the quantitative and descriptive table to make them have the same samples, samples present in both tables are remained. If 'norm' table exist in the 'mina' object, descriptive table will be filtered again to only keep samples present in 'norm'.
## S4 method for signature 'mina' fit_tabs(x)
## S4 method for signature 'mina' fit_tabs(x)
x |
An object of class mina. |
x The same object as input with fitted 'tab', 'des' and 'norm' (if defined).
{ data(maize) maize <- fit_tabs(maize) maize <- norm_tab(maize, method = "total") maize <- fit_tabs(maize) }
{ data(maize) maize <- fit_tabs(maize) maize <- norm_tab(maize, method = "total") maize <- fit_tabs(maize) }
Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.
get_net_cls_tab(x_norm, x_cls, uw = FALSE)
get_net_cls_tab(x_norm, x_cls, uw = FALSE)
x_norm |
The normalized quantitative table used for netowrk inference and clustering. |
x_cls |
The network clustering table. |
uw |
By summing up the number of present components of each cluster instead of relative abundance, default is FALSE. |
x_cls The quantitative table with clusters in rows.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize_norm <- norm(maize) maize_adj <- adj(maize_norm, method = "spearman") maize_cls <- net_cls(maize_adj, method = "ap", cutoff = 0.5) maize_cls_tab <- get_net_cls_tab(maize_norm, maize_cls)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize_norm <- norm(maize) maize_adj <- adj(maize_norm, method = "spearman") maize_cls <- net_cls(maize_adj, method = "ap", cutoff = 0.5) maize_cls_tab <- get_net_cls_tab(maize_norm, maize_cls)
Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.
## S4 method for signature 'matrix,data.frame' get_net_cls_tab(x_norm, x_cls, uw = FALSE)
## S4 method for signature 'matrix,data.frame' get_net_cls_tab(x_norm, x_cls, uw = FALSE)
x_norm |
The normalized quantitative table used for netowrk inference and clustering. |
x_cls |
The network clustering table. |
uw |
By summing up the number of present components of each cluster instead of relative abundance, default is FALSE. |
x_cls The quantitative table with clusters in rows.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize_norm <- norm(maize) maize_adj <- adj(maize_norm, method = "spearman") maize_cls <- net_cls(maize_adj, method = "ap", cutoff = 0.5) maize_cls_tab <- get_net_cls_tab(maize_norm, maize_cls)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize_norm <- norm(maize) maize_adj <- adj(maize_norm, method = "spearman") maize_cls <- net_cls(maize_adj, method = "ap", cutoff = 0.5) maize_cls_tab <- get_net_cls_tab(maize_norm, maize_cls)
Same function as 'com_r2' with matrix and corresponding descriptive table as input.
get_r2(x, des, group)
get_r2(x, des, group)
x |
Dissimilarity / distance matrix which indicate variances. |
des |
The descriptive table of samples which define the groups. |
group |
The name(s) of column(s) used as experimental setup group(s) in descriptive file. |
r2 The variance ratio cannot be explained by given groups.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") get_r2(dis(maize), des(maize), group = c("Compartment", "Soil"))
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") get_r2(dis(maize), des(maize), group = c("Compartment", "Soil"))
Function for unexplained variance ratio calculation indicated in Anderson, M.J. 2001. A new method for non-parametric multivariate analysis of variance. Austral Ecology, 26: 32–46.
## S4 method for signature 'matrix,ANY,ANY' get_r2(x, des, group) ## S4 method for signature 'matrix,data.frame,ANY' get_r2(x, des, group) ## S4 method for signature 'matrix,data.frame,character' get_r2(x, des, group = c("Host_genotype", "Compartment", "Soil", "Management"))
## S4 method for signature 'matrix,ANY,ANY' get_r2(x, des, group) ## S4 method for signature 'matrix,data.frame,ANY' get_r2(x, des, group) ## S4 method for signature 'matrix,data.frame,character' get_r2(x, des, group = c("Host_genotype", "Compartment", "Soil", "Management"))
x |
Dissimilarity / distance matrix which indicate variances. |
des |
The descriptive table of samples which define the groups. |
group |
The name(s) of column(s) used as experimental setup group(s) in descriptive file. |
r2 The variance ratio cannot be explained by given groups.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") x <- dis(maize) des <- des(maize) get_r2(x, des, group = c("Compartment", "Soil"))
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") x <- dis(maize) des <- des(maize) get_r2(x, des, group = c("Compartment", "Soil"))
Get the representative community members by extracting the most abundant and prevalent compositions.
Get the representative community members.
get_rep(x, ...) ## S4 method for signature 'matrix' get_rep(x, top = 5)
get_rep(x, ...) ## S4 method for signature 'matrix' get_rep(x, top = 5)
x |
A quantitative matrix with samples in columns and compositions in rows. |
... |
Additional parameters. |
top |
The percent of the most abundant and prevalent members. |
The matrix with samples in columns and representative compositions in rows.
The matrix with samples in columns and representative compositions in rows.
data(maize_asv) maize_asv_rep <- get_rep(maize_asv) data(maize_asv) maize_asv_rep <- get_rep(maize_asv, top = 5)
data(maize_asv) maize_asv_rep <- get_rep(maize_asv) data(maize_asv) maize_asv_rep <- get_rep(maize_asv, top = 5)
Get the representative community members.
## S4 method for signature 'mina' get_rep(x, top = 5)
## S4 method for signature 'mina' get_rep(x, top = 5)
x |
An object of the class 'mina' with @norm define. |
top |
The percent of the most abundant and prevalent members. |
The same object with @norm replaced by the representative members.
maize <- new("mina", tab = maize_asv, des = maize_des) maize <- norm_tab(maize, method = "raref") maize <- get_rep(maize, top = 5)
maize <- new("mina", tab = maize_asv, des = maize_des) maize <- norm_tab(maize, method = "raref") maize <- get_rep(maize, top = 5)
Design file for HMP project, including 2711 samples in total.
A data frame with columns:
The unique ID of the microbial profiling sample.
The gender of the host human.
The lab proccessing the sample sequencing.
The subsite of body where samples were collected.
The site of body where samples were collectec.
The further details about the samples.
HMP project.
data(hmp_des)
data(hmp_des)
OTU table of HMP project, data downloaded from https://www.hmpdacc.org/hmp/HMQCP/
A matrix with samples in columns and OTUs in rows.
HMP project.
data(hmp_otu)
data(hmp_otu)
ASV table of maize project, vegetative stage samples only.
A matrix with samples in columns and ASVs in rows. Unormalized table including 12765 ASVs from 420 samples.
RECONSTRUCT project, maize microbiome part.
data(maize_asv)
data(maize_asv)
Subset of ASV table of maize project, ASVs appear in less than 100 samples were filtered for later analysis.
A matrix with samples in columns and ASVs in rows. Unormalized table including 1219 ASVs from 313 samples.
RECONSTRUCT project, maize microbiome part.
data(maize_asv2)
data(maize_asv2)
Design file of maize project, vegetative stage samples only, including 528 samples in total.
A data frame with columns:
The unique ID of the microbial profiling sample.
The genotype of the plant host maize.
The compartment of the microbial sample comes from.
The soil of the sampled microbiome.
The management of the soil where microbial sample from.
RECONSTRUCT project, maize microbiome part.
data(maize_des)
data(maize_des)
Subset of design file of maize project, 313 samples are included.
A data frame with columns:
The unique ID of the microbial profiling sample.
The genotype of the plant host maize.
The compartment of the microbial sample comes from.
The soil of the sampled microbiome.
The management of the soil where microbial sample from.
RECONSTRUCT project, maize microbiome part.
data(maize_des2)
data(maize_des2)
Class "mina" includes the quantitative table and descriptive table.
tab
The quantitative table of the dataset.
des
The descriptive table of the samples listed in @tab.
norm
The normalized quantitative table of @tab.
dis
The distance / dissimilarity matrix between samples in @tab.
dmr
The list of dimensionality reduction result, includes points and variance.
adj
The adjacency matrix between pairwise compositions (e.g. OTUs/ASVs)
adj_sig
The P-value matrix of adjacency matrix, only applicable for Pearson and Spearman correlation adjacency matrices.
cls
The cluster information for each composition.
cls_tab
The cluster quantitative table.
multi
The list of subsampled adjacency matrices for each environment.
perm
The list of permutated adjacency matrices for each pairwise environmental comparison.
dis_bs
The distance between networks of different environmental communities.
dis_pm
The distance between networks of permutated groups.
dis_stat
The average distance between subsampled environmental community networks, permutated networks and corresponding significance.
Rui Guan https://github.com/Guan06
maize <- new("mina", tab = maize_asv, des = maize_des)
maize <- new("mina", tab = maize_asv, des = maize_des)
Network clustering of sparsed adjacacency matrix.
net_cls(x, method, ...)
net_cls(x, method, ...)
x |
An object of class 'mina' with 'adj' defined. |
method |
The clustering method used. |
... |
Additional parameters. |
The network clustering results.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "mcl", cutoff = 0.4, neg = FALSE)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "mcl", cutoff = 0.4, neg = FALSE)
Get the cluster table 'cls_tab' from 'norm' and 'cls'.
net_cls_tab(x, uw = FALSE)
net_cls_tab(x, uw = FALSE)
x |
An object of class 'mina' with 'norm' and 'cls' defined. |
uw |
By summing up the number of present components of each cluster instead of relative abundances, default is FALSE. |
The network cluster relative abundance table.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "ap", cutoff = 0.5) maize <- net_cls_tab(maize)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "ap", cutoff = 0.5) maize <- net_cls_tab(maize)
Get the cluster table 'cls_tab' from quantitative table 'norm' and network clustering results 'cls'.
## S4 method for signature 'mina' net_cls_tab(x, uw = FALSE)
## S4 method for signature 'mina' net_cls_tab(x, uw = FALSE)
x |
An object of class 'mina' with 'norm' and 'cls' defined. |
uw |
By summing up the number of present components of each cluster instead of relative abundance, default is FALSE. |
x The same 'mina' object with 'cls_tab' added.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "mcl", cutoff = 0.5) maize <- net_cls_tab(maize)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "mcl", cutoff = 0.5) maize <- net_cls_tab(maize)
Network clustering based on the sparsed adjacacency matrix.
## S4 method for signature 'matrix,ANY' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...) ## S4 method for signature 'matrix,character' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)
## S4 method for signature 'matrix,ANY' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...) ## S4 method for signature 'matrix,character' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)
x |
Adjacency matrix used for clustering. |
method |
The clustering method used. |
cutoff |
The cutoff for the sparsed adjacacency matrix, default 0.4. |
neg |
Whether to keep the negative edges, cannot be TRUE when using 'mcl' for clustering. Default FALSE. |
... |
Additional parameters. |
y The cluster table.
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_adj <- adj(asv_norm, method = "spearman") asv_cls <- net_cls(asv_adj, method = "mcl")
asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_adj <- adj(asv_norm, method = "spearman") asv_cls <- net_cls(asv_adj, method = "mcl")
Network clustering based on the sparsed adjacacency matrix.
## S4 method for signature 'mina,ANY' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...) ## S4 method for signature 'mina,character' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)
## S4 method for signature 'mina,ANY' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...) ## S4 method for signature 'mina,character' net_cls(x, method, cutoff = 0.4, neg = FALSE, ...)
x |
An object of class 'mina' with 'adj' defined. |
method |
The clustering method used. |
cutoff |
The cutoff for the sparsed adjacacency matrix, default 0.4. |
neg |
Whether to keep the negative edges, cannot be TRUE when using 'mcl' for clustering. Default FALSE. |
... |
Additional parameters. |
x The same 'mina' class with @cls added.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "mcl", cutoff = 0.4, neg = FALSE) maize <- net_cls(maize, method = "ap", cutoff = 0.4, neg = FALSE)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000) maize <- fit_tabs(maize) maize <- adj(maize, method = "spearman") maize <- net_cls(maize, method = "mcl", cutoff = 0.4, neg = FALSE) maize <- net_cls(maize, method = "ap", cutoff = 0.4, neg = FALSE)
Calculate the network distance of 'multi' and test the significance when 'perm' is defined.
net_dis(x, method, ...)
net_dis(x, method, ...)
x |
An object of class 'mina' with 'multi' (and 'perm' if 'sig' is TRUE) defined. |
method |
The distance to be calculated, "spectra" and "Jaccard" are available. |
... |
Additional parameters. |
The netowrk comparison result.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "spectra", evk = 30)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "spectra", evk = 30)
Calculate the network distance of bootstrap and permutation when appliable.
Calculate the network distance of bootstrap and permutation when appliable.
net_dis_indi(x, method, ...) ## S4 method for signature 'character,ANY' net_dis_indi( x, method, evk = 100, sig = TRUE, skip = TRUE, egv = TRUE, dir = "./", ... ) ## S4 method for signature 'character,character' net_dis_indi( x, method, evk = 100, sig = TRUE, skip = TRUE, egv = TRUE, dir = "./", ... )
net_dis_indi(x, method, ...) ## S4 method for signature 'character,ANY' net_dis_indi( x, method, evk = 100, sig = TRUE, skip = TRUE, egv = TRUE, dir = "./", ... ) ## S4 method for signature 'character,character' net_dis_indi( x, method, evk = 100, sig = TRUE, skip = TRUE, egv = TRUE, dir = "./", ... )
x |
The folder store the network inference results. defined. |
method |
The distance to be calculated, "spectra" and "Jaccard" are available. |
... |
Additional parameters. |
evk |
The first 'evk' eigenvalues will be used for 'spectra' distance, the default is 100. |
sig |
Whether to test the significance, if TRUE (by default), permutation results should be included in the folder 'x'. |
skip |
Whether to skip the comparison when the dimenstion of adjacency matrix is smaller than setted 'evk', default TRUE. |
egv |
Wheather to output the eigenvectors for Spectral distance, the defult is TRUE, only validate when 'method == "spectra"'. |
dir |
The folder to output the eigenvectors, only validate when 'egv == TRUE'. |
y The 'mina' object with 'dis_bs', 'dis_pm' and 'dis_stat'.
y The 'mina' object with 'dis_bs', 'dis_pm' and 'dis_stat'.
## Not run: data(maize) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize_stat1 <- net_dis_indi(x = "./individual_bs_pm/", method = "spectra") maize_stat2 <- net_dis_indi(x = "./individual_bs_pm/", method = "Jaccard") maize_stat3 <- net_dis_indi(x = "./individual_bs_pm/", method = "spectra", evk = 100, skip = TRUE) ## End(Not run) ## Not run: data(maize) norm(maize) <- maize_asv2 maize <- fit_tabs(maize) maize <- get_rep(maize, top= 5) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize_stat1 <- net_dis_indi("./individual_bs_pm/", method = "spectra") maize_stat2 <- net_dis_indi("./individual_bs_pm/", method = "Jaccard") maize_stat3 <- net_dis_indi("./individual_bs_pm/", method = "spectra", evk = 100, skip = TRUE) ## End(Not run)
## Not run: data(maize) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize_stat1 <- net_dis_indi(x = "./individual_bs_pm/", method = "spectra") maize_stat2 <- net_dis_indi(x = "./individual_bs_pm/", method = "Jaccard") maize_stat3 <- net_dis_indi(x = "./individual_bs_pm/", method = "spectra", evk = 100, skip = TRUE) ## End(Not run) ## Not run: data(maize) norm(maize) <- maize_asv2 maize <- fit_tabs(maize) maize <- get_rep(maize, top= 5) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize_stat1 <- net_dis_indi("./individual_bs_pm/", method = "spectra") maize_stat2 <- net_dis_indi("./individual_bs_pm/", method = "Jaccard") maize_stat3 <- net_dis_indi("./individual_bs_pm/", method = "spectra", evk = 100, skip = TRUE) ## End(Not run)
Visulization of spectra network distance as PCoA.
Visulization of spectra network distance as PCoA.
net_dis_pcoa(x) ## S4 method for signature 'character' net_dis_pcoa(x)
net_dis_pcoa(x) ## S4 method for signature 'character' net_dis_pcoa(x)
x |
The folder with all egv files generated by net_dis_indi(). |
p The plotted figure.
p The plotted figure.
## Not run: data(maize) norm(maize) <- maize_asv2 maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize <- net_dis_indi("./individual_bs_pm/", method = "spectra", egv = TRUE, dir = "./egv_folder/") p <- net_dis_pcoa("./egv_folder/") ## End(Not run) ## Not run: data(maize) maize <- norm_tab(maize) maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize <- net_dis_indi("./individual_bs_pm/", method = "spectra", egv = TRUE, dir = "./egv_folder/") p <- net_dis_pcoa("./egv_folder/") ## End(Not run)
## Not run: data(maize) norm(maize) <- maize_asv2 maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize <- net_dis_indi("./individual_bs_pm/", method = "spectra", egv = TRUE, dir = "./egv_folder/") p <- net_dis_pcoa("./egv_folder/") ## End(Not run) ## Not run: data(maize) maize <- norm_tab(maize) maize <- fit_tabs(maize) maize <- get_rep(maize, top = 5) maize <- bs_pm(maize, group = "Compartment", individual = TRUE, out_dir = "./individual_bs_pm/") maize <- net_dis_indi("./individual_bs_pm/", method = "spectra", egv = TRUE, dir = "./egv_folder/") p <- net_dis_pcoa("./egv_folder/") ## End(Not run)
Visulization of network distance, average distances are used for tile plot.
Visulization of network distance, average distances are used for tile plot.
net_dis_plot(x, d = "BS", ...) ## S4 method for signature 'mina' net_dis_plot(x, d = "BS", sig = TRUE)
net_dis_plot(x, d = "BS", ...) ## S4 method for signature 'mina' net_dis_plot(x, d = "BS", sig = TRUE)
x |
An object of 'mina' with slot 'dis_stat' defined. |
d |
The distance to be plotted, could be "BS" or "PM". |
... |
Additional parameters. |
sig |
If 'TRUE', indicating significant distance with gold guild. |
p The plotted figure.
p The plotted figure.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "Jaccard") p <- net_dis_plot(maize) maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "Jaccard") p <- net_dis_plot(maize, d = "BS")
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "Jaccard") p <- net_dis_plot(maize) maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "Jaccard") p <- net_dis_plot(maize, d = "BS")
Calculate the network distance of 'multi' and test the significance when 'perm' is defined.
## S4 method for signature 'mina,ANY' net_dis( x, method, evk = 100, egv = TRUE, dir = "./", sig = TRUE, skip = TRUE, ... ) ## S4 method for signature 'mina,character' net_dis( x, method, evk = 100, egv = TRUE, dir = "./", sig = TRUE, skip = TRUE, ... )
## S4 method for signature 'mina,ANY' net_dis( x, method, evk = 100, egv = TRUE, dir = "./", sig = TRUE, skip = TRUE, ... ) ## S4 method for signature 'mina,character' net_dis( x, method, evk = 100, egv = TRUE, dir = "./", sig = TRUE, skip = TRUE, ... )
x |
An object of class 'mina' with 'multi' (and 'perm' if sig is TRUE) defined. |
method |
The distance to be calculated, "spectra" and "Jaccard" are available. |
evk |
The first 'evk' eigenvalues will be used for 'spectra' distance, the default is 100. |
egv |
Wheather to output the eigenvectors for Spectral distance, the defult is TRUE, only validate when 'method == "spectra"'. |
dir |
The folder to output the eigenvectors, only validate when 'egv == TRUE'. |
sig |
Whether to test the significance, if TRUE (by default), 'perm' is needed. |
skip |
Whether to skip the comparison when the dimenstion of adjacency matrix is smaller than setted 'evk'. |
... |
Additional parameters. |
x The same 'mina' object with 'net_dis' defined.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "Jaccard")
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- bs_pm(maize, group = "Compartment") maize <- net_dis(maize, method = "Jaccard")
Compare the group features between networks.
Compare the group features between networks.
net_grp_cmp(x, cmp = "contrast", dir = "./", grp) ## S4 method for signature 'character' net_grp_cmp(x, cmp = "contrast", dir = "./", grp)
net_grp_cmp(x, cmp = "contrast", dir = "./", grp) ## S4 method for signature 'character' net_grp_cmp(x, cmp = "contrast", dir = "./", grp)
x |
The folder with all network inference results generated by bs_pm() |
cmp |
The compared feature of grp, default 'contrast'. |
dir |
The directory to store the alculated node features. |
grp |
The table with group information. |
## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./", grp = cls_tab(maize)) ## End(Not run) ## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./", grp = cls_tab(maize)) ## End(Not run)
## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./", grp = cls_tab(maize)) ## End(Not run) ## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./", grp = cls_tab(maize)) ## End(Not run)
Compare the node features between networks.
Compare the node features between networks.
net_node_cmp(x, cmp = "contrast", dir = "./") ## S4 method for signature 'character,character' net_node_cmp(x, cmp = "contrast", dir = "./")
net_node_cmp(x, cmp = "contrast", dir = "./") ## S4 method for signature 'character,character' net_node_cmp(x, cmp = "contrast", dir = "./")
x |
The folder with all network inference results generated by bs_pm() |
cmp |
The compared feature of node, default 'contrast'. |
dir |
The directory to store the alculated node features. |
## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./") ## End(Not run) ## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./") ## End(Not run)
## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./") ## End(Not run) ## Not run: net_node_cmp("./individual_bs_pm/", f = "contrast", dir = "./") ## End(Not run)
Normalize the slot 'tab' for later analysis.
norm_tab(x, method, ...)
norm_tab(x, method, ...)
x |
The input mina object with quantitative tab / a matrix needed to be normalized. |
method |
The method used for the normalization of quantitative table. |
... |
Additional parameters. |
Normalized quantitative table.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "total")
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "total")
norm_tab
Normalization methods should be specified by exact string match.
norm_tab_method_list
norm_tab_method_list
A list of character vectors.
raref
By downsampling all samples to specific depth.
total
Devided by the total read of each sample.
? norm_tab_method_list
? norm_tab_method_list
Normalize the quantitative matrix.
## S4 method for signature 'matrix,character' norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...)
## S4 method for signature 'matrix,character' norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...)
x |
A quantitative matrix with samples in columns and compositions in rows. |
method |
The method used for normalization. |
depth |
The depth for rarefying, 1000 by default. |
replace |
Whether to sample with replacement ( |
multi |
Rarefy the table for multiple times, 1 by default, indicate the times of rarefaction want to be repeated, only validate for rarefaction. |
... |
Additional parameters. |
The normalized quantitative matrix.
x_norm Normalized matrix of the quantitative table.
data(maize_asv2) maize_asv_norm <- norm_tab(maize_asv2, method = "total") maize_asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000, replace = TRUE, multi = 3)
data(maize_asv2) maize_asv_norm <- norm_tab(maize_asv2, method = "total") maize_asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000, replace = TRUE, multi = 3)
Normalize the quantitative table with mina input.
## S4 method for signature 'mina,ANY' norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...) ## S4 method for signature 'mina,character' norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...)
## S4 method for signature 'mina,ANY' norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...) ## S4 method for signature 'mina,character' norm_tab(x, method, depth = 1000, replace = TRUE, multi = 1, ...)
x |
An object of the class mina with @tab defined. |
method |
The method used for normalization. |
depth |
The depth for subsampling by rarefying, 1000 by default. |
replace |
Whether to sample with replacement ( |
multi |
Rarefy the table for multiple times, FALSE by default, indicate the times of rarefaction want to be repeated, only validate for rarefaction. |
... |
Additional parameters. |
x An object of the class mina with @norm added.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000, replace = TRUE, multi = 3)
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref", depth = 1000, replace = TRUE, multi = 3)
Setter and getters for the slot 'norm', normalized 'tab' matrix.
norm(x) <- value ## S4 replacement method for signature 'mina' norm(x) <- value norm(x) ## S4 method for signature 'mina' norm(x)
norm(x) <- value ## S4 replacement method for signature 'mina' norm(x) <- value norm(x) ## S4 method for signature 'mina' norm(x)
x |
The 'mina' object. |
value |
The value to set for the slot of the 'mina' object 'x'. |
The 'norm' slot of the 'mina' object.
norm(maize) <- norm_tab(maize_asv2, method = "total") norm(maize)[1:5, 1:5]
norm(maize) <- norm_tab(maize_asv2, method = "total") norm(maize)[1:5, 1:5]
Visulization of components distance / dissimilarity in k dimension.
Visulization of components distance / dissimilarity in k dimension.
pcoa_plot(x, des, match, ...) ## S4 method for signature 'list,data.frame,character' pcoa_plot(x, des, match, d1 = 1, d2 = 2, color, shape = NULL, ...)
pcoa_plot(x, des, match, ...) ## S4 method for signature 'list,data.frame,character' pcoa_plot(x, des, match, d1 = 1, d2 = 2, color, shape = NULL, ...)
x |
A list generated by 'dmr'. |
des |
The corresponding descriptive table. |
match |
The column name of the components IDs in 'des' with exactly the same as rownames in x. |
... |
Additional parameters. |
d1 |
The dimension be visualized in x-axis, default '1'. |
d2 |
The dimension be visualized in y-axis, default '2'. |
color |
The column name in 'des' to be used for different color groups. |
shape |
The column name in 'des' to be used for different shape groups, default 'NULL'. |
p The plotted figure.
p The plotted PCoA.
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) asv_dmr <- .dmr(maize) des <- des(maize) p1a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment") p1b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Host_genotype") p2b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil") maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) asv_dmr <- .dmr(maize) des <- des(maize) p1a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment") p1b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Host_genotype") p2b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil")
maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) asv_dmr <- .dmr(maize) des <- des(maize) p1a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment") p1b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Host_genotype") p2b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil") maize <- new("mina", tab = maize_asv2, des = maize_des2) maize <- norm_tab(maize, method = "raref") maize <- fit_tabs(maize) maize <- com_dis(maize, method = "bray") maize <- dmr(maize) asv_dmr <- .dmr(maize) des <- des(maize) p1a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment") p1b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 3, d2 = 4, color = "Compartment") p2a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Host_genotype") p2b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 3, color = "Host_genotype") p3a <- pcoa_plot(asv_dmr, des, match = "Sample_ID", color = "Compartment", shape = "Soil") p3b <- pcoa_plot(asv_dmr, des, match = "Sample_ID", d1 = 1, d2 = 4, color = "Compartment", shape = "Soil")
Setter and getter for the slot 'tab'.
tab(x) <- value ## S4 replacement method for signature 'mina' tab(x) <- value tab(x) ## S4 method for signature 'mina' tab(x)
tab(x) <- value ## S4 replacement method for signature 'mina' tab(x) <- value tab(x) ## S4 method for signature 'mina' tab(x)
x |
The 'mina' object. |
value |
The value to set for the slot of the 'mina' object 'x'. |
The 'tab' slot of the 'mina' object.
The 'tab' slot of the 'mina' object.
The 'tab' slot of the 'mina' object.
The 'tab' slot of the 'mina' object.
tab(maize) <- maize_asv2 tab(maize)[1:5, 1:5]
tab(maize) <- maize_asv2 tab(maize)[1:5, 1:5]
com_dis
.
Function for 'tina' dissimilarity/distance calculation. Modified from Schmidt
et al., 2016.TINA community dissimilarity used in com_dis
.
Function for 'tina' dissimilarity/distance calculation. Modified from Schmidt
et al., 2016.
tina(x, ...)
tina(x, ...)
x |
An matrix for dissimilarity calculation. |
... |
Additional parameters. |
The output 'tina' dissimilarity matrix.
## Not run: asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray") asv_dis <- com_dis(asv_norm, method = "tina", threads = 8, nblocks = 40) asv_tina <- tina(asv_norm, cor_method = "spearman", sim_method = "w_ja", threads = 8, nblocks = 40) ## End(Not run)
## Not run: asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray") asv_dis <- com_dis(asv_norm, method = "tina", threads = 8, nblocks = 40) asv_tina <- tina(asv_norm, cor_method = "spearman", sim_method = "w_ja", threads = 8, nblocks = 40) ## End(Not run)
Function for 'tina' dissimilarity calculation. Modified from Schmidt et al., 2016. Person and Spearman could be used for correlation and weighted and unweighted Jaccard could be used for similarity calculation.
## S4 method for signature 'matrix' tina( x, cor_method = "spearman", sim_method = "w_ja", threads = 80, nblocks = 400, ... )
## S4 method for signature 'matrix' tina( x, cor_method = "spearman", sim_method = "w_ja", threads = 80, nblocks = 400, ... )
x |
A matrix for dissimilarity calculation. |
cor_method |
The method for correlation, "pearson" and "spearman" are available. |
sim_method |
The method for similarity, "w_ja" and "uw_ja" are available for weighted and unweighted Jaccard similarity respectively. |
threads |
The number of threads used for parallel running, 80 by default. |
nblocks |
The number of row and column for splitted sub-matrix, 400 by default. |
... |
Additional parameters. |
t The output 'tina' dissimilarity matrix.
## Not run: asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray") asv_dis <- com_dis(asv_norm, method = "tina", threads = 8, nblocks = 40) asv_tina <- tina(asv_norm, cor_method = "spearman", sim_method = "w_ja", threads = 8, nblocks = 40) ## End(Not run)
## Not run: asv_norm <- norm_tab(maize_asv2, method = "raref", depth = 1000) asv_dis <- com_dis(asv_norm, method = "bray") asv_dis <- com_dis(asv_norm, method = "tina", threads = 8, nblocks = 40) asv_tina <- tina(asv_norm, cor_method = "spearman", sim_method = "w_ja", threads = 8, nblocks = 40) ## End(Not run)