plotDistr_RGList: Plot distributions of signals in a RGList object using...

Description Usage Arguments Value Implementation Examples

Description

Plots distributions for each combination of FUNS, channels and sampleColors. By default, samples are ordered according to the sampleColors (if provided). Colors should be provided as factors with a preset order of levels; the order of colors is determined by the order of levels

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
plotDistr_RGList(
  RGList,
  filePath = NULL,
  channels = c("R", "G"),
  FUNS = c(ggplot2::geom_density, ggplot2::geom_boxplot),
  probeTypeVec = NULL,
  probeTypeValue = 0,
  numProbes = NULL,
  sampleColors = NULL,
  orderByColors = TRUE,
  scale_x_limits = NULL,
  width = 16/9 * 7,
  height = 7,
  ...
)

Arguments

RGList

A list of matrices of signal intensities per channel

filePath

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

channels

List of data.frames from RGList, e.g. list("log2(R)", "log2(G)")

FUNS

geom_functions from ggplot2, default c(geom_density, geom_boxplot), others: c(geom_violin, geom_histogram, ggridges::geom_density_ridges)

probeTypeVec

Vector of probe types

probeTypeValue

Value from probeTypeVec to use for plotting

numProbes

Number of randomly select probes

sampleColors

Tibble of named factors of colors with names matching sample names

orderByColors

Logical for ordering samples by colors (coded as a factor with levels in order); default TRUE

scale_x_limits

NULL for auto-scale; use c(0,16) or less for log2(intensities)

width

PDF width, default 16/9*7=12.44

height

PDF height, default 7

...

Passed to ggplot2::FUN, e.g.: bins, binwidth, show.legend

Value

A list of ggplots, one per a combination of FUNS, channels and sampleColors PDF if filePath is not NULL

Implementation

See https://www.tidyverse.org/blog/2020/02/glue-strings-and-tidy-eval/ for bracing variables. Evaluation of expression: https://adv-r.hadley.nz/evaluation.html. For bquote(a +. (b)): http://adv-r.had.co.nz/Expressions.html.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
plotDistr_RGList(dataRG.bgc, file.path(curDir, "density-boxplot_dataRG.bgc_genes.pdf"), 
channels = c("log2R","log2G","beta"), probeTypeVec = dataRG.bgc$genes$ControlType, probeTypeValue = 0,
numProbes = 10000, sampleColors = targets %>% select(starts_with("color_")))
## Removed parameters/code:
# transform = log2: transformation function applied to each channel (default: log2; identity for none)
mutate("{{transform}}({ch})" := transform(!!parse_expr(ch)))
ggplot(aes(x=transform(!!parse_expr(ch)), color=HybName)) +
ggplot(d2, aes(x=!!parse_expr(ch), color=fct_reorder(HybName, order(colors)))) + #, order=colors)) + 

## End(Not run)

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