| cohesionclass {meconetcomp} | R Documentation |
Calculate the cohesion of samples for each network
Description
The cohesion is a method for quantifying the connectivity of microbial communities <doi:10.1038/ismej.2017.91>. It is defined:
C_{j}^{pos} = \sum_{i=1}^{n} a_{i} \cdot \bar{r_{i}}_{|r>0}
C_{j}^{neg} = \sum_{i=1}^{n} a_{i} \cdot \bar{r_{i}}_{|r<0}
where C_{j}^{pos} is the positive cohesion, and C_{j}^{neg} is the negative cohesion.
a_{i} is the relative abundance of species i in sample j.
\bar{r_{i}}_{|r>0} denotes the mean weight (correlation coefficient, interaction strength) of all the edges (related with species i) with positive association.
Methods
Public methods
Method new()
Usage
cohesionclass$new(network_list)
Arguments
network_lista list with multiple networks; all the networks should be
trans_networkobject created fromtrans_networkclass of microeco package.
Returns
res_list, stored in the object.
It includes two tables: res_feature and res_sample. In res_feature, the r_pos and r_neg columns mean the \bar{r_{i}}_{|r>0} and \bar{r_{i}}_{|r<0}.
In res_sample, the c_pos and c_neg columns denote C_{j}^{pos} and C_{j}^{neg}.
Examples
t1 <- cohesionclass$new(soil_amp_network)
Method cal_diff()
Differential test.
Usage
cohesionclass$cal_diff(
measure = "c_pos",
method = c("anova", "KW", "KW_dunn", "wilcox", "t.test")[1],
...
)Arguments
measuredefault "c_pos"; "c_pos" or "c_neg" in the
res_list$sample; "r_pos" or "r_neg" in theres_list$feature.methoddefault "anova"; see the following available options:
- 'anova'
Duncan's multiple range test for anova
- 'KW'
KW: Kruskal-Wallis Rank Sum Test for all groups (>= 2)
- 'KW_dunn'
Dunn's Kruskal-Wallis Multiple Comparisons, see
dunnTestfunction inFSApackage- 'wilcox'
Wilcoxon Rank Sum and Signed Rank Tests for all paired groups
- 't.test'
Student's t-Test for all paired groups
...parameters passed to
cal_difffunction oftrans_alphaclass ofmicroecopackage.
Returns
res_diff in object. See the Return of cal_diff function in trans_alpha class of microeco package.
Examples
\donttest{
t1$cal_diff(method = "wilcox")
}
Method plot()
Plot the result.
Usage
cohesionclass$plot(measure = "c_pos", ...)
Arguments
measuredefault "c_pos"; "c_pos" or "c_neg" in the
res_list$sample; "r_pos" or "r_neg" in theres_list$feature....parameters pass to
plot_alphafunction oftrans_alphaclass ofmicroecopackage.
Returns
ggplot.
Examples
\donttest{
t1$plot(boxplot_add = "none", add_sig = TRUE)
}
Method clone()
The objects of this class are cloneable with this method.
Usage
cohesionclass$clone(deep = FALSE)
Arguments
deepWhether to make a deep clone.
Examples
## ------------------------------------------------
## Method `cohesionclass$new`
## ------------------------------------------------
t1 <- cohesionclass$new(soil_amp_network)
## ------------------------------------------------
## Method `cohesionclass$cal_diff`
## ------------------------------------------------
t1$cal_diff(method = "wilcox")
## ------------------------------------------------
## Method `cohesionclass$plot`
## ------------------------------------------------
t1$plot(boxplot_add = "none", add_sig = TRUE)