Title: | Identifying Significant Node Scores using Network Diffusion Algorithm |
---|---|
Description: | Designed for network analysis, leveraging the personalized PageRank algorithm to calculate node scores in a given graph. This innovative approach allows users to uncover the importance of nodes based on a customized perspective, making it particularly useful in fields like bioinformatics, social network analysis, and more. |
Authors: | Farzaneh Firoozbakht [aut, cre, cph] |
Maintainer: | Farzaneh Firoozbakht <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.2 |
Built: | 2024-10-31 16:33:13 UTC |
Source: | https://github.com/cran/DiffNet |
Calculation of diffusion score for each node
actual_score(graph, initial.score, damping = 0.7)
actual_score(graph, initial.score, damping = 0.7)
graph |
an igraph object with the length of N |
initial.score |
a named vector of node preferences of length N served as the initial values for diffusion algorithm. |
damping |
The damping factor of the diffusion algorithm. |
This function calculates the diffusion score for each node using the personalized page rank algorithm.
a vector of diffusion scores.
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Actual_score = actual_score(graph = graph, initial.score = initial_score, damping = 0.7)
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Actual_score = actual_score(graph = graph, initial.score = initial_score, damping = 0.7)
dummy graph generation
graph_generation(n.nodes = 10, prob.connection = 0.5)
graph_generation(n.nodes = 10, prob.connection = 0.5)
n.nodes |
number of nodes |
prob.connection |
node connection probability (default=0.5) |
Generate a random graph
igraph object
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph)
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph)
Correction for multiple testing
multiple_testing_correction(p.values, method = "BH")
multiple_testing_correction(p.values, method = "BH")
p.values |
a vector of p.values |
method |
method of correction: c( |
Correction for multiple testing
vector of q-values
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Actual_score = actual_score(graph = graph, initial.score = initial_score, damping = 0.7) Null_score = null_score(graph = graph, initial.score = initial_score, damping = 0.7, N.repeat = 10) pvalue = pval(actual.scores = Actual_score, null.scores = Null_score, method = "non_parametric") adj_nodes = multiple_testing_correction(pvalue)
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Actual_score = actual_score(graph = graph, initial.score = initial_score, damping = 0.7) Null_score = null_score(graph = graph, initial.score = initial_score, damping = 0.7, N.repeat = 10) pvalue = pval(actual.scores = Actual_score, null.scores = Null_score, method = "non_parametric") adj_nodes = multiple_testing_correction(pvalue)
Calculation of diffusion null scores for each node
null_score(graph, initial.score, damping = 0.7, N.repeat = 10, n.cores = 1)
null_score(graph, initial.score, damping = 0.7, N.repeat = 10, n.cores = 1)
graph |
an igraph object with the length of N |
initial.score |
a named vector of node preferences of length N served as the initial values for diffusion algorithm. |
damping |
The damping factor of the diffusion algorithm. |
N.repeat |
number of permutation repeats of null scores. |
n.cores |
number of cores for parallel processing. |
This function calculates the null diffusion score for each node using the personalized page rank algorithm.
The initial values are obtained by permuting the given initial.score
a matrix of null diffusion scores (N.repeat
—BY—number_of_nodes).
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Null = null_score(graph, initial_score)
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Null = null_score(graph, initial_score)
Calculation of p-values for each score with respect to the null.
pval(actual.scores, null.scores, method = "exponential")
pval(actual.scores, null.scores, method = "exponential")
actual.scores |
a vector including actual scores with the length of number of nodes (N_nodes). |
null.scores |
a matrix of null scores with the dimension of N_nodes x N_repeat |
method |
statistical test method: c( |
Calculate the p-value for each node based on the actual and null diffusion scores.
vector of p-values
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Actual_score = actual_score(graph = graph, initial.score = initial_score, damping = 0.7) Null_score = null_score(graph = graph, initial.score = initial_score, damping = 0.7, N.repeat = 10) pvalue = pval(actual.scores = Actual_score, null.scores = Null_score, method = "exponential")
graph = graph_generation(n.nodes = 10, prob.connection = 0.5) initial_score = c(rep(0,5),0.2, 0.3, 0, 0, 0.5) names(initial_score) = igraph::V(graph) Actual_score = actual_score(graph = graph, initial.score = initial_score, damping = 0.7) Null_score = null_score(graph = graph, initial.score = initial_score, damping = 0.7, N.repeat = 10) pvalue = pval(actual.scores = Actual_score, null.scores = Null_score, method = "exponential")