edge_node_distance {meconetcomp} | R Documentation |
Perform the distance distribution of paired nodes in edges across networks.
Description
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.
Methods
Public methods
Method new()
Usage
edge_node_distance$new( network_list, dis_matrix = NULL, label = "+", with_module = FALSE, module_thres = 2 )
Arguments
network_list
a list with multiple networks; all the networks should be
trans_network
object created fromtrans_network
class ofmicroeco
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
.
Returns
data_table
, stored in the object
Examples
\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 = "+") }
Method cal_diff()
Differential test across networks.
Usage
edge_node_distance$cal_diff( method = c("anova", "KW", "KW_dunn", "wilcox", "t.test")[1], ... )
Arguments
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 distance.
Usage
edge_node_distance$plot(...)
Arguments
...
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
edge_node_distance$clone(deep = FALSE)
Arguments
deep
Whether to make a deep clone.
Examples
## ------------------------------------------------
## 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)