Write a table of protein results.
| 441 | |
| 442 | /// Write a table of protein results. |
| 443 | void writeProteinTable_(SVOutStream& out, const ProteinQuant& quant, const ExperimentalDesign& ed) |
| 444 | { |
| 445 | const bool print_ratios = getFlag_("ratios"); |
| 446 | const bool print_SILACratios = getFlag_("ratiosSILAC"); |
| 447 | // write header: |
| 448 | out << "protein" << "n_proteins" << "protein_score" << "n_peptides"; |
| 449 | if (ed.getNumberOfSamples() <= 1) |
| 450 | { |
| 451 | out << "abundance"; |
| 452 | } |
| 453 | else |
| 454 | { |
| 455 | for (Size i = 0; i < ed.getNumberOfSamples(); ++i) |
| 456 | { |
| 457 | out << "abundance_" + String(i+1); |
| 458 | } |
| 459 | |
| 460 | // TODO MULTIPLEXING: check if correct |
| 461 | // if ratios-flag is set, print log2-ratios. ratio_1 <sep> ratio_x .... |
| 462 | if (print_ratios) |
| 463 | { |
| 464 | for (Size i = 0; i < ed.getNumberOfSamples(); ++i) |
| 465 | { |
| 466 | out << "ratio_" + String(i+1); |
| 467 | } |
| 468 | } |
| 469 | // if ratiosSILAC-flag is set, print SILAC log2-ratios, only if three |
| 470 | if (print_SILACratios && ed.getNumberOfSamples() == 3) |
| 471 | { |
| 472 | for (Size i = 0; i < ed.getNumberOfSamples(); ++i) |
| 473 | { |
| 474 | out << "SILACratio_" + String(i+1); |
| 475 | } |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | out << endl; |
| 480 | |
| 481 | // mapping: accession of leader -> (accessions of grouped proteins, score) |
| 482 | map<String, pair<StringList, double> > leader_to_group; |
| 483 | if (!proteins_.getIndistinguishableProteins().empty()) |
| 484 | { |
| 485 | for (auto group : proteins_.getIndistinguishableProteins()) //OMS_CODING_TEST_EXCLUDE |
| 486 | { |
| 487 | StringList& accessions = leader_to_group[group.accessions[0]].first; |
| 488 | accessions = group.accessions; |
| 489 | for (auto & acc : accessions) |
| 490 | { |
| 491 | acc.substitute('/', '_'); // to allow concatenation later |
| 492 | } |
| 493 | leader_to_group[group.accessions[0]].second = group.probability; |
| 494 | } |
| 495 | } |
| 496 | |
| 497 | for (auto const & q : quant) |
| 498 | { |
| 499 | if (q.second.total_abundances.empty()) |
| 500 | { |
nothing calls this directly
no test coverage detected