alignment.edit() — edit overhangs in alignment

edit(overhang, edit_align_codes, base_align_codes, min_base_entries, by_chain=False, io=None)
This command edits the overhangs in the alignment.

edit_align_codes specifies the alignment codes for the alignment entries whose overhangs are to be cut; in addition, all or last can be used.

base_align_codes specifies the alignment codes for the alignment entries that are used to determine the extent of the overhangs to be cut from the edited entries; in addition, all or rest (relative to edit_align_codes) can be used.

The same entries can be cut and used for determining the base.

The base of the alignment is determined by the first and last alignment positions that have at least min_base_entries entries that started by that position, beginning from the first and last alignment positions, respectively.

The cuts are shortened by overhang residues respectively, so that reasonably short termini can be easily modeled ab initio if desired.

The io argument is used because the beginning and ending residue numbers for the ‘structure’ entries in the alignment are renumbered automatically by reading the appropriate atom files.

The number of residues (not alignment positions) removed from the start and end of the first sequence in edit_align_codes is returned.

Normally, this procedure ignores chain breaks, removing overhangs only from the very start and end of the entire sequence. However, if by_chain is set to True, overhangs for every chain in the edit_align_codes sequence are removed. This mode only works for a single edited sequence, and only for a sequence that does not have structural information. In this case, a list of pairs is returned, one for each chain; each pair contains the number of residues removed from the start and end of the chain.

Example: examples/commands/edit_alignment.py

# Example for: alignment.edit()

# Read an alignment, write it out in the 'PAP' format, with overhangs cut.

from modeller import *

log.level(1, 1, 1, 1, 0)
env = environ()
env.io.atom_files_directory = ['.', '../atom_files']

aln = alignment(env, file='overhang.ali', align_codes='all',
                alignment_format='PIR')

# Cut overhangs in the 1is4 sequence that are longer than 3 residues
# relative to the longest remaining entry in the alignment:
aln.edit(edit_align_codes='1is4', base_align_codes='rest',
         min_base_entries=1, overhang=3)
aln.write(file='overhang-1.pir', alignment_format='PIR')
aln.write(file='overhang-1.pap', alignment_format='PAP')