sp_enrichment: Generating enrichment plot

Description Usage Arguments Value Examples

View source: R/sp_enrichment.R

Description

Generating enrichment plot

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
sp_enrichment(
  data,
  xvariable,
  yvariable,
  size_variable = NULL,
  color_variable = NULL,
  xvariable_order = NULL,
  yvariable_order = NULL,
  shape_variable_order = NULL,
  title = NULL,
  x_label = NULL,
  y_label = NULL,
  scale_size_max = NULL,
  scale_size_min = NULL,
  yvariable_width = 60,
  manual_color_vector = c("green", "red"),
  log10_transform_variable = NULL,
  sqrt_transform_variable = NULL,
  legend.position = "right",
  xtics_angle = 0,
  shape_variable = NULL,
  coordinate_flip = FALSE,
  extra_ggplot2_cmd = NULL,
  ...
)

Arguments

data

Data file (with header line, the first column is not the rowname, tab seperated).

xvariable

One of column names used as the variable for horizontal axis.

yvariable

One of column names used as the variable for vertical axis.

size_variable

One of column names used as the variable for defining point sizes. Normally count. Default the variable name given to sqrt_transform_variable.

color_variable

One of column names used as the variable for defining point colors. Default the variable name given to log10_transform_variable.

xvariable_order

The order for horizontal axis. Only woroks if horizontal axis variables are strings. If horizontaol axis are numbers like GeneRatio, this will be treated as shape_variable order. Default alphabetical order, accept a vector like c('SampA_Up','SampB_Up').

shape_variable_order

The order for shape variable. Default alphabetical order, accept a vector like c('SampA_Up','SampB_Up').

title

Title of picture. Default empty.

x_label

X-axis title of picture. Default empty.

y_label

Y-axis title of picture. Default empty.

scale_size_max

Scale size with maximum value specified

scale_size_min

Scale size with minimum value specified

yvariable_width

Default 60. Normally yvariable would be terms. This is used to set the max-allowed term length. Terms with length larger than given value will be wrap to new line.

manual_color_vector

Manually set colors for each geom. Default NULL, meaning using ggplot2 default. Colors like c('red', 'blue', '#6181BD') (number of colors not matter) or a RColorBrewer color set like "BrBG" "PiYG" "PRGn" "PuOr" "RdBu" "RdGy" "RdYlBu" "RdYlGn" "Spectral" "Accent" "Dark2" "Paired" "Pastel1" "Pastel2" "Set1" "Set2" "Set3" "Blues" "BuGn" "BuPu" "GnBu" "Greens" "Greys" "Oranges" "OrRd" "PuBu" "PuBuGn" "PuRd" "Purples" "RdPu" "Reds" "YlGn" "YlGnBu" "YlOrBr" "YlOrRd" (check http://www.sthda.com/english/wiki/colors-in-r for more).

log10_transform_variable

Get log-transformed data for given variable. Default NULL, means no log10 transform. Accept a variable like p_value to get (-1) * log10(p_value).

sqrt_transform_variable

Get square root-transformed data for given variable. Default NULL, means no sqrt transform. Accept a variable like count to get sqrt(count).

legend.position

Position of legend, accept top, bottom, left, right, none or c(0.8,0.8).

xtics_angle

Rotation angle for a-axis. Default 0.

shape_variable

One of column names used as the variable for defining point shapes.

coordinate_flip

Flip cartesian coordinates so that horizontal becomes vertical, and vertical, horizontal. This is primarily useful for converting geoms and statistics which display y conditional on x, to x conditional on y.

extra_ggplot2_cmd

Extra ggplot2 commands (currently unsupported)

...

Parameters given to sp_ggplot_layout

Value

A ggplot2 object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run:
enrichment_data <- "enrichment.data"

library(YSX)
enrichment_data <- "enrichment.data"
sp_enrichment(data = enrichment_data, xvariable = "GeneRatio", yvariable = "Description",
              log10_transform_variable = "Qvalue", sqrt_transform_variable = "Count",
              shape_variable = "SampleGroup")

enrichment_data <- "goeast.enrich.txt"
enrichment.data <- sp_readTable(enrichment_data)
head(enrichment.data)

p <- sp_enrichment(data = enrichment.data, xvariable = "log_odds_ratio",
                   yvariable = "Term", color_variable = "p",
                   log10_transform_variable="p", size_variable = "q",
                   sqrt_transform_variable = "q",
                   shape_variable = "Ontology")
## End(Not run)

Tong-Chen/YSX documentation built on Jan. 25, 2021, 2:49 a.m.