The computeReactionActivity
function computes and assigns reaction activity values to edges in an input graph based on the provided gene expression counts data. This function facilitates the computation of reaction activities and incorporates these values as edge attributes within the graph.
Usage
computeReactionActivity(
igraph,
counts,
gene_column = "symbol",
attr_name = "edge_sum",
output_graph = FALSE,
rowname_column = "miriam.kegg.reaction"
)
Arguments
- igraph
An igraph object representing the graph to which reaction activity values should be assigned.
- counts
A numeric matrix or data frame containing gene expression counts data. Each column represents a sample, and each row corresponds to a gene.
- gene_column
A character string specifying the name of the edge attribute in the graph that contains gene identifiers. Defaults to "symbol".
- attr_name
A character string specifying the name of the edge attribute to which the computed reaction activity values should be assigned. Defaults to "edge_sum".
- output_graph
A logical value indicating whether the function should return the modified graph with assigned edge attributes (TRUE) or a data frame of computed reaction activities (FALSE). Defaults to FALSE.
- rowname_column
TODOTODO
Value
If output_graph
is TRUE, returns a list of modified igraph objects with assigned reaction activity edge attributes for each sample. If output_graph
is FALSE, returns a data frame containing computed reaction activity values for each sample and reaction.
Note
The function assumes that the input graph has edge attributes containing gene identifiers (default column name: "symbol"), and the counts matrix or data frame contains numeric expression counts for those genes. The function uses the igraph package for working with graphs and edge attributes.
Examples
# Create a sample igraph object
library(igraph)
g <- make_ring(10)
E(g)$symbol <- sample(letters, 10, replace = TRUE)
# Create a sample counts matrix
counts <- matrix(runif(260), nrow = 26, dimnames = list(letters, paste0("Sample", 1:10)))
# Compute reaction activity values and modify the graph
g_with_activity <- computeReactionActivity(g, counts, output_graph = TRUE)
# Compute reaction activity values and get as a data frame
reaction_activity_df <- computeReactionActivity(g, counts, output_graph = FALSE)