Title: | A 'ggplot2' Extension for Drawing Publication-Ready Sequence Logos |
---|---|
Description: | The extensive range of functions provided by this package makes it possible to draw highly versatile sequence logos. Features include, but not limited to, modifying colour schemes and fonts used to draw the logo, generating multiple logo plots, and aiding the visualisation with annotations. Sequence logos can easily be combined with other plots 'ggplot2' plots. |
Authors: | Omar Wagih |
Maintainer: | Omar Wagih <[email protected]> |
License: | LGPL |
Version: | 0.1 |
Built: | 2024-11-12 06:27:12 UTC |
Source: | https://github.com/omarwagih/ggseqlogo |
Plots sequence logo as a layer on ggplot
geom_logo(data = NULL, method = "bits", seq_type = "auto", namespace = NULL, font = "roboto_medium", stack_width = 0.95, rev_stack_order = F, col_scheme = "auto", low_col = "black", high_col = "yellow", na_col = "grey20", plot = T, ...)
geom_logo(data = NULL, method = "bits", seq_type = "auto", namespace = NULL, font = "roboto_medium", stack_width = 0.95, rev_stack_order = F, col_scheme = "auto", low_col = "black", high_col = "yellow", na_col = "grey20", plot = T, ...)
data |
Character vector of sequences or named list of sequences. All sequences must have same width. |
method |
Height method, can be one of "bits" or "probability" (default: "bits") |
seq_type |
Sequence type, can be one of "auto", "aa", "dna", "rna" or "other" (default: "auto", sequence type is automatically guessed) |
namespace |
Character vector of single letters to be used for custom namespaces. Can be alphanumeric, including Greek characters. |
font |
Name of font. See |
stack_width |
Width of letter stack between 0 and 1 (default: 0.95) |
rev_stack_order |
If |
col_scheme |
Color scheme applied to the sequence logo. See |
low_col , high_col
|
Colors for low and high ends of the gradient if a quantitative color scheme is used (default: "black" and "yellow"). |
na_col |
Color for letters missing in color scheme (default: "grey20") |
plot |
If |
... |
Additional arguments passed to layer params |
# Load sample data data(ggseqlogo_sample) # Produce single sequence logo using geom_logo p1 = ggseqlogo( seqs_dna[[1]] )
# Load sample data data(ggseqlogo_sample) # Produce single sequence logo using geom_logo p1 = ggseqlogo( seqs_dna[[1]] )
ggseqlogo
is a shortcut for generating sequence logos.
It adds the ggseqlogo theme theme_logo
by default, and facets when multiple input data are provided.
It serves as a convenient wrapper, so to customise logos beyond the defaults here, please use geom_logo
.
ggseqlogo(data, facet = "wrap", scales = "free_x", ncol = NULL, nrow = NULL, ...)
ggseqlogo(data, facet = "wrap", scales = "free_x", ncol = NULL, nrow = NULL, ...)
data |
Character vector of sequences or named list of sequences. All sequences must have same width |
facet |
Facet type, can be 'wrap' or 'grid' |
scales |
Facet scales, see |
ncol |
Number of columns, works only when |
nrow |
Number of rows, same as |
... |
Additional arguments passed to |
# Load sample data data(ggseqlogo_sample) # Plot a single DNA sequence logo p1 = ggseqlogo( seqs_dna[[1]] ) print(p1) # Plot multiple sequence logos at once p2 = ggseqlogo( seqs_dna ) print(p2)
# Load sample data data(ggseqlogo_sample) # Plot a single DNA sequence logo p1 = ggseqlogo( seqs_dna[[1]] ) print(p1) # Plot multiple sequence logos at once p2 = ggseqlogo( seqs_dna ) print(p2)
List color schemes available in ggseqlogo
list_col_schemes(v = T)
list_col_schemes(v = T)
v |
If true, font names are printed to stderr. Otherwise, color scheme names are returned as a character vector |
List fonts available in ggseqlogo
list_fonts(v = T)
list_fonts(v = T)
v |
If true, font names are printed to stderr. Otherwise, font names are returned as a character vector |
Create new sequence logo color scheme
make_col_scheme(chars = NULL, groups = NULL, cols = NULL, values = NULL, name = "")
make_col_scheme(chars = NULL, groups = NULL, cols = NULL, values = NULL, name = "")
chars |
Vector of one letter characters |
groups |
Vector of groups for letters with same length as chars (optional if cols parameter is provided) |
cols |
Vector of colors with same length as chars (optional if values parameter is provided) |
values |
Vector of numerical values with same length as chars |
name |
Name of color scheme |
# Discrete color scheme examples cs1 = make_col_scheme(chars=c('A', 'T', 'G', 'C'), groups=c('g1', 'g1', 'g2', 'g2'), cols=c('red', 'red', 'blue', 'blue'), name='custom1') cs2 = make_col_scheme(chars=c('A', 'T', 'G', 'C'), cols=c('red', 'red', 'blue', 'blue'), name='custom2') # Quantitative color scheme cs3 = make_col_scheme(chars=c('A', 'T', 'G', 'C'), values=1:4, name='custom3')
# Discrete color scheme examples cs1 = make_col_scheme(chars=c('A', 'T', 'G', 'C'), groups=c('g1', 'g1', 'g2', 'g2'), cols=c('red', 'red', 'blue', 'blue'), name='custom1') cs2 = make_col_scheme(chars=c('A', 'T', 'G', 'C'), cols=c('red', 'red', 'blue', 'blue'), name='custom2') # Quantitative color scheme cs3 = make_col_scheme(chars=c('A', 'T', 'G', 'C'), values=1:4, name='custom3')
List of position frequency matrices for transcription factors
List of aligned kinase-substrate binding sequences
List of aligned transcription factor binding sequences
ggseqlogo custom theme
theme_logo(base_size = 12, base_family = "")
theme_logo(base_size = 12, base_family = "")
base_size |
font base size |
base_family |
font base family |