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

Function buildFMIndex

Map/map.cc:501–520  ·  view source on GitHub ↗

Build an FM index of the specified file. */

Source from the content-addressed store, hash-verified

499
500/** Build an FM index of the specified file. */
501static void buildFMIndex(FMIndex& fm, const char* path)
502{
503 if (opt::verbose > 0)
504 std::cerr << "Reading `" << path << "'...\n";
505 std::vector<FMIndex::value_type> s;
506 readFile(path, s);
507
508 uint64_t MAX_SIZE = numeric_limits<FMIndex::sais_size_type>::max();
509 if (s.size() > MAX_SIZE) {
510 std::cerr << PROGRAM << ": `" << path << "', "
511 << toSI(s.size())
512 << "B, must be smaller than "
513 << toSI(MAX_SIZE) << "B\n";
514 exit(EXIT_FAILURE);
515 }
516
517 transform(s.begin(), s.end(), s.begin(), ::toupper);
518 fm.setAlphabet(opt::alphabet);
519 fm.assign(s.begin(), s.end());
520}
521
522/** Return the size of the specified file. */
523static streampos fileSize(const string& path)

Callers 1

mainFunction · 0.70

Calls 7

toSIFunction · 0.85
setAlphabetMethod · 0.80
readFileFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
assignMethod · 0.45

Tested by

no test coverage detected