Skip to content

Commit

Permalink
Fix Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
fbreitwieser committed Nov 10, 2017
1 parent 10f5998 commit 1d37b54
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ CXX = g++
FOPENMP?=-fopenmp
CXXFLAGS = -Wall -std=c++0x $(FOPENMP) -I./gzstream -O2 -Wfatal-errors ${CPPFLAGS}
#CXXFLAGS = -Wall -std=c++11 $(FOPENMP) -O3 -Wfatal-errors
PROGS = classify db_sort set_lcas db_shrink build_taxdb read_uid_mapping count_unique
PROGS1 = classify db_sort set_lcas db_shrink build_taxdb read_uid_mapping count_unique
TEST_PROGS = grade_classification dump_taxdb test_hll_on_db
PROGS = $(PROGS1) $(TEST_PROGS)
#LIBFLAGS = -L. -lz -lgzstream ${LDFLAGS}
LIBFLAGS = -L. -lz ${LDFLAGS}

Expand Down
34 changes: 30 additions & 4 deletions src/test_hll_on_db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,23 @@ int main(int argc, char **argv) {
char *db_name = argv[1];
QuickFile db_file;
db_file.open_file(db_name);
//db_file.load_file();
db_file.load_file();
cerr << "Fully loaded\n";
KrakenDB db(db_file.ptr());

size_t p = stoi(argv[2]);
bool sparse = bool(stoi(argv[3]));
size_t nr = stoi(argv[4]);

HyperLogLogPlusMinus<uint64_t> hll(p, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll10(10, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll11(11, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll12(12, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll13(13, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll14(14, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll15(15, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll16(16, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll17(17, sparse); // unique k-mer count per taxon
HyperLogLogPlusMinus<uint64_t> hll18(18, sparse); // unique k-mer count per taxon

char* ptr = db.get_ptr();
//char* pair_ptr = db.get_pair_ptr();
Expand All @@ -73,17 +82,34 @@ int main(int argc, char **argv) {
std::mt19937 gen(rd()); //Standard mersenne_twister_engine seeded with rd()
std::uniform_real_distribution<> dis(0.0, 1.0);

cout << "precision\ttrue_count\testimate\n";
size_t ctr = 0;
for (uint64_t i = 0; i < key_ct; i++) {
if (dis(gen) < prob) {
uint64_t* kmer = (uint64_t *) (ptr + pair_sz * i);
//uint32_t* taxon = (uint32_t *) (ptr + pair_sz * i + key_len);
//if (taxon == NULL) {
// std::cerr << "taxon is NULL (i is " << i << " and key_ct is " << key_ct << ")" << std::endl;
hll.add(*kmer);
hll10.add(*kmer);
hll11.add(*kmer);
hll12.add(*kmer);
hll13.add(*kmer);
hll14.add(*kmer);
hll15.add(*kmer);
hll16.add(*kmer);
hll17.add(*kmer);
hll18.add(*kmer);
++ctr;
if (ctr < 10 || floor(log10(ctr)) == log10(ctr)) {
cout << ctr << '\t' << hll.cardinality() << '\n';
cout << 10 << '\t' << ctr << '\t' << hll10.cardinality() << '\n';
cout << 11 << '\t' << ctr << '\t' << hll11.cardinality() << '\n';
cout << 12 << '\t' << ctr << '\t' << hll12.cardinality() << '\n';
cout << 13 << '\t' << ctr << '\t' << hll13.cardinality() << '\n';
cout << 14 << '\t' << ctr << '\t' << hll14.cardinality() << '\n';
cout << 15 << '\t' << ctr << '\t' << hll15.cardinality() << '\n';
cout << 16 << '\t' << ctr << '\t' << hll16.cardinality() << '\n';
cout << 17 << '\t' << ctr << '\t' << hll17.cardinality() << '\n';
cout << 18 << '\t' << ctr << '\t' << hll18.cardinality() << '\n';
}
}
}
Expand Down

0 comments on commit 1d37b54

Please sign in to comment.