edge_node_distance | R Documentation |
This class is a wrapper for a series of analysis on the distance values of paired nodes in edges across networks, including distance matrix conversion, the differential test and the visualization.
new()
edge_node_distance$new( network_list, dis_matrix = NULL, label = "+", with_module = FALSE, module_thres = 2 )
network_list
a list with multiple networks; all the networks should be trans_network
object
created from trans_network
class of microeco
package.
dis_matrix
default NULL; the distance matrix of nodes, used for the value extraction; must be a symmetrical matrix with both colnames and rownames (i.e. feature names).
label
default "+"; "+" or "-" or c("+", "-")
; the edge label used for the selection of edges.
with_module
default FALSE; whether show the module classification of nodes in the result.
module_thres
default 2; the threshold of the nodes number of modules remained when with_module = TRUE
.
data_table
, stored in the object
\donttest{ data(soil_amp_network) data(soil_amp) # filter useless features to speed up the calculation node_names <- unique(unlist(lapply(soil_amp_network, function(x){colnames(x$data_abund)}))) filter_soil_amp <- microeco::clone(soil_amp) filter_soil_amp$otu_table <- filter_soil_amp$otu_table[node_names, ] filter_soil_amp$tidy_dataset() # obtain phylogenetic distance matrix phylogenetic_distance <- as.matrix(cophenetic(filter_soil_amp$phylo_tree)) # choose the positive labels t1 <- edge_node_distance$new(network_list = soil_amp_network, dis_matrix = phylogenetic_distance, label = "+") }
cal_diff()
Differential test across networks.
edge_node_distance$cal_diff( method = c("anova", "KW", "KW_dunn", "wilcox", "t.test")[1], ... )
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 distance.
edge_node_distance$plot(...)
...
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.
edge_node_distance$clone(deep = FALSE)
deep
Whether to make a deep clone.
## ------------------------------------------------
## Method `edge_node_distance$new`
## ------------------------------------------------
data(soil_amp_network)
data(soil_amp)
# filter useless features to speed up the calculation
node_names <- unique(unlist(lapply(soil_amp_network, function(x){colnames(x$data_abund)})))
filter_soil_amp <- microeco::clone(soil_amp)
filter_soil_amp$otu_table <- filter_soil_amp$otu_table[node_names, ]
filter_soil_amp$tidy_dataset()
# obtain phylogenetic distance matrix
phylogenetic_distance <- as.matrix(cophenetic(filter_soil_amp$phylo_tree))
# choose the positive labels
t1 <- edge_node_distance$new(network_list = soil_amp_network,
dis_matrix = phylogenetic_distance, label = "+")
## ------------------------------------------------
## Method `edge_node_distance$cal_diff`
## ------------------------------------------------
t1$cal_diff(method = "wilcox")
## ------------------------------------------------
## Method `edge_node_distance$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.