MCPcopy Create free account
hub / github.com/BirolLab/abyss / fixUnknown

Function fixUnknown

Consensus/Consensus.cpp:294–330  ·  view source on GitHub ↗

Convert all 'N' bases to nt's based on local information. */

Source from the content-addressed store, hash-verified

292
293/** Convert all 'N' bases to nt's based on local information. */
294static 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
332static void writePileup(ostream& out,
333 const string &id, unsigned pos,

Callers 1

consensusFunction · 0.85

Calls 3

colourToNucleotideSpaceFunction · 0.85
atMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected