I have used the below code to get the local alignment score between two strings using Smith-Waterman Algorithm. However, I'm getting the required output, I'm finding it difficult to save the result into some variable for further analysis.
import swalign
def Local_Alignment(string1, string2):
match_score = 100
mismatch_score = -100
matrix = swalign.NucleotideScoringMatrix(match_score, mismatch_score)
lalignment_object = swalign.LocalAlignment(matrix)
alignment_object = lalignment_object.align(string1, string2)
return alignment_object.dump()
string1 = "ABCDEFGHIJKLMNOP"
string2 = "CDGIKNOP"
temp = Local_Alignment(string1, string2)
Whenever I try to save the result into some variable, it simply stores a None
value. Even though I tried storing the result in a text file, that also didn't work.