plot_network: Plotting network calculated by turboGliph or GLIPH2

View source: R/plot_network.R

plot_networkR Documentation

Plotting network calculated by turboGliph or GLIPH2

Description

With plot_network an automated function is provided to visualize the network generated by turboGliph or gliph2 with the package visNetwork.

Usage

plot_network(
  clustering_output = NULL,
  result_folder = "",
  show_additional_columns = NULL,
  color_info = "total.score",
  color_palette = viridis::viridis,
  local_edge_color = "orange",
  global_edge_color = "#68bceb",
  size_info = NULL,
  absolute_size = FALSE,
  cluster_min_size = 3,
  n_cores = 1
)

Arguments

clustering_output

list. By default NULL. If the value of result_folder is "", the output list of the functions turboGliph or gliph2 must be entered here.

result_folder

character. By default "". Path to the folder in which the output files of turboGliph or gliph2 are stored. If specified, the clustering results are loaded directly from the files and the parameter clustering_output is ignored.

show_additional_columns

character vector. By default NULL. By default, the sequence, cluster tag, and cluster score are shown for each node. Here, further column names can be specified, whose information is additionally displayed. All column names of the data frame originally entered under the parameter cdr3_sequences in turboGliph, gliph2 or gliph_combined (sequence specific information) and all column names of the data frame under clustering_output$cluster_properties (cluster specific information) are available.

color_info

character. By default "total.score". color_info specifies the column name by which the nodes are colored. All column names of the data frame originally entered under the parameter cdr3_sequences in turboGliph, gliph2 or gliph_combined (sequence specific information) and all column names of the data frame under clustering_output$cluster_properties (cluster specific information) are available. If color_info = "color" applies, the values from the column "color" are directly interpreted as color values for the respective sequence. If other columns are specified, colors are automatically assigned to the contained values using the viridis palette. For numeric values, purple corresponds to small values and yellow corresponds to high values. Two example options:

  • "none": All nodes are colored gray.

  • "total.score": The nodes are colored according to their total cluster score using the viridis palette. Purple corresponds to small scores of significant clusters. Yellow corresponds to high scores of clusters with little significance.

color_palette

function. This function specifies the color palette for node coloring. By default, the viridis-palette is used. The function has to expect a number n as input representing the desired amount of color values and has to return n color values in a vector.

local_edge_color

color. By default #11c21d. Specifies the color of edges representing local similarities. The value must specify a color.

global_edge_color

color. By default #ad1717. Specifies the color of edges representing global similarities. The value must specify a color.

size_info

character. By default NULL. size_info specifies the column name after which the node sizes are determined. All column names of the data frame originally entered under the parameter cdr3_sequences in turboGliph, gliph2 or gliph_combined (sequence specific information) and all column names of the data frame under clustering_output$cluster_properties (cluster specific information) are available. The values of the chosen column have to represent numeric values.

absolute_size

logical. By default FALSE. If TRUE, the values from the column of cdr3_sequences named after size_info are used as absolute sizes of the nodes. Otherwise, the values are normalized linearly to a range of values for the node size between 12 and 20.

cluster_min_size

numeric. By default 3. Minimal size of a cluster required to be considered for plotting.

n_cores

numeric. Number of cores to use, by default 1. In case of NULL it will be set to number of cores in your machine minus 2.

Value

plot_network returns an object of class 'visNetwork' which visualizes the network from the results of turboGliph or gliph2. The resulting graph is interactive. Scrolling zooms, hovering over a node displays additional information about that node, and clicking on a node highlights all direct neighbors. The color and size of the nodes can be adjusted with the parameters. For details, see the parameter information.

Examples

utils::data("gliph_input_data")
res <- turbo_gliph(cdr3_sequences = gliph_input_data[base::seq_len(200),],
sim_depth = 100,
n_cores = 1)

plot_network(clustering_output = res,
n_cores = 1)


HetzDra/turboGliph documentation built on Oct. 2, 2022, 2:22 a.m.