Skip to content

Commit

Permalink
Fix gzstream compilation, update on HLL
Browse files Browse the repository at this point in the history
  • Loading branch information
fbreitwieser committed Nov 9, 2017
1 parent 4e3cbd3 commit f34f8d4
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 250 deletions.
10 changes: 7 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
CXX = g++
FOPENMP?=-fopenmp
CXXFLAGS = -Wall -std=c++0x $(FOPENMP) -O2 -Wfatal-errors ${CPPFLAGS}
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 make_seqid_to_taxid_map db_shrink build_taxdb grade_classification dump_taxdb read_uid_mapping
LIBFLAGS = -L. -I./gzstream -L./gzstream -lz -lgzstream ${LDFLAGS}
#LIBFLAGS = -L. -lz -lgzstream ${LDFLAGS}
LIBFLAGS = -L. -lz ${LDFLAGS}

.PHONY: all install clean

Expand All @@ -25,7 +26,7 @@ grade_classification: taxdb.h report-cols.h

read_uid_mapping: quickfile.o

classify: classify.cpp krakendb.o quickfile.o krakenutil.o seqreader.o uid_mapping.o hyperloglogplus.h taxdb.h report-cols.h
classify: classify.cpp krakendb.o quickfile.o krakenutil.o seqreader.o uid_mapping.o gzstream.o hyperloglogplus.h taxdb.h report-cols.h
$(CXX) $(CXXFLAGS) -o classify $^ $(LIBFLAGS)

build_taxdb: taxdb.h report-cols.h quickfile.o
Expand All @@ -43,6 +44,9 @@ krakendb.o: krakendb.cpp krakendb.hpp quickfile.hpp
seqreader.o: seqreader.cpp seqreader.hpp quickfile.hpp
$(CXX) $(CXXFLAGS) -c seqreader.cpp

gzstream.o: gzstream/gzstream.C gzstream/gzstream.h
$(CXX) $(CXXFLAGS) -c -O gzstream/gzstream.C

quickfile.o: quickfile.cpp quickfile.hpp
$(CXX) $(CXXFLAGS) -c quickfile.cpp

Expand Down
60 changes: 30 additions & 30 deletions src/classify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,19 +114,19 @@ ostream* cout_or_file(string file) {
}

void loadKrakenDB(KrakenDB& database, string DB_filename, string Index_filename) {
QuickFile db_file;
db_file.open_file(DB_filename);
if (Populate_memory) {
db_file.load_file();
}
database = KrakenDB(db_file.ptr());
QuickFile idx_file;
idx_file.open_file(Index_filename);
if (Populate_memory)
idx_file.load_file();

KrakenDBIndex db_index(idx_file.ptr());
database.set_index(&db_index);
QuickFile db_file;
db_file.open_file(DB_filename);
if (Populate_memory) {
db_file.load_file();
}
database = KrakenDB(db_file.ptr());
QuickFile idx_file;
idx_file.open_file(Index_filename);
if (Populate_memory)
idx_file.load_file();

KrakenDBIndex db_index(idx_file.ptr());
database.set_index(&db_index);
}

int main(int argc, char **argv) {
Expand Down Expand Up @@ -242,18 +242,18 @@ int main(int argc, char **argv) {
taxdb.readGenomeSizes(fname);
}

TaxReport<uint32_t,ReadCounts> rep = TaxReport<uint32_t, ReadCounts>(*Report_output, taxdb, taxon_counts, false);
rep.setReportCols(vector<string> {
"%",
"reads",
TaxReport<uint32_t,ReadCounts> rep = TaxReport<uint32_t, ReadCounts>(*Report_output, taxdb, taxon_counts, false);
rep.setReportCols(vector<string> {
"%",
"reads",
"taxReads",
"kmers",
"dup",
"cov",
"taxID",
"rank",
"taxName"});
rep.printReport("kraken","blu");
"taxID",
"rank",
"taxName"});
rep.printReport("kraken","blu");
}

for (size_t i = 0; i < Open_fstreams.size(); ++i) {
Expand Down Expand Up @@ -367,11 +367,11 @@ void process_file(char *filename) {

inline
uint32_t get_taxon_for_kmer(KrakenDB& database, uint64_t* kmer_ptr, uint64_t& current_bin_key,
int64_t& current_min_pos, int64_t& current_max_pos) {
uint32_t* val_ptr = database.kmer_query(
database.canonical_representation(*kmer_ptr), &current_bin_key,
&current_min_pos, &current_max_pos);
return val_ptr ? *val_ptr : 0;
int64_t& current_min_pos, int64_t& current_max_pos) {
uint32_t* val_ptr = database.kmer_query(
database.canonical_representation(*kmer_ptr), &current_bin_key,
&current_min_pos, &current_max_pos);
return val_ptr ? *val_ptr : 0;
}


Expand Down Expand Up @@ -512,10 +512,10 @@ bool classify_sequence(DNASequence &dna, ostringstream &koss,
taxon = get_taxon_for_kmer(*KrakenDatabases[i], kmer_ptr,
db_statuses[i].current_bin_key, db_statuses[i].current_min_pos, db_statuses[i].current_max_pos);

//uint32_t* val_ptr = KrakenDatabases[i]->kmer_query(
// KrakenDatabases[i]->canonical_representation(*kmer_ptr), &db_statuses[i].current_bin_key,
// &db_statuses[i].current_min_pos, &db_statuses[i].current_max_pos);
//taxon = val_ptr ? *val_ptr : 0;
//uint32_t* val_ptr = KrakenDatabases[i]->kmer_query(
// KrakenDatabases[i]->canonical_representation(*kmer_ptr), &db_statuses[i].current_bin_key,
// &db_statuses[i].current_min_pos, &db_statuses[i].current_max_pos);
//taxon = val_ptr ? *val_ptr : 0;
if (taxon) break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/gzstream/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
# ----------------------------------------------------------------------------

# CXX = CC -n32 -LANG:std # for SGI Irix 6.5, MIPSpro CC version 7.30
CXX = g++-7 # for Linux RedHat 6.1, g++ version 2.95.2
CXX = g++ # for Linux RedHat 6.1, g++ version 2.95.2

CPPFLAGS = -I. -O -fPIC
LDFLAGS = -L. -lgzstream -lz
Expand Down
145 changes: 0 additions & 145 deletions src/gzstream/index.html

This file was deleted.

Binary file removed src/gzstream/libgzstream.a
Binary file not shown.
Binary file removed src/gzstream/logo.gif
Binary file not shown.
4 changes: 3 additions & 1 deletion src/hyperloglogbias.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#ifndef HYPERLOGLOGBIAS_H_
#define HYPERLOGLOGBIAS_H_

const double rawEstimateData_precision4[] = {
// Bias data from https://docs.google.com/document/d/1gyjfMHy43U9OWBXxfaeG-3MjGzejW1dlpyMwEYAAWEI/view?fullscreen

static const double rawEstimateData_precision4[] = {
11, 11.717, 12.207, 12.7896, 13.2882, 13.8204, 14.3772, 14.9342, 15.5202, 16.161, 16.7722, 17.4636, 18.0396, 18.6766, 19.3566, 20.0454, 20.7936, 21.4856, 22.2666, 22.9946, 23.766, 24.4692, 25.3638, 26.0764, 26.7864, 27.7602, 28.4814, 29.433, 30.2926, 31.0664, 31.9996, 32.7956, 33.5366, 34.5894, 35.5738, 36.2698, 37.3682, 38.0544, 39.2342, 40.0108, 40.7966, 41.9298, 42.8704, 43.6358, 44.5194, 45.773, 46.6772, 47.6174, 48.4888, 49.3304, 50.2506, 51.4996, 52.3824, 53.3078, 54.3984, 55.5838, 56.6618, 57.2174, 58.3514, 59.0802, 60.1482, 61.0376, 62.3598, 62.8078, 63.9744, 64.914, 65.781, 67.1806, 68.0594, 68.8446, 69.7928, 70.8248, 71.8324, 72.8598, 73.6246, 74.7014, 75.393, 76.6708, 77.2394
};

Expand Down
Loading

0 comments on commit f34f8d4

Please sign in to comment.