ssvSignalLineplotAgg: aggregate line signals in a single line plot

ssvSignalLineplotAggR Documentation

aggregate line signals in a single line plot

Description

aggregate line signals in a single line plot

Usage

ssvSignalLineplotAgg(
  bw_data,
  x_ = "x",
  y_ = "y",
  sample_ = "sample",
  color_ = sample_,
  group_ = sample_,
  agg_fun = mean,
  spline_n = NULL,
  return_data = FALSE
)

Arguments

bw_data

a GRanges or data.table of bigwig signal. As returned from ssvFetchBam and ssvFetchBigwig

x_

variable name mapped to x aesthetic, x by default.

y_

variable name mapped to y aesthetic, y by default.

sample_

variable name, along with region_ used to group by default,

color_

variable name mapped to color aesthetic, sample_ by default. change group_ to override.

group_

group aesthetic keeps lines of geom_path from mis-connecting. Most useful if you need to supply a variable to later facet upon. Defaults to value of sample_.

agg_fun

the aggregation function to apply by sample_ and x_, default is mean

spline_n

if not NULL, applySpline will be called with n = spline_n. default is NULL.

return_data

logical. If TRUE, return value is no longer ggplot and is instead the data used to generate that plot. Default is FALSE.

Value

ggplot of signal aggregated with agg_fun() by sample.

Examples

data(CTCF_in_10a_profiles_gr)
bw_gr = CTCF_in_10a_profiles_gr
ssvSignalLineplotAgg(bw_gr) +
    labs(title = "agg regions by sample.")
ssvSignalLineplotAgg(CTCF_in_10a_profiles_gr, spline_n = 10) +
    labs(title = "agg regions by sample, with spline smoothing.")
ssvSignalLineplotAgg(subset(bw_gr, bw_gr$id %in% seq_len(10)),
    sample_ = "id", color_ = "id") +
    labs(title = "agg samples by region id (weird)")
ssvSignalLineplotAgg(subset(bw_gr, bw_gr$id %in% seq_len(10)), sample_ = "id",
    color_ = "id", spline_n = 10) +
    labs(title = "agg samples by region id (weird), with spline smoothing")

jrboyd/seqsetvis documentation built on Oct. 15, 2024, 11:28 p.m.