plot_signals: plot_signals

View source: R/functions_plot.R

plot_signalsR Documentation

plot_signals

Description

Performs clustering on signal profiles in prof_dt and produces various plots. Optionally outputs annotation (with anno_grs) and/or FRIP (with frip_dt) plots that incorporate signal clustering information.

Usage

plot_signals(
  prof_dt,
  query_gr,
  assign_dt = NULL,
  n_to_plot = 500,
  fill_var = "y_relative",
  anno_grs = NULL,
  frip_dt = NULL,
  scc_dt = NULL,
  name_lev = NULL,
  nclust = 6
)

Arguments

prof_dt

data.table of signal profiles from ssvFetchBam or ssvFetchBigwig.

query_gr

The GRanges used to produce prof_dt.

assign_dt

(optional) Precalculated clustering. From running ssvSignalClustering followed by make_assign_dt

n_to_plot

numeric. Number of items plotted in heatmap. Default is 500.

fill_var

character. Variable in prof_dt to cluster and plot on. Default of y_relative is the fraction of max y per id.

anno_grs

(optional) output from make_anno_grs

frip_dt

(optional) output from make_frip_dt

scc_dt

(optional) output from make_scc_dt

name_lev

(optional) manual specification for levels of "name" to control ordering.

nclust

Number of clusters for heatmap. Defaults to 6.

Value

named list of ggplot plots and relevant data

Examples

bw_files = dir(system.file("extdata", package = "seqqc"), pattern = "^M.+bw$", full.names = TRUE)
query_dt = make_dt(bw_files)
query_dt[, sample := sub("_FE_random100.A", "", name)]

peak_files = dir(system.file("extdata", package = "seqqc"), pattern = "Peak$", full.names = TRUE)
peak_grs = seqsetvis::easyLoad_narrowPeak(peak_files)
query_gr = resize(seqsetvis::ssvOverlapIntervalSets(peak_grs), 6e2, fix = "center")

prof_dt = seqsetvis::ssvFetchBigwig(query_dt, query_gr, return_data.table = TRUE)

sig_res = plot_signals(prof_dt, query_gr)
sig_res$heatmap
sig_res$heatmap_sidebar
sig_res$cluster_assignment

gtf_file = system.file(package = "seqqc", "extdata/gencode.v35.annotation.at_peaks.gtf")
anno_grs = make_anno_grs(gtf_file)

sig_res.anno = plot_signals(prof_dt, query_gr, anno_grs = anno_grs)
sig_res.anno$heatmap
sig_res.anno$annotation_heatmap

bam_files = dir(system.file("extdata", package = "seqqc"), pattern = "^M.+bam$", full.names = TRUE)
query_dt.bam = make_dt(bam_files)

frip_dt = make_frip_dt(query_dt.bam, query_gr)

sig_res.frip = plot_signals(prof_dt, query_gr, frip_dt = frip_dt)
sig_res.frip$heatmap
sig_res.frip$frip_bars_per_cluster
sig_res.frip$frip_text_per_cluster

scc_dt = make_scc_dt(query_dt.bam, query_gr)
sig_res.scc = plot_signals(prof_dt, query_gr, scc_dt = scc_dt)

sig_res.scc$scc_curves_per_cluster
sig_res.scc$scc_dots_per_cluster


FrietzeLabUVM/ssvQC documentation built on March 25, 2024, 12:24 a.m.