Generate an interactive network map of the summary statistics data.

networkmap(
  dat,
  cols = grep("^w", names(dat), value = TRUE),
  node_vars = c("dataset", "GENE", "SNP"),
  i = seq_len(50),
  snps = unique(dat$SNP)[i],
  agg_var = NULL,
  agg_fun = mean,
  as_cor = FALSE,
  k_row = 3,
  annot_vars = c("TYPE", "GENE"),
  show_plot = TRUE,
  layout = "nicely",
  node_size_range = NULL
)

Arguments

dat

Summary statistics data.

cols

Numeric columns to plot in the heatmap.

node_vars

Columns within dat to set as nodes. Each node variable will link to the next node in the character vector. You can repeat column names to create more connections between nodes.

i

Indices of rows to include. Set to NULL to include all rows, but be warned that this can become very computationally expensive.

snps

A character vector of SNP RSIDs to subset dat by.

agg_var

Variable to aggregate data by. Set to NULL to skip this step.

agg_fun

Function to aggregate cols with.

as_cor

Show the heatmap as a correlation matrix instead of a feature x sample matrix.

k_row

an integer scalar with the desired number of groups by which to color the dendrogram's branches in the rows (uses color_branches) If NA then find_k is used to deduce the optimal number of clusters.

annot_vars

Variables in dat to include as row-wise annotations.

show_plot

Print the plot.

layout

The type of layout to create. Either a valid string, a function, a matrix, or a data.frame (see Details)

node_size_range

The minimum / maximum size of each node.

Value

A named list containing a network plot and the data used to create it.

Examples

dat <- ThreeWayTest::data_matrix_final
nm <- networkmap(dat = dat)
#> Loading required namespace: tidygraph
#> Loading required namespace: ggnetwork
#> Loading required namespace: pals
#> Warning: The following aesthetics were dropped during statistical transformation: xend,
#> yend, label
#>  This can happen when ggplot fails to infer the correct grouping structure in
#>   the data.
#>  Did you forget to specify a `group` aesthetic or to convert a numerical
#>   variable into a factor?