Type: Package
Title: A 'ggplot2' Extension for Drawing Publication-Ready Sequence Logos
Version: 0.2
Date: 2024-02-08
Author: Omar Wagih
Maintainer: Omar Wagih <omarwagih@gmail.com>
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.
License: LGPL-2 | LGPL-2.1 | LGPL-3 [expanded from: LGPL]
URL: https://github.com/omarwagih/ggseqlogo
BugReports: https://github.com/omarwagih/ggseqlogo/issues
Encoding: UTF-8
Imports: ggplot2
RoxygenNote: 6.0.1
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2024-02-08 17:47:13 UTC; omarwagih
Repository: CRAN
Date/Publication: 2024-02-09 00:20:08 UTC

Description

Plots sequence logo as a layer on ggplot

Usage

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, ...)

Arguments

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 list_fonts for available fonts.

stack_width

Width of letter stack between 0 and 1 (default: 0.95)

rev_stack_order

If TRUE, order of letter stack is reversed (default: FALSE)

col_scheme

Color scheme applied to the sequence logo. See list_col_schemes for available fonts. (default: "auto", color scheme is automatically picked based on seq_type). One can also pass custom color scheme objects created with the make_col_scheme function

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 FALSE, plotting data is returned

...

Additional arguments passed to layer params

Examples

# Load sample data
data(ggseqlogo_sample)

# Produce single sequence logo using geom_logo
p1 = ggseqlogo( seqs_dna[[1]] ) 


Description

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.

Usage

ggseqlogo(data, facet = "wrap", scales = "free_x", ncol = NULL,
  nrow = NULL, ...)

Arguments

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 facet_wrap

ncol

Number of columns, works only when facet='wrap', see facet_wrap

nrow

Number of rows, same as ncol

...

Additional arguments passed to geom_logo

Examples

# 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

Description

List color schemes available in ggseqlogo

Usage

list_col_schemes(v = T)

Arguments

v

If true, font names are printed to stderr. Otherwise, color scheme names are returned as a character vector


List fonts available in ggseqlogo

Description

List fonts available in ggseqlogo

Usage

list_fonts(v = T)

Arguments

v

If true, font names are printed to stderr. Otherwise, font names are returned as a character vector


Create new sequence logo color scheme

Description

Create new sequence logo color scheme

Usage

make_col_scheme(chars = NULL, groups = NULL, cols = NULL, values = NULL,
  name = "")

Arguments

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

Examples


# 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

Description

List of position frequency matrices for transcription factors


List of aligned kinase-substrate binding sequences

Description

List of aligned kinase-substrate binding sequences


List of aligned transcription factor binding sequences

Description

List of aligned transcription factor binding sequences


Description

ggseqlogo custom theme

Usage

theme_logo(base_size = 12, base_family = "")

Arguments

base_size

font base size

base_family

font base family