| plot.alignment | R Documentation |
Produces a plot displaying the alignment matrix of seq1 and seq2.
## S3 method for class 'alignment'
plot(x, ...)
x |
Object of class |
... |
Additional parameters to be passed to the |
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.
Plot of the alignment matrix.
The implementation is inspired by the visualization (code) by Kamil Slowikowski (ORCID).
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.