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
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
- GC_chart
The chart object to be modified.
- transcript
Optional column name used for clustering transcript data. Default is NULL.
- type
Column name identifying the feature type ("UTR", "exon"). Default is NULL.
- strand
Optional 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.
- group
Optional column name used for transcript grouping to influence color aesthetics.
- selection
Numeric or character, the specific transcript to filter transcripts by.
- show
Logical, whether to show the transcripts or not.
- colorScheme
Character 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 noselectionis made, the legend uses the same colours. NULL keeps the colours set byGC_color().- customColors
List 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
selectionis made, the legend uses the same colours.- styleExons
List, styles to apply to exons in the chart.
- styleIntrons
List, styles to apply to introns in the chart.
- styleUTRs
List, styles to apply to UTRs in the chart.
- itemStyleExons
List, a list of styles to apply to individual exons in the chart.
- itemStyleIntrons
List, a list of styles to apply to individual introns in the chart.
- itemStyleUTRs
List, a list of styles to apply to individual UTRs in the chart.
- groupStyleExons, groupStyleIntrons, groupStyleUTRs
Named lists of styles by group, applied to all exons, introns or UTRs of that group (of
group, or of the column given instyle_by), e.g.groupStyleExons = list(tx1 = list(fill = "red")). They take the same options as the matchingitemStyle, which takes precedence.- style_by
Column name or NULL; the column whose values the group styles are matched against. Default is NULL:
group.- labelOptions
List, options for styling labels such as font size, color, and position.
- ...
Additional arguments to be passed to the gene options.
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
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")
)
)
