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_list
a list with multiple networks; all the networks should be
trans_network
object created fromtrans_network
class 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
measure
default "c_pos"; "c_pos" or "c_neg" in the
res_list$sample
; "r_pos" or "r_neg" in theres_list$feature
.method
default "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
dunnTest
function inFSA
package- '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_diff
function oftrans_alpha
class ofmicroeco
package.
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
measure
default "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_alpha
function oftrans_alpha
class ofmicroeco
package.
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
deep
Whether 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)