Fills the genes, exons and legend markers with a pattern per group, for example for black and white figures. Patterns can also be drawn on top of the gene colours to show each group with both a colour and a pattern.
Usage
GC_pattern(
GC_chart,
patterns = NULL,
color = "black",
background = "white",
size = 6,
strokeWidth = 1
)Arguments
- GC_chart
The gene chart object to be modified.
- patterns
NULL, a vector of pattern names or a named list of pattern names by group. NULL gives each group a pattern in a fixed order. A vector is recycled over the groups. Available patterns: "none", "solid", "horizontal", "vertical", "diagonal", "antidiagonal", "grid", "crosshatch", "dots", "zigzag", "checkerboard", "rings", "bricks", "plus", "wideStripes" and "inverseDots" (background-coloured dots on a solid tile).
- color
The colour of the pattern lines and dots: a single colour, a vector of colours recycled over the groups, or a named list of colours by group. For example,
color = "white"withbackground = "black"gives white patterns on black.- background
The colour behind the pattern: a single colour, a vector of colours recycled over the groups, or a named list of colours by group. NULL keeps the gene colours set by
GC_color(). Whenbackgroundis not NULL, intron lines and UTR outlines takecolor.- size
Numeric, the width and height of one pattern tile in pixels.
- strokeWidth
Numeric, the width of the pattern lines in pixels.
Examples
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)
)
# Black and white
GC_chart(genes_data, cluster = "cluster", group = "group", height = "150px") %>%
GC_pattern()
# Chosen patterns on grey backgrounds
GC_chart(genes_data, cluster = "cluster", group = "group", height = "150px") %>%
GC_pattern(
patterns = list(A = "dots", B = "crosshatch", C = "none"),
background = c("white", "grey80")
)
# Patterns on top of the gene colours
GC_chart(genes_data, cluster = "cluster", group = "group", height = "150px") %>%
GC_pattern(background = NULL)
# White patterns on black for group C
GC_chart(genes_data, cluster = "cluster", group = "group", height = "150px") %>%
GC_pattern(
patterns = list(A = "checkerboard", B = "rings", C = "bricks"),
color = list(A = "black", B = "black", C = "white"),
background = list(A = "white", B = "white", C = "black")
)
