Read a set of paths from the specified file. */
| 797 | |
| 798 | /** Read a set of paths from the specified file. */ |
| 799 | static ContigPathMap |
| 800 | readPaths(const Lengths& lengths, const string& filePath) |
| 801 | { |
| 802 | if (opt::verbose > 0) |
| 803 | cerr << "Reading `" << filePath << "'..." << endl; |
| 804 | ifstream in(filePath.c_str()); |
| 805 | assert_good(in, filePath); |
| 806 | |
| 807 | unsigned tooSmall = 0; |
| 808 | ContigPathMap paths; |
| 809 | std::string name; |
| 810 | ContigPath path; |
| 811 | while (in >> name >> path) { |
| 812 | // Ignore seed contigs shorter than the threshold length. |
| 813 | ContigID id(get(g_contigNames, name)); |
| 814 | unsigned len = lengths[id] + opt::k - 1; |
| 815 | if (len < opt::seedLen) { |
| 816 | tooSmall++; |
| 817 | continue; |
| 818 | } |
| 819 | |
| 820 | bool inserted = paths.insert(make_pair(id, path)).second; |
| 821 | assert(inserted); |
| 822 | (void)inserted; |
| 823 | } |
| 824 | assert(in.eof()); |
| 825 | |
| 826 | if (opt::seedLen > 0) |
| 827 | cout << "Ignored " << tooSmall << " paths whose seeds are shorter than " << opt::seedLen |
| 828 | << " bp.\n"; |
| 829 | return paths; |
| 830 | } |
| 831 | |
| 832 | /** Store it in out and increment it. |
| 833 | * @return true if out != last |