You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to migrate from align.localds to PairwiseAligner and require assistance as I am not sure how to replicate the behaviour I need. I have attached a code snippet with a test illustrating the localds's output. Could someone please show me how to replicate this with the PairwiseAligner.
In particular, how do I get an output which includes the - character and what is the equivalent of penalize_end_gaps.
from Bio import pairwise2
from Bio.Align import substitution_matrices, PairwiseAligner
SUBSTITUTION_MATRIX = substitution_matrices.load("BLOSUM62")
def using_pairwise_aligner(seq1, seq2, matrix, gap_open, gap_extend, penalize_end_gaps) -> tuple[str, str]:
aligner = PairwiseAligner()
# How do I replicate the result?
pass
def test_align_format_sequences():
input_seq1, input_seq2 = "GCVLDGNYQIW", "GCLIQGRFDILF"
expected_seq1, expected_seq2 = "GCVLDGNYQIW-", "GCLIQGRFDILF"
# Old method
alignment = pairwise2.align.localds(input_seq1, input_seq2, SUBSTITUTION_MATRIX, -10.0, -0.5, penalize_end_gaps=(False, False))[0]
actual_seq1, actual_seq2 = alignment.seqA, alignment.seqB
assert (actual_seq1, actual_seq2) == (expected_seq1, expected_seq2)
# New method
actual_seq1, actual_seq2 = using_pairwise_aligner(input_seq1, input_seq2, SUBSTITUTION_MATRIX, -10.0, -0.5, penalize_end_gaps=(False, False))
assert (actual_seq1, actual_seq2) == (expected_seq1, expected_seq2)
The text was updated successfully, but these errors were encountered:
Setup
I am reporting a problem with Biopython version, Python version, and operating
system as follows:
I am trying to migrate from align.localds to PairwiseAligner and require assistance as I am not sure how to replicate the behaviour I need. I have attached a code snippet with a test illustrating the localds's output. Could someone please show me how to replicate this with the
PairwiseAligner
.In particular, how do I get an output which includes the
-
character and what is the equivalent ofpenalize_end_gaps
.The text was updated successfully, but these errors were encountered: