MCPcopy Create free account
hub / github.com/BirolLab/abyss / loadFile

Function loadFile

Bloom/Bloom.h:78–118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76 /** Load a sequence file into a bloom filter */
77 template <typename BF>
78 inline static void loadFile(BF& bloomFilter, unsigned k, const std::string& path,
79 bool verbose = false, size_t taskIOBufferSize = 100000)
80 {
81 assert(!path.empty());
82 if (verbose)
83 std::cerr << "Reading `" << path << "'...\n";
84 FastaReader in(path.c_str(), FastaReader::FOLD_CASE);
85 uint64_t count = 0;
86#pragma omp parallel
87 for (std::vector<std::string> buffer(taskIOBufferSize);;) {
88 buffer.clear();
89 size_t bufferSize = 0;
90 bool good = true;
91#pragma omp critical(in)
92 for (; good && bufferSize < taskIOBufferSize;) {
93 std::string seq;
94 good = in >> seq;
95 if (good) {
96 buffer.push_back(seq);
97 bufferSize += seq.length();
98 }
99 }
100 if (buffer.size() == 0)
101 break;
102 for (size_t j = 0; j < buffer.size(); j++) {
103 loadSeq(bloomFilter, k, buffer.at(j));
104 if (verbose)
105#pragma omp critical(cerr)
106 {
107 count++;
108 if (count % LOAD_PROGRESS_STEP == 0)
109 std::cerr << "Loaded " << count << " reads into bloom filter\n";
110 }
111 }
112 }
113 assert(in.eof());
114 if (verbose) {
115 std::cerr << "Loaded " << count << " reads from `"
116 << path << "` into bloom filter\n";
117 }
118 }
119
120 /** Load a sequence (string) into a bloom filter */
121 template <typename BF>

Callers 6

loadFiltersFunction · 0.70
buildRollingHashBloomFunction · 0.70
buildCountingBloomFunction · 0.70
mainFunction · 0.50
mainFunction · 0.50
mainFunction · 0.50

Calls 9

loadSeqFunction · 0.70
emptyMethod · 0.45
c_strMethod · 0.45
clearMethod · 0.45
push_backMethod · 0.45
lengthMethod · 0.45
sizeMethod · 0.45
atMethod · 0.45
eofMethod · 0.45

Tested by

no test coverage detected