Skip to content

Create a GC Chart Visualization ​

Generates an interactive GC chart for genomic data.

Usage ​

r
GC_chart(
  data,
  start = "start",
  end = "end",
  cluster = NULL,
  group = NULL,
  strand = NULL,
  width = "100%",
  height = "400px",
  style = list(),
  elementId = NULL,
  save_button = TRUE
)

Arguments ​

ArgumentDescription
dataData frame containing genomic information or the file path to a folder containing .gbk files. When providing a file path, the data is loaded and processed into a data frame internally.
startColumn name that indicates start positions. Default is "start".
endColumn name that indicates end positions. Default is "end".
clusterOptional column name used for clustering purposes. Default is NULL.
groupColumn name used for gene grouping to influence color aesthetics.
strandOptional column name indicating strand orientation. Acceptable values include 1, 'forward', 'sense', or '+' to represent the forward strand, and -1, 0, 'reverse', 'antisense', "complement" or '-' to represent the reverse strand. Default is NULL, meaning strand information is not used.
widthWidth specification for the chart, such as '100%' or 500. Default is unspecified.
heightHeight specification for the chart, such as '400px' or 300. Default is unspecified.
styleA list of CSS styles to be applied to the chart container. Each element of the list should be a valid CSS property-value pair. For example, list(backgroundColor = "white", border = "2px solid black"). Default is an empty list.
elementIdOptional identifier string for the widget. Default is NULL.
save_buttonLogical, whether to include a save button to save the chart as SVG or PNG. Default is TRUE.

Value ​

A GC chart widget.

Examples ​

r
genes_data <- data.frame(
  start = c(10, 50, 90, 130, 170, 210),
  end = c(40, 80, 120, 160, 200, 240),
  name = c('Gene 1', 'Gene 2', 'Gene 3', 'Gene 4', 'Gene 5', 'Gene 6'),
  group = c('A', 'A', 'B', 'B', 'A', 'C'),
  cluster = c(1, 1, 1, 2, 2, 2)
)
# Load from data.frame
GC_chart(genes_data, group = "group", cluster = "cluster", height = "200px") %>%
GC_labels("name")

# Load from a GenBank file (or a folder of .gbk files)
gbk_file <- system.file("extdata", "BGC0000001.gbk", package = "geneviewer")
GC_chart(gbk_file, height = "200px")