This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Pairwise2 Alignment Gap Penalties

I am trying to align two sequences. I have the error information for the insertion/deletion of each letter(A,G,T,C). How do I effectively incorporate this into the gap penalty?

alignments = pairwise2.align.globalms(X, Y, 1, -1, -1, -0.1, force_generic=True)
sequencing alignment python biopython

1 answer

You can specify a dict of lists that define nucleotide substitution scores. See this answer for an example:

Custom substitution matrix in biopython pairwise2 aligner

Note you need to specify this the d option. Read the documentation:

https://biopython.org/docs/1.75/api/Bio.pairwise2.html

I believe the function call would be:

pairwise2.align.globalds(X, Y, match_dict, ...)

Yes but is this for substitutions(mismatch) errors?

I have a particular sequence that is passed through a channel which results in insertion, deletion and substitution errors.

I have these probabilities but all insertions and deletions appear as gaps in the alignments.

You can define a callback gap function for such cases then:

c     A callback function returns the gap penalties.

Everything is in the documentation.

Log in to answer this question.