Edit alignments
The Alignment view (
) is the primary, graphical view of an alignment.
Zooming in and out in this view allows different levels of detail to be considered, from individual residues and gaps when zoomed in, to the general form of large regions when zoomed out. The alignment can also be edited in various ways.
This section focuses on functionality specific to the Alignment view, in particular, functionality not already described in the section about working with individual sequences.
Topics covered:
- Marking sequences and working with marked sequences
- Changing the sequence order
- Selecting residues in alignments
- Editing, including working with gaps
- Deleting sequences from an alignment
- Renaming a sequence in an alignment
- Copying annotations to other sequences
- Adding sequences to an alignment
Marking sequences and working with marked sequences
Sequences in an alignment can be marked (figure 25.11), and those marked sequences can then be removed from the alignment or manually moved, as a set, in a single action. The order of the sequences in the alignment can also be sorted based on marked status.
Marking sequences is intended for interactive use. The marked status of a sequence is not saved when the alignment is closed.
Marking sequences To mark a sequence, click once on its label or check the selection checkbox to the right of the sequence label. The labels of marked sequences are highlighted.
Checkboxes for marking sequences are not displayed by default. To show these, check the Show selection boxes option in the Sequence layout Side Panel palette.
Clicking once on an additional sequence name, or in an additional checkbox, marks an additional sequence.
To simultaneously mark multiple sequences:
- After marking one sequence, keep the Shift key depressed and click on another sequence name, or in another selection checkbox. The sequence clicked on, along with all sequences between it and the first sequence marked, will be marked.
- Right-click a selection checkbox, and choose the Mark All option.
- Right-click a selection checkbox, and choose the Invert All Marks option.
Mark All and Invert All Marks can be useful when most sequences should be marked.
Clearing marks Clearing marked status can be done in a number of ways:
- Unmark a single sequence:
- Click the name of a marked sequence once.
- Click a checked selection checkbox once.
- Unmark all marked sequences:
- With selection checkboxes displayed (described above), right-click any checkbox and choose the menu option Clear All Marks.
- Close the Sequence List (saving changes if desired) and re-open it. Mark status is not stored when closing an element.
Figure 25.11: Selection boxes are being displayed, and sequences ATP8a1 and O94296 have been marked. The selection box next for sequence P57792 has been right-clicked, opening a menu with options for marking, unmarking or inverting the marked status for all sequences in the alignment.
Changing the sequence order
To change the order of sequences in the alignment:
- Drag marked sequences Click the label of a marked sequence and drag the cursor up or down to change the position of that sequence and all other marked sequences.
- Drag an individual sequence Click the label of a single sequence and drag the cursor up or down to change the position of that sequence.
Note: The position of a single sequence cannot be changed if other sequences are marked. To move a single sequence, either clear all marks (see above), mark just this one sequence, or use the Table view instead and drag the individual row to the desired location.
- Move a sequence to the top of the alignment Right-click on a sequence label, or anywhere in the row representing that sequence, and choose the option Move Sequence to Top from the menu (figure 25.12).
This can be particularly useful if coloring residues according their similarity with the top sequence, for example when the Matching residues as dots option is selected in the Sequence layout palette or when the Relative to top sequence option for "Translation" has been checked for a nucleotide alignment.
- Sort the sequences in the alignment The menu opened when right-clicking on a sequence name or on a residue within a sequence includes three options for changing the order of the sequences in the alignment by sorting (figure 25.12):
- Sort Alphabetically on Name
- Sort by Marked Status
- Sort by Similarity
Notes relating to changing the sequence order:
- Changes must be saved for the updated order to be used when the Alignment is later re-opened.
- Undo and Redo functionality is available when re-ordering actions are carried out.
Figure 25.12: The context menu opened by right-clicking on residues in a sequence or by right-clicking on a label.
Selecting residues in alignments
Regions in individual sequences can be selected like in other data types that contain sequence information. Resiudes that have been selected are highlighted in purple. Positions selected in at least one sequence will be enclosed in a red box for all sequences (figure 25.13).
Figure 25.13: Two regions in three sequences have been selected, indicated by purple highlighting. Red boxes surround regions in all sequences where a selection has been made in any sequence at that position.
The selected residues in an alignment can be copied and pasted into external text editing programs, or similar, if desired. For alignment data, pasting to a monospace font such as Courier is recommended.
Selecting a region in non-adjacent sequences
To select a region in some sequences, where not all those sequences are adjacent to one another, start by selecting the region of interest in one sequence. Then hold down the Ctrl key (
on Mac) while clicking anywhere on within the same position range in each of the other sequences where the selection should be made.
Making multiple selections in different regions in an alignment
To select multiple regions in an alignment, keep the Ctrl key depressed, (
on Mac) while dragging the mouse cursor horizontally across the residues of the relevant coordinate range, and vertically, if desired, to also select that region in adjacent sequences.
Notes:
- Additional selections in any region where some positions in that region already have selections are treated as extensions of the original selection in that region.
- Selections will always be made for all the sequences already included in an earlier selection.
- If an additional sequence is included in a later selection, the regions included in other selections will now also be selected in that sequence.
To illustrate that last two points: If an alignment had 5 sequences, and bases 2 through 10 were selected in the first two sequence, and an additional selection, keeping the Ctrl key depressed, (
on Mac) of bases 15 through 20 was made in the fourth sequence, this would result in bases 2 through 10, and bases 15 through 20, being selected in first two sequences and in the fourth sequence in the alignment.
Selecting long regions in an alignment
When selecting long regions in an alignment, zooming out can help for some cases. However, for accurate end-point selection, keeping the view zoomed in and using the Shift key is recommended. Specifically: select the initial residue or residues in the desired region, scroll to where the final residue is visible, press the Shift key and then click the mouse. All residues in between the initially selected residues and this position will be selected.
If the residue clicked on while the Shift key is depressed is in a different sequence to the residue(s) initially selected, then all residues, in all sequences between the initial and final selected residue are selected.
Selecting all residues for a single, long sequence can also be achieved using a linked Table view.
Editing, including working with gaps
Repositioning gaps in the alignment
To update the positions of gaps in the alignment:
- Selecting one or more gap positions and/or residues adjacent to gap positions.
- Place the mouse cursor over one of the selected positions, and drag the selection until the gaps are in the expected location.
Note: If the cursor changes to a horizontal, double headed arrow, then dragging will extend the selected region rather than moving the position of the existing selection.
This can be done for selections on a single sequence or in a singe region selected in multiple sequences, including when selections are across non-adjacent sequences.
Figure 25.14: Residues adjacent to gaps have been selected in three sequences in an alignment (left) and then dragged leftwards, thereby repositioning the gaps adjacent to those residues (right).
Inserting gaps into the alignment
To add gaps to an alignment:
- Select a single region in one or more sequences. The length selected should equal the number of gaps to be added. For example, if 5 positions are selected, 5 gaps will be added.
- Right-click the selection and choose Add Gaps After or Add Gaps Before from the menu.
Edit residues in a sequence
Individual sequences can be edited to update or add residues. To do this:
- Select the region of interest in a single sequence.
- Right-click the selection and choose Edit Selection... (
).
- Make the desired changes in the dialog that opened and then click OK.
The alignment itself is not affected by the addition or removal of residues this way. If residues are added, gaps will be inserted in the corresponding positions of the other sequences in the alignment. If residues are removed, gaps will be inserted into the edited sequence.
Delete residues and gaps in one or more sequences
Residues or gaps can be deleted from one or more sequences simultaneously. To do this:
- Select the region to be deleted in one or more sequences.
- Right-click the selection and choose Delete Selection (
) from the menu.
Note: Deleting residues for some, but not all, sequences in an alignment using Delete Selection will change the alignment. Remaining residues in sequences are moved to the left after a deletion, potentially resulting in sequences no longer being aligned.
Subsections of an alignment can be realigned, as described in Realignment.
To remove bases or gaps without changing the alignment, edit individual sequence regions, as described above. Using that method, gaps are added to compensate for such changes.
Deleting sequences from an alignment
To delete a single sequence from the list, right-click the sequence label or any of its sequence residues and choose the option Delete Sequence from the menu.
To delete multiple sequences, mark those to be removed, right-click any sequence label or sequence residue, and choose the option Delete Marked Sequences from the menu.
Sequences can also be deleted using the Table view (
).
Renaming a sequence in an alignment
To rename a sequence in the alignment.
- Right-click the sequence label.
- Choose Rename Sequence... from the menu and enter a new name in the dialog that opens.
If the sequence label has been changed so that something other than the name is being used, then the new name will not be visible in the Alignment view, but the update will still be visible in other views, for example, the Table view (
).
Copying annotations to other sequences
Annotations on one sequence can be transferred to other sequences in the alignment. Annotations can be transferred to just specified sequences or to all other sequences.
To copy an annotation to specified sequences:
- Right-click the annotation.
- Choose Copy Annotation to Other Sequences... from the menu (figure 25.15).
- In the dialog that opens, check the checkbox next to each sequence that the annotation should be copied to.
- When ready, click Copy.
To copy an annotation to all other sequences:
- Right-click the annotation.
- Choose Copy All Annotations to Other Sequences... from the menu (figure 25.15).
Note: Copied/transferred annotations contain the same qualifier text as the original. As an example, if the annotation contains 'translation' as qualifier text, this translation will be copied to the new sequence and will thus reflect the translation of the original sequence, not the new sequence.
To adjust which annotations are shown, and how they are displayed in the Alignment view, use options in the Side Panel palettes Annotation types and Annotation layout.
Figure 25.15: Actions relating to annotations are offered in the menu opened by right-clicking on an annotation in the graphical view of the alignment.
Adding sequences to an alignment
To add sequences to an existing alignment, rerun the Create Alignment tool and use the existing alignment as input together with the desired new sequence(s) and/or alignment(s).
Subsections
