In [ ]:
suppressPackageStartupMessages(library(sna))
library(readr)
suppressPackageStartupMessages(library(igraph))
suppressPackageStartupMessages(library(expm))
suppressPackageStartupMessages(library(ProNet))
In [104]:
test_adjmat <- read.dot("testr.dot")
test_adjmat <- test_adjmat + t(test_adjmat)
test_igraph <- igraph::graph_from_adjacency_matrix(test_adjmat, mode="undirected")
summary(test_igraph)
In [105]:
plot(test_igraph)
Run ProNet::mcode on your test graph with the default parameters; what cluster sizes do you get back?
In [106]:
ProNet::mcode(test_igraph)
Load the Krogan et al. network edge-list as a dataframe
In [129]:
edge_list_df <- unique(readr::read_tsv("krogan.sif",
col_names=c("protein1","protein2"),
col_types=cols()))
head(edge_list_df)
Make an igraph graph out of your edge-list data frame (undirected); print a summary
In [130]:
big_graph <- igraph::graph_from_data_frame(edge_list_df, directed=FALSE)
summary(big_graph)
Plot the degree distribution of your graph, on log-log scale
In [131]:
suppressWarnings(plot(degree_distribution(big_graph), log="xy", xlab="k", ylab="Pk"))
Run ProNet::mcode on your graph, with vwp=0.2 and fdt=0.1; print out the cluster sizes that you get bakc
In [136]:
res <- ProNet::mcode(big_graph, haircut=TRUE, fluff=TRUE, vwp=0.2, fdt=0.1)
s_vals <- sapply(res$COMPLEX, length)
sort(s_vals, decreasing=TRUE)
Print a histogram of log N(S) vs. log cluster size S.
In [161]:
s_bins <- (0:15)*80/15
hist_res <- hist(s_vals[-1],breaks=s_bins, plot=FALSE)
plot(hist_res$mids, hist_res$counts, log="y", xlab="numprot", ylab="Nclust(numprot)")