Read contig paths from the specified file. * @param ids [out] the string ID of the paths */
| 319 | * @param ids [out] the string ID of the paths |
| 320 | */ |
| 321 | static ContigPaths |
| 322 | readPaths(const string& inPath, vector<string>* ids = NULL) |
| 323 | { |
| 324 | if (ids != NULL) |
| 325 | assert(ids->empty()); |
| 326 | ifstream fin(inPath.c_str()); |
| 327 | if (opt::verbose > 0) |
| 328 | cerr << "Reading `" << inPath << "'..." << endl; |
| 329 | if (inPath != "-") |
| 330 | assert_good(fin, inPath); |
| 331 | istream& in = inPath == "-" ? cin : fin; |
| 332 | |
| 333 | unsigned count = 0; |
| 334 | ContigPaths paths; |
| 335 | string id; |
| 336 | ContigPath path; |
| 337 | while (in >> id >> path) { |
| 338 | paths.push_back(path); |
| 339 | if (ids != NULL) |
| 340 | ids->push_back(id); |
| 341 | |
| 342 | ++count; |
| 343 | if (opt::verbose > 1 && count % 1000000 == 0) |
| 344 | cerr << "Read " << count |
| 345 | << " paths. " |
| 346 | "Using " |
| 347 | << toSI(getMemoryUsage()) << "B of memory.\n"; |
| 348 | } |
| 349 | if (opt::verbose > 0) |
| 350 | cerr << "Read " << count |
| 351 | << " paths. " |
| 352 | "Using " |
| 353 | << toSI(getMemoryUsage()) << "B of memory.\n"; |
| 354 | if (!opt::db.empty()) |
| 355 | addToDb(db, "Init_paths", count); |
| 356 | opt::pathCount = count; |
| 357 | assert(in.eof()); |
| 358 | return paths; |
| 359 | } |
| 360 | |
| 361 | /** Finds all contigs used in each path in paths, and |
| 362 | * marks them as seen in the vector seen. */ |
no test coverage detected