Build the FM index from the BWT. */
| 119 | |
| 120 | /** Build the FM index from the BWT. */ |
| 121 | static void buildFMIndexFromBWT(FMIndex& fm, const string& path) |
| 122 | { |
| 123 | if (opt::verbose > 0) |
| 124 | cerr << "Reading `" << path << "'...\n"; |
| 125 | std::vector<FMIndex::value_type> bwt; |
| 126 | readFile(path.c_str(), bwt); |
| 127 | assert(bwt.size() > 1); |
| 128 | |
| 129 | if (opt::alphabet.empty()) { |
| 130 | fm.setAlphabet(bwt.begin(), bwt.end()); |
| 131 | std::cerr << "The alphabet has " |
| 132 | << fm.alphabetSize() << " symbols.\n"; |
| 133 | } else |
| 134 | fm.setAlphabet(opt::alphabet); |
| 135 | |
| 136 | fm.encode(bwt.begin(), bwt.end()); |
| 137 | fm.sampleSA(opt::sampleSA); |
| 138 | fm.assignBWT(bwt.begin(), bwt.end()); |
| 139 | } |
| 140 | |
| 141 | /** Build an FM index of the specified file. */ |
| 142 | static void buildFMIndex(FMIndex& fm, const string& path) |