Session 22 – Biopython: Mulitple Sequence Alignments

22.1 pairwise2

Save the following as prot1.faa and prot2.faa

prot1 MVLSPADKTNVKAAWGKVGAHAGEYGAEALERMFLSFPTTKTYFPHFDLSHGSAQVKGHG KKVADALTNAVAHVDDMPNALSALSDLHAHKLRVDPVNFKLLSHCLLVTLAAHLPAEFTP AVHASLDKFLASVSTVLTSKYR

prot2 MVHLTPEEKSAVTALWGKVNVDEVGGEALGRLLVVYPWTQRFFESFGDLSTPDAVMGNPK VKAHGKKVLGAFSDGLAHLDNLKGTFATLSELHCDKLHVDPENFRLLGNVLVCVLAHHFG KEFTPPVQAAYQKVVAGVANALAHKYH

from Bio import pairwise2
from Bio import SeqIO

seq1 = SeqIO.read("alpha.faa", "fasta")
seq2 = SeqIO.read("beta.faa", "fasta")
alignments = pairwise2.align.globalxx(seq1.seq, seq2.seq)

22.2 PairwiseAligner

from Bio import Align
aligner = Align.PairwiseAligner(match_score=1.0)
print(aligner)

aligner.algorithm

seq1 = "TATACATTAAAGGAGGGGGATGCGGATAAATGGAAAGGCGAAAAAGAAAAAAATGAATCTAAATGATA"
seq2 = "TATACATTAAAGGAGGGGGATGCGGATAAATGGAAAGGCGAAAGAAAGAAAAAAATGAATCTAAATGATA"
score = aligner.score(seq1, seq2)
score

alignments = aligner.align(seq1, seq2)
for alignment in alignments:
    print(alignment)