Pairwise2 Gap penalty function for insertion errors
0
0
Entering edit mode
3.3 years ago

I am trying to compare 2 sequences sequence A and Sequence B. Seq A is the original loss-less equation and equation B is the sequence with errors. I am using Biopython (pairwise2) to solve my problem.

  def gap_function(x, y):  # x is gap position in seq, y is gap length
        if y == 0:  # No gap
            return 0
        elif y == 1:  # Gap open penalty
            return -2
        return - (2 + y/4.0 + log(y)/2.0)

What does the position x mean? Is it the position in the original sequence?

Additionally, suppose there was a gap in Sequence A and the letter "G" in sequence B. By definition (for my problem) it means an insertion of G.

If I were to assign an error for the insertion of G then would the following code be fine or is there a more efficient method?

def gap_function(x, y):  # x is gap position in seq, y is gap length
    if seqB[x] == G 
        if y == 0:  # No gap
            return 0
        elif y == 1:  # Gap open penalty
            return insertion_A_error

To illustrate the above example seqA = "AAA" seqB = "AAGA"

alignment sequencing python biopython • 634 views
ADD COMMENT

Login before adding your answer.

Traffic: 3287 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6