-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbigseq.seq
56 lines (45 loc) · 1.44 KB
/
bigseq.seq
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import sys
import os.path
from lib import bytearray
from bloomfilter import BloomFilter
from bio import FASTA, seqs, Kmer, kmers
from utils.cortex import CTX
from constants import K, get_storage
from graph.bigsi import BIGSI
from lib.bitarray import bitarray
# right now: seqc run bloom.seq .ctx output
# desired: seqc run bigseq.seq bloom .ctx output
# desired: seqc run bigseq.seq build ...
# desired: seqc run bigseq.seq search string
def run():
args = sys.argv[1:]
if len(args) == 0:
return
if args[0]=='bloom':
if len(args) != 3:
print 'Usage: seqc run bloom <sequence> <out>'
return
ctx_file = args[1]
out_file = args[2]
BIGSI.bloom(CTX[31](ctx_file)).to_file(out_file)
elif args[0]=='build':
if len(args)%2!=1:
print 'Usage: seqc run build -b bloomfilter1 -b bloomfilter2 ... -s sample1 -s sample2 ...'
print 'same number of bloomfilters and samples must be passed in'
return
bloomfilter_paths = []
for i in range(len(args)):
if args[i]=='-b':
bloomfilter_paths.append(args[i+1])
samples = []
for i in range(len(args)):
if args[i]=='-s':
samples.append(args[i+1])
BIGSI.build(get_storage(), [bitarray.from_file(x) for x in bloomfilter_paths], samples)
elif args[0]=='search':
if len(args) != 2:
print 'Usage: seqc run search.seq <string>'
return
print BIGSI(get_storage()).search(args[1])
# return search(args[1])
run()