coverage_heatmap: coverage_heatmap

Description Usage Arguments Details Value Author(s) Examples

Description

Makes an interactive coverage heatmap.

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
coverage_heatmap(data, ...)

add_coverage_heatmap(p, data, ...)

## S4 method for signature 'SummarizedExperiment'
coverage_heatmap(data,
  assay = assayNames(data), ...)

## S4 method for signature 'IheatmapHorizontal,SummarizedExperiment'
add_coverage_heatmap(p,
  data, assay = assayNames(data), ...)

## S4 method for signature 'ScoreMatrix'
coverage_heatmap(data, start, end, x = seq(start, end,
  length.out = ncol(data)), y = default_y(data), ...)

## S4 method for signature 'IheatmapHorizontal,ScoreMatrixList'
add_coverage_heatmap(p, data,
  start, end, x = seq(start, end, length.out = ncol(data[[1]])), ...)

## S4 method for signature 'matrix'
coverage_heatmap(data, x = default_x(data),
  y = default_y(data), row_order = c("signal", "hclust", "kmeans", "groups",
  "none"), k = NULL, groups = NULL, clust_dist = stats::dist,
  signal = log10rowMeans(data), plot_signal = TRUE, name = "Coverage",
  signal_name = "Avg. (log10)", summary = TRUE,
  scale_method = c("localRms", "localMean", "localNonZeroMean",
  "PercentileMax", "scalar", "none"), pct = 0.95, scale_factor = 1,
  show_xlabels = TRUE, start = x[1], end = default_end(x),
  col_title = "Position", layout = list(font = list(size = 10)), ...)

## S4 method for signature 'IheatmapHorizontal,matrix'
add_coverage_heatmap(p, data,
  x = default_x(data), signal = log10rowMeans(data), plot_signal = TRUE,
  name = "Coverage", signal_name = "Avg. (log10)", summary = TRUE,
  scale_method = c("localRms", "localMean", "localNonZeroMean",
  "PercentileMax", "scalar", "none"), pct = 0.95, scale_factor = 1,
  show_xlabels = TRUE, start = x[1], end = default_end(x),
  col_title = "Position", ...)

## S4 method for signature 'list'
coverage_heatmap(data, x = default_x(data[[1]]),
  y = default_y(data[[1]]), row_order = c("signal", "hclust", "kmeans",
  "groups", "none"), k = NULL, groups = NULL, clust_dist = stats::dist,
  cluster_by = c("first", "all"), signal = lapply(data, log10rowMeans),
  plot_signal = TRUE, name = "Coverage", signal_name = "Avg. (log10)",
  summary = TRUE, scale_method = c("localRms", "localMean",
  "localNonZeroMean", "PercentileMax", "scalar", "none"), pct = 0.95,
  scale_factor = 1, show_xlabels = TRUE, start = x[1],
  end = default_end(x), col_title = "Position", layout = list(font =
  list(size = 10)), ...)

## S4 method for signature 'IheatmapHorizontal,list'
add_coverage_heatmap(p, data,
  x = default_x(data[[1]]), signal = lapply(data, log10rowMeans),
  plot_signal = TRUE, name = "Coverage", signal_name = "Avg. (log10)",
  summary = TRUE, scale_method = c("localRms", "localMean",
  "localNonZeroMean", "PercentileMax", "scalar", "none"), pct = 0.95,
  scale_factor = 1, show_xlabels = TRUE, start = x[1],
  end = default_end(x), col_title = "Position", ...)

Arguments

data

single coverage matrix or list of coverage matrices

...

additional arguments

p

IHeatmap object

assay

name(s) of assay to plot, if data is SummarizedExperiment

start

label for start of x range

end

label for end of x range

x

x axis labels

y

y axis labels

row_order

row order method

k

k to use for kmeans clustering or cutting heirarchical clustering

groups

pre-determined groups for rows

clust_dist

distance function to use for clustering

signal

signal along row

plot_signal

add an annotation heatmap showing the average signal? default is TRUE

name

name of colorbar

signal_name

name for signal colorbar

summary

make summary plot, boolean, default is TRUE

scale_method

how to scale matrix before displaying in heatmap, see Details section

pct

percentile to use if scale_method is "PercentileMax"

scale_factor

scale_factor to use if scale_method is "scalar"

show_xlabels

show xlabels? default is TRUE

col_title

x axis label

layout

list of layout attributes

cluster_by

use "first" or "all" matrices for clustering if given multiple matrices

Details

scale_method choices are "localRms", "localMean", "localNonZeroMean", "PercentileMax", "scalar", and "none". localRMS will divide each row by the root mean squared values of that row. localMean will divide each row by the mean of that row. localNonZeroMean will divide each row by nonzero values in that row. PercentileMax will divide values based on percentile (given by pct argument) of the entire matrix. scalar will divide entire matrix by a scalar, given by scalar argument. This scalar could for example be a measure of the sequencing depth.

Value

iheatmap object

Author(s)

Alicia Schep

Examples

 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
library(GenomicRanges)
## First we'll read in some sample data
genomation_dir <- system.file("extdata", package = "genomationData")
samp.file <- file.path(genomation_dir,'SamplesInfo.txt')
samp.info <- read.table(samp.file, header=TRUE, sep='\t', 
                        stringsAsFactors = FALSE)
samp.info$fileName <- file.path(genomation_dir, samp.info$fileName)
ctcf.peaks = genomation::readBroadPeak(system.file("extdata",
                          "wgEncodeBroadHistoneH1hescCtcfStdPk.broadPeak.gz",
                           package = "genomationData"))
ctcf.peaks = ctcf.peaks[seqnames(ctcf.peaks) == "chr21"]
ctcf.peaks = ctcf.peaks[order(-ctcf.peaks$signalValue)]
ctcf.peaks = resize(ctcf.peaks, width = 501, fix = "center")

## Make coverage matrix
ctcf_mats <- make_coverage_matrix(samp.info$fileName[1:5], 
                                  ctcf.peaks, 
                                  input_names = samp.info$sampleName[1:5],
                                  up = 250, 
                                  down = 250, 
                                  binsize = 25)
                                  
## Plot coverage for Ctcf and Znf143
if (interactive()){
  coverage_heatmap(ctcf_mats, "Ctcf") %>% 
    add_coverage_heatmap(ctcf_mats, "Znf143")
}                                   

skummerf/GenomicWidgets documentation built on May 31, 2019, 6:16 p.m.