reference
Functions
This page lists the key functions in EV-Net.
::: {.cell}
::: {.cell-output .cell-output-stdout}
```
# infer_supporting_datasources
```
:::
::: {.cell-output .cell-output-stdout}
Get the data sources that support the specific interactions in the extracted EV_cargo-target signaling subnetwork
Description
infer_supporting_datasources Get the data sources that support the specific interactions in the extracted EV_cargo-target signaling subnetwork
Usage
infer_supporting_datasources(signaling_graph_list,lr_network, sig_network, gr_network)Arguments
signaling_graph_list: A list of two elements: sig: a data frame/ tibble containg weighted EV_cargo-receptor and signaling interactions (from, to, weight); and gr: a data frame/tibble containng weighted gene regulatory interactions (from, to, weight)lr_network: A data frame / tibble containing ligand-receptor interactions (required columns: from, to, source)sig_network: A data frame / tibble containing signaling interactions (required columns: from, to, source)gr_network: A data frame / tibble containing gene regulatory interactions (required columns: from, to, source)source_weights_df: A data frame / tibble containing the weights associated to each individual data source. Sources with higher weights will contribute more to the final model performance (required columns: source, weight). Note that only interactions described by sources included here, will be retained during model construction.n_output_networks: The number of output networks to return: 2 (ligand-signaling and gene regulatory; default) or 3 (ligand-receptor, signaling and gene regulatory).
Value
A tibble with columns from, to, source and layer
Examples
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
EV_cargo = list("TNF","BMP2",c("IL4","IL13"))
EV_cargo_tf_matrix = construct_EV_cargo_tf_matrix(weighted_networks, EV_cargo, ltf_cutoff = 0.99, algorithm = "PPR", damping_factor = 0.5,EV_cargo_as_cols = TRUE)
all_EV_cargo = c("BMP2")
all_targets = c("HEY1")
top_n_regulators = 2
EV_cargo_target_signaling_list = get_EV_cargo_signaling_path(EV_cargo_tf_matrix,all_EV_cargo,all_targets,top_n_regulators,weighted_networks)
data_source_info_network = infer_supporting_datasources(EV_cargo_target_signaling_list, lr_network, sig_network, gr_network)make_heatmap_ggplot
:::
::: {.cell-output .cell-output-stdout}
Make a ggplot heatmap object from an input matrix (2-color).
Description
make_heatmap_ggplot Make a ggplot heatmap object from an input matrix containing continuous values. Two-color scale from white to color of choice.
Usage
make_heatmap_ggplot(matrix, y_name, x_name, y_axis = TRUE,x_axis = TRUE, x_axis_position = "top", legend_position = "top", color = "blue", legend_title = "score",...)Arguments
matrix: Matrix with continuous values to plot in heatmapy_name: Title of the y-axisx_name: Title of the x-axisy_axis: Should y-axis label names and titles be displayed? TRUE or FALSE. Default: TRUE.x_axis: Should x-axis label names and titles be displayed? TRUE or FALSE. Default: TRUE.x_axis_position: X-axis position: “top” or “bottomm”; only relevant if x_axis == TRUE. Default:“top”.legend_position: Legend position: “top”, “bottom”, “left”, “right” or “none”. Default: “top”.color: Color for highest continuous value in heatmap. Color gradient will go from “whitesmoke” to this color. Default: “blue”.legend_title: Title of the legend....: Optional arguments passed to element_text(); used to set font type and size of axis labels and titles.
Value
A ggplot object displaying a heatmap
Examples
library(dplyr)
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
EV_cargo = list("TNF","BMP2",c("IL4","IL13"))
EV_cargo_target_matrix = construct_EV_cargo_target_matrix(weighted_networks, EV_cargo, ltf_cutoff = 0.99, algorithm = "PPR", damping_factor = 0.5,EV_cargo_as_cols = TRUE)
p = make_heatmap_ggplot(EV_cargo_target_matrix[1:50,] %>% t(), y_name = "EV_cargo", x_name = "target")diagrammer_format_signaling_graph
:::
::: {.cell-output .cell-output-stdout}
Prepare extracted EV_cargo-target signaling network for visualization with DiagrammeR.
Description
diagrammer_format_signaling_graph Prepare extracted EV_cargo-target signaling network for visualization with DiagrammeR.
Usage
diagrammer_format_signaling_graph(signaling_graph_list, EV_cargo_all,targets_all, sig_color = "steelblue", gr_color = "orange")Arguments
signaling_graph_list: A list of two elements: sig: a data frame/ tibble containg weighted EV_cargo-receptor and signaling interactions (from, to, weight); and gr: a data frame/tibble containng weighted gene regulatory interactions (from, to, weight)EV_cargo_all: A character vector of one or more EV_cargo of interesttargets_all: A character vector of one or more target genes of interestsig_color: The color for EV_cargo-signaling edges and the EV_cargo node. Default: steelblue.gr_color: The color for the gene regulatory edges and the target node. Default: orange.
Value
A DiagrammeR Graph object ready for visualization via DiagrammeR::render_graph.
Examples
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
EV_cargo = list("TNF","BMP2",c("IL4","IL13"))
EV_cargo_tf_matrix = construct_EV_cargo_tf_matrix(weighted_networks, EV_cargo, ltf_cutoff = 0.99, algorithm = "PPR", damping_factor = 0.5,EV_cargo_as_cols = TRUE)
all_EV_cargo = c("BMP2")
all_targets = c("HEY1")
top_n_regulators = 2
EV_cargo_target_signaling_list = get_EV_cargo_signaling_path(EV_cargo_tf_matrix,all_EV_cargo,all_targets,top_n_regulators,weighted_networks)
graph = diagrammer_format_signaling_graph(EV_cargo_target_signaling_list, all_EV_cargo,all_targets)
# DiagrammeR::render_graph(graph, layout = "tree")get_EV_cargo_signaling_path
:::
::: {.cell-output .cell-output-stdout}
Get EV_cargo-target signaling paths between EV_cargo(s) and target gene(s) of interest
Description
get_EV_cargo_signaling_path Extract possible signaling paths between a EV_cargo and target gene of interest. The most highly weighted path(s) will be extracted.
Usage
get_EV_cargo_signaling_path(EV_cargo_tf_matrix, EV_cargo_all, targets_all, top_n_regulators = 4, weighted_networks, EV_cargo_position = "cols")Arguments
EV_cargo_tf_matrix: A matrix of EV_cargo-regulator probability scoresEV_cargo_all: A character vector of one or more EV_cargo of interesttargets_all: A character vector of one or more target genes of interesttop_n_regulators: The number of top regulators that should be included in the EV_cargo-target signaling network. Top regulators are regulators that score both high for being upstream of the target gene(s) and high for being downstream of the EV_cargo. Default: 4.weighted_networks: A list of two elements: lr_sig: a data frame/ tibble containg weighted EV_cargo-receptor and signaling interactions (from, to, weight); and gr: a data frame/tibble containng weighted gene regulatory interactions (from, to, weight)EV_cargo_position: Indicate whether the EV_cargo in the EV_cargo-target matrix are in the rows (“rows”) or columns (“cols”). Default: “cols”.minmax_scaling: Indicate whether the weights of both dataframes should be min-max scaled between 0.75 and 1. Default: FALSE.
Value
A list containing 2 elements (sig and gr): the integrated weighted EV_cargo-signaling and gene regulatory networks data frame / tibble format with columns: from, to, weight
Examples
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
EV_cargo = list("TNF","BMP2",c("IL4","IL13"))
EV_cargo_tf_matrix = construct_EV_cargo_tf_matrix(weighted_networks, EV_cargo, ltf_cutoff = 0.99, algorithm = "PPR", damping_factor = 0.5,EV_cargo_as_cols = TRUE)
all_EV_cargo = c("BMP2")
all_targets = c("HEY1")
top_n_regulators = 2
EV_cargo_target_signaling_list = get_EV_cargo_signaling_path(EV_cargo_tf_matrix,all_EV_cargo,all_targets,top_n_regulators,weighted_networks)predict_EV_cargo_activities
:::
::: {.cell-output .cell-output-stdout}
Predict activities of EV_cargo in regulating expression of a gene set of interest
Description
predict_EV_cargo_activities Predict activities of EV_cargo in regulating expression of a gene set of interest. Ligand activities are defined as how well they predict the observed transcriptional response (i.e. gene set) according to the NicheNet model.
Usage
predict_EV_cargo_activities(geneset, background_expressed_genes,EV_cargo_target_matrix, potential_EV_cargo, single = TRUE,...)Arguments
geneset: Character vector of the gene symbols of genes of which the expression is potentially affected by EV_cargo from the interacting cell.background_expressed_genes: Character vector of gene symbols of the background, non-affected, genes (can contain the symbols of the affected genes as well).EV_cargo_target_matrix: The NicheNet EV_cargo-target matrix denoting regulatory potential scores between EV_cargo and targets (EV_cargo in columns).potential_EV_cargo: Character vector giving the gene symbols of the potentially active EV_cargo you want to define EV_cargo activities for.single: TRUE if you want to calculate EV_cargo activity scores by considering every EV_cargo individually (recommended). FALSE if you want to calculate EV_cargo activity scores as variable importances of a multi-EV_cargo classification model....: Additional parameters for get_multi_EV_cargo_importances if single = FALSE.
Value
A tibble giving several EV_cargo activity scores. Following columns in the tibble: $test_EV_cargo, $auroc, $aupr and $pearson.
Examples
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
EV_cargo = list("TNF","BMP2","IL4")
EV_cargo_target_matrix = construct_EV_cargo_target_matrix(weighted_networks, EV_cargo, ltf_cutoff = 0, algorithm = "PPR", damping_factor = 0.5, secondary_targets = FALSE)
potential_EV_cargo = c("TNF","BMP2","IL4")
geneset = c("SOCS2","SOCS3", "IRF1")
background_expressed_genes = c("SOCS2","SOCS3","IRF1","ICAM1","ID1","ID2","ID3")
EV_cargo_activities = predict_EV_cargo_activities(geneset = geneset, background_expressed_genes = background_expressed_genes, EV_cargo_target_matrix = EV_cargo_target_matrix, potential_EV_cargo = potential_EV_cargo)prepare_EV_cargo_target_visualization
:::
::: {.cell-output .cell-output-stdout}
Prepare heatmap visualization of the EV_cargo-target links starting from a EV_cargo-target tibble.
Description
prepare_EV_cargo_target_visualization Prepare heatmap visualization of the EV_cargo-target links starting from a EV_cargo-target tibble. Get regulatory potential scores between all pairs of EV_cargo and targets documented in this tibble. For better visualization, we propose to define a quantile cutoff on the EV_cargo-target scores.
Usage
prepare_EV_cargo_target_visualization(EV_cargo_target_df, EV_cargo_target_matrix, cutoff = 0.25)Arguments
EV_cargo_target_df: Tibble with columns ‘EV_cargo’, ‘target’ and ‘weight’ to indicate EV_cargo-target regulatory potential scores of interest.EV_cargo_target_matrix: The NicheNet EV_cargo-target matrix denoting regulatory potential scores between EV_cargo and targets (EV_cargo in columns).cutoff: Quantile cutoff on the EV_cargo-target scores of the input weighted EV_cargo-target network. Scores under this cutoff will be set to 0.
Value
A matrix giving the EV_cargo-target regulatory potential scores between EV_cargo of interest and their targets genes part of the gene set of interest.
Examples
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
EV_cargo = list("TNF","BMP2","IL4")
EV_cargo_target_matrix = construct_EV_cargo_target_matrix(weighted_networks, EV_cargo, ltf_cutoff = 0, algorithm = "PPR", damping_factor = 0.5, secondary_targets = FALSE)
geneset = c("SOCS2","SOCS3", "IRF1")
background_expressed_genes = c("SOCS2","SOCS3","IRF1","ICAM1","ID1","ID2","ID3")
active_EV_cargo_target_links_df = potential_EV_cargo %>% lapply(get_weighted_EV_cargo_target_links, geneset = geneset, EV_cargo_target_matrix = EV_cargo_target_matrix, n = 250) %>% bind_rows()
active_EV_cargo_target_links = prepare_EV_cargo_target_visualization(EV_cargo_target_df = active_EV_cargo_target_links_df, EV_cargo_target_matrix = EV_cargo_target_matrix, cutoff = 0.25)get_weighted_EV_cargo_target_links
:::
::: {.cell-output .cell-output-stdout}
Infer weighted active EV_cargo-target links between a possible EV_cargo and target genes of interest
Description
get_weighted_EV_cargo_target_links Infer active EV_cargo target links between possible EV_cargo and genes belonging to a gene set of interest: consider the intersect between the top n targets of a EV_cargo and the gene set.
Usage
get_weighted_EV_cargo_target_links(EV_cargo, geneset,EV_cargo_target_matrix,n = 250)Arguments
EV_cargo: Character vector giving the gene symbols of the potentially active EV_cargo for which you want to find target genes.geneset: Character vector of the gene symbols of genes of which the expression is potentially affected by EV_cargo from the interacting cell.EV_cargo_target_matrix: The NicheNet EV_cargo-target matrix denoting regulatory potential scores between EV_cargo and targets (EV_cargo in columns).n: The top n of targets per EV_cargo that will be considered. Default: 250.
Value
A tibble with columns EV_cargo, target and weight (i.e. regulatory potential score).
Examples
weighted_networks = construct_weighted_networks(lr_network, sig_network, gr_network,source_weights_df)
EV_cargo = list("TNF","BMP2","IL4")
EV_cargo_target_matrix = construct_EV_cargo_target_matrix(weighted_networks, EV_cargo, ltf_cutoff = 0, algorithm = "PPR", damping_factor = 0.5, secondary_targets = FALSE)
potential_EV_cargo = "TNF"
geneset = c("SOCS2","SOCS3", "IRF1")
active_EV_cargo_target_links_df = get_weighted_EV_cargo_target_links(EV_cargo = potential_EV_cargo, geneset = geneset, EV_cargo_target_matrix = EV_cargo_target_matrix, n = 250)
:::
:::