Creating dot plots for alignment visualizations
Dot plots of pairs of aligned sequences are possibly the oldest alignment visualization. In these plots, the positions of two sequences are plotted on the x axis and y axis, and for every coordinate in that space, a point is drawn if the letters (nucleotides or amino acids) correspond at that (x,y) coordinate. Since the plot can show regions that match that aren’t generally in the same region of the two sequences (as lines away from the diagonal), the plot is a good way to visually spot insertions and deletions and structural rearrangements in the two sequences. In this recipe, we’ll look at a speedy method for constructing a dot plot using the dotplot
package and a bit of code for getting a grid plot of all pairwise dot plots for sequences in a file.
Getting ready
We’ll need the bhlh.fa
file, which contains three basic helix-loop-helix (bHLH) transcription factor sequences from pea, soy, and lotus
. The file...