libpappsomspp
Library for mass spectrometry
pappso::cbor::psm::SageTsvHandler Class Reference

#include <sagetsvhandler.h>

Inheritance diagram for pappso::cbor::psm::SageTsvHandler:

Classes

struct  Line
 
struct  Psm
 
struct  Sample
 
struct  Scan
 

Public Types

enum class  Columns : std::int8_t {
  psm_id , peptide , proteins , num_proteins ,
  filename , scannr , rank , label ,
  expmass , calcmass , charge , peptide_len ,
  missed_cleavages , semi_enzymatic , isotope_error , precursor_ppm ,
  fragment_ppm , hyperscore , delta_next , delta_best ,
  rt , aligned_rt , predicted_rt , delta_rt_model ,
  ion_mobility , predicted_mobility , delta_mobility , matched_peaks ,
  longest_b , longest_y , longest_y_pct , matched_intensity_pct ,
  scored_candidates , poisson , sage_discriminant_score , posterior_error ,
  spectrum_q , peptide_q , protein_q , ms2_intensity
}
 

Public Member Functions

 SageTsvHandler (pappso::UiMonitorInterface *p_monitor, const SageReader &sage_reader, bool is_fasta_pass, PsmProteinMap &psm_protein_map)
 
virtual ~SageTsvHandler ()
 
virtual void startSheet (const QString &sheet_name) override
 
virtual void endSheet () override
 
virtual void startLine () override
 
virtual void endLine () override
 
virtual void setCell (const OdsCell &cell) override
 
virtual void endDocument () override
 

Private Member Functions

void parsePeptide (const QString &peptide_str)
 
void parseProteins (const QString &proteins_str)
 
bool parseSpectrumStringId (const QString &spectrum_string_id)
 
void parseMsRunFilename (const QString &msrun_filename)
 
void recordLine ()
 
void writeSample (const Sample &one_sample)
 
void writeScan (const Scan &one_scan)
 
void writePsm (const Psm &one_psm)
 

Private Attributes

const SageReaderm_sageReader
 
PsmProteinMapm_psmProteinMap
 
pappso::UiMonitorInterfacemp_monitor = nullptr
 
std::size_t m_progressIndex = 0
 
std::size_t m_lineNumber = 0
 
std::size_t m_columnNumber = 0
 
std::vector< Columnsm_columnTypeList
 
pappso::PeptideSp msp_peptide
 
std::vector< SageReader::SageModificationm_staticModificationList
 
std::vector< SageReader::SageModificationm_variableModificationList
 
std::size_t m_spectrumIndex
 
Line m_line
 
QString m_decoyTag
 
bool m_isFirstPass
 
QStringList m_proteinList
 
QString m_spectrumNativeId
 
std::map< QString, Samplem_sampleMap
 
Samplemp_currentSample
 

Detailed Description

Todo:
write docs

Definition at line 43 of file sagetsvhandler.h.

Member Enumeration Documentation

◆ Columns

enum class pappso::cbor::psm::SageTsvHandler::Columns : std::int8_t
strong
Enumerator
psm_id 
peptide 
proteins 
num_proteins 
filename 
scannr 
rank 
label 
expmass 
calcmass 
charge 
peptide_len 
missed_cleavages 
semi_enzymatic 
isotope_error 
precursor_ppm 
fragment_ppm 
hyperscore 
delta_next 
delta_best 
rt 
aligned_rt 
predicted_rt 
delta_rt_model 
ion_mobility 
predicted_mobility 
delta_mobility 
matched_peaks 
longest_b 
longest_y 
longest_y_pct 
matched_intensity_pct 
scored_candidates 
poisson 
sage_discriminant_score 
posterior_error 
spectrum_q 
peptide_q 
protein_q 
ms2_intensity 

Definition at line 46 of file sagetsvhandler.h.

47 {
48 psm_id,
49 peptide,
50 proteins,
51 num_proteins,
52 filename,
53 scannr,
54 rank,
55 label,
56 expmass,
57 calcmass,
58 charge,
59 peptide_len,
60 missed_cleavages,
61 semi_enzymatic,
62 isotope_error,
63 precursor_ppm,
64 fragment_ppm,
65 hyperscore,
66 delta_next,
67 delta_best,
68 rt,
69 aligned_rt,
70 predicted_rt,
71 delta_rt_model,
72 ion_mobility,
73 predicted_mobility,
74 delta_mobility,
75 matched_peaks,
76 longest_b,
77 longest_y,
78 longest_y_pct,
79 matched_intensity_pct,
80 scored_candidates,
81 poisson,
82 sage_discriminant_score,
83 posterior_error,
84 spectrum_q,
85 peptide_q,
86 protein_q,
87 ms2_intensity,
88 };
@ rt
Retention time.

Constructor & Destructor Documentation

◆ SageTsvHandler()

pappso::cbor::psm::SageTsvHandler::SageTsvHandler ( pappso::UiMonitorInterface p_monitor,
const SageReader sage_reader,
bool  is_fasta_pass,
PsmProteinMap psm_protein_map 
)

Default constructor

Definition at line 40 of file sagetsvhandler.cpp.

44 : m_sageReader(sage_reader), m_psmProteinMap(psm_protein_map)
45{
46 mp_monitor = p_monitor;
47 m_staticModificationList = sage_reader.getStaticModificationList();
48 m_variableModificationList = sage_reader.getVariableModificationList();
49 m_decoyTag = sage_reader.getDecoyTag();
50 m_isFirstPass = is_fasta_pass;
51}
std::vector< SageReader::SageModification > m_staticModificationList
pappso::UiMonitorInterface * mp_monitor
std::vector< SageReader::SageModification > m_variableModificationList

References pappso::cbor::psm::SageReader::getDecoyTag(), pappso::cbor::psm::SageReader::getStaticModificationList(), pappso::cbor::psm::SageReader::getVariableModificationList(), m_decoyTag, m_isFirstPass, m_staticModificationList, m_variableModificationList, and mp_monitor.

◆ ~SageTsvHandler()

pappso::cbor::psm::SageTsvHandler::~SageTsvHandler ( )
virtual

Destructor

Definition at line 53 of file sagetsvhandler.cpp.

54{
55}

Member Function Documentation

◆ endDocument()

void pappso::cbor::psm::SageTsvHandler::endDocument ( )
overridevirtual

callback that report the end of the ODS document. Override it if you need to know that reading is finished.

Definition at line 58 of file sagetsvhandler.cpp.

59{
60 for(auto it_sample_map : m_sampleMap)
61 {
62 writeSample(it_sample_map.second);
63 }
64}
void writeSample(const Sample &one_sample)
std::map< QString, Sample > m_sampleMap

◆ endLine()

void pappso::cbor::psm::SageTsvHandler::endLine ( )
overridevirtual

callback that indicates a line ending. Override it if needed.

Definition at line 67 of file sagetsvhandler.cpp.

◆ endSheet()

void pappso::cbor::psm::SageTsvHandler::endSheet ( )
overridevirtual

callback that indicates the end of the current data sheet. Override it if needed

Definition at line 75 of file sagetsvhandler.cpp.

76{
77}

◆ parseMsRunFilename()

void pappso::cbor::psm::SageTsvHandler::parseMsRunFilename ( const QString &  msrun_filename)
private

Definition at line 534 of file sagetsvhandler.cpp.

535{
536
537 if(m_isFirstPass)
538 return;
539
540 // find the sample :
541 auto it_insert = m_sampleMap.insert({msrun_filename, {}});
542 mp_currentSample = &(it_insert.first->second);
543 if(it_insert.second)
544 {
545 // new sample
546 it_insert.first->second.name = msrun_filename;
547 QCborMap ms_file;
548 QCborMap identification_file;
549
550 it_insert.first->second.cbor_core_sample.insert(QString("name"),
551 QFileInfo(msrun_filename).baseName());
552
553 // identification_file_list
554 QCborArray identification_file_list;
555 identification_file.insert(QString("name"), m_sageReader.getmJsonAbsoluteFilePath());
556 identification_file_list.push_back(identification_file);
557 it_insert.first->second.cbor_core_sample.insert(QString("identification_file_list"),
558 identification_file_list);
559
560
561 ms_file.insert(QString("name"), QFileInfo(msrun_filename).absoluteFilePath());
562 it_insert.first->second.cbor_core_sample.insert(QString("peaklist_file"), ms_file);
563 }
564
565 /*
566 msp_msrun = m_sageReader.getSageFileReader().getMsRunSpWithFileName(msrun_filename);
567 qDebug() << msp_msrun.get()->getFileName();
568
569 msp_identificationSageJsonFileSp =
570 m_sageReader.getSageFileReader().getIdentificationSageJsonFileSpWithFileName(msrun_filename);
571
572 mp_identificationGroup =
573 m_sageReader.getSageFileReader().getIdentificationGroupPtrWithFileName(msrun_filename);
574 qDebug() << msp_msrun.get()->getFileName();
575 */
576}
const QString & getmJsonAbsoluteFilePath() const
Definition: sagereader.cpp:56

◆ parsePeptide()

void pappso::cbor::psm::SageTsvHandler::parsePeptide ( const QString &  peptide_str)
private

Definition at line 431 of file sagetsvhandler.cpp.

432{
433 qDebug();
434 if(m_isFirstPass)
435 return;
436 QString peptide_str_verif = peptide_str;
437 // fixed modifications :
438 for(SageReader::SageModification modif : m_staticModificationList)
439 {
440 qDebug() << modif.strModification;
441 qDebug() << modif.modification->getAccession();
442 peptide_str_verif = peptide_str_verif.replace(
443 modif.strModification, QString("[%1]").arg(modif.modification->getAccession()));
444 }
445 // variable modifications :
446 for(SageReader::SageModification modif : m_variableModificationList)
447 {
448 qDebug() << modif.strModification;
449 qDebug() << modif.modification->getAccession();
450 peptide_str_verif = peptide_str_verif.replace(
451 modif.strModification, QString("[%1]").arg(modif.modification->getAccession()));
452 }
453
454 qDebug() << peptide_str_verif;
455 // LPMFGC[+57.0216]NDATQVYK
457 qDebug();
458 // variable modifications :
459 /*
460 setVariableModifications(peptide_sp,
461 peptide_line.peptide_string_list.at(6));
462*/
463 qDebug() << msp_peptide.get()->toProForma();
464}
static PeptideSp parseString(const QString &pepstr)

References pappso::PeptideProFormaParser::parseString().

◆ parseProteins()

void pappso::cbor::psm::SageTsvHandler::parseProteins ( const QString &  proteins_str)
private

Definition at line 468 of file sagetsvhandler.cpp.

469{
470 m_proteinList.clear();
471 m_proteinList = proteins_str.split(";");
472 if(m_isFirstPass)
473 {
474 for(QString accession : m_proteinList)
475 {
476
478 psm_protein.protein_sp = std::make_shared<pappso::Protein>(accession, "");
479 psm_protein.isTarget = true;
480 if(accession.startsWith(m_decoyTag))
481 {
482 psm_protein.isTarget = false;
483 }
484
485 m_psmProteinMap.insert(psm_protein);
486 }
487 }
488}
std::pair< std::map< QString, pappso::cbor::psm::PsmProtein >::iterator, bool > insert(const PsmProtein &psm_protein)
std::shared_ptr< Protein > protein_sp
Definition: psmproteinmap.h:41

References pappso::cbor::psm::PsmProtein::isTarget, and pappso::cbor::psm::PsmProtein::protein_sp.

◆ parseSpectrumStringId()

bool pappso::cbor::psm::SageTsvHandler::parseSpectrumStringId ( const QString &  spectrum_string_id)
private

Definition at line 491 of file sagetsvhandler.cpp.

492{
493 m_spectrumNativeId = spectrum_string_id;
494 qDebug() << spectrum_string_id;
495 if(m_isFirstPass)
496 return false;
497 // controllerType=0 controllerNumber=1 scan=176056
498
499 bool is_ok = false;
500 QStringList scan_list = spectrum_string_id.split("scan=");
501 if(scan_list.size() == 2)
502 {
503 // we bet that there is a scan number, easy to parse
504 m_spectrumIndex = scan_list.at(1).toULongLong(&is_ok);
505 if(m_spectrumIndex > 0)
507 }
508 if(is_ok == false)
509 { /*
510 if(msp_previousMsrun != msp_msrun)
511 {
512 mp_monitor->setStatus(
513 QObject::tr("Reading mz data file %1").arg(msp_msrun.get()->getFileName()));
514 msp_previousMsrun = msp_msrun;
515 }
516
517 pappso::MsRunReader *msrunreader_p = msp_msrun.get()->getMsRunReaderSPtr().get();
518 if(msrunreader_p->getMsRunId()->getMsDataFormat() == pappso::MsDataFormat::brukerTims)
519 {
520 m_spectrumIndex = spectrum_string_id.toInt() * 2 - 1;
521 }
522 else
523 {
524 m_spectrumIndex =
525 msrunreader_p->spectrumStringIdentifier2SpectrumIndex(spectrum_string_id);
526 }*/
527 }
528
529 qDebug() << spectrum_string_id;
530 return is_ok;
531}

◆ recordLine()

void pappso::cbor::psm::SageTsvHandler::recordLine ( )
private

Definition at line 579 of file sagetsvhandler.cpp.

580{
581 qDebug();
582
583 if(m_isFirstPass)
584 {
585 for(const QString &accession : m_proteinList)
586 {
588 psm_protein.protein_sp = std::make_shared<pappso::Protein>(accession, "");
589
590 auto it = m_psmProteinMap.insert(psm_protein);
591 it.first->second.cborEval.insert(QString("protein_q"), m_line.protein_q);
592 }
593 }
594 else
595 {
596 /*
597 PeptideEvidence pe(msp_msrun.get(), m_spectrumIndex, true);
598 pe.setCharge(m_line.charge);
599 pe.setChecked(true);
600 pe.setExperimentalMass(m_line.expmass);
601 pe.setPeptideXtpSp(msp_peptide);
602 pe.setIdentificationDataSource(msp_identificationSageJsonFileSp.get());
603 pe.setIdentificationEngine(m_identificationEngine);
604 pe.setRetentionTime(m_line.rt);
605 pe.setParam(PeptideEvidenceParam::tandem_hyperscore, m_line.hyperscore);
606 pe.setParam(PeptideEvidenceParam::sage_sage_discriminant_score,
607 m_line.sage_discriminant_score);
608 pe.setParam(PeptideEvidenceParam::sage_peptide_q, m_line.peptide_q);
609 pe.setParam(PeptideEvidenceParam::sage_posterior_error, m_line.posterior_error);
610 pe.setParam(PeptideEvidenceParam::sage_spectrum_q, m_line.spectrum_q);
611 pe.setParam(PeptideEvidenceParam::sage_predicted_rt, m_line.predicted_rt);
612 pe.setParam(PeptideEvidenceParam::sage_isotope_error, m_line.isotope_error);
613
614
615 PeptideMatch peptide_match;
616 // peptide_match.setStart(mz_peptide_evidence.start);
617 peptide_match.setPeptideEvidenceSp(
618 msp_identificationSageJsonFileSp.get()->getPeptideEvidenceStore().getInstance(&pe));
619 */
620
621 // find the scan in sample
622 auto it_insert = mp_currentSample->scan_map.insert({m_spectrumNativeId, Scan()});
623 Scan *current_cbor_scan_p = &(it_insert.first->second);
624 if(it_insert.second)
625 {
626 // new scan
627 QCborMap &scan_id = it_insert.first->second.cbor_id;
628 scan_id.insert(QString("index"), (qint64)m_spectrumIndex);
629 scan_id.insert(QString("native_id"), m_spectrumNativeId);
630
631 QCborMap &scan_ms2 = it_insert.first->second.cbor_ms2;
632 scan_ms2.insert(QString("rt"), m_line.rt);
633
634 QCborMap &scan_precursor = it_insert.first->second.cbor_precursor;
635 scan_precursor.insert(QString("z"), m_line.charge);
636 scan_precursor.insert(QString("mz"), m_line.expmass);
637 }
638
639 Psm one_psm;
640 one_psm.proforma = msp_peptide.get()->toProForma();
641
642 for(const QString &accession : m_proteinList)
643 {
644 QCborMap cbor_protein;
645 cbor_protein.insert(QString("accession"), accession);
646
647
648 // start/end positions
649 QString protein_sequence =
650 QString(m_psmProteinMap.getByAccession(accession).protein_sp.get()->getSequence())
651 .replace("L", "I");
652 QString peptide_sequence = msp_peptide.get()->getSequenceLi();
653 int position = protein_sequence.indexOf(peptide_sequence);
654
655 QCborArray positions;
656 while(position >= 0)
657 {
658 positions.push_back(position);
659 position = protein_sequence.indexOf(peptide_sequence, position + 1);
660 }
661
662 cbor_protein.insert(QString("positions"), positions);
663
664 one_psm.cbor_protein_list.append(cbor_protein);
665 }
666
667 one_psm.cbor_eval.insert(QString("aligned_rt"), m_line.aligned_rt);
668 one_psm.cbor_eval.insert(QString("calcmass"), m_line.calcmass);
669 one_psm.cbor_eval.insert(QString("delta_best"), m_line.delta_best);
670 one_psm.cbor_eval.insert(QString("delta_mobility"), m_line.delta_mobility);
671 one_psm.cbor_eval.insert(QString("delta_next"), m_line.delta_next);
672 one_psm.cbor_eval.insert(QString("delta_rt_model"), m_line.delta_rt_model);
673 one_psm.cbor_eval.insert(QString("fragment_ppm"), m_line.fragment_ppm);
674 one_psm.cbor_eval.insert(QString("hyperscore"), m_line.hyperscore);
675 one_psm.cbor_eval.insert(QString("ion_mobility"), m_line.ion_mobility);
676 one_psm.cbor_eval.insert(QString("isotope_error"), m_line.isotope_error);
677 one_psm.cbor_eval.insert(QString("label"), m_line.label);
678 one_psm.cbor_eval.insert(QString("longest_b"), (qint64)m_line.longest_b);
679 one_psm.cbor_eval.insert(QString("longest_y"), (qint64)m_line.longest_y);
680 one_psm.cbor_eval.insert(QString("longest_y_pct"), m_line.longest_y_pct);
681 one_psm.cbor_eval.insert(QString("matched_intensity_pct"), m_line.matched_intensity_pct);
682 one_psm.cbor_eval.insert(QString("matched_peaks"), (qint64)m_line.matched_peaks);
683 one_psm.cbor_eval.insert(QString("missed_cleavages"), m_line.missed_cleavages);
684 one_psm.cbor_eval.insert(QString("ms2_intensity"), m_line.ms2_intensity);
685 one_psm.cbor_eval.insert(QString("peptide_len"), (qint64)m_line.peptide_len);
686 one_psm.cbor_eval.insert(QString("peptide_q"), m_line.peptide_q);
687 one_psm.cbor_eval.insert(QString("poisson"), m_line.poisson);
688 one_psm.cbor_eval.insert(QString("posterior_error"), m_line.posterior_error);
689 one_psm.cbor_eval.insert(QString("precursor_ppm"), m_line.precursor_ppm);
690 one_psm.cbor_eval.insert(QString("predicted_mobility"), m_line.predicted_mobility);
691 one_psm.cbor_eval.insert(QString("predicted_rt"), m_line.predicted_rt);
692 one_psm.cbor_eval.insert(QString("protein_q"), m_line.protein_q);
693 one_psm.cbor_eval.insert(QString("rank"), m_line.rank);
694 one_psm.cbor_eval.insert(QString("sage_discriminant_score"), m_line.sage_discriminant_score);
695 one_psm.cbor_eval.insert(QString("scored_candidates"), (qint64)m_line.scored_candidates);
696 one_psm.cbor_eval.insert(QString("semi_enzymatic"), m_line.semi_enzymatic);
697 one_psm.cbor_eval.insert(QString("spectrum_q"), m_line.spectrum_q);
698
699 current_cbor_scan_p->psm_list.emplace_back(one_psm);
700 }
701
702 std::size_t progress = m_lineNumber / 10000;
703 if(progress > m_progressIndex)
704 {
706 {
708 QObject::tr("Sage TSV data reading process interrupted"));
709 }
710 m_progressIndex = progress;
711 mp_monitor->setStatus(QString("%1K ").arg(m_progressIndex * 10));
712 }
713}
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 ...
const pappso::cbor::psm::PsmProtein & getByAccession(const QString &accession) const

References pappso::cbor::psm::SageTsvHandler::Psm::cbor_eval, pappso::cbor::psm::SageTsvHandler::Scan::cbor_id, pappso::cbor::psm::SageTsvHandler::Psm::cbor_protein_list, pappso::cbor::psm::SageTsvHandler::Psm::proforma, pappso::cbor::psm::PsmProtein::protein_sp, and pappso::cbor::psm::SageTsvHandler::Scan::psm_list.

◆ setCell()

void pappso::cbor::psm::SageTsvHandler::setCell ( const OdsCell &  cell)
overridevirtual

callback that report the content of the current cell in a dedicated Cell object. Override it if you need to retrieve cell content.

Definition at line 80 of file sagetsvhandler.cpp.

81{
82 if(m_lineNumber == 0)
83 {
84 // header
85 QString tag = cell.getStringValue();
86 if(tag == "psm_id")
87 {
89 }
90 else if(tag == "peptide")
91 {
93 }
94 else if(tag == "proteins")
95 {
97 }
98 else if(tag == "num_proteins")
99 {
101 }
102 else if(tag == "filename")
103 {
105 }
106 else if(tag == "scannr")
107 {
109 }
110 else if(tag == "rank")
111 {
113 }
114 else if(tag == "label")
115 {
117 }
118 else if(tag == "expmass")
119 {
121 }
122
123 else if(tag == "calcmass")
124 {
126 }
127 else if(tag == "charge")
128 {
130 }
131 else if(tag == "peptide_len")
132 {
134 }
135 else if(tag == "missed_cleavages")
136 {
138 }
139 else if(tag == "semi_enzymatic")
140 {
142 }
143 else if(tag == "isotope_error")
144 {
146 }
147 else if(tag == "precursor_ppm")
148 {
150 }
151 else if(tag == "fragment_ppm")
152 {
154 }
155 else if(tag == "hyperscore")
156 {
158 }
159 else if(tag == "delta_next")
160 {
162 }
163 else if(tag == "delta_best")
164 {
166 }
167 else if(tag == "rt")
168 {
169 m_columnTypeList.push_back(Columns::rt);
170 }
171 else if(tag == "aligned_rt")
172 {
174 }
175 else if(tag == "predicted_rt")
176 {
178 }
179 else if(tag == "delta_rt_model")
180 {
182 }
183 else if(tag == "ion_mobility")
184 {
186 }
187 else if(tag == "predicted_mobility")
188 {
190 }
191 else if(tag == "delta_mobility")
192 {
194 }
195 else if(tag == "matched_peaks")
196 {
198 }
199 else if(tag == "longest_b")
200 {
202 }
203 else if(tag == "longest_y")
204 {
206 }
207 else if(tag == "longest_y_pct")
208 {
210 }
211 else if(tag == "matched_intensity_pct")
212 {
214 }
215 else if(tag == "scored_candidates")
216 {
218 }
219 else if(tag == "poisson")
220 {
222 }
223 else if(tag == "sage_discriminant_score")
224 {
226 }
227 else if(tag == "posterior_error")
228 {
230 }
231 else if(tag == "spectrum_q")
232 {
234 }
235 else if(tag == "peptide_q")
236 {
238 }
239 else if(tag == "protein_q")
240 {
242 }
243 else if(tag == "ms2_intensity")
244 {
246 }
247 else
248 {
249 throw pappso::ExceptionNotPossible(QObject::tr("column \"%1\" not defined").arg(tag));
250 }
251 }
252 else
253 {
254 if(m_columnNumber >= m_columnTypeList.size())
255 {
257 QObject::tr("the value %1 is out of range").arg(cell.getStringValue()));
258 }
260 switch(column_type)
261 {
262 case Columns::psm_id:
263 break;
264 case Columns::peptide:
265 parsePeptide(cell.toString());
266 break;
268 parseProteins(cell.toString());
269 break;
271 if((std::size_t)cell.getDoubleValue() != (std::size_t)m_proteinList.size())
272 {
274 QObject::tr("column \"num_proteins\"!=%1").arg(m_proteinList.size()));
275 }
276 break;
278 parseMsRunFilename(cell.toString());
279 break;
280 case Columns::scannr:
281 parseSpectrumStringId(cell.toString());
282 break;
283 case Columns::rank:
284 m_line.rank = cell.getDoubleValue();
285 break;
286 case Columns::label:
287 m_line.label = cell.getDoubleValue();
288 break;
289 case Columns::expmass:
290 m_line.expmass = cell.getDoubleValue();
291 break;
293 m_line.calcmass = cell.getDoubleValue();
294 break;
295 case Columns::charge:
296 m_line.charge = cell.getDoubleValue();
297 break;
299 m_line.peptide_len = cell.getDoubleValue();
300 break;
302 m_line.missed_cleavages = cell.getDoubleValue();
303 break;
305 m_line.semi_enzymatic = cell.getDoubleValue();
306 break;
308 m_line.isotope_error = cell.getDoubleValue();
309 break;
310
312 m_line.precursor_ppm = cell.getDoubleValue();
313 break;
315 m_line.fragment_ppm = cell.getDoubleValue();
316 break;
318 m_line.hyperscore = cell.getDoubleValue();
319 break;
321 m_line.delta_next = cell.getDoubleValue();
322 break;
324 m_line.delta_best = cell.getDoubleValue();
325 break;
326 case Columns::rt:
327 m_line.rt = cell.getDoubleValue() * 60; // to convert retention time in seconds
328 break;
330 m_line.aligned_rt = cell.getDoubleValue();
331 break;
333 m_line.predicted_rt = cell.getDoubleValue();
334 break;
336 m_line.delta_rt_model = cell.getDoubleValue();
337 break;
339 m_line.ion_mobility = cell.getDoubleValue();
340 break;
342 m_line.predicted_mobility = cell.getDoubleValue();
343 break;
345 m_line.delta_mobility = cell.getDoubleValue();
346 break;
348 m_line.matched_peaks = cell.getDoubleValue();
349 break;
351 m_line.longest_b = cell.getDoubleValue();
352 break;
354 m_line.longest_y = cell.getDoubleValue();
355 break;
357 m_line.longest_y_pct = cell.getDoubleValue();
358 break;
360 m_line.matched_intensity_pct = cell.getDoubleValue();
361 break;
363 m_line.scored_candidates = cell.getDoubleValue();
364 break;
365 case Columns::poisson:
366 m_line.poisson = cell.getDoubleValue();
367 break;
369 m_line.sage_discriminant_score = cell.getDoubleValue();
370 break;
372 m_line.posterior_error = cell.getDoubleValue();
373 break;
375 m_line.spectrum_q = cell.getDoubleValue();
376 break;
378 m_line.peptide_q = cell.getDoubleValue();
379 break;
381 m_line.protein_q = cell.getDoubleValue();
382 break;
384 m_line.ms2_intensity = cell.getDoubleValue();
385 break;
386 default:
387 qDebug() << "m_line.calcmass=" << m_line.calcmass;
389 QObject::tr("column type %1 not implemented").arg((std::uint8_t)column_type));
390 break;
391 }
392
393 /*
394
395 2333 TMISDSDYTEFENFTK
396 GRMZM2G018197_P01;GRMZM2G068952_P01;GRMZM5G822976_P01 3
397 20120906_balliau_extract_1_A01_urnb-1.mzML controllerType=0
398 controllerNumber=1 scan=12542 1 1 1926.8225 1926.8193 2 16 0 0
399 0.0 1.6471838 1.9796097 54.06803492297634 28.049970383419556 0.0 38.192993
400 0.76385987 0.7671368 0.0032769442 0.0 0.0 0.0 16 2 14 0.875 32.54396 380
401 -13.375352220427656 1.1570586 -34.13482 0.00016041065 0.00022231363
402 0.00040124074 1271951.1
403 */
404 }
406}
void parseProteins(const QString &proteins_str)
void parsePeptide(const QString &peptide_str)
bool parseSpectrumStringId(const QString &spectrum_string_id)
void parseMsRunFilename(const QString &msrun_filename)
std::vector< Columns > m_columnTypeList

◆ startLine()

void pappso::cbor::psm::SageTsvHandler::startLine ( )
overridevirtual

callback that indicates a new line start. Override it if needed.

Definition at line 409 of file sagetsvhandler.cpp.

410{
411 m_columnNumber = 0;
412 msp_peptide = nullptr;
413 m_proteinList.clear();
414 m_line = Line();
415}

◆ startSheet()

void pappso::cbor::psm::SageTsvHandler::startSheet ( const QString &  sheet_name)
overridevirtual

callback that indicates the begining of a data sheet. Override it in order to retrieve information about the current data sheet.

Definition at line 418 of file sagetsvhandler.cpp.

419{
420 m_columnNumber = 0;
421 m_lineNumber = 0;
422 mp_monitor->setStatus(QObject::tr("reading Sage TSV file"));
423
425 {
426 throw pappso::ExceptionInterrupted(QObject::tr("Sage TSV data reading process interrupted"));
427 }
428}

◆ writePsm()

void pappso::cbor::psm::SageTsvHandler::writePsm ( const Psm one_psm)
private

Definition at line 768 of file sagetsvhandler.cpp.

769{
771 m_sageReader.getCborStreamWriter().append("proforma");
772 m_sageReader.getCborStreamWriter().append(one_psm.proforma);
773 m_sageReader.getCborStreamWriter().append("protein_list");
774 QCborValue(one_psm.cbor_protein_list).toCbor(m_sageReader.getCborStreamWriter());
775
776 m_sageReader.getCborStreamWriter().append("eval");
778 m_sageReader.getCborStreamWriter().append("sage");
779 QCborValue(one_psm.cbor_eval).toCbor(m_sageReader.getCborStreamWriter());
781
783}
pappso::cbor::CborStreamWriter & getCborStreamWriter() const
Definition: sagereader.cpp:102

References pappso::cbor::psm::SageTsvHandler::Psm::cbor_eval, pappso::cbor::psm::SageTsvHandler::Psm::cbor_protein_list, and pappso::cbor::psm::SageTsvHandler::Psm::proforma.

◆ writeSample()

void pappso::cbor::psm::SageTsvHandler::writeSample ( const Sample one_sample)
private

Definition at line 716 of file sagetsvhandler.cpp.

718{
720 m_sageReader.getCborStreamWriter().append("name");
721 one_sample.cbor_core_sample.value("name").toCbor(m_sageReader.getCborStreamWriter());
722
723 m_sageReader.getCborStreamWriter().append("identification_file_list");
724 one_sample.cbor_core_sample.value("identification_file_list")
726
727
728 m_sageReader.getCborStreamWriter().append("peaklist_file");
729 one_sample.cbor_core_sample.value("peaklist_file").toCbor(m_sageReader.getCborStreamWriter());
730 //"scan_list": [
731
732 m_sageReader.getCborStreamWriter().append("scan_list");
733 m_sageReader.getCborStreamWriter().startArray(one_sample.scan_map.size());
734 for(auto &it_scan : one_sample.scan_map)
735 {
736 writeScan(it_scan.second);
737 }
739
740
742}
void writeScan(const Scan &one_scan)

References pappso::cbor::psm::SageTsvHandler::Sample::cbor_core_sample, and pappso::cbor::psm::SageTsvHandler::Sample::scan_map.

◆ writeScan()

void pappso::cbor::psm::SageTsvHandler::writeScan ( const Scan one_scan)
private

Definition at line 745 of file sagetsvhandler.cpp.

747{
749 m_sageReader.getCborStreamWriter().append("id");
750 QCborValue(one_scan.cbor_id).toCbor(m_sageReader.getCborStreamWriter());
751 m_sageReader.getCborStreamWriter().append("precursor");
752 QCborValue(one_scan.cbor_precursor).toCbor(m_sageReader.getCborStreamWriter());
753 m_sageReader.getCborStreamWriter().append("ms2");
754 QCborValue(one_scan.cbor_ms2).toCbor(m_sageReader.getCborStreamWriter());
755
756 m_sageReader.getCborStreamWriter().append("psm_list");
757 m_sageReader.getCborStreamWriter().startArray(one_scan.psm_list.size());
758 for(auto &it_psm : one_scan.psm_list)
759 {
760 writePsm(it_psm);
761 }
763
765}
void writePsm(const Psm &one_psm)

References pappso::cbor::psm::SageTsvHandler::Scan::cbor_id, pappso::cbor::psm::SageTsvHandler::Scan::cbor_ms2, pappso::cbor::psm::SageTsvHandler::Scan::cbor_precursor, and pappso::cbor::psm::SageTsvHandler::Scan::psm_list.

Member Data Documentation

◆ m_columnNumber

std::size_t pappso::cbor::psm::SageTsvHandler::m_columnNumber = 0
private

Definition at line 215 of file sagetsvhandler.h.

◆ m_columnTypeList

std::vector<Columns> pappso::cbor::psm::SageTsvHandler::m_columnTypeList
private

Definition at line 216 of file sagetsvhandler.h.

◆ m_decoyTag

QString pappso::cbor::psm::SageTsvHandler::m_decoyTag
private

Definition at line 223 of file sagetsvhandler.h.

Referenced by SageTsvHandler().

◆ m_isFirstPass

bool pappso::cbor::psm::SageTsvHandler::m_isFirstPass
private

Definition at line 224 of file sagetsvhandler.h.

Referenced by SageTsvHandler().

◆ m_line

Line pappso::cbor::psm::SageTsvHandler::m_line
private

Definition at line 222 of file sagetsvhandler.h.

◆ m_lineNumber

std::size_t pappso::cbor::psm::SageTsvHandler::m_lineNumber = 0
private

Definition at line 214 of file sagetsvhandler.h.

◆ m_progressIndex

std::size_t pappso::cbor::psm::SageTsvHandler::m_progressIndex = 0
private

Definition at line 213 of file sagetsvhandler.h.

◆ m_proteinList

QStringList pappso::cbor::psm::SageTsvHandler::m_proteinList
private

Definition at line 225 of file sagetsvhandler.h.

◆ m_psmProteinMap

PsmProteinMap& pappso::cbor::psm::SageTsvHandler::m_psmProteinMap
private

Definition at line 211 of file sagetsvhandler.h.

◆ m_sageReader

const SageReader& pappso::cbor::psm::SageTsvHandler::m_sageReader
private

Definition at line 210 of file sagetsvhandler.h.

◆ m_sampleMap

std::map<QString, Sample> pappso::cbor::psm::SageTsvHandler::m_sampleMap
private

Definition at line 227 of file sagetsvhandler.h.

◆ m_spectrumIndex

std::size_t pappso::cbor::psm::SageTsvHandler::m_spectrumIndex
private

Definition at line 221 of file sagetsvhandler.h.

◆ m_spectrumNativeId

QString pappso::cbor::psm::SageTsvHandler::m_spectrumNativeId
private

Definition at line 226 of file sagetsvhandler.h.

◆ m_staticModificationList

std::vector<SageReader::SageModification> pappso::cbor::psm::SageTsvHandler::m_staticModificationList
private

Definition at line 219 of file sagetsvhandler.h.

Referenced by SageTsvHandler().

◆ m_variableModificationList

std::vector<SageReader::SageModification> pappso::cbor::psm::SageTsvHandler::m_variableModificationList
private

Definition at line 220 of file sagetsvhandler.h.

Referenced by SageTsvHandler().

◆ mp_currentSample

Sample* pappso::cbor::psm::SageTsvHandler::mp_currentSample
private

Definition at line 228 of file sagetsvhandler.h.

◆ mp_monitor

pappso::UiMonitorInterface* pappso::cbor::psm::SageTsvHandler::mp_monitor = nullptr
private

Definition at line 212 of file sagetsvhandler.h.

Referenced by SageTsvHandler().

◆ msp_peptide

pappso::PeptideSp pappso::cbor::psm::SageTsvHandler::msp_peptide
private

Definition at line 218 of file sagetsvhandler.h.


The documentation for this class was generated from the following files: