forked from rcedgar/syncmer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompress.cpp
52 lines (43 loc) · 1.01 KB
/
compress.cpp
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
#include "myutils.h"
#include "syncmerindex.h"
#include "randseq.h"
static void Compress1(const byte *Seq, const string &Name,
uint k, uint t, uint w)
{
SyncmerType ST = StrToST(Name);
SyncmerIndex SI;
SI.Create(ST, k, t, w, Seq, BENCHL);
double f = SI.GetFractKmersIndexed();
double c = 1.0/f;
ProgressLog("%s", Name.c_str());
ProgressLog(" k=%u", k);
if (t != UINT_MAX)
ProgressLog(" t=%u", t);
else
ProgressLog(" w=%u", w);
ProgressLog(" c=%.1f", c);
ProgressLog("\n");
}
void cmd_compress()
{
const string Name = opt(compress);
ResetRand(1);
byte *Seq = myalloc(byte, BENCHL);
MakeRandSeq(Seq, BENCHL);
asserta(optset_k);
uint k = opt(k);
if (optset_tlo)
{
asserta(optset_thi);
for (uint t = opt(tlo); t <= opt(thi); ++t)
Compress1(Seq, Name, k, t, UINT_MAX);
}
else if (optset_wlo)
{
asserta(optset_whi);
for (uint w = opt(wlo); w <= opt(whi); ++w)
Compress1(Seq, Name, k, UINT_MAX, w);
}
else
asserta(false);
}