[Biopython] bug with pairwise2 local alignments?

Jocelyne jocelyne at gmail.com
Thu Sep 6 20:31:06 UTC 2012


Hello:
First, I'd like to say that I really appreciate the effort of the community
to provide us with such a nice package.
I found some odd scoring behavior with the pairwise2 local alignment (see 5
below). I think these 2 alignments should have the same score.
First required details:
1) Which operating system and hardware (32 bit or 64 bit) you are using
    Linux jocelyne-VirtualBox 3.2.0-29-generic #46-Ubuntu SMP Fri Jul 27
17:03:23 UTC 2012 x86_64 x86_64 x86_64 GNU/Linux
    (basically, latest Ubuntu 64 bit through virtual box)
2) Python version
    Python 2.7.3 (default, Aug  1 2012, 05:14:39)
    [GCC 4.6.3] on linux2
3) Biopython version (or git version/date)
     (installed through repository)  python-biopython/precise uptodate
1.58-1
4) Traceback that occurs (the full error message)
    None
5) A data file that causes the problem
    None
6) Example code that breaks
I feel the two local alignments should both score 4. I think it has to do
with how the top row and left columns are filled in the score matrix.
================================================================================
>>> for a in pairwise2.align.localms("ACTGAGT", "TGC", 2, -1, -100, -100,
force_generic = True):
...     print a
...     print pairwise2.format_alignment(*a)...
('ACTGAGT', '--TGC--', 4, 2, 4)
ACTGAGT
  ||
--TGC--
  Score=4

  >>> for a in pairwise2.align.localms("ACTGAGT", "CGA", 2, -1, -100, -100,
force_generic = True):
...     print a
...     print pairwise2.format_alignment(*a)...
('ACTGAGT', '--CGA--', 3, 3, 5)
ACTGAGT
   ||
--CGA--
  Score=3

================================================================================
I outputted the matrices
================================================================================
>>> score_matrix, trace_matrix =
pairwise2._make_score_matrix_generic("ACTGAGT", "TGC",
pairwise2.identity_match(2, -1), pairwise2.affine_penalty(-100, -100),
pairwise2.affine_penalty(-100, -100), False, False,False, False)
>>> pairwise2.print_matrix(score_matrix)-1  -1  -1
-1   0   1
 2   0   0
-1   4   0
-1   0   3
-1   1   0
 2   0   0
>>> score_matrix, trace_matrix =
pairwise2._make_score_matrix_generic("ACTGAGT", "CGA",
pairwise2.identity_match(2, -1), pairwise2.affine_penalty(-100, -100),
pairwise2.affine_penalty(-100, -100), False, False,False, False)
>>> pairwise2.print_matrix(score_matrix)-1  -1  2
 2   0  0
-1   1  0
-1   1  0
-1   0  3
-1   1  0
-1   0  0

Let me know if there is a quick fix I can do on my side.
Thanks!
Jocelyne



More information about the Biopython mailing list