Skip to contents

This function updates a GC chart by modifying the coordinates settings. It allows for showing or hiding tick values, applying custom tick values for the top and bottom axes, and supports several other customizations for specific or all clusters in the chart.

Usage

GC_coordinates(
  GC_chart,
  show = TRUE,
  tickValuesTop = NULL,
  tickValuesBottom = NULL,
  ticksFormat = NULL,
  tickStyle = list(),
  textStyle = list(),
  cluster = NULL,
  groupStyle = NULL,
  style_by = NULL,
  ...
)

Arguments

GC_chart

The GC chart object to be modified.

show

Logical, whether to show the tick values or not. Can be a single value or a vector.

tickValuesTop

Numeric vector or NULL, custom tick values to be used at the top of the cluster. If NULL, the default tick values are used.

tickValuesBottom

Numeric vector or NULL, custom tick values to be used at the bottom of the cluster. If NULL, the default tick values are used.

ticksFormat

Format for tick labels. Default is ",.0f".

tickStyle

List, styling options for the ticks.

textStyle

List, styling options for the text.

cluster

Numeric or character vector or NULL; specifies which clusters to generate coordinates for. If NULL, labels will be applied to all clusters. Default is NULL.

groupStyle

Named list of styles by group, applied to the coordinates of all genes of that group (the group of GC_chart(), or the column given in style_by). show = FALSE leaves out their coordinates, styles in tick go to their ticks and the other styles to their text, e.g. list(other = list(show = FALSE), tnsA = list(fill = "red")). Only for the coordinates computed from the genes, not for tickValuesTop or tickValuesBottom.

style_by

Column name or NULL; the column whose values groupStyle is matched against. Default is NULL: the group of GC_chart(). the coordinate modifications. If NULL, applies to all clusters.

...

Additional arguments to be passed to the coordinate options.

Value

Returns the GC chart object with updated coordinates.

Examples

genes_data <- data.frame(
  start = c(10, 90, 130, 170, 210),
  end = c(40, 120, 160, 200, 240),
  name = c('Gene 1', 'Gene 2', 'Gene 3', 'Gene 4', 'Gene 5'),
  cluster = c(1, 1, 2, 2, 2)
)

# Add coordinates to all clusters
GC_chart(genes_data, cluster = "cluster", group = "name", height = "200px") %>%
GC_coordinates()
# Modify coordinates of a specific cluster GC_chart(genes_data, cluster = "cluster", group = "name", height = "200px") %>% GC_coordinates() %>% GC_coordinates( cluster = 2, show = TRUE, tickValuesTop = c(130, 170, 210, 240), tickValuesBottom = c(160, 200), ticksFormat = ",.0f", # ".2s", rotate = -45, yPositionTop = 55, yPositionBottom = 45, overlapThreshold = 20, tickStyle = list( stroke = "black", strokeWidth = 1, lineLength = 6 ), textStyle = list( fill = "black", fontSize = "12px", fontFamily = "Arial", cursor = "default" ) )