Convert all 'N' bases to nt's based on local information. */
| 292 | |
| 293 | /** Convert all 'N' bases to nt's based on local information. */ |
| 294 | static void fixUnknown(Sequence& ntSeq, const Sequence& csSeq ) |
| 295 | { |
| 296 | size_t index = ntSeq.find_first_of('N'); |
| 297 | size_t rindex = ntSeq.find_last_of('N'); |
| 298 | char base; |
| 299 | #if 0 |
| 300 | if (index == 0) { |
| 301 | #if 0 |
| 302 | for (index = ntSeq.find_first_of("ACGT"); index > 0; index--) |
| 303 | #endif |
| 304 | index = ntSeq.find_first_of("ACGT"); |
| 305 | while (index != 0) { |
| 306 | base = colourToNucleotideSpace(ntSeq.at(index), |
| 307 | csSeq.at(index - 1)); |
| 308 | ntSeq.replace(index - 1, 1, 1, base); |
| 309 | //ntSeq[index-1] = base; |
| 310 | index = ntSeq.find_first_of("ACGT"); |
| 311 | } |
| 312 | index = ntSeq.find_first_of('N'); |
| 313 | } |
| 314 | #endif |
| 315 | |
| 316 | if (index == 0 || rindex == ntSeq.length() - 1) { |
| 317 | ntSeq = ntSeq.substr(ntSeq.find_first_of("ACGT"), |
| 318 | ntSeq.find_last_of("ACGT") - |
| 319 | ntSeq.find_first_of("ACGT") + 1); |
| 320 | index = ntSeq.find_first_of('N'); |
| 321 | } |
| 322 | |
| 323 | while (index != string::npos) { |
| 324 | // If the base isn't the first or last base in the seq... |
| 325 | base = colourToNucleotideSpace(ntSeq.at(index - 1), |
| 326 | csSeq.at(index - 1)); |
| 327 | ntSeq.replace(index, 1, 1, base); |
| 328 | index = ntSeq.find_first_of('N'); |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | static void writePileup(ostream& out, |
| 333 | const string &id, unsigned pos, |
no test coverage detected