def test_correct_barcode_bitwise(self): """ correct_barcode should correctly assign barcode to 2nd possibility, 2 base errors, 3 bit errors with this nt_to_bits """ nt_to_bits = {"A": "11", "C": "00", "T": "10", "G": "01"} original = "ATTTTTTTTTCG" recieved = "ATTTTTTTTTTT" possibilities = ["TGTATTCGTGTA", "ATTTTTTTTTCG", "TGTAGGCGTGTA", "TGTAGAAGTGTA", "TGTAGGCGTATA", "TGTAAAAAAAAA"] decoded, num_errors = barcode.correct_barcode_bitwise(recieved, possibilities, nt_to_bits) self.assertEqual(decoded, original) self.assertEqual(num_errors, 3)
def test_correct_barcode_bitwise_tie(self): """ correct_barcode should not assign barcode to to a tie situation """ nt_to_bits = { "A":"11", "C":"00", "T":"10", "G":"01"} #~ original = 'ATTTTTTTTTCG' #doesn't matter, last entry is just # as close to recieved as original is recieved = 'ATTTTTTTTTTT' possibilities = ['TGTATTCGTGTA','ATTTTTTTTTCG','TGTAGGCGTGTA', 'TGTAGAAGTGTA','TGTAGGCGTATA','TGTAAAAAAAAA', 'ATTTTTTTTAAA'] decoded, num_errors = barcode.correct_barcode_bitwise(\ recieved, possibilities, nt_to_bits) self.assertEqual(decoded, None) self.assertEqual(num_errors, 3)
def test_correct_barcode_bitwise_tie(self): """ correct_barcode should not assign barcode to to a tie situation """ nt_to_bits = {"A": "11", "C": "00", "T": "10", "G": "01"} # ~ original = 'ATTTTTTTTTCG' #doesn't matter, last entry is just # as close to recieved as original is recieved = 'ATTTTTTTTTTT' possibilities = ['TGTATTCGTGTA', 'ATTTTTTTTTCG', 'TGTAGGCGTGTA', 'TGTAGAAGTGTA', 'TGTAGGCGTATA', 'TGTAAAAAAAAA', 'ATTTTTTTTAAA'] decoded, num_errors = barcode.correct_barcode_bitwise( recieved, possibilities, nt_to_bits) self.assertEqual(decoded, None) self.assertEqual(num_errors, 3)
def test_correct_barcode_bitwise(self): """ correct_barcode should correctly assign barcode to 2nd possibility, 2 base errors, 3 bit errors with this nt_to_bits """ nt_to_bits = {"A": "11", "C": "00", "T": "10", "G": "01"} original = 'ATTTTTTTTTCG' recieved = 'ATTTTTTTTTTT' possibilities = ['TGTATTCGTGTA', 'ATTTTTTTTTCG', 'TGTAGGCGTGTA', 'TGTAGAAGTGTA', 'TGTAGGCGTATA', 'TGTAAAAAAAAA'] decoded, num_errors = barcode.correct_barcode_bitwise( recieved, possibilities, nt_to_bits) self.assertEqual(decoded, original) self.assertEqual(num_errors, 3)