biopython's local alignment get start and end position of both sequences
1
0
Entering edit mode
6.9 years ago

I'm trying to get the position of the start and end/length for both sequences in a pairwise alignment, but I do not get that information in output, what I have so far

    alignments = pairwise2.align.localms(seq1, seq2, 2, -2, -3, -3)
    for a in alignments:
        print a
        print pairwise2.format_alignment(*a)
        break

... 232.0, 61, 189)

where 232 is the score, 61 is the start of something and 189 is the end. I need start and end for seq1 and seq2, any hints?

biopython smithwaterman alignment pairwise • 2.5k views
ADD COMMENT
0
Entering edit mode
6.9 years ago
Joe 21k

Check what Type a is. If it's already a list, then try something like start = a[1] and end = a[2] (you'll have to show us the full output to be more specific).

If it's just a string, you can try something like a.split(',')[1].

Biopython probably already has an attribute for this though, so check the pairwise2 documentation (it’s been updated recently) so you probably don’t need to do anything as hacky as I’ve suggested.

ADD COMMENT
0
Entering edit mode

I had seen the documentation, but there's no output like you suggested. What I'm asking for it is not the way to access the tuple, but where are those results placed in the output of the algorithm

ADD REPLY

Login before adding your answer.

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