plot_gs_network: Visualise a network from a tidygraph object

Description Usage Arguments Details Value Examples

View source: R/plot_gs_network.R

Description

Visualise a gene-expression network

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
plot_gs_network(
  tg,
  layout = "fr",
  up_col = "#FF000033",
  down_col = "#0000FF33",
  palette = "Dark2",
  palette_type = c("RColorBrewer", "grDevices"),
  gs_label_size = 3,
  gs_point_size = 10,
  gs_shape = 21,
  gs_label_repel = TRUE,
  gs_label_padding = unit(0.15, "lines"),
  gs_text_col = "black",
  gene_label_repel = TRUE,
  gene_shape = 21,
  gene_alpha = 0.7,
  gene_text_col = "black",
  stroke = 0.5,
  scale_size_trans = "sqrt",
  scale_size_range = c(1, 3.5),
  na_col = "grey80"
)

Arguments

tg

The gene-set network as a tidygraph, as output by make_gs_network

layout

The layout algorithm to apply

up_col

The colour to label up-regulated genes

down_col

The colour to label down-regulated genes

palette

The name of the palette to use for gene-set nodes. Can be drawn from those provided in RColorBrewer::brewer.pal, or grDevices::hcl.colors

palette_type

Choose either RColorBrewer or grDevices palettes

gs_label_size

Size of gene-set labels

gs_point_size

Size of gene-set nodes

gs_shape

Shape to use for gene-set nodes

gs_label_repel

logical(1). Should the gene-set labels repel away from the points

gs_label_padding

Set the padding within each label around the text

gs_text_col

Text colour for node labels

gene_label_repel

logical(1). Should the gene labels repel away from the points

gene_shape

Shape to use for gene-level nodes

gene_alpha

Transparency of gene-level nodes

gene_text_col

Colour of the gene names

stroke

Controls thickness of the coloured region inside any point with a fill attribute

scale_size_trans

Passed to scale_size_continuous(trans = scale_size_trans)

scale_size_range

Passed to scale_size_continuous(range = scale_size_range)

na_col

The colour for any lines and points with missing values

Details

Draws a network graph of genes connected to gene-sets. By default, up-regulated genes will be coloured red, whlst down-regulated genes will be coloured blue. This requires a column labelled 'logFC' to be included in the nodes component of the tidygraph.

It is also assumed that an NA value for logFC will be provided for the gene-set nodes. This is used to generate colours for each node, with edges from each node being drawn in the same colours, making this column mandatory

Available palettes for nodes can be found using rownames(RColorBrewer::brewer.pal.info) for the RColorBrewer palettes, or hcl.pals() for the grDevices palettes

Value

A ggplot2 object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
set.seed(100)
geneSets <- list(
  a = as.character(1:3), b = as.character(3:5), c = as.character((1:3)*2)
)
topTable <- tibble(
  gene_name = as.character(1:6), PValue = runif(6), logFC = runif(6, -3, 3)
)
tg <- make_gs_network(gene_sets = geneSets, top_table = topTable)
plot_gs_network(tg)
## Plots can be easily customised
suppressWarnings(
  plot_gs_network(tg, gs_shape = NA, gs_label_repel = FALSE,
  gs_label_size = 10, gs_label_padding = unit(0.5, "line")
  )
)

steveped/spBioUtils documentation built on Sept. 25, 2021, 7:22 p.m.