Skip to content

Add a Zoom Slider to a GC Chart ​

GC_zoom() adds a slider below the clusters to zoom in on part of them. Drag a handle to change the window, drag the window to move it, click the track to move the window there, and double-click the slider or use the reset zoom button of the toolbar (GC_toolbar()) to show everything again. With the keyboard, the arrow keys move a handle or the window by 1% of the slider (Shift: 10%), Home and End to the ends.

Usage ​

r
GC_zoom(
  GC_chart,
  show = TRUE,
  range = NULL,
  mode = NULL,
  min = NULL,
  update = NULL,
  height = NULL,
  overview = NULL,
  color = NULL,
  style = NULL,
  windowStyle = NULL,
  handleStyle = NULL
)

Arguments ​

ArgumentDescription
GC_chartA GC chart object.
showLogical, whether to show the slider. FALSE removes it.
rangeThe window shown first, as c(start, end) in the units of mode. NULL (default) shows everything. A Shiny app can keep the window the user picked with range = input$<outputId>_zoom$range (see GC_events()(zoom = TRUE)). The chart keeps the window the user picked when it is drawn again with the same data, the same range and mode and the same GC_events()(render_id = ); a new render_id marks a new load, which starts at range again.
modeHow the window applies to the clusters: "relative" (default) zooms every cluster to the same share of its own range, e.g. range = c(0.25, 0.5) for its second quarter, which suits clusters of different genomes. "absolute" shows the same base pairs in every cluster, e.g. range = c(12000, 18000), and the slider spans the range of all clusters.
minThe narrowest window, in the units of mode (default 1% of the slider).
update"live" (default) draws the chart while the slider moves, "release" when it is let go, for large charts.
heightHeight of the slider in pixels (default 24). The clusters make room for it.
overviewLogical, whether the slider shows the genes of each cluster, one row per cluster, in the colours of their group (default TRUE).
colorOne colour for the genes of the overview instead of their group colours.
style, windowStyle, handleStyleNamed lists of CSS styles of the slider track, the window and the two handles, e.g. style = list(backgroundColor = "#eeeeee").

Value ​

The GC chart object with the zoom slider.

Details ​

The chart is drawn again for each window: genes, labels, links, coordinates and annotations follow the window, and parts outside it are cut off at the edges of the plot area. The axis shows the ticks of the window. The window of GC_scale()(start, end) is the whole range the slider covers. Text moved by dragging (GC_events()(drag = TRUE)) keeps its offset. Saved images leave out the slider and the room it takes.

In Shiny, GC_events()(zoom = TRUE) reports the window, and GC_zoom_to() sets it from the server.

See also ​

GC_zoom_to(), GC_events(), GC_scale()

Examples ​

r
GC_chart(ophA_clusters, cluster = "cluster", group = "class",
         height = "300px") %>%
  GC_labels("name") %>%
  GC_zoom(range = c(0.2, 0.6))

# The same base pairs in every cluster
GC_chart(ophA_clusters, cluster = "cluster", group = "class",
         height = "300px") %>%
  GC_zoom(mode = "absolute", update = "release", height = 30,
          handleStyle = list(backgroundColor = "#d9d9d9"))