view_motifs {universalmotif} | R Documentation

## Plot motif logos.

### Description

Show sequence logo. If given a list of more than one motif, then the motifs are aligned with the first in the list.

### Usage

    view_motifs(motifs, use.type = "ICM", method = "PCC", tryRC = TRUE,
      min.overlap = 6, min.mean.ic = 0.25, relative_entropy = FALSE,
      normalise.scores = FALSE, min.position.ic = 0, score.strat = "sum",
      return.raw = FALSE, dedup.names = FALSE, ...)

### Arguments

`motifs` | See `convert_motifs()` for acceptable motif formats.
`use.type` | `character(1)` One of `c('PCM', 'PPM', 'PWM', 'ICM')`.
`method` | `character(1)` One of PCC, EUCL, SW, KL, ALLR, BHAT, HELL, SEUCL, MAN, ALLR_LL, WEUCL, WPCC. See details.
`tryRC` | `logical(1)` Try the reverse complement of the motifs as well, report the best score.
`min.overlap` | `numeric(1)` Minimum overlap required when aligning the motifs. Setting this to a number higher then the width of the motifs will not allow any overhangs. Can also be a number between 0 and 1, representing the minimum fraction that the motifs must overlap.
`min.mean.ic` | `numeric(1)` Minimum mean information content between the two motifs for an alignment to be scored. This helps prevent scoring alignments between low information content regions of two motifs.
`relative_entropy` | `logical(1)` Change the ICM calculation affecting `min.position.ic` and `min.mean.ic`. See `convert_type()`.
`normalise.scores` | `logical(1)` Favour alignments which leave fewer unaligned positions, as well as alignments between motifs of similar length. Similarity scores are multiplied by the ratio of aligned positions to the total number of positions in the larger motif, and the inverse for distance scores.
`min.position.ic` | `numeric(1)` Minimum information content required between individual alignment positions for it to be counted in the final alignment score. It is recommended to use this together with `normalise.scores = TRUE`, as this will help punish scores resulting from only a fraction of an alignment.
`score.strat` | `character(1)` How to handle column scores calculated from motif alignments. "sum": add up all scores. "a.mean": take the arithmetic mean. "g.mean": take the geometric mean. "median": take the median. "wa.mean", "wg.mean": weighted arithmetic/geometric mean. "fzt": Fisher Z-transform. Weights are the total information content shared between aligned columns.
`return.raw` | `logical(1)` Instead of returning a plot, return the aligned named matrices used to generate the plot. This can be useful if you wish to use `view_motifs()` alignment capabilities for custom plotting uses. Alignment is performed by adding empty columns to the left or right of motifs to generate matrices of equal length.
`dedup.names` | `logical(1)` Plotting motifs with duplicated names is not allowed. Setting this to `TRUE` allows the names to be modified for plotting.
`...` | Additional options for `ggseqlogo::geom_logo()`.

### Details

Since the ggseqlogo package can only plot individual characters and not strings, plotting the `multifreq` slot is not supported. See the `examples` section for plotting the `multifreq` slot using the Logolas package.

See `compare_motifs()` for more info on comparison parameters.

Note: `score.strat = "a.mean"` is NOT recommended, as `view_motifs()` will not discriminate between two alignments with equal mean scores, even if one alignment is longer than the other.

### Value

A ggplot object. If `return.raw = TRUE`, a list.

### Author(s)

Benjamin Jean-Marie Tremblay, b2tremblay@uwaterloo.ca

### References

Dey KK, Xie D, Stephens M (2017). “A new sequence logo plot to highlight enrichment and depletion.” bioRxiv, p.226597.

Wagih O (2017). ggseqlogo: A 'ggplot2' Extension for Drawing Publication-Ready Sequence Logos. R package version 0.1, https://CRAN.R-project.org/package=ggseqlogo.

### See Also

`compare_motifs()`, `add_multifreq()`

### Examples

    ## plotting multifreq motifs:
    ## Not run:
      motif <- create_motif()
      motif <- add_multifreq(motif, sample_sites(motif))
      Logolas::logomaker(motif["multifreq"][["2"]], type = "Logo",
                         color_type = "per_symbol")

    ## End(Not run)

[Package universalmotif version 1.5.36 Index]