density_plot: Plot density signal of NGS data.

View source: R/density_plot.R

density_plotR Documentation

Plot density signal of NGS data.

Description

Plots the density profile of NGS data (e.g. ChIP-seq, ATAC-seq, MeDIP-seq, etc.). Used by the function plot.density.profile.

Usage

density_plot(
  samples,
  scores,
  positions,
  variance_scores,
  xlab = "Distance from regions center [bp]",
  ylab = "Average density signal",
  line_type = "solid",
  y_lim = NULL,
  x_lim = NULL,
  x_intercept = 0,
  colors = c("blue", "red", "purple", "orange", "green"),
  title = "Density profile",
  text_size = 12,
  variance = T,
  print_plot = F,
  line_width = 1,
  variance_opacity = 0.25
)

Arguments

samples

A character vector containing the samples list.

scores

A numeric vector containing the scores for the Y-axis.

positions

A numeric vector containing the position for the X-axis.

variance_scores

A numeric vector containing the variance/error value at each position.

xlab

A string containing the label for the X-axis. By default "Distance from regions center [bp]".

ylab

A string containing the label for the Y-axis. By default "Average density signal".

line_type

Vector to define each line type. Both numeric and string codes are accepted. if only one element is given this will be applied to all the lines. By default "solid".
Example 1: c("solid", "dashed").
Example 2: c(1, 2)

y_lim

List of numeric vectors with two elements each to define the range of the Y-axis. To set only one side use NA for the side to leave automatic. If only one range is given this one will be applied to all the plots. By default NULL, the range will be defined automatically.
Example list(c(0, 20), c(NA, 30), c(0, NA), c(NA, NA)).,

x_lim

List of numeric vectors with two elements each to define the range of the X-axis. To set only one side use NA for the side to leave automatic. If only one range is given this one will be applied to all the plots. By default NULL, the range will be defined automatically.
Example list(c(0, 20), c(NA, 30), c(0, NA), c(NA, NA)).,

x_intercept

A vector indicating the X intercepts for the vertical lines. By default 0.

colors

Vector to define the line and error area colors. If only one value is provided or the number of values is lower than the required ones only the first value will be used. All standard R.colors values are accepted. By default c("blue", "red", "purple", "orange", "green").

title

A string containing the label for the X-axis. By default "Density profile".

text_size

Numeric value to define the size of the text for the labels of all the plots. By default 12.

variance

Logic value to define whether to plot the error/variance around the signal. By default TRUE.

print_plot

Logic value to define whether to print the plot once generated or not. By default FALSE.

line_width

Numeric value to define the line width for all the plots. By default 1.,

variance_opacity

Numeric value to define the alpha/transparency of the error/variance. By default 0.25. Parameter considered only when variance = TRUE).

Value

Returns a plot in ggplot2 format.


sebastian-gregoricchio/Rseb documentation built on May 15, 2024, 5:45 a.m.