def test_clean_alignments(self): alns = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] expected = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] result = pairwise2._clean_alignments(alns) self.assertEqual(expected, result)
def test_clean_alignments(self): alns = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] expected = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] result = pairwise2._clean_alignments(alns) self.assertEqual(expected, result)
def test_clean_alignments(self): """``_clean_alignments`` removes redundant alignments.""" alns = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] expected = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] result = pairwise2._clean_alignments(alns) self.assertEqual(expected, result)
def test_clean_alignments(self): """``_clean_alignments`` removes redundant alignments.""" alns = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] expected = [ ('ACCGT', 'AC-G-', 3.0, 0, 4), ('ACCGT', 'A-CG-', 3.0, 0, 4), ] result = pairwise2._clean_alignments(alns) self.assertEqual(expected, result)
def test_clean_alignments(self): """``_clean_alignments`` removes redundant and wrong alignments.""" alns = [ ("ACCGT", "AC-G-", 3.0, 0, 4), ("ACCGT", "AC-G-", 3.0, 1, 1), ("ACCGT", "A-CG-", 3.0, 0, 4), ("ACCGT", "AC-G-", 3.0, 0, 4), ("ACCGT", "A-CG-", 3.0, 0, 4), ] expected = [ ("ACCGT", "AC-G-", 3.0, 0, 4), ("ACCGT", "A-CG-", 3.0, 0, 4), ] result = pairwise2._clean_alignments(alns) self.assertEqual(expected, result)
def get_alignments(sent1, sent2): alignments = pairwise2.align.localms(sent1, sent2, 2, -1, -1, -0.5) alignment = pairwise2._clean_alignments(alignments)[ 0] # retrieve the first alignment, (sent1, sents) return alignment[0], alignment[1]