plot.alignment {SeqAlignR}R Documentation

Plot Alignment Matrix

Description

Produces a plot displaying the alignment matrix of seq1 and seq2.

Usage

## S3 method for class 'alignment'
plot(x, ...)

Arguments

x

Object of class alignment (see align_sequences).

...

Additional parameters to be passed to the plot() function.

Details

The first sequence (seq1) is represented by the columns and the second sequence (seq2) is represented by the rows. The first column and first row are left bank, meaning a gap. Each cell in the matrix displays the score. The subtitle states the match, mismatch and gap penalty d used in the algorithm. A mismatch is shown by the red arrows, a match by the blue arrows, and a gap by the green arrows. The alignment(s) with the highest score are highlighted with thick gray borders.

Value

Plot of the alignment matrix.

References

The implementation is inspired by the visualization (code) by Kamil Slowikowski (ORCID).

Examples

seq1 <- "GCATGCG"
seq2 <- "GATTACA"
# Run the Needleman-Wunsch algorithm
alignment1 <- align_sequences(seq1, seq2, d = -1, mismatch = -1, match = 1)
# Plot the matrix
plot(alignment1)


[Package SeqAlignR version 0.1.1 Index]