calculates the distance of tracks values from intervals bins the distances based on dist_breaks, and then calculates the average methylation m / (m + um) in each bin and plots the results.

gpatterns.spatial_meth_trend(tracks, intervals, method = "extract",
  dist_breaks = c(-4000000, -1000000, seq(-1000, 1000, 50), 1000000, 4000000),
  iterator = .gpatterns.genome_cpgs_intervals, min_cov = NULL,
  min_cgs = NULL, names = NULL, include.lowest = TRUE, groups = NULL,
  group_name = NULL, add_vline = TRUE, ncol = 2, nrow = 2, width = 5,
  height = 4, units = "in", pointsize = 12, res = 150, fig_fn = NULL,
  xlab = "Distance (bp)", ylim = c(0, 1), linewidth = 0.8, title = "",
  legend = TRUE, colors = NULL,
  parallel = getOption("gpatterns.parallel"))

Arguments

tracks
tracks to plot
intervals
intervals to plot spatial methylation around. Can be any intervals set, or one of the following 'special' intervals: 'tss', 'exon', 'utr3', 'intron', 'cgi'
dist_breaks
breaks to determine the distances from intervals
iterator
track expression iterator (of both tracks and strat_track)
min_cov
minimal coverage of each track
min_cgs
minimal number of CpGs per bin.
names
alternative names for the track
include.lowest
if 'TRUE', the lowest value of the range determined by breaks is included
groups
a vector the same length of tracks with group for each track. Each group will on a different facet.
group_name
name of the grouping variable (e.g. tumor, sample, patient, experiment)
add_vline
add vertical line at 0 coordinate
ncol
number of columns
nrow
number of rows
width
plot width (if fig_fn is not NULL)
height
plot height (if fig_fn is not NULL)
units
see png
pointsize
see png
res
see png
fig_fn
output filename for the figure (if NULL, figure would be returned)
xlab
label for the x axis'
ylim
ylim of the plot
title
title for the plot
legend
add legend
colors
custom colors
parallel
get trends parallely

Value

list with trend data frame (under 'trend') and the plot (under 'p')