| 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_lista list with multiple networks; all the networks should be
trans_networkobject created fromtrans_networkclass ofmicroecopackage.dis_matrixdefault 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).
labeldefault "+"; "+" or "-" or
c("+", "-"); the edge label used for the selection of edges.with_moduledefault FALSE; whether show the module classification of nodes in the result.
module_thresdefault 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
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 distance.
Usage
edge_node_distance$plot(...)
Arguments
...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
edge_node_distance$clone(deep = FALSE)
Arguments
deepWhether 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)