Description Usage Arguments Details Value Author(s) Examples
Plotting function that returns a ggplot2
layer representing the specified dataset for the specified samples in the region [positon - windowsize, position + windowsize]
.
1 |
data |
The data to be plotted. Returned by |
sampledata |
The sampledata for the cohort represented by
|
samples |
A character vector listing the names of samples to be
plotted, defaults to all samples as described in |
windowsize |
Size of the window in which to plot on each side. The total interval that is plotted will be [position-windowsize,position+windowsize] |
position |
The position at which the plot shall be centered |
dataset |
The slot in the |
... |
Paramteters to be passed to the internally used |
Creates a ggplot layer centered on position
using the specified dataset
from list data
, annotating it with sample information provided in the data.frame sampledata
and showing all samples listed in sample
. The resulting plot uses ggplot2
's geom_rect
to draw boxes representing the values from dataset
. The x-axis is the position and will span the interval [positon - windowsize, position + windowsize]
. The x-axis is centered at 0 and additional layers to be added to the plot should be centered at 0 also.
Ths function allows for fast creation of overview plots similar to mismatchPlot
(without the stacking of tracks). The example below shows how one can create a plot showing the coverage and number of mismatches per position (but not the alternative allele) for a given region.
A ggplot
layer object containing the plot of the specified dataset, this can be used
like any other ggplot layer, i.e. it may be added to another plot.
Paul Pyl
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | # loading library and example data
library(h5vc)
library(ggplot2)
tallyFile <- system.file( "extdata", "example.tally.hfs5", package = "h5vcData" )
sampleData <- getSampleData( tallyFile, "/ExampleStudy/16" )
position <- 29979629
windowsize <- 30
samples <- sampleData$Sample[sampleData$Patient == "Patient8"]
data <- h5dapply(
filename = tallyFile,
group = "/ExampleStudy/16",
blocksize = windowsize * 3, #choose blocksize larger than range so that all needed data is collected as one block
names = c("Coverages", "Counts", "Deletions"),
range = c(position - windowsize, position + windowsize)
)[[1]]
# Summing up all mismatches irrespective of the alternative allele
data$CountsAggregate = colSums(data$Counts)
# Simple overview plot showing number of mismatches per position
p <- ggplot() +
geom_h5vc( data=data, sampledata=sampleData, windowsize = 35, position = 500, dataset = "Coverages", fill = "gray" ) +
geom_h5vc( data=data, sampledata=sampleData, windowsize = 35, position = 500, dataset = "CountsAggregate", fill = "#D50000" ) +
facet_wrap( ~ Sample, ncol = 2 )
print(p)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.