Learn R Programming

alignfigR (version 0.1.1)

plot_alignment: Plot a multiple sequence alignment

Description

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

Usage

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

Run this code
# NOT RUN {
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
# }

Run the code above in your browser using DataLab