def test_constructor(self): query_sequence = 'AGGGTAATTAGGCGTGTTCACCTA' target_sequence = 'TACTTATAAGATGTCTCAACGGCATGCGCAACTTGTGAAGTG' align1 = local_pairwise_align_ssw(query_sequence, target_sequence) align2 = local_pairwise_align_ssw(query_sequence, target_sequence, constructor=DNA) self.assertEqual(type(align1[0]), Sequence) self.assertEqual(type(align2[0]), DNA)
def test_same_as_using_StripedSmithWaterman_object(self): query_sequence = 'ATGGAAGCTATAAGCGCGGGTGAG' target_sequence = 'AACTTATATAATAAAAATTATATATTCGTTGGGTTCTTTTGATATAAATC' query = StripedSmithWaterman(query_sequence) align1 = query(target_sequence) align2 = local_pairwise_align_ssw(query_sequence, target_sequence) self._check_Alignment_to_AlignmentStructure(align2, align1)
def test_kwargs_are_usable(self): kwargs = {} kwargs['mismatch_score'] = -2 kwargs['match_score'] = 5 query_sequence = 'AGGGTAATTAGGCGTGTTCACCTA' target_sequence = 'TACTTATAAGATGTCTCAACGGCATGCGCAACTTGTGAAGTG' query = StripedSmithWaterman(query_sequence, **kwargs) align1 = query(target_sequence) align2 = local_pairwise_align_ssw(query_sequence, target_sequence, **kwargs) self._check_Alignment_to_AlignmentStructure(align2, align1)
def test_same_as_using_StripedSmithWaterman_object_Protein(self): query_sequence = 'HEAGAWGHEE' target_sequence = 'PAWHEAE' query = StripedSmithWaterman(query_sequence, protein=True, substitution_matrix=blosum50) align1 = query(target_sequence) align2 = local_pairwise_align_ssw(Protein(query_sequence), Protein(target_sequence), substitution_matrix=blosum50) self._check_TabularMSA_to_AlignmentStructure(align2, align1, Protein)
def test_type_mismatch(self): with self.assertRaisesRegex(TypeError, r"same type: 'DNA' != 'RNA'"): local_pairwise_align_ssw(DNA('ACGT'), RNA('ACGU'))
def test_invalid_type(self): with self.assertRaisesRegex(TypeError, r"not type 'Sequence'"): local_pairwise_align_ssw(DNA('ACGT'), Sequence('ACGT')) with self.assertRaisesRegex(TypeError, r"not type 'str'"): local_pairwise_align_ssw('ACGU', RNA('ACGU'))