View and Align Multiple Sequences

Overview of the Sequence Alignment and Phylogenetic Tree Apps

The Sequence Alignment app integrates many sequence and multiple alignment functions in the toolbox. Instead of entering commands in the MATLAB® Command Window, you can use this app to visually inspect a multiple alignment and make manual adjustments.

The Phylogenetic Tree app allows you to view, edit, and explore phylogenetic tree data. It also allows branch pruning, reordering, renaming, and distance exploring. It can also open or save Newick or ClustalW tree formatted files.

Load Sequence Data and Viewing the Phylogenetic Tree

Load unaligned sequence data into the MATLAB environment, and create a phylogenetic tree.

  1. Load sequence data.

    load primates.mat
  2. Create a phylogenetic tree.

    tree = seqlinkage(seqpdist(primates),'single', primates);
  3. View the phylogenetic tree.

    phytreeviewer(tree)

Select a Subset of Data from the Phylogenetic Tree

Select the human and chimp branches.

  1. From the toolbar, click the Prune icon.

  2. Click the branches to prune (remove) from the tree. For this example, click the branch nodes for gorillas, orangutans, and Neanderthals.

  3. Export the selected branches to a second tree. Select File > Export to Workspace, and then select Only Displayed.

  4. In the Export to dialog box, enter the name of a variable. For example, enter tree2, and then click OK.

  5. Extract sequences from the tree object.

    primates2 = primates(seqmatch(get(tree2, 'Leafnames'),{primates.Header}));

Align Multiple Sequences

After selecting a set of related sequences, you can align them and view the results.

  1. Align multiple sequences.

    ma = multialign(primates2);
  2. View the aligned sequences in the Sequence Alignment app.

    seqalignviewer(ma);

    The aligned sequences appear as shown below.

Adjust Multiple Sequence Alignments Manually

Algorithms for aligning multiple sequences do not always produce an optimal result. By visually inspecting the alignment, you can identify areas that could use a manual adjustment to improve the alignment.

  1. Identify an area where you could improve the alignment.

  2. Click a letter to select it, and then move the cursor over the red direction bar. The cursor changes to a hand.

  3. Click and drag the sequence to the right to insert a gap. If there is a gap to the left, you can also move the sequence to the left and eliminate the gap.

    Alternately, to insert a gap, select a character, and then click the Insert Gap icon on the toolbar or press the spacebar.

      Note:   You cannot delete or add letters to a sequence, but you can add or delete gaps. If all of the sequences at one alignment position have gaps, you can delete that column of gaps.

  4. Continue adding gaps and moving sequences to improve the alignment.

Close the Sequence Alignment App

Close the Sequence Alignment app from the MATLAB command line using the following syntax:

seqalignviewer('close')
Was this topic helpful?