next up previous contents index
Next: alignment.append_model() copy Up: The alignment class: comparison Previous: alignment.check() check   Contents   Index

alignment.compare_with() -- compare two alignments

compare_with(aln)
This command compares two pairwise alignments read by the alignment.append() commands. The alignment of the first sequence with the second sequence in ALIGNMENT is evaluated with respect to 'aln'. The numbers are not symmetric; i.e., they will change if the sequences or alignments are swapped. The output in the log file is self-explanatory.

Example: examples/commands/compare_alignments.py


# Example for: alignment.compare_with(), alignment.append_model()

# Compare two alignments of two proteins each. In this case, the first
# alignment is a sequence-sequence alignment and the second alignment
# is a structure-structure alignment.

from modeller import *
log.level(1, 1, 1, 1, 0)
env = environ()
env.io.atom_files_directory = '../atom_files'

# Generate and save sequence-sequence alignment:
aln = alignment(env)
for code in ('1fas', '2ctx'):
    mdl = model(env, file=code)
    aln.append_model(mdl=mdl, align_codes=code, atom_files=code)
aln.align(gap_penalties_1d=(-600, -400))
aln.write(file='toxin-seq.ali')

# Generate and save structure-structure alignment:
aln.align3d(gap_penalties_3d=(0, 2.0))
aln.write(file='toxin-str.ali')

# Compare the two pairwise alignments:
aln  = alignment(env, file='toxin-seq.ali', align_codes='all')
aln2 = alignment(env, file='toxin-str.ali', align_codes='all')
aln.compare_with(aln2)



Ben Webb 2007-01-19