network_visualization: Generate graphs from results of Mapper

View source: R/mapper_vis.R

network_visualizationR Documentation

Generate graphs from results of Mapper

Description

network_visualization generates an interactive graph from the provided Mapper object.

Usage

network_visualization(
  obj_mapper,
  groups_ind,
  dat = NULL,
  folder = "",
  add_surv_analysis = FALSE,
  add_analysis_js = NULL,
  palette = "Set1",
  legend_ncol = 2,
  color_code = NULL,
  color_mix = FALSE
)

Arguments

obj_mapper

An object of class TDAmapper.

groups_ind

A vector of group names each of the samples belongs to.

dat, add_surv_analysis, add_analysis_js

Arguments passed to stat_summery for customizing statistics summary of nodes.

folder

The name of the folder to save the generated networks.

palette

A string giving the name of palette provided in RColorBrewer to automatically assign colors to nodes.

legend_ncol

Number of columns of legends.

color_code

The dataframe of color codes for groups of samples. If not provided, the function will automatically assign colors to different groups.

color_mix

Boolean. If to display the color of nodes as a mixer of the colors of samples within the nodes, where colors of samples are determined by their associated groups

Details

network_visualization generates an interactive graph based on the provided Mapper object with Javascript tools from visNetwork. It accepts statistics summary from the stat_summery function and display them as tooltips. The tooltips can also be customized by the users by passing Javascript codes with additional summerise of nodes to the argument add_analysis_js.

Nodes are colored with the colors associated with the dominated groups within each of the nodes. The colors of groups can either be defined by users or by function auto_set_colorcode. Self defined color codes should follow the format introduced in check_color_code, and we recommend reading color code files with read_color_code.

The width of edges is propotional to the percentage of overlapping between connected nodes.

Value

An HTML file and a set of pie plots will be saved under the location given in folder. The HTML file contains the interactive graph generated based on the Mapper object, and the pie plots are for the summerise of nodes.

References

Feng, T., Davila, J.I., Liu, Y., Lin, S., Huang, S. and Wang, C., 2019. Semi-supervised Topological Analysis for Elucidating Hidden Structures in High-Dimensional Transcriptome Datasets. _IEEE/ACM transactions on computational biology and bioinformatics._

Examples

tp_data = chicken_generator(1)
ff = filter_coordinate(tp_data[,-1], 2)
tp_data_mapper = mapper.sta(dat = tp_data[,2:4],
                               filter_values = ff,
                               num_intervals = 10,
                               percent_overlap = 70)
network_visualization(tp_data_mapper, groups_ind = tp_data$Group, dat = tp_data[,2:4],
                      folder = "Exp_network")

# Add additional analysis to nodes

add_analysis_js = paste0('Node Index:<b>',
                           1:length(tp_data_mapper$points_in_vertex),
                           '</b><br>')
network_visualization(tp_data_mapper, groups_ind = tp_data$Group, dat = tp_data[,2:4],
                      folder = "Exp_network", add_analysis_js = add_analysis_js)


TianshuFeng/SemiMapper documentation built on Sept. 16, 2022, 10:26 p.m.