# blastn returning an inferior alignment

In my work I've found that in circumstances where there is a mismatch near the edges of the query sequence, blastn prefers to return a shorter contiguous alignment, rather than allowing for a mismatch near the 5' or 3' end of the query sequence.

For example, consider the subject sequence (bold indicates alignment with mismatch in brackets):

GACCAACCTGCTGGATCTGCTGATCGGCG[G]TTTGCGAAATA

and query sequence:

CTGGATCTGCTGATCGGCG[A]T

Blasting this will return the 19bp contiguous alignment upstream of the mismatch, rather than returning a 21bp alignment with a single mismatch at the G/A base at position 20 in the query.

I'm using the command line version of blastn, and I've tried messing with the penalties as well as setting -task blastn-short, but nothing seems to fix this issue.

I speculate that the various gap and mismatch penalties are working out such that a shorter contiguous alignment is preferred over a slightly longer alignment with a mismatch, but I haven't been able to figure out how to modify the penalties in such a way as to change this preference.

• Nope, altering the weights is the solution as you said. So please do answer your own question —this a totally encouraged behaviour. Oct 8 at 9:20

So I found a choice of parameters that resolves this, -reward 3 -gapopen 5 -gapextend 5.