This is a test version of Biostars. For the public version, visit https://www.biostars.org.
biopython: How does pairwise2 alignement returns begin on first matching amino acid?

Hi there,

I aligned two sequences using the following:

from Bio import pairwise2
from Bio.pairwise2 import format_alignment
from Bio.SubsMat import MatrixInfo as matlist

seq1="SKFQQVEQDVKAIEVSLSARIGVSVLDTQNGEYWDYNGNQRFPLTSTFKTIACAKLLYDAEQGKVNPNST"
seq2="HPETLVKVKDAEDQLGARVGYIELDLNSGKILESFRPEERFPLTSTFKVLLCGAVLSRVDAGQEQLGRRI"
matrix = matlist.blosum62
gap_open = -11
gap_extend = -1
alns = pairwise2.align.localds(seq1, seq2, matrix, gap_open, gap_extend)
for a in alns:
    print(format_alignment(*a))

So the result is:

SKFQQVEQDVKAIEVSLSARIGVSVLDTQNGEYWD-YNGNQRFPLTSTFKTIACAKLLYDAEQGKVNPNST-
         ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
--HPETLVKVKDAEDQLGARVGYIELDLNSGKILESFRPEERFPLTSTFKVLLCGAVLSRVDAGQEQLGRRI
  Score=98

And hence the begin is 9 but I want the beginning to be 2. Also for the end I want it to be the T/R combination and not K/Q. Any idea how to do this?

Thanks!

python biopython blast pairwise2 alignment

Can you please explain what do you mean when you say, I want the beginning/end to be x/y?

Have you calculated the score of the preferred alignment (starting from the first letter of the second sequence, F/H, though to the last letter of the first sequence, T/R)? Can you see how to adjust the scoring to make this win?

0 answers

No answers yet.

Log in to answer this question.