Revision 746f66b8cfde9400ce3f4021a3283f10e2caa70f authored by Ilan Schnell on 21 January 2021, 00:52:57 UTC, committed by Ilan Schnell on 21 January 2021, 00:52:57 UTC
1 parent 173c848
gene.py
# gene sequence example from @yoch, see
# https://github.com/ilanschnell/bitarray/pull/54
from random import choice
from timeit import timeit
from bitarray import bitarray
trans = {
"A": bitarray("00"),
"T": bitarray("01"),
"G": bitarray("10"),
"C": bitarray("11")
}
N = 10000
seq = [choice("ATGC") for _ in range(N)]
arr = bitarray()
arr.encode(trans, seq)
assert arr.decode(trans) == seq
# decodage
t = timeit(lambda: arr.decode(trans), number=1000)
print(t)
Computing file changes ...