Semi Global Alignment
2
2
Entering edit mode
12.5 years ago
Maria ▴ 170

hello,

I'm trying to write a code to algin 2 sequences where gaps are for free in the beginning and the end of the second sequence i.e.

s1 = CATACGTCGACGGCT
s2 = ACGACGT**AAAAC**

Alignment:

CATACGTCGACGGCT
---ACGACGT-----------

I need to stop at some point(T for example) in s2 where the two sequences don't match anymore ( global alignment with free gaps at start and end)

I used a semi global alignment approach s1 in row, s2 in column , initialize the first row to 0 , initialize the 1st column as gaps accumulation

Questions :1- what is the best way to chose the beginning of trace back , is it the maximum of the last row ? 2- for this problem filling the matrix is like local alignment (minimum =0) or like the global one ore negative values are allowed ?

• 9.0k views
ADD COMMENT
0
Entering edit mode

There's nothing bold in s2.

ADD REPLY
0
Entering edit mode

check the right part now

ADD REPLY
0
Entering edit mode
12.5 years ago

This looks much more like local alignment for me (no start/end gap penalty). May be this is the right algorithm for you?

ADD COMMENT
0
Entering edit mode

local also sets all negative scores to 0. If you only want no start/end gap penalties it is semi-global

ADD REPLY
0
Entering edit mode
12.5 years ago
brentp 24k

I think what you're looking for is global alignment with cost-free-ends.

You can try various strategies with this module: https://github.com/brentp/align

Here's an example script:

s1 = "CATACGTCGACGGCT"
s2 = "ACGACGTAAAAC"

from align import aligner

for method in ("global_cfe", "glocal", "local", "global"):

    print "-" * len(method)
    print method
    print "-" * len(method)
    print "\n".join(aligner(s1, s2, method=method))
    print

which creates the following output:

----------
global_cfe
----------
CATACGTCG-ACGGCT
---ACGACGTAAAAC-

------
glocal
------
ACGTCG-ACGGC
ACGACGTAAAAC

-----
local
-----
ACGTCG-ACGGC
ACGACGTAAAAC

------
global
------
CATACGTCGACGGCT
ACGACGTAAAA--C-
ADD COMMENT
0
Entering edit mode

thank you for your answer, I'm interested in the first one (global cfe) where can find how the algorithm works ?

ADD REPLY
0
Entering edit mode

i;m trying to implement under perl

ADD REPLY

Login before adding your answer.

Traffic: 2045 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