compute_GO_child_term_metrics {GeneSelectR} | R Documentation |
Retrieve and Plot the Offspring Nodes of GO Terms
Description
This function retrieves the children nodes for a set of Gene Ontology (GO) terms from a list of GO terms and can plot the offspring nodes' numbers and fractions for each term.
Usage
compute_GO_child_term_metrics(GO_data, GO_terms, ontology = "BP", plot = FALSE)
Arguments
GO_data |
A list of GO data where each element corresponds to a different feature list. Each element should have a @result data frame with a column 'ID' containing GO terms. |
GO_terms |
A character vector containing GO term IDs for which offspring nodes are to be fetched. |
ontology |
A character string specifying the type of ontology to be considered. Can be one of 'BP' (Biological Process), 'MF' (Molecular Function), or 'CC' (Cellular Component). Default is 'BP'. |
plot |
A logical. If TRUE, the function plots the number and fraction of offspring nodes
for each term in |
Value
A data frame with columns:
-
feature_list - The names of the feature lists from
GO_data
. -
all_terms_number - The total number of GO terms in each feature list.
-
offspring_nodes_number - The number of offspring nodes for the given GO term(s) in each feature list.
-
offspring_terms - The actual offspring terms for the given GO term(s) in each feature list, concatenated by ';'.
-
fraction - The fraction (percentage) of offspring nodes out of all terms in each feature list.
-
GO_term - The GO term being considered.
Examples
# Mock GO terms data frame
all_selection.GO_inbuilt <- data.frame(
GO_ID = c("GO:0002376", "GO:0008150", "GO:0006955", "GO:0009628"),
Description = c("immune system process",
"biological_process",
"immune response",
"response to virus"),
Parent_GO_ID = c(NA, NA, "GO:0002376", "GO:0006955"), # Simplified parent-child
stringsAsFactors = FALSE
)
# Mock vector of GO terms to compute metrics for
GO_terms_vec <- c("GO:0002376", "GO:0008150")
# Assuming compute_GO_child_term_metrics is defined and available
# df_res <- compute_GO_child_term_metrics(GO_data = all_selection.GO_inbuilt,
# GO_terms = GO_terms_vec,
# plot = TRUE)