| pyramidtracks | R Documentation | 
These functions add new facets to a pyramid plot with additional annotations. You can add annotations to the pyramid plot with BED regions, bedgraphs, CTCF sites, discoveries that run along the genome and ggplot layers.
as_track(x, height = 0.1, name, scale_y, ...)
## S3 method for class 'LayerInstance'
as_track(x, height = 0.1, name, scale_y = NULL, ...)
add_bed_track(bed, height = 0.1, name, ...)
add_bed_graph(bedgraph, height = 0.1, name, ...)
add_ctcf_sites(bed, strand, height = 0.05, name = "CTCF", scale_y = NULL, ...)
## S3 method for class 'CS_discovery'
as_track(
  x,
  height = 0.1,
  name = "Compartment\nScore",
  scale_y = NULL,
  ...,
  geom = "area"
)
## S3 method for class 'IS_discovery'
as_track(
  x,
  height = 0.1,
  name = "Insulation\nScore",
  scale_y = NULL,
  ...,
  geom = "area"
)
## S3 method for class 'DI_discovery'
as_track(
  x,
  height = 0.1,
  name = "Directionality\nIndex",
  scale_y = NULL,
  ...,
  geom = "area"
)
## S3 method for class 'domainogram_discovery'
as_track(x, height = 0.1, name = NULL, scale_y = NULL, ...)
## S3 method for class 'virtual4C_discovery'
as_track(x, height = 0.1, name = NULL, scale_y = NULL, ..., geom = "area")
| x | A ggplot layer instance | 
| height | A  | 
| name | A  | 
| scale_y | A ggplot position scale with the y-aesthetic to control parameters of the track's y-scale. | 
| ... | Additional arguments to pass to  | 
| bed | A BED-formatted  
 | 
| bedgraph | A  | 
| strand | [ | 
| geom | [discovery only] A  
  Does not apply to  | 
Currently, as_track() only accepts layers wherein the
data argument is explicitly defined before evaluation. For example,
geom_point(aes(x = 1, y = 1)) is not an appropriate track, while
geom_point(aes(x + 1, y = y), data = data.frame(x = 1, y = 1)) is an
appropriate track.
An attempt is made to subset the input based on the x-coordinates of the
main pyramid() plot, but this requires the layer-data to have 
column-names that match x-position names, e.g. "x", "xend", 
"xmax" etc. Likewise, when the layer-data contains a 
"chrom"-column, this is also subsetted to match the location of the
main pyramid() plot.
A track_layer object.
## Not run: 
# Initialising a pyramid
p <- pyramid(exp, "chr2", 25e6, 30e6)
# Adding a bed annotation
p + add_bed_track(bed, fill = "blue", name = "bed")
# Adding a bedgraph annotation
p <- p + add_bed_graph(bedgraph, linetype = 2, name = "Some statistic")
p
# Adding custom annotation
# Use the name to display in the same panel as previous annotation
p + as_track(ggplot2::geom_vline(xintercept = 27.5e6),
             name = "Some statistic")
# Adding discovery annotation
insula <- insulation_score(exp)
p + insula
# Using `as_track()` gives more control over the appearance of discoveries
p + as_track(insula, geom = "line", linetype = 2)
# When a discovery contains multiple samples, all are added
compart <- compartment_score(list(exp1, exp2), bed = H3K4me1_peaks)
p + compart
# To seperate discoveries as individual tracks, they have to be unbundled and
# named differently
compart <- unbundle(compart)
p + as_track(compart[[1]], name = "exp1") + 
 as_track(compart[[2]], name = "exp2")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.