File: consume.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 (20 lines) | stat: -rwxr-xr-x 623 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
#!/usr/bin/env python

# A demonstration of khmer's primary sequence loading function.

from __future__ import print_function
import khmer
import sys

ksize = 21
target_table_size = 5e8
num_tables = 4

counts = khmer.Counttable(ksize, target_table_size, num_tables)
nseqs, nkmers = counts.consume_seqfile(sys.argv[1])
print('Loaded', nseqs, 'sequences and', nkmers, 'k-mers from', sys.argv[1])

print('The kmer "CAGCGCCGTGTTGTTGCAATT" appears',
      counts.get('CAGCGCCGTGTTGTTGCAATT'), 'times in the data')
print('The kmer "GATTACAGATTACAGATTACA" appears',
      counts.get('GATTACAGATTACAGATTACA'), 'times in the data')