Reverse network diffusion to remove indirect noise for better inference of gene regulatory networks.
You can install the development version of RENDOR like so:
devtools::install_github("Wu-Lab/RENDOR")
This is a basic example which shows you how to solve a common problem:
library(RENDOR)
mat <- matrix(runif(100), nrow = 10)
m <- 5
denoised_network <- RENDOR(mat, m)
Here is a more comprehensive example using the load_example_data
function, which includes example data from the paper:
library(ggplot2)
library(RENDOR)
library(igraph)
# Load example data
example_A <- load_example_data()
# Original graph
g1 <- graph_from_adjacency_matrix(example_A$True_net, mode = 'undirected')
e1 <- length(E(g1))
E(g1)$color <- 'black'
plot(
g1,
edge.width = 2,
vertex.color = "#56B4E9",
main = 'Original Graph',
vertex.label.cex = 0.8,
vertex.size = 20,
layout = layout_in_circle(g1)
)
# Noisy graph
g2 <- graph_from_adjacency_matrix(example_A$Noisy_net, mode = 'undirected')
g2 <- g1 + edge(c(t(as_edgelist(g2 - g1))), color = '#EE2C2C')
plot(
g2,
edge.width = 2,
vertex.color = "#56B4E9",
main = 'Noisy Graph',
vertex.label.cex = 0.8,
vertex.size = 20,
layout = layout_in_circle(g2)
)
# RENDOR denoising
w_out <- RENDOR(example_A$Noisy_net, 3, 1, 1)
A_out <- change_into_adj_keep_edges(w_out, e1)
g3 <- graph_from_adjacency_matrix(A_out, mode = 'undirected')
E(g3)$color <- 'black'
e3 <- length(E(g3))
g3 <- g1 - (g1 - g3) + edge(c(t(as_edgelist(g3 - g1))), color = '#EE2C2C')
plot(
g3,
edge.width = 2,
vertex.color = "#56B4E9",
main = 'RENDOR Denoised Graph',
vertex.label.cex = 0.8,
vertex.size = 20,
layout = layout_in_circle(g3)
)