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