File: bloom.py

package info (click to toggle)
khmer 2.1.2%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 59,060 kB
  • sloc: cpp: 102,051; python: 19,654; ansic: 677; makefile: 578; sh: 171; xml: 19
file content (26 lines) | stat: -rwxr-xr-x 775 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env python

# A demonstration of using khmer to query a dataset for a k-mer. Typically
# khmer accrues a small false positive rate in order to save substantially on
# memory requirements.

from __future__ import print_function
import khmer

ksize = 21
target_table_size = 5e8
num_tables = 4

bloomfilter = khmer.Nodetable(ksize, target_table_size, num_tables)
bloomfilter.consume('GCTGCACCGATGTACGCAAAGCTATTTAAAACCATAACTATTCTCACTTA');

print('count for "GCTGCACCGATGTACGCAAAG" is',
      bloomfilter.get('GCTGCACCGATGTACGCAAAG'))

bloomfilter.count('GCTGCACCGATGTACGCAAAG')

print('count for "GCTGCACCGATGTACGCAAAG" is',
      bloomfilter.get('GCTGCACCGATGTACGCAAAG'))

print('count for "GATTACAGATTACAGATTACA" is',
      bloomfilter.get('GATTACAGATTACAGATTACA'))