binSum {PeakSegJoint} | R Documentation |
binSum
Description
Compute sum of compressed
coverage profile in bins, using fast C
code.
Usage
binSum(compressed, bin.chromStart = 0L,
bin.size = 1L, n.bins = 2000L,
empty.as.zero = FALSE)
Arguments
compressed |
data.frame with integer columns chromStart, chromEnd, count. |
bin.chromStart |
Base before first bin. |
bin.size |
Bin size. |
n.bins |
Number of bins. |
empty.as.zero |
Sometimes the last few bins do not have any overlapping data in
|
Value
data.frame with n.bins
rows and columns chromStart, chromEnd,
count, mean.
Author(s)
Toby Dylan Hocking
Examples
## bins of size 3bp.
## -1- -3- -5-
## -2- -4-
## 123456789012345 base index.
## --2---
## --1-
## --0-------
## Coverage profile.
profile <- data.frame(chromStart=as.integer(c(0, 6, 10)),
chromEnd=as.integer(c(6, 10, 10000)),
count=as.integer(c(2, 1, 0)))
library(PeakSegJoint)
bins <- binSum(profile,
bin.chromStart=0L,
bin.size=3L,
n.bins=2000L)
library(ggplot2)
bases <- data.frame(position=1:15, base="N")
ggplot()+
ylab("")+
geom_text(aes(position, 0, label=base),
data=bases)+
geom_step(aes(chromStart+0.5, count, color=what),
data=data.frame(profile, what="profile"),
size=2)+
geom_step(aes(chromStart+0.5, count, color=what),
data=data.frame(bins, what="bin total"))+
geom_step(aes(chromStart+0.5, mean, color=what),
data=data.frame(bins, what="bin mean"))+
coord_cartesian(xlim=c(0, max(bases$position)))
[Package PeakSegJoint version 2024.6.27 Index]