Question: Pairwise2 Gap penalty function for insertion errors
0
gravatar for trinityduke100
5 weeks ago by
trinityduke10010 wrote:

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"

ADD COMMENTlink modified 5 weeks ago • written 5 weeks ago by trinityduke10010
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 2525 users visited in the last hour
_