Skip to content

Modify Transcript Characteristics within a Chart ​

This function updates the chart with specific characteristics for transcripts based on the given parameters. It can show/hide transcripts, apply a color scheme, assign custom colors, filter by cluster, and accept additional options.

Usage ​

r
GC_transcript(
  GC_chart,
  transcript = NULL,
  type = NULL,
  strand = NULL,
  group = NULL,
  selection = NULL,
  show = TRUE,
  colorScheme = NULL,
  customColors = NULL,
  styleExons = list(),
  styleIntrons = list(),
  styleUTRs = list(),
  itemStyleExons = list(),
  itemStyleIntrons = list(),
  itemStyleUTRs = list(),
  groupStyleExons = NULL,
  groupStyleIntrons = NULL,
  groupStyleUTRs = NULL,
  style_by = NULL,
  labelOptions = list(),
  ...
)

Arguments ​

ArgumentDescription
GC_chartThe chart object to be modified.
transcriptOptional column name used for clustering transcript data. Default is NULL.
typeColumn name identifying the feature type ("UTR", "exon"). Default is NULL.
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.
groupOptional column name used for transcript grouping to influence color aesthetics.
selectionNumeric or character, the specific transcript to filter transcripts by.
showLogical, whether to show the transcripts or not.
colorSchemeCharacter or NULL, the name of the color scheme to use: a d3 scheme (e.g. "schemeSet2") or a geneviewer palette (e.g. "okabeIto", see geneviewer_palette()). When no selection is made, the legend uses the same colours. NULL keeps the colours set by GC_color().
customColorsList or NULL, custom colors to apply to the genes: a vector of colours, recycled over the groups, or a named list of colours by group. Groups left out of a named list keep the colours of the colour scheme. When no selection is made, the legend uses the same colours.
styleExonsList, styles to apply to exons in the chart.
styleIntronsList, styles to apply to introns in the chart.
styleUTRsList, styles to apply to UTRs in the chart.
itemStyleExonsList, a list of styles to apply to individual exons in the chart.
itemStyleIntronsList, a list of styles to apply to individual introns in the chart.
itemStyleUTRsList, a list of styles to apply to individual UTRs in the chart.
groupStyleExons, groupStyleIntrons, groupStyleUTRsNamed lists of styles by group, applied to all exons, introns or UTRs of that group (of group, or of the column given in style_by), e.g. groupStyleExons = list(tx1 = list(fill = "red")). They take the same options as the matching itemStyle, which takes precedence.
style_byColumn name or NULL; the column whose values the group styles are matched against. Default is NULL: group.
labelOptionsList, options for styling labels such as font size, color, and position.
...Additional arguments to be passed to the gene options.

Value ​

Returns the modified gene chart object.

Details ​

The first call of GC_transcript() makes the chart again with the transcripts as clusters. Settings of the whole chart made before it (e.g. GC_title(), GC_legend(), GC_theme() and the margins of GC_grid()) are kept. Settings per cluster (e.g. GC_labels(), GC_clusterTitle()) are for the old clusters: set them after GC_transcript().

Examples ​

r
transcript_data <- data.frame(
  transcript = c("transcript1", "transcript1", "transcript1", "transcript1",
                 "transcript2", "transcript2", "transcript2"),
  type = c("5_utr", "exon", "exon", "3_utr",
           "5_utr", "exon", "3_utr"),
  start = c(1, 101, 201, 301,
            1, 101, 301),
  end = c(50, 150, 250, 350,
          50, 150, 350),
  strand = rep("forward", 7)
)

# All default transcript settings
GC_chart(
  transcript_data,
  start = "start",
  end = "end",
  height = "200px"
) %>%
  GC_transcript(
    transcript = "transcript",
    strand = "strand",
    type = "type",
    group = NULL,
    show = TRUE,
    selection = NULL,
    colorScheme = NULL,
    customColors = NULL,
    styleExons = list(
      show = TRUE,
      strokeWidth = 0,
      cursor = "default",
      marker = "box",
      markerSize = "medium",
      arrowheadWidth = NULL,
      arrowheadHeight = NULL,
      markerHeight = NULL,
      cornerRadius = NULL
      # Any other CSS style
    ),
    styleIntrons = list(
      show = TRUE,
      strokeWidth = 1,
      fill = "none",
      cursor = "default",
      marker = "intron",
      markerSize = "medium",
      arrowheadWidth = NULL,
      arrowheadHeight = NULL,
      markerHeight = NULL,
      cornerRadius = NULL
      # Any other CSS style
    ),
    styleUTRs = list(
      show = TRUE,
      fontSize = "10px",
      fontStyle = "normal",
      fontFamily = "sans-serif",
      cursor = "default",
      color = "black",
      fill = "#FFF",
      strokeWidth = 1,
      marker = "box",
      markerSize = "medium",
      arrowheadWidth = NULL,
      arrowheadHeight = NULL,
      markerHeight = NULL,
      cornerRadius = NULL
      # Any other CSS style
    ),
    labelOptions = list(
      show = TRUE,
      xOffset = 2,
      yOffset = 0,
      fontSize = "12px",
      fontStyle = "normal",
      fontWeight = "normal",
      fontFamily = "sans-serif",
      cursor = "default",
      color = "black"
    ),
    itemStyleExons = list(),
    itemStyleIntrons = list(),
    itemStyleUTRs = list()
  )
# Change the appearance of a specific intron
GC_chart(transcript_data,
         start = "start",
         end = "end",
         height = "200px"
) %>%
  GC_transcript(
    transcript = "transcript",
    type = "type",
    selection = 2,
    itemStyleExons = list(list(index = 0, fill = "red")
    )
  )