Read contig paths from the specified file. * @param[in] inPath the filename of the contig paths * @param[out] ids the string ID of the paths * @param[out] isAmb whether the path contains a gap */
| 218 | * @param[out] isAmb whether the path contains a gap |
| 219 | */ |
| 220 | static ContigPaths readPaths(const string& inPath, |
| 221 | vector<string>& ids, vector<bool>& isAmb) |
| 222 | { |
| 223 | assert(ids.empty()); |
| 224 | assert(isAmb.empty()); |
| 225 | assert(g_ambpath_contig.empty()); |
| 226 | ifstream fin(inPath.c_str()); |
| 227 | if (opt::verbose > 0) |
| 228 | cerr << "Reading `" << inPath << "'..." << endl; |
| 229 | if (inPath != "-") |
| 230 | assert_good(fin, inPath); |
| 231 | istream& in = inPath == "-" ? cin : fin; |
| 232 | |
| 233 | ContigPaths paths; |
| 234 | string id; |
| 235 | Path path; |
| 236 | while (in >> id >> path) { |
| 237 | paths.push_back(path); |
| 238 | ids.push_back(id); |
| 239 | isAmb.push_back(false); |
| 240 | |
| 241 | if (path.size() <= 2) |
| 242 | continue; |
| 243 | for (Path::iterator it = path.begin() + 2; |
| 244 | it != path.end(); ++it) { |
| 245 | ContigPath::value_type t = it[-2], u = it[-1], v = it[0]; |
| 246 | if (u.ambiguous()) { |
| 247 | assert(!t.ambiguous()); |
| 248 | assert(!v.ambiguous()); |
| 249 | g_ambpath_contig.insert(AmbPath2Contig::value_type( |
| 250 | AmbPathConstraint(t, v, u.length()), |
| 251 | ContigPath())); |
| 252 | isAmb.back() = true; |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | assert(in.eof()); |
| 257 | return paths; |
| 258 | } |
| 259 | |
| 260 | /** Mark every contig in path as seen. */ |
| 261 | static void markSeen(vector<bool>& seen, const ContigPath& path, |
no test coverage detected