reshape_results {mulea}R Documentation

Reshape Results

Description

This function takes a model and model_results data, reshapes them into a suitable format for plotting, and returns the resulting data frame, which can be used for further analysis or visualization.

Usage

reshape_results(
  model = NULL,
  model_results = NULL,
  model_ontology_col_name = "ontology_id",
  ontology_id_colname = "ontology_id",
  p_value_type_colname = "eFDR",
  p_value_max_threshold = TRUE
)

Arguments

model

a mulea model, created by the ora or the gsea functions.

model_results

Result data.frame returned by the run_test function.

model_ontology_col_name

Character, specifies the column name in the model that contains ontology IDs. It defines which column in the model should be used for matching ontology IDs. Possible values are 'ontology_id' and 'ontology_name'. The default value is 'ontology_id'.

ontology_id_colname

Character, specifies the column name for ontology IDs in the model results. It indicates which column in the model results contains ontology IDs for merging. Possible values are 'ontology_id' and 'ontology_name'. The default value is 'ontology_id'.

p_value_type_colname

Character, specifies the column name for the type or raw or adjusted p-value in the result data.frame returned by the run_test function. The default value is 'eFDR'.

p_value_max_threshold

Logical, indicating whether to apply a p-value threshold when filtering the resulting data. If TRUE, the function filters the data based on a p-value threshold.

Value

Return detailed and relaxed data.table where model and results are merged for plotting purposes.

See Also

plot_graph, plot_barplot, plot_heatmap

Examples

library(mulea)

# loading and filtering the example ontology from a GMT file
tf_gmt <- read_gmt(file = system.file(package="mulea", "extdata", 
    "Transcription_factor_RegulonDB_Escherichia_coli_GeneSymbol.gmt"))
tf_gmt_filtered <- filter_ontology(gmt = tf_gmt, min_nr_of_elements = 3, 
    max_nr_of_elements = 400)

# loading the example data
sign_genes <- readLines(system.file(
    package = "mulea", "extdata", "target_set.txt"))
background_genes <- readLines(
    system.file(package="mulea", "extdata", "background_set.txt"))

# creating the ORA model
ora_model <- ora(gmt = tf_gmt_filtered,
    # the test set variable
    element_names = sign_genes, 
    # the background set variable
    background_element_names = background_genes, 
    # the p-value adjustment method
    p_value_adjustment_method = "eFDR", 
    # the number of permutations
    number_of_permutations = 10000,
    # the number of processor threads to use
    nthreads = 2)
# running the ORA
ora_results <- run_test(ora_model)

# reshaping results for visualisation
ora_reshaped_results <- reshape_results(model = ora_model,
    model_results = ora_results,
    # choosing which column to use for the indication of significance
    p_value_type_colname = "eFDR")

[Package mulea version 1.0.1 Index]