plot_alignment: Plot a multiple sequence alignment

Description Usage Arguments Value Examples

View source: R/alignfigR.R

Description

This function uses ggplot (in particular, w/ geom_rect) to plot a sequence alignment

Usage

1
2
3
plot_alignment(seq_list, palette = NA, taxa = c(), columns = c(),
  exclude_taxa = FALSE, exclude_columns = FALSE,
  legend_title = "Character")

Arguments

seq_list

Sequence list parsed using the function 'read_alignment'

palette

Named-array mapping sequence to color or a pre-defined color scheme (random, rainbow, etc.)

taxa

Array of taxa (the actual labels, not order) intended to restrict figure to or to exclude from figure.

columns

Array of columns (indexed from 1) intended to restrict figure to or to exclude from figure.

exclude_taxa

Boolean argument indicating that taxa should be excluded from plot. Default: False

exclude_columns

Boolean argument indicating that columns should be excluded from plot. Default: False

legend_title

String determining title of legend. Default: "Character"

Value

ggplot object which may be saved or edited as desired

Examples

1
2
3
4
5
6
7
fasta_file <- system.file("extdata", "example.fasta", package = "alignfigR")
plot_frame <- read_alignment(file = fasta_file)
align_plot <- plot_alignment(plot_frame, "DNA")
align_plot <- plot_alignment(plot_frame, "protein")
align_plot <- plot_alignment(plot_frame, taxa = c("Cow", "Whale"), columns = c(1:25))
align_plot <- plot_alignment(plot_frame, taxa = c("Whale"), exclude_taxa = TRUE)
align_plot <- plot_alignment(plot_frame, legend_title = "") ## Remove the title

Example output

Welcome to alignfigR!

alignfigR documentation built on May 1, 2019, 9:11 p.m.