Esempio n. 1
0
 def test_build_target_index(self, seq, expected_kmers_or_none):
   """Test Aligner.set_targets()."""
   target = aligner.Target(seq)
   result = target.build_target_index(k=3)
   self.assertEqual(result, bool(expected_kmers_or_none))
   if expected_kmers_or_none is None:
     self.assertEqual(len(target.kmer_index), 0)
   else:
     self.assertEqual(expected_kmers_or_none, target.kmer_index)
Esempio n. 2
0
 def test_sw_start_offsets(self):
   """Test Aligner._sw_start_offsets()."""
   k = 3
   read = aligner.Read(
       test_utils.make_read(
           'AaGAt', start=0, cigar=[(5, 'M')], quals=[64] * 5, name='read_1'))
   read.set_read_kmers(k)
   target = aligner.Target('TgATCAGATAAG')
   target.build_target_index(k)
   self.assertEqual([-1, 4, 9],
                    aligner._sw_start_offsets(target.kmer_index, read.kmers))