cbitmap
A C-based bitmap implementation.
Install
pip install cbitmap
Basic Usage
import
from cbitmap import Bitmap
init a bitmap
size = 100
b = Bitmap(size)
path = '/path/data'
b = Bitmap.load(path)
set
b = Bitmap(100)
b.set(10)
get
b = Bitmap(100)
b.set(10)
print(b.get(10))
print(b.get(1))
print(b.get(100000))
delete
b = Bitmap(100)
b.set(10)
print(b.get(10))
b.delete(10)
print(b.get(10))
set kmer
b = b = Bitmap((1<< 32) - 1)
seq = 'AAcgagtcatcgatgcAAcgagtcatcgatgctagtcgta'.upper()
b.set_kmers(seq, 16)
Persistence
b = Bitmap(1000)
path = '/path/data'
b.dump(path)
b = Bitmap().load(path)
len(b) == 1000