Description Usage Arguments Details Value See Also Examples
View source: R/kpPlotCoverage.R
Given a GRanges
object, plot the coverage along the genome.
1 |
karyoplot |
(a |
data |
(a |
show.0.cov |
(boolean) Wether to plot a thin line representing the regions with no coverage at all. (defaults to TRUE, plot the line) |
data.panel |
(numeric) The identifier of the data panel where the data is to be plotted. The available data panels depend on the plot type selected in the call to |
r0 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
r1 |
(numeric) r0 and r1 define the vertical range of the data panel to be used to draw this plot. They can be used to split the data panel in different vertical ranges (similar to tracks in a genome browser) to plot differents data. If NULL, they are set to the min and max of the data panel, it is, to use all the available space. (defaults to NULL) |
col |
(color) The background color of the regions. (defaults to "#0e87eb") |
border |
(color) The color of the border used to plot the coverage. If NULL, NA (no border) is used. (defaults to NULL) |
ymax |
(numeric) The maximum value to be plotted on the data.panel. If NULL the maximum coverage is used. (defaults to NULL) |
clipping |
(boolean) Only used if zooming is active. If TRUE, the data representation will be not drawn out of the drawing area (i.e. in margins, etc) even if the data overflows the drawing area. If FALSE, the data representation may overflow into the margins of the plot. (defaults to TRUE) |
... |
The ellipsis operator can be used to specify any additional graphical parameters. Any additional parameter will be passed to the internal calls to the R base plotting functions. |
This is one of the high-level, or specialized, plotting functions of karyoploteR.
It takes a GRanges
object and plots it's coverage, that is, the number of regions
overlapping each genomic position. The input can also be a SimpleRleList
resulting
from computing the coverage with coverage(data)
. In contrast with the low-level
functions such as kpRect
, it is not possible to specify the data using
independent numeric vectors and the function only takes in the expected object types.
There's more information at the https://bernatgel.github.io/karyoploter_tutorial/karyoploteR tutorial.
Returns the original karyoplot object with the data computed (max.coverage, ymax) stored in latest.plot.
plotKaryotype
, kpPlotRegions
, kpBars
, kpPlotBAMCoverage
, kpPlotDensity
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 |
set.seed(1000)
#Example 1: create 20 sets of non-overlapping random regions and plot them all. Add a coverage plot on top.
kp <- plotKaryotype("hg19", plot.type=1, chromosomes=c("chr1", "chr2"))
all.regs <- GRanges()
nreps <- 20
for(i in 1:nreps) {
regs <- createRandomRegions(nregions = 100, length.mean = 10000000, length.sd = 1000000,
non.overlapping = TRUE, genome = "hg19", mask=NA)
all.regs <- c(all.regs, regs)
kpPlotRegions(kp, regs, r0 = (i-1)*(0.8/nreps), r1 = (i)*(0.8/nreps), col="#AAAAAA")
}
kpPlotCoverage(kp, all.regs, ymax = 20, r0=0.8, r1=1, col="#CCCCFF")
kpAxis(kp, ymin = 0, ymax= 20, numticks = 2, r0 = 0.8, r1=1)
#Example 2: Do the same with a single bigger set of possibly overlapping regions
kp <- plotKaryotype("hg19", plot.type=1, chromosomes=c("chr1", "chr2"))
regs <- createRandomRegions(nregions = 1000, length.mean = 10000000, length.sd = 1000000,
non.overlapping = FALSE, genome = "hg19", mask=NA)
kpPlotRegions(kp, regs, r0 = 0, r1 = 0.8, col="#AAAAAA")
kpPlotCoverage(kp, regs, ymax = 20, r0=0.8, r1=1, col="#CCCCFF")
kpAxis(kp, ymin = 0, ymax= 20, numticks = 2, r0 = 0.8, r1=1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.