cohesionclass | R Documentation |
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.
new()
cohesionclass$new(network_list)
network_list
a list with multiple networks; all the networks should be trans_network
object
created from trans_network
class of microeco package.
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}
.
t1 <- cohesionclass$new(soil_amp_network)
cal_diff()
Differential test.
cohesionclass$cal_diff( measure = "c_pos", method = c("anova", "KW", "KW_dunn", "wilcox", "t.test")[1], ... )
measure
default "c_pos"; "c_pos" or "c_neg" in the res_list$sample
; "r_pos" or "r_neg" in the res_list$feature
.
method
default "anova"; see the following available options:
Duncan's multiple range test for anova
KW: Kruskal-Wallis Rank Sum Test for all groups (>= 2)
Dunn's Kruskal-Wallis Multiple Comparisons, see dunnTest
function in FSA
package
Wilcoxon Rank Sum and Signed Rank Tests for all paired groups
Student's t-Test for all paired groups
...
parameters passed to cal_diff
function of trans_alpha
class of microeco
package.
res_diff
in object. See the Return of cal_diff
function in trans_alpha
class of microeco
package.
\donttest{ t1$cal_diff(method = "wilcox") }
plot()
Plot the result.
cohesionclass$plot(measure = "c_pos", ...)
measure
default "c_pos"; "c_pos" or "c_neg" in the res_list$sample
; "r_pos" or "r_neg" in the res_list$feature
.
...
parameters pass to plot_alpha
function of trans_alpha
class of microeco
package.
ggplot
.
\donttest{ t1$plot(boxplot_add = "none", add_sig = TRUE) }
clone()
The objects of this class are cloneable with this method.
cohesionclass$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.