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
= SeqIO.read("alpha.faa", "fasta")
seq1 = SeqIO.read("beta.faa", "fasta")
seq2 = pairwise2.align.globalxx(seq1.seq, seq2.seq) alignments
22.2 PairwiseAligner
from Bio import Align= Align.PairwiseAligner(match_score=1.0)
aligner print(aligner)
aligner.algorithm
= "TATACATTAAAGGAGGGGGATGCGGATAAATGGAAAGGCGAAAAAGAAAAAAATGAATCTAAATGATA"
seq1 = "TATACATTAAAGGAGGGGGATGCGGATAAATGGAAAGGCGAAAGAAAGAAAAAAATGAATCTAAATGATA"
seq2 = aligner.score(seq1, seq2)
score
score
= aligner.align(seq1, seq2)
alignments for alignment in alignments:
print(alignment)