plotRegionStats()
takes a set of regions from getRegions()
,
generates histograms of region characteristics, and saves it as a pdf.
Region-level statistics include width, number of CpGs, minimum coverage, mean
coverage, mean methylation, and methylation standard deviation.
Usage
plotRegionStats(
regions,
maxQuantile = 1,
bins = 30,
histCol = "#132B43",
lineCol = "red",
nBreaks = 4,
save = TRUE,
file = "Region_Plots.pdf",
width = 11,
height = 8.5,
verbose = TRUE
)
Arguments
- regions
A
data.frame
output fromgetRegions()
giving the set of regions and statistics for each region.- maxQuantile
A
numeric(1)
giving the maximum quantile of each feature to plot.- bins
A
numeric(1)
specifying the number of bins in each histogram.- histCol
A
character(1)
giving the color of the histogram.- lineCol
A
character(1)
giving the color of the vertical median line.- nBreaks
A
numeric(1)
specifying the number of breaks for the x-axis.- save
A
logical(1)
indicating whether to save the plot.- file
A
character(1)
giving the file name (.pdf) for the plot.- width
A
numeric(1)
specifying the width in inches of the saved plot.- height
A
numeric(1)
specifying the height in inches of the saved plot.- verbose
A
logical(1)
indicating whether messages should be printed.
Details
It's recommended to examine region characteristics before and after filtering.
The vertical line on each histogram indicates the median value for that
feature. A ggplot
object is produced and can be edited outside of this
function if desired.
See also
getRegions()
to generate the set of regions.plotSDstats()
,getRegionTotals()
, andplotRegionTotals()
for more help visualizing region characteristics and setting cutoffs for filtering.filterRegions()
for filtering regions by minimum coverage and methylation standard deviation.
Examples
if (FALSE) {
# Call Regions
regions <- getRegions(bs, file = "Unfiltered_Regions.txt")
plotRegionStats(regions, maxQuantile = 0.99,
file = "Unfiltered_Region_Plots.pdf")
plotSDstats(regions, maxQuantile = 0.99,
file = "Unfiltered_SD_Plots.pdf")
# Examine Region Totals at Different Cutoffs
regionTotals <- getRegionTotals(regions, file = "Region_Totals.txt")
plotRegionTotals(regionTotals, file = "Region_Totals.pdf")
# Filter Regions
regions <- filterRegions(regions, covMin = 10, methSD = 0.05,
file = "Filtered_Regions.txt")
plotRegionStats(regions, maxQuantile = 0.99,
file = "Filtered_Region_Plots.pdf")
plotSDstats(regions, maxQuantile = 0.99,
file = "Filtered_SD_Plots.pdf")
}