예제 #1
0
def determine_corrections(valid, invalid):
    corrections = []
    for iv in invalid:
        for v in valid:
            if pm.hamming_distance(iv, v) == 1:
                corrections.append([iv, v])
    return corrections
예제 #2
0
 def test_no_difference_between_identical_strands(self):
     self.assertEqual(hamming_distance('GGACTGA', 'GGACTGA'), 0)
예제 #3
0
 def test_no_difference_between_empty_strands(self):
     self.assertEqual(hamming_distance('', ''), 0)
예제 #4
0
 def test_ignores_extra_length_on_original_strand_when_longer(self):
     self.assertEqual(
         hamming_distance('GACTACGGACAGGGTAGGGAAT', 'GACATCGCACACC'), 5)
예제 #5
0
 def test_ignores_extra_length_on_other_strand_when_longer(self):
     self.assertEqual(hamming_distance('AAACTAGGGG', 'AGGCTAGCGGTAGGAC'), 3)
예제 #6
0
 def test_larger_distance(self):
     self.assertEqual(hamming_distance('ACCAGGG', 'ACTATGG'), 2)
예제 #7
0
 def test_small_hamming_distance_in_middle_somewhere(self):
     self.assertEqual(hamming_distance('GGACG', 'GGTCG'), 1)
예제 #8
0
 def test_hamming_distance_in_off_by_one_strand(self):
     self.assertEqual(
         hamming_distance('GGACGGATTCTGACCTGGACTAATTTTGGGG',
                          'AGGACGGATTCTGACCTGGACTAATTTTGGGG'), 19)
예제 #9
0
 def test_complete_hamming_distance_in_small_strand(self):
     self.assertEqual(hamming_distance('ACT', 'GGA'), 3)
예제 #10
0
def p_distance(s1, s2):
    # hamming distance / total bases
    return pm.hamming_distance(s1, s2) / len(s1)