Remove tandem repeats from the set of paths. * @return the removed paths */
| 220 | * @return the removed paths |
| 221 | */ |
| 222 | static set<ContigID> |
| 223 | removeRepeats(ContigPathMap& paths) |
| 224 | { |
| 225 | set<ContigID> repeats = findRepeats(paths); |
| 226 | if (gDebugPrint) { |
| 227 | cout << "Repeats:"; |
| 228 | if (!repeats.empty()) { |
| 229 | for (set<ContigID>::const_iterator it = repeats.begin(); it != repeats.end(); ++it) |
| 230 | cout << ' ' << get(g_contigNames, *it); |
| 231 | } else |
| 232 | cout << " none"; |
| 233 | cout << '\n'; |
| 234 | } |
| 235 | |
| 236 | unsigned removed = 0; |
| 237 | for (set<ContigID>::const_iterator it = repeats.begin(); it != repeats.end(); ++it) |
| 238 | if (paths.count(*it) > 0) |
| 239 | removed++; |
| 240 | if (removed == paths.size()) { |
| 241 | // Every path was identified as a repeat. It's most likely a |
| 242 | // cyclic sequence. Don't remove anything. |
| 243 | repeats.clear(); |
| 244 | return repeats; |
| 245 | } |
| 246 | |
| 247 | ostringstream ss; |
| 248 | for (set<ContigID>::const_iterator it = repeats.begin(); it != repeats.end(); ++it) |
| 249 | if (paths.erase(*it) > 0) |
| 250 | ss << ' ' << get(g_contigNames, *it); |
| 251 | |
| 252 | if (opt::verbose > 0 && removed > 0) |
| 253 | cout << "Removing paths in repeats:" << ss.str() << '\n'; |
| 254 | return repeats; |
| 255 | } |
| 256 | |
| 257 | static void |
| 258 | appendToMergeQ(deque<ContigNode>& mergeQ, set<ContigNode>& seen, const ContigPath& path) |