Skip to content

Align gene clusters ​

This function aligns clusters based on a specified gene id. The clusters are shifted so the gene sits at the same place in each of them, and all clusters keep the same scale: genes of the same length are drawn at the same width. The alignment is kept when GC_scale() is called afterwards, also with axis_type = "range".

Usage ​

r
GC_align(GC_chart, id_column, id, align = "left")

Arguments ​

ArgumentDescription
GC_chartA chart object containing genomic data along with clustering information.
id_columnThe name of the column that contains the gene identifiers.
idThe specific identifier of the gene to be aligned.
alignThe alignment method for the gene. Valid values are "left", "right", or "center". Defaults to "left".

Value ​

The modified GC_chart object with updated genomic coordinates.

Examples ​

r
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'),
  group = c('A', 'B', 'C', 'C', 'A'),
  cluster =  c(1, 1, 1, 2, 2)
)


GC_chart(genes_data, group = "group", cluster = "cluster", height = "150px") %>%
  GC_align("group", "A", align = "left") %>%
  GC_legend(FALSE)