libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
sagetsvhandler.cpp
Go to the documentation of this file.
1/**
2 * \file input/sage/sagereader.h
3 * \date 21/08/2024
4 * \author Olivier Langella
5 * \brief read data files from Sage output
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2024 Olivier Langella
10 *<Olivier.Langella@universite-paris-saclay.fr>.
11 *
12 * This file is part of i2MassChroQ.
13 *
14 * i2MassChroQ is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation, either version 3 of the License, or
17 * (at your option) any later version.
18 *
19 * i2MassChroQ is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with i2MassChroQ. If not, see <http://www.gnu.org/licenses/>.
26 *
27 ******************************************************************************/
28
29
30#include "sagetsvhandler.h"
35#include "../../../../peptide/peptideproformaparser.h"
37#include <qcbormap.h>
38#include <qlogging.h>
39#include <qregularexpression.h>
40
41
42namespace pappso
43{
44namespace cbor
45{
46namespace psm
47{
48
50 const SageReader &sage_reader,
51 PsmProteinMap &psm_protein_map)
52 : m_sageReader(sage_reader), m_psmProteinMap(psm_protein_map)
53{
54 mp_monitor = p_monitor;
57 m_decoyTag = sage_reader.getDecoyTag();
58}
59
63
64void
66{
67 for(auto it_sample_map : m_sampleMap)
68 {
69 writeSample(it_sample_map.second);
70 }
71}
72
73void
80
81void
85
86void
87SageTsvHandler::setCell(const OdsCell &cell)
88{
89 if(m_lineNumber == 0)
90 {
91 // header
92 QString tag = cell.getStringValue();
93 if(tag == "psm_id")
94 {
96 }
97 else if(tag == "peptide")
98 {
100 }
101 else if(tag == "proteins")
102 {
104 }
105 else if(tag == "protein_groups")
106 {
108 }
109 else if(tag == "num_protein_groups")
110 {
112 }
113 else if(tag == "num_proteins")
114 {
116 }
117 else if(tag == "filename")
118 {
120 }
121 else if(tag == "scannr")
122 {
124 }
125 else if(tag == "rank")
126 {
128 }
129 else if(tag == "label")
130 {
132 }
133 else if(tag == "expmass")
134 {
136 }
137
138 else if(tag == "calcmass")
139 {
141 }
142 else if(tag == "charge")
143 {
145 }
146 else if(tag == "peptide_len")
147 {
149 }
150 else if(tag == "missed_cleavages")
151 {
153 }
154 else if(tag == "semi_enzymatic")
155 {
157 }
158 else if(tag == "isotope_error")
159 {
161 }
162 else if(tag == "precursor_ppm")
163 {
165 }
166 else if(tag == "fragment_ppm")
167 {
169 }
170 else if(tag == "hyperscore")
171 {
173 }
174 else if(tag == "delta_next")
175 {
177 }
178 else if(tag == "delta_best")
179 {
181 }
182 else if(tag == "rt")
183 {
184 m_columnTypeList.push_back(Columns::rt);
185 }
186 else if(tag == "aligned_rt")
187 {
189 }
190 else if(tag == "predicted_rt")
191 {
193 }
194 else if(tag == "delta_rt_model")
195 {
197 }
198 else if(tag == "ion_mobility")
199 {
201 }
202 else if(tag == "predicted_mobility")
203 {
205 }
206 else if(tag == "delta_mobility")
207 {
209 }
210 else if(tag == "matched_peaks")
211 {
213 }
214 else if(tag == "longest_b")
215 {
217 }
218 else if(tag == "longest_y")
219 {
221 }
222 else if(tag == "longest_y_pct")
223 {
225 }
226 else if(tag == "matched_intensity_pct")
227 {
229 }
230 else if(tag == "scored_candidates")
231 {
233 }
234 else if(tag == "poisson")
235 {
237 }
238 else if(tag == "sage_discriminant_score")
239 {
241 }
242 else if(tag == "posterior_error")
243 {
245 }
246 else if(tag == "spectrum_q")
247 {
249 }
250 else if(tag == "peptide_q")
251 {
253 }
254 else if(tag == "protein_q")
255 {
257 }
258 else if(tag == "protein_group_q")
259 {
261 }
262 else if(tag == "ms2_intensity")
263 {
265 }
266 else
267 {
268 throw pappso::ExceptionNotPossible(QObject::tr("column \"%1\" not defined").arg(tag));
269 }
270 }
271 else
272 {
273 if(m_columnNumber >= m_columnTypeList.size())
274 {
276 QObject::tr("the value %1 is out of range").arg(cell.getStringValue()));
277 }
279 switch(column_type)
280 {
281 case Columns::psm_id:
282 break;
284 break;
286 break;
288 break;
289 case Columns::peptide:
290 parsePeptide(cell.toString());
291 break;
293 parseProteins(cell.toString());
294 break;
296 if((std::size_t)cell.getDoubleValue() != (std::size_t)m_proteinList.size())
297 {
299 QObject::tr("column \"num_proteins\"!=%1").arg(m_proteinList.size()));
300 }
301 break;
303 parseMsRunFilename(cell.toString());
304 break;
305 case Columns::scannr:
306 parseScanNrColumn(cell.toString());
307 break;
308 case Columns::rank:
309 m_line.rank = cell.getDoubleValue();
310 break;
311 case Columns::label:
312 m_line.label = cell.getDoubleValue();
313 break;
314 case Columns::expmass:
315 m_line.expmass = cell.getDoubleValue();
316 break;
318 m_line.calcmass = cell.getDoubleValue();
319 break;
320 case Columns::charge:
321 m_line.charge = cell.getDoubleValue();
322 break;
324 m_line.peptide_len = cell.getDoubleValue();
325 break;
327 m_line.missed_cleavages = cell.getDoubleValue();
328 break;
330 m_line.semi_enzymatic = cell.getDoubleValue();
331 break;
333 m_line.isotope_error = cell.getDoubleValue();
334 break;
335
337 m_line.precursor_ppm = cell.getDoubleValue();
338 break;
340 m_line.fragment_ppm = cell.getDoubleValue();
341 break;
343 m_line.hyperscore = cell.getDoubleValue();
344 break;
346 m_line.delta_next = cell.getDoubleValue();
347 break;
349 m_line.delta_best = cell.getDoubleValue();
350 break;
351 case Columns::rt:
352 m_line.rt = cell.getDoubleValue() * 60; // to convert retention time in seconds
353 break;
355 m_line.aligned_rt = cell.getDoubleValue();
356 break;
358 m_line.predicted_rt = cell.getDoubleValue();
359 break;
361 m_line.delta_rt_model = cell.getDoubleValue();
362 break;
364 m_line.ion_mobility = cell.getDoubleValue();
365 break;
367 m_line.predicted_mobility = cell.getDoubleValue();
368 break;
370 m_line.delta_mobility = cell.getDoubleValue();
371 break;
373 m_line.matched_peaks = cell.getDoubleValue();
374 break;
376 m_line.longest_b = cell.getDoubleValue();
377 break;
379 m_line.longest_y = cell.getDoubleValue();
380 break;
382 m_line.longest_y_pct = cell.getDoubleValue();
383 break;
385 m_line.matched_intensity_pct = cell.getDoubleValue();
386 break;
388 m_line.scored_candidates = cell.getDoubleValue();
389 break;
390 case Columns::poisson:
391 m_line.poisson = cell.getDoubleValue();
392 break;
394 m_line.sage_discriminant_score = cell.getDoubleValue();
395 break;
397 m_line.posterior_error = cell.getDoubleValue();
398 break;
400 m_line.spectrum_q = cell.getDoubleValue();
401 break;
403 m_line.peptide_q = cell.getDoubleValue();
404 break;
406 m_line.protein_q = cell.getDoubleValue();
407 break;
409 m_line.ms2_intensity = cell.getDoubleValue();
410 break;
411 default:
412 qDebug() << "m_line.calcmass=" << m_line.calcmass;
414 QObject::tr("column type %1 not implemented").arg((std::uint8_t)column_type));
415 break;
416 }
417
418 /*
419
420 2333 TMISDSDYTEFENFTK
421 GRMZM2G018197_P01;GRMZM2G068952_P01;GRMZM5G822976_P01 3
422 20120906_balliau_extract_1_A01_urnb-1.mzML controllerType=0
423 controllerNumber=1 scan=12542 1 1 1926.8225 1926.8193 2 16 0 0
424 0.0 1.6471838 1.9796097 54.06803492297634 28.049970383419556 0.0 38.192993
425 0.76385987 0.7671368 0.0032769442 0.0 0.0 0.0 16 2 14 0.875 32.54396 380
426 -13.375352220427656 1.1570586 -34.13482 0.00016041065 0.00022231363
427 0.00040124074 1271951.1
428 */
429 }
431}
432
433void
435{
436 m_columnNumber = 0;
437 msp_peptide = nullptr;
438 m_proteinList.clear();
439 m_line = Line();
440}
441
442void
446void
447SageTsvHandler::startSheet(const QString &sheet_name [[maybe_unused]])
448{
449 m_columnNumber = 0;
450 m_lineNumber = 0;
451 mp_monitor->setStatus(QObject::tr("reading Sage TSV file"));
452
454 {
455 throw pappso::ExceptionInterrupted(QObject::tr("Sage TSV data reading process interrupted"));
456 }
457}
458
459void
460SageTsvHandler::parsePeptide(const QString &peptide_str)
461{
462 qDebug();
463 QString peptide_str_verif = peptide_str;
464 // fixed modifications :
466 {
467 qDebug() << modif.strModification;
468 qDebug() << modif.modification->getAccession();
469 peptide_str_verif = peptide_str_verif.replace(
470 modif.strModification, QString("[%1]").arg(modif.modification->getAccession()));
471 }
472 // variable modifications :
474 {
475 qDebug() << modif.strModification;
476 qDebug() << modif.modification->getAccession();
477 peptide_str_verif = peptide_str_verif.replace(
478 modif.strModification, QString("[%1]").arg(modif.modification->getAccession()));
479 }
480
481 qDebug() << peptide_str_verif;
482 // LPMFGC[+57.0216]NDATQVYK
484 qDebug();
485 // variable modifications :
486 /*
487 setVariableModifications(peptide_sp,
488 peptide_line.peptide_string_list.at(6));
489*/
490 qDebug() << msp_peptide.get()->toProForma();
491}
492
493
494void
495SageTsvHandler::parseProteins(const QString &proteins_str)
496{
497
498 m_proteinList.clear();
499 m_proteinList = proteins_str.split(";");
500 for(QString accession : m_proteinList)
501 {
502
503 PsmProtein psm_protein;
504 psm_protein.protein_sp = std::make_shared<pappso::Protein>(accession, "");
505 psm_protein.isTarget = true;
506 if(accession.startsWith(m_decoyTag))
507 {
508 psm_protein.isTarget = false;
509 }
510
511 m_psmProteinMap.insert(psm_protein);
512 }
513}
514
515bool
516SageTsvHandler::parseScanNrColumn(const QString &spectrum_string_id)
517{
518 m_spectrumNativeId = spectrum_string_id;
519 qDebug() << spectrum_string_id;
520 m_scanNumber = 0;
521 bool is_ok = false;
522 m_scanNumberIsOk = false;
523 // controllerType=0 controllerNumber=1 scan=176056
524 if(mp_currentSample->name.endsWith(".d"))
525 { // assume this is a Bruker's timTOF sample
526 // 200ngHeLaPASEF_2min_compressed.d 2005
527 std::size_t precursor_number = spectrum_string_id.toULongLong(&is_ok);
528 if(is_ok)
529 {
530 // precursor=2006 idxms2=4011
531 m_scanNumberIsOk = is_ok;
532 m_spectrumIndex = precursor_number * 2 + 1;
533 m_spectrumNativeId = QString("precursor=%1 idxms2=%2")
534 .arg(precursor_number + 1)
535 .arg(precursor_number * 2 + 1);
536 }
537 }
538
539 if(!is_ok)
540 {
541 QStringList scan_list = spectrum_string_id.split("scan=");
542 if(scan_list.size() == 2)
543 {
544 // we bet that there is a scan number, easy to parse
545 m_scanNumber = scan_list.at(1).toULongLong(&is_ok);
546 m_scanNumberIsOk = is_ok;
547 if(m_scanNumber > 0)
549 }
550 if(is_ok == false)
551 {
552 ;
553 QStringList scan_list = spectrum_string_id.split(QRegularExpression("[^\\d]"));
554 if(scan_list.size() == 2)
555 {
556 m_scanNumber = scan_list.at(0).toULongLong(&is_ok);
557 m_scanNumberIsOk = is_ok;
558 if(m_scanNumber > 0)
560 }
561 /*
562 if(msp_previousMsrun != msp_msrun)
563 {
564 mp_monitor->setStatus(
565 QObject::tr("Reading mz data file %1").arg(msp_msrun.get()->getFileName()));
566 msp_previousMsrun = msp_msrun;
567 }
568
569 pappso::MsRunReader *msrunreader_p = msp_msrun.get()->getMsRunReaderSPtr().get();
570 if(msrunreader_p->getMsRunId()->getMsDataFormat() == pappso::MsDataFormat::brukerTims)
571 {
572 m_spectrumIndex = spectrum_string_id.toInt() * 2 - 1;
573 }
574 else
575 {
576 m_spectrumIndex =
577 msrunreader_p->spectrumStringIdentifier2SpectrumIndex(spectrum_string_id);
578 }*/
579 }
580 }
581 qDebug() << spectrum_string_id;
582 return is_ok;
583}
584
585void
586SageTsvHandler::parseMsRunFilename(const QString &msrun_filename)
587{
588
589
590 // find the sample :
591 auto it_insert = m_sampleMap.insert({msrun_filename, {}});
592 mp_currentSample = &(it_insert.first->second);
593 if(it_insert.second)
594 {
595 // new sample
596 it_insert.first->second.name = msrun_filename;
597 QCborMap ms_file;
598 QCborMap identification_file;
599
600 it_insert.first->second.cbor_core_sample.insert(QString("name"),
601 QFileInfo(msrun_filename).baseName());
602
603 // identification_file_list
604 QCborArray identification_file_list;
605 identification_file.insert(QString("name"), m_sageReader.getmJsonAbsoluteFilePath());
606 identification_file_list.push_back(identification_file);
607 it_insert.first->second.cbor_core_sample.insert(QString("identification_file_list"),
608 identification_file_list);
609
610
611 ms_file.insert(QString("name"), m_sageReader.getMzmlPath(msrun_filename));
612 it_insert.first->second.cbor_core_sample.insert(QString("peaklist_file"), ms_file);
613 }
614
615 /*
616 msp_msrun = m_sageReader.getSageFileReader().getMsRunSpWithFileName(msrun_filename);
617 qDebug() << msp_msrun.get()->getFileName();
618
619 msp_identificationSageJsonFileSp =
620 m_sageReader.getSageFileReader().getIdentificationSageJsonFileSpWithFileName(msrun_filename);
621
622 mp_identificationGroup =
623 m_sageReader.getSageFileReader().getIdentificationGroupPtrWithFileName(msrun_filename);
624 qDebug() << msp_msrun.get()->getFileName();
625 */
626}
627
628void
630{
631 qDebug();
632
633 for(const QString &accession : m_proteinList)
634 {
635 PsmProtein psm_protein;
636 psm_protein.protein_sp = std::make_shared<pappso::Protein>(accession, "");
637
638 QCborMap sage_eval;
639 sage_eval.insert(QString("protein_q"), m_line.protein_q);
640
641 auto it = m_psmProteinMap.insert(psm_protein);
642 it.first->second.cborEval.insert(QString("sage"), sage_eval);
643 }
644 /*
645 PeptideEvidence pe(msp_msrun.get(), m_spectrumIndex, true);
646 pe.setCharge(m_line.charge);
647 pe.setChecked(true);
648 pe.setExperimentalMass(m_line.expmass);
649 pe.setPeptideXtpSp(msp_peptide);
650 pe.setIdentificationDataSource(msp_identificationSageJsonFileSp.get());
651 pe.setIdentificationEngine(m_identificationEngine);
652 pe.setRetentionTime(m_line.rt);
653 pe.setParam(PeptideEvidenceParam::tandem_hyperscore, m_line.hyperscore);
654 pe.setParam(PeptideEvidenceParam::sage_sage_discriminant_score,
655 m_line.sage_discriminant_score);
656 pe.setParam(PeptideEvidenceParam::sage_peptide_q, m_line.peptide_q);
657 pe.setParam(PeptideEvidenceParam::sage_posterior_error, m_line.posterior_error);
658 pe.setParam(PeptideEvidenceParam::sage_spectrum_q, m_line.spectrum_q);
659 pe.setParam(PeptideEvidenceParam::sage_predicted_rt, m_line.predicted_rt);
660 pe.setParam(PeptideEvidenceParam::sage_isotope_error, m_line.isotope_error);
661
662
663 PeptideMatch peptide_match;
664 // peptide_match.setStart(mz_peptide_evidence.start);
665 peptide_match.setPeptideEvidenceSp(
666 msp_identificationSageJsonFileSp.get()->getPeptideEvidenceStore().getInstance(&pe));
667 */
668
669 // find the scan in sample
670 auto it_insert = mp_currentSample->scan_map.insert({m_spectrumNativeId, Scan()});
671 Scan *current_cbor_scan_p = &(it_insert.first->second);
672 if(it_insert.second)
673 {
674 // new scan
675 QCborMap &scan_id = it_insert.first->second.cbor_id;
677 {
678 scan_id.insert(QString("index"), (qint64)m_spectrumIndex);
679 if(m_scanNumber > 0)
680 scan_id.insert(QString("scan"), (qint64)m_scanNumber);
681 }
682 scan_id.insert(QString("native_id"), m_spectrumNativeId);
683
684 QCborMap &scan_ms2 = it_insert.first->second.cbor_ms2;
685 scan_ms2.insert(QString("rt"), m_line.rt);
686
687 QCborMap &scan_precursor = it_insert.first->second.cbor_precursor;
688 scan_precursor.insert(QString("z"), m_line.charge);
689 double mh = m_line.expmass + MHPLUS;
690 scan_precursor.insert(QString("mh"), mh);
691 double exp_mz = (m_line.expmass + (MHPLUS * m_line.charge)) / m_line.charge;
692 scan_precursor.insert(QString("mz"), exp_mz);
693 }
694
695 Psm one_psm;
696 one_psm.peptide_sequence_li = msp_peptide.get()->getSequenceLi();
697 one_psm.proforma = msp_peptide.get()->toProForma();
698 one_psm.protein_list = m_proteinList;
699
700
701 one_psm.cbor_eval.insert(QString("aligned_rt"), m_line.aligned_rt);
702 one_psm.cbor_eval.insert(QString("calcmass"), m_line.calcmass);
703 one_psm.cbor_eval.insert(QString("delta_best"), m_line.delta_best);
704 one_psm.cbor_eval.insert(QString("delta_mobility"), m_line.delta_mobility);
705 one_psm.cbor_eval.insert(QString("delta_next"), m_line.delta_next);
706 one_psm.cbor_eval.insert(QString("delta_rt_model"), m_line.delta_rt_model);
707 one_psm.cbor_eval.insert(QString("fragment_ppm"), m_line.fragment_ppm);
708 one_psm.cbor_eval.insert(QString("hyperscore"), m_line.hyperscore);
709 one_psm.cbor_eval.insert(QString("ion_mobility"), m_line.ion_mobility);
710 one_psm.cbor_eval.insert(QString("isotope_error"), m_line.isotope_error);
711 one_psm.cbor_eval.insert(QString("label"), m_line.label);
712 one_psm.cbor_eval.insert(QString("longest_b"), (qint64)m_line.longest_b);
713 one_psm.cbor_eval.insert(QString("longest_y"), (qint64)m_line.longest_y);
714 one_psm.cbor_eval.insert(QString("longest_y_pct"), m_line.longest_y_pct);
715 one_psm.cbor_eval.insert(QString("matched_intensity_pct"), m_line.matched_intensity_pct);
716 one_psm.cbor_eval.insert(QString("matched_peaks"), (qint64)m_line.matched_peaks);
717 one_psm.cbor_eval.insert(QString("missed_cleavages"), m_line.missed_cleavages);
718 one_psm.cbor_eval.insert(QString("ms2_intensity"), m_line.ms2_intensity);
719 one_psm.cbor_eval.insert(QString("peptide_len"), (qint64)m_line.peptide_len);
720 one_psm.cbor_eval.insert(QString("peptide_q"), m_line.peptide_q);
721 one_psm.cbor_eval.insert(QString("poisson"), m_line.poisson);
722 one_psm.cbor_eval.insert(QString("posterior_error"), m_line.posterior_error);
723 one_psm.cbor_eval.insert(QString("precursor_ppm"), m_line.precursor_ppm);
724 one_psm.cbor_eval.insert(QString("predicted_mobility"), m_line.predicted_mobility);
725 one_psm.cbor_eval.insert(QString("predicted_rt"), m_line.predicted_rt);
726 one_psm.cbor_eval.insert(QString("protein_q"), m_line.protein_q);
727 one_psm.cbor_eval.insert(QString("rank"), m_line.rank);
728 one_psm.cbor_eval.insert(QString("sage_discriminant_score"), m_line.sage_discriminant_score);
729 one_psm.cbor_eval.insert(QString("scored_candidates"), (qint64)m_line.scored_candidates);
730 one_psm.cbor_eval.insert(QString("semi_enzymatic"), m_line.semi_enzymatic);
731 one_psm.cbor_eval.insert(QString("spectrum_q"), m_line.spectrum_q);
732
733 current_cbor_scan_p->psm_list.emplace_back(one_psm);
734
735
736 std::size_t progress = m_lineNumber / 10000;
737 if(progress > m_progressIndex)
738 {
740 {
742 QObject::tr("Sage TSV data reading process interrupted"));
743 }
744 m_progressIndex = progress;
745 mp_monitor->setStatus(QString("%1K ").arg(m_progressIndex * 10));
746 }
747}
748
749void
751{
753 m_sageReader.getCborStreamWriter().append("name");
754 one_sample.cbor_core_sample.value("name").toCbor(m_sageReader.getCborStreamWriter());
755
756 m_sageReader.getCborStreamWriter().append("identification_file_list");
757 one_sample.cbor_core_sample.value("identification_file_list")
759
760
761 m_sageReader.getCborStreamWriter().append("peaklist_file");
762 one_sample.cbor_core_sample.value("peaklist_file").toCbor(m_sageReader.getCborStreamWriter());
763 //"scan_list": [
764
765 m_sageReader.getCborStreamWriter().append("scan_list");
766 m_sageReader.getCborStreamWriter().startArray(one_sample.scan_map.size());
767 for(auto &it_scan : one_sample.scan_map)
768 {
769 writeScan(it_scan.second);
770 }
772
773
775}
776
777void
779{
781 m_sageReader.getCborStreamWriter().append("id");
782 QCborValue(one_scan.cbor_id).toCbor(m_sageReader.getCborStreamWriter());
783 m_sageReader.getCborStreamWriter().append("precursor");
784 QCborValue(one_scan.cbor_precursor).toCbor(m_sageReader.getCborStreamWriter());
785 m_sageReader.getCborStreamWriter().append("ms2");
786 QCborValue(one_scan.cbor_ms2).toCbor(m_sageReader.getCborStreamWriter());
787
788 m_sageReader.getCborStreamWriter().append("psm_list");
789 m_sageReader.getCborStreamWriter().startArray(one_scan.psm_list.size());
790 for(auto &it_psm : one_scan.psm_list)
791 {
792 writePsm(it_psm);
793 }
795
797}
798
799void
801{
803 m_sageReader.getCborStreamWriter().append("proforma");
804 m_sageReader.getCborStreamWriter().append(one_psm.proforma);
805 m_sageReader.getCborStreamWriter().append("protein_list");
806
807 QCborArray cbor_protein_list;
808 for(const QString &accession : one_psm.protein_list)
809 {
810 // qWarning() << "accession=" << accession;
811 QCborMap cbor_protein;
812 cbor_protein.insert(QString("accession"), accession);
813
814
815 // start/end positions
816 QString protein_sequence =
817 QString(m_psmProteinMap.getByAccession(accession).protein_sp.get()->getSequence())
818 .replace("L", "I");
819 int position = protein_sequence.indexOf(one_psm.peptide_sequence_li);
820
821 QCborArray positions;
822 while(position >= 0)
823 {
824 positions.push_back(position);
825 position = protein_sequence.indexOf(one_psm.peptide_sequence_li, position + 1);
826 }
827
828 cbor_protein.insert(QString("positions"), positions);
829
830 cbor_protein_list.append(cbor_protein);
831 }
832
833
834 QCborValue(cbor_protein_list).toCbor(m_sageReader.getCborStreamWriter());
835
836 m_sageReader.getCborStreamWriter().append("eval");
838 m_sageReader.getCborStreamWriter().append("sage");
839 QCborValue(one_psm.cbor_eval).toCbor(m_sageReader.getCborStreamWriter());
841
843}
844
845
846} // namespace psm
847} // namespace cbor
848} // namespace pappso
static PeptideSp parseString(const QString &pepstr)
virtual void setStatus(const QString &status)=0
current status of the process
virtual bool shouldIstop()=0
should the procces be stopped ? If true, then cancel process Use this function at strategic point of ...
store PsmProtein in a map with accession as key
const pappso::cbor::psm::PsmProtein & getByAccession(const QString &accession) const
retrieve a PsmProtein with its accession
std::pair< std::map< QString, PsmProtein >::iterator, bool > insert(const PsmProtein &psm_protein)
standard map insert of a PsmProtein (accession is the key)
const QString & getMzmlPath(const QString &file_msrun) const
std::vector< SageModification > getStaticModificationList() const
const QString & getmJsonAbsoluteFilePath() const
pappso::cbor::CborStreamWriter & getCborStreamWriter() const
std::vector< SageModification > getVariableModificationList() const
std::vector< SageReader::SageModification > m_staticModificationList
void parseProteins(const QString &proteins_str)
virtual void endSheet() override
pappso::UiMonitorInterface * mp_monitor
virtual void startSheet(const QString &sheet_name) override
std::vector< SageReader::SageModification > m_variableModificationList
void parsePeptide(const QString &peptide_str)
void writeSample(const Sample &one_sample)
virtual void setCell(const OdsCell &cell) override
void writePsm(const Psm &one_psm)
SageTsvHandler(pappso::UiMonitorInterface *p_monitor, const SageReader &sage_reader, PsmProteinMap &psm_protein_map)
void writeScan(const Scan &one_scan)
std::map< QString, Sample > m_sampleMap
virtual void endDocument() override
virtual void startLine() override
void parseMsRunFilename(const QString &msrun_filename)
bool parseScanNrColumn(const QString &spectrum_string_id)
virtual void endLine() override
std::vector< Columns > m_columnTypeList
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
const pappso_double MHPLUS(1.007276466879)
std::shared_ptr< Protein > protein_sp