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

Function writePileup

Consensus/Consensus.cpp:332–364  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

330}
331
332static void writePileup(ostream& out,
333 const string &id, unsigned pos,
334 char refc, char genotype,
335 const BaseCount& counts)
336{
337 char foldrefc = toupper(refc);
338 if (opt::onlyVariants && foldrefc == genotype)
339 return;
340 out << id << '\t' // reference sequence name
341 << 1 + pos << '\t' // reference coordinate
342 << refc << '\t' // reference base
343 << genotype << '\t' // genotype
344 << "25\t" // P(genotype is wrong)
345 << "25\t" // P(genotype is the same as the reference)
346 << "25\t" // RMS mapping quality
347 << counts.sum() << '\t'; // number of reads
348 switch (foldrefc) {
349 case 'A': case 'C': case 'G': case 'T':
350 case '0': case '1': case '2': case '3': {
351 uint8_t ref = baseToCode(foldrefc);
352 for (int i = 0; i < 4; i++)
353 if (i != ref)
354 out << string(counts.count[i], codeToBase(i));
355 out << string(counts.count[ref], '.');
356 break;
357 }
358 default:
359 for (int i = 0; i < 4; i++)
360 out << string(counts.count[i], codeToBase(i));
361 }
362 out << '\n';
363 assert(out.good());
364}
365
366/** Forms contigs based on the consensus of each base and outputs them
367 * to the file specified by the -o option. */

Callers 1

consensusFunction · 0.85

Calls 4

baseToCodeFunction · 0.85
codeToBaseFunction · 0.85
goodMethod · 0.80
sumMethod · 0.45

Tested by

no test coverage detected