Extract edges in graph involving any module in object_of_interest set
prev_for_selected_nodes.RdExtract edges in graph involving any module in object_of_interest set
Usage
prev_for_selected_nodes(
data_with_annotation,
graph_file,
col_module_id,
annotation_level,
object_of_interest = NULL
)Arguments
- data_with_annotation
Dataframe. The abundance table merged with the module names. Required format: modules are the rows and samples are the columns. The first column must be the modules name (e.g. species), the second is the module ID (e.g. msp), and each subsequent column is a sample
- graph_file
Dataframe. The object generated by graph_step() function
- col_module_id
String. The name of the column with the module names in annotation_table
- annotation_level
String. The name of the column with the level to be studied. Examples: species, genus, level_1
- object_of_interest
String. The name of the bacteria or species of interest or a key word in the functional module definition
Value
Dataframe. The dataframe of edges in the graph involving modules corresponding to object_of_interest and their corresponding prevalences.
Examples
tiny_data <- data.frame(
species = c("One bacteria", "One bacterium L", "One bacterium G", "Two bact"),
msp_name = c("msp_1", "msp_2", "msp_3", "msp_4"),
SAMPLE1 = c(0, 1.328425e-06, 0, 1.527688e-07),
SAMPLE2 = c(1.251707e-07, 1.251707e-07, 3.985320e-07, 0),
SAMPLE3 = c(0, 0, 4.926046e-09, 5.626392e-06),
SAMPLE4 = c(0, 0, 2.98320e-05, 0)
)
tiny_graph <- graph_step(tiny_data, col_module_id = "msp_name", annotation_level = "species", seed = 20242025) %>% suppressWarnings()
tiny_truth <- prev_for_selected_nodes(tiny_data, tiny_graph, col_module_id = "msp_name", annotation_level = "species", object_of_interest = "bacterium")