Read contig paths from the specified file. * @param g the contig adjacency graph * @param inPath the file of contig paths * @param[out] pathIDs the path IDs * @return the paths */
| 219 | * @return the paths |
| 220 | */ |
| 221 | static Paths |
| 222 | readPaths(Graph& g, const string& inPath, vector<string>& pathIDs) |
| 223 | { |
| 224 | typedef graph_traits<Graph>::vertex_descriptor V; |
| 225 | |
| 226 | assert(pathIDs.empty()); |
| 227 | ifstream fin(inPath.c_str()); |
| 228 | if (opt::verbose > 0) |
| 229 | cerr << "Reading `" << inPath << "'..." << endl; |
| 230 | if (inPath != "-") |
| 231 | assert_good(fin, inPath); |
| 232 | istream& in = inPath == "-" ? cin : fin; |
| 233 | |
| 234 | assert_good(in, inPath); |
| 235 | Paths paths; |
| 236 | string id; |
| 237 | ContigPath path; |
| 238 | while (in >> id >> path) { |
| 239 | if (path.empty()) { |
| 240 | // Remove this contig from the graph. |
| 241 | V u = find_vertex(id, false, g); |
| 242 | clear_vertex(u, g); |
| 243 | remove_vertex(u, g); |
| 244 | } else { |
| 245 | pathIDs.push_back(id); |
| 246 | paths.push_back(path); |
| 247 | } |
| 248 | } |
| 249 | assert(in.eof()); |
| 250 | return paths; |
| 251 | } |
| 252 | |
| 253 | typedef multimap<ContigNode, Vertex> SeedMap; |
| 254 |
no test coverage detected