Return a consensus sequence of a and b. * @return an empty string if a consensus could not be found */
| 350 | * @return an empty string if a consensus could not be found |
| 351 | */ |
| 352 | static string createConsensus(const Sequence& a, const Sequence& b) |
| 353 | { |
| 354 | assert(a.length() == b.length()); |
| 355 | if (a == b) |
| 356 | return a; |
| 357 | string s; |
| 358 | s.reserve(a.length()); |
| 359 | for (string::const_iterator ita = a.begin(), itb = b.begin(); |
| 360 | ita != a.end(); ++ita, ++itb) { |
| 361 | bool mask = islower(*ita) || islower(*itb); |
| 362 | char ca = toupper(*ita), cb = toupper(*itb); |
| 363 | char c = ca == cb ? ca |
| 364 | : ca == 'N' ? cb |
| 365 | : cb == 'N' ? ca |
| 366 | : 'x'; |
| 367 | if (c == 'x') |
| 368 | return string(""); |
| 369 | s += mask ? tolower(c) : c; |
| 370 | } |
| 371 | return s; |
| 372 | } |
| 373 | |
| 374 | /** Merge the specified two contigs, default overlap is k-1, |
| 375 | * generate a consensus sequence of the overlapping region. The result |
no test coverage detected