View source: R/prioritise_targets_network.R
prioritise_targets_network | R Documentation |
Plot the output of prioritise_targets
as an interactive network with visNetwork.
See layout for a list of all layout functions
that can be passed to the prioritise_targets_network(layout=)
argument
as a string (e.g. "layout.fruchterman.reingold" or "layout_as_tree").
See here for some visualized
examples of each layout.
prioritise_targets_network(
top_targets,
vertex_vars = c("disease_name", "hpo_name", "cl_name", "gene_symbol"),
group_var = vertex_vars[[1]],
agg_fun = mean,
colour_var = "node_type",
edge_color_var = "estimate",
edge_size_var = edge_color_var,
node_opacity = 0.75,
edge_opacity = 0.5,
mediator_var = list(c(1, 2), c(2, 3), c(3, 4), c(1, 3)),
layout = "layout_with_sugiyama",
solver = "forceAtlas2Based",
physics = FALSE,
forceAtlas2Based = list(avoidOverlap = 0.5, gravitationalConstant = -50),
scaling = NULL,
arrows = "from",
smooth = list(enabled = TRUE, type = "cubicBezier", roundness = 0.5),
add_visExport = FALSE,
degree = 1,
width = "100%",
height = "100vh",
main = "Rare Disease Celltyping",
submain = "Prioritised Targets Network",
preferred_palettes = "kovesi.linear_bmy_10_95_c78",
randomSeed = 2023,
verbose = TRUE,
show_plot = TRUE,
save_path = tempfile(fileext = "_prioritise_targets_network.html"),
run_prune_ancestors = FALSE
)
top_targets |
output of prioritise_targets. |
vertex_vars |
Columns within |
group_var |
Variable to group nodes by. |
agg_fun |
Function to aggregate edge values with when there are multiple edges between a given pair of nodes. |
colour_var |
Column to color nodes by. |
edge_color_var |
Variable to color edges by. |
edge_size_var |
Variable to scale edges by. |
node_opacity |
Node opacity. |
edge_opacity |
Edge opacity. |
mediator_var |
Variable to connect cell types and phenotypes by
(i.e. "gene_symbol").
If |
layout |
: Character Name of igraph layout function to use. Default to "layout_nicely" |
solver |
: String. Default to 'barnesHut'. You can select your own solver. Possible options: 'barnesHut', 'repulsion', 'hierarchicalRepulsion', 'forceAtlas2Based'. When setting the hierarchical layout, the hierarchical repulsion solver is automaticaly selected, regardless of what you fill in here. |
physics |
: Boolean. Default to FALSE. Enabled physics on nodes ? |
forceAtlas2Based |
named list of options
|
scaling |
: Named list. If the value option is specified, the size of the nodes will be scaled according to the properties in this object.
|
arrows |
: Named list or String. To draw an arrow with default settings a string can be supplied. For example: 'to, from,middle' or 'to;from', any combination with any seperating symbol is fine. If you want to control the size of the arrowheads, you can supply an object. See visDocumentation |
smooth |
: Boolean. Default to FALSE. Use smooth edges ? |
add_visExport |
Add PDF download button. |
degree |
of depth of nodes to be colored. Default to 1. Set high number to have the entire sub-network. In case of "hierarchical" algorithm, you can also pass a list(from = 1, to = 1) to control degree in both direction. |
width |
Width of the heatmap body. |
height |
Height of the heatmap body. |
main |
: For add a title. Character or a named list.
|
submain |
: For add a subtitle. Character or a named list.
|
preferred_palettes |
Preferred palettes to use for each column. |
randomSeed |
: Number. The nodes are randomly positioned initially. This means that the settled result is different every time. If you provide a random seed manually, the layout will be the same every time. |
verbose |
Print messages. |
show_plot |
Print the plot after it's been generated. |
save_path |
Path to save interactive plot to as a self-contained HTML file. |
run_prune_ancestors |
Prune redundant ancestral terms if any of their descendants are present. Passes to prune_ancestors. |
A named list containing the visNetwork plot and the the graph used to make the plot.
top_targets <- MSTExplorer::example_targets$top_targets[1:10]
top_targets[,estimate:=fold_change]
top_targets <- map_celltype(top_targets)
vn <- prioritise_targets_network(top_targets = top_targets)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.