plotPCAtargets2: Plot PCA for gene expression (expLog2) and phenotype data...

Description Usage Arguments Details Value TODO Implementation

Description

Colnames of expLog2 should be equal as rownames from targets. Up to 4 variables from targets can be used for color, fill, shape and size. Colors and fill of points is collected from targets using variable names with a prefix colorsFrom (default: "color_"). Continuous variables may be used; colors from targets are nor used thus. Shape for a continuous variable must not be used together with fill.

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
26
27
28
29
30
31
32
33
34
35
plotPCAtargets2(
  expLog2,
  targets,
  shape = NULL,
  color = NULL,
  fill = NULL,
  size = NULL,
  colorsFrom = "color_",
  filePath = NULL,
  width = 7,
  height = 7,
  stroke = 1,
  alpha = 0.75,
  sizeUniform = 4,
  sizeRange = c(3, 5),
  ...
)

plotPCAtargets(
  expLog2,
  targets,
  shape,
  color,
  fill,
  size,
  scale_color = NULL,
  scale_fill = NULL,
  filePath = NULL,
  width = 7,
  height = 7,
  stroke = 1,
  guides_fill = "none",
  alpha = 0.5,
  ...
)

Arguments

expLog2

Expression matrix (preferably in log2 scale) with genes in rows and samples in columns

targets

Phenotype data with columns shape, color, fill, size, as well as color_color and color_fill, e.g., Sex and color_Sex

shape

Variable from targets for ggplot2::aes

color

Variable from targets for ggplot2::aes

fill

Variable from targets for ggplot2::aes

size

Variable from targets for ggplot2::aes

colorsFrom

Character prefix of variable names from targets with colors

filePath

NULL or character; if given, output a PDF; default NULL

width

PDF width

height

PDF height

stroke

Line thickness, passed to geom_point

alpha

Transparency of points, passed to geom_point

sizeUniform

Integer point size, used when size parameter is NULL; default 4

sizeRange

Integer c(min,max) for scaling point size; used when size parameter is given

...

Passed to geom_point

scale_color

Variable from targets, named vector for scale_color_manual(value=scale_color)

scale_fill

Variable from targets, named vector for scale_fill_manual(value=scale_fill)

guides_fill

Default "none"; use "legend" to display it

Details

Note: use (.) for using data multiple times and/or as a non-first argument; using y %>% f(x, .) + g(.) is equivalent to f(x,y) + g(y); may be left out

Value

ggplot2 object and PDF if filePath is given

ggplot2 object and PDF if filePath is given

TODO

FIX: add guides_* FIX: Discrete color_targets supplied for continuous color variable; color_targets not used Fix scale_size: Error: Discrete value supplied to continuous scale Consider using scale_colour_viridis_c

FIX: add return value FIX: Discrete scale_color supplied for continuous color variable; scale_color not used Fix: case that scale_color and scale_fill are not named vectors or NULL Fix scale_size: Error: Discrete value supplied to continuous scale Use scale_colour_viridis_c

Implementation

Put ggplot() inside to be able to access data using dot (.), e.g. mutata(...) %>% ggplot(., ...) Access data of an existing ggplot using .$data inside , e.g. . + scale_color_manual(..., .$data)

Put ggplot() inside to be able to access data using dot (.)


peterjuv/FunGenPipe documentation built on June 18, 2021, 3:38 a.m.