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(), taxon_labels = FALSE,
  columns = c(), exclude_taxa = FALSE, exclude_columns = FALSE,
  include_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

taxon_labels

Boolean argument indicating that the Y-axis should be labeled with taxon names. Default: False

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

include_columns

Boolean argument indicating that columns should be included 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

sjspielman/alignfigR documentation built on Oct. 20, 2021, 4:19 p.m.