Exemplo n.º 1
0
 def test_seq_to_symbol_factory(self):
     """checks factory function for conversion works"""
     motifs = ['AA', 'AT', 'TT']
     seq_to_symbols = SeqToSymbols(motifs)
     self.assertEqual(seq_to_symbols('AATGGTTA'),
                     numpy.array([1,1,0,0,0,1,0,0]))
     self.assertEqual(seq_to_symbols('AAGATT'),
                     numpy.array([1,0, 0, 1, 1, 0], numpy.uint8))
Exemplo n.º 2
0
 def test_seq_to_symbol(self):
     """both py and pyx seq_to_symbol versions correctly convert a sequence"""
     motifs = ['AA', 'AT', 'TT']
     symbols = _seq_to_symbols('AATGGTTA', motifs, 2)
     self.assertEqual(symbols, numpy.array([1,1,0,0,0,1,0,0]))
     symbols = seq_to_symbols('AAGATT', motifs, 2, numpy.zeros(6, numpy.uint8))
     self.assertEqual(symbols, numpy.array([1,0,0,1,1,0]))