Description Usage Arguments Value Examples
View source: R/to_adjacency_matrix.R
Convert a data frame containing pairwise interactions into an adjacency matrix. The resulting square adjacency matrix contains ones for interacting proteins and zeroes for non-interacting proteins.
1 | to_adjacency_matrix(dat, symmetric = TRUE, node_columns = c(1, 2))
|
dat |
a data frame containing pairwise interactions |
symmetric |
if true, interactions in both directions will be added to the adjacency matrix |
node_columns |
a vector of length two, denoting either the indices
(integer vector) or column names (character vector) of the columns within
the data frame containing the nodes participating in pairwise interactions;
defaults to the first two columns of the data frame ( |
an adjacency matrix between all interacting proteins
1 2 3 4 | ppi = data.frame(protein_A = paste0("protein", seq_len(10)),
protein_B = paste0("protein", c(rep(3, 2), rep(5, 5),
rep(7, 3))), stringsAsFactors = FALSE)
adj = to_adjacency_matrix(ppi)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.