def test_needleman_wunsch_score_BLOSUMXX(self): test_cases = [ ("BLOSUM45", 513), ("BLOSUM62", 426), ("BLOSUM80", 452) ] for x, output in test_cases: with self.subTest(name=x): sa = SequenceAlignment(self.ab_collection_1[0], self.ab_collection_2, 'needleman_wunsch', x) sa.align_sequences() self.assertEqual(sa.score[self.ab_collection_2.names[0]], output)
def test_alignment_indel_sign(self): # if indel is positive the user receives a warning and indel will be set to -indel sa = SequenceAlignment(self.ab_collection_1[0], self.ab_collection_2, 'needleman_wunsch', 'BLOSUM62') sa.align_sequences(indel=-10) sa_score_1 = sa.score sa = SequenceAlignment(self.ab_collection_1[0], self.ab_collection_2, 'needleman_wunsch', 'BLOSUM62') sa.align_sequences(indel=10) sa_score_2 = sa.score # since the second indel is positive it will be set to # its negative, which runs the algorithms # with the same params again and will get the same scores self.assertEqual(sa_score_1, sa_score_2)
def test_alignment_print_string(self): sa = SequenceAlignment(self.ab_collection_1[0], self.ab_collection_2, 'needleman_wunsch', 'BLOSUM62') sa.align_sequences() self.assertEqual(len(sa._aligned_sequences_string()), 3)
def test_needleman_wunsch_aligned_sequences(self): sa = SequenceAlignment(self.ab_collection_1[0], self.ab_collection_2, 'needleman_wunsch', 'BLOSUM62') sa.align_sequences() self.assertEqual(sa.aligned_sequences[self.ab_collection_2.names[0]], self.seq2_aligned)
def test_needleman_wunsch_score_BLOSUM45(self): sa = SequenceAlignment(self.ab_collection_1[0], self.ab_collection_2, 'needleman_wunsch', 'BLOSUM45') sa.align_sequences() self.assertEqual(sa.score[self.ab_collection_2.names[0]], 513)