primer3-org / primer3

Primer3 is a command line tool to select primers for polymerase chain reaction (PCR).
GNU General Public License v2.0
218 stars 62 forks source link

Understanding the dpal logic #70

Open karen-nativ opened 1 year ago

karen-nativ commented 1 year ago

Hello, I'd like help understanding the logic of the dpal module in global mode. It should find the best global alignment using the Needleman Wunsch algorithm correct? However I see different behavior, for example when running the following (the m flag allows a gap of length 100, and g parameter for global mode): ./ntdpal -m 100 ACCCCTTTTTTTTTTTTT AT g

The output is: |ACCCCTTTTTTTTTTTTT| |AT| G score=0.00 len=2 |16,0|17,1|

From the output I understand that the alignment created is:

ACCCCTTTTTTTTTTTTT
----------------AT

Meaning the alignment includes indels and at the end a T/A mismatch and a T/T match. However the Needleman Wunsch algorithm in this case can give us the following alignment:

ACCCCTTTTTTTTTTTTT
A----------------T

In this case the created gap is of the same length but we have two matches - A/A and T/T. So it seems this output has a better score.

Why are the outputs different in this case? Or perhaps does the dpal module work a bit differently than the NW algorithm? If so, how?

Thanks for the help.