89 QString tag = cell.getStringValue();
94 else if(tag ==
"peptide")
98 else if(tag ==
"proteins")
102 else if(tag ==
"protein_groups")
106 else if(tag ==
"num_protein_groups")
110 else if(tag ==
"num_proteins")
114 else if(tag ==
"filename")
118 else if(tag ==
"scannr")
122 else if(tag ==
"rank")
126 else if(tag ==
"label")
130 else if(tag ==
"expmass")
135 else if(tag ==
"calcmass")
139 else if(tag ==
"charge")
143 else if(tag ==
"peptide_len")
147 else if(tag ==
"missed_cleavages")
151 else if(tag ==
"semi_enzymatic")
155 else if(tag ==
"isotope_error")
159 else if(tag ==
"precursor_ppm")
163 else if(tag ==
"fragment_ppm")
167 else if(tag ==
"hyperscore")
171 else if(tag ==
"delta_next")
175 else if(tag ==
"delta_best")
183 else if(tag ==
"aligned_rt")
187 else if(tag ==
"predicted_rt")
191 else if(tag ==
"delta_rt_model")
195 else if(tag ==
"ion_mobility")
199 else if(tag ==
"predicted_mobility")
203 else if(tag ==
"delta_mobility")
207 else if(tag ==
"matched_peaks")
211 else if(tag ==
"longest_b")
215 else if(tag ==
"longest_y")
219 else if(tag ==
"longest_y_pct")
223 else if(tag ==
"matched_intensity_pct")
227 else if(tag ==
"scored_candidates")
231 else if(tag ==
"poisson")
235 else if(tag ==
"sage_discriminant_score")
239 else if(tag ==
"posterior_error")
243 else if(tag ==
"spectrum_q")
247 else if(tag ==
"peptide_q")
251 else if(tag ==
"protein_q")
255 else if(tag ==
"protein_group_q")
259 else if(tag ==
"ms2_intensity")
273 QObject::tr(
"the value %1 is out of range").arg(cell.getStringValue()));
293 if((std::size_t)cell.getDoubleValue() != (std::size_t)
m_proteinList.size())
296 QObject::tr(
"column \"num_proteins\"!=%1").arg(
m_proteinList.size()));
306 m_line.rank = cell.getDoubleValue();
309 m_line.label = cell.getDoubleValue();
312 m_line.expmass = cell.getDoubleValue();
315 m_line.calcmass = cell.getDoubleValue();
318 m_line.charge = cell.getDoubleValue();
321 m_line.peptide_len = cell.getDoubleValue();
324 m_line.missed_cleavages = cell.getDoubleValue();
327 m_line.semi_enzymatic = cell.getDoubleValue();
330 m_line.isotope_error = cell.getDoubleValue();
334 m_line.precursor_ppm = cell.getDoubleValue();
337 m_line.fragment_ppm = cell.getDoubleValue();
340 m_line.hyperscore = cell.getDoubleValue();
343 m_line.delta_next = cell.getDoubleValue();
346 m_line.delta_best = cell.getDoubleValue();
349 m_line.rt = cell.getDoubleValue() * 60;
352 m_line.aligned_rt = cell.getDoubleValue();
355 m_line.predicted_rt = cell.getDoubleValue();
358 m_line.delta_rt_model = cell.getDoubleValue();
361 m_line.ion_mobility = cell.getDoubleValue();
364 m_line.predicted_mobility = cell.getDoubleValue();
367 m_line.delta_mobility = cell.getDoubleValue();
370 m_line.matched_peaks = cell.getDoubleValue();
373 m_line.longest_b = cell.getDoubleValue();
376 m_line.longest_y = cell.getDoubleValue();
379 m_line.longest_y_pct = cell.getDoubleValue();
382 m_line.matched_intensity_pct = cell.getDoubleValue();
385 m_line.scored_candidates = cell.getDoubleValue();
388 m_line.poisson = cell.getDoubleValue();
391 m_line.sage_discriminant_score = cell.getDoubleValue();
394 m_line.posterior_error = cell.getDoubleValue();
397 m_line.spectrum_q = cell.getDoubleValue();
400 m_line.peptide_q = cell.getDoubleValue();
403 m_line.protein_q = cell.getDoubleValue();
406 m_line.ms2_intensity = cell.getDoubleValue();
409 qDebug() <<
"m_line.calcmass=" <<
m_line.calcmass;
411 QObject::tr(
"column type %1 not implemented").arg((std::uint8_t)column_type));
448 mp_monitor->setStatus(QObject::tr(
"reading Sage TSV file"));
460 QString peptide_str_verif = peptide_str;
464 qDebug() << modif.strModification;
465 qDebug() << modif.modification->getAccession();
466 peptide_str_verif = peptide_str_verif.replace(
467 modif.strModification, QString(
"[%1]").arg(modif.modification->getAccession()));
472 qDebug() << modif.strModification;
473 qDebug() << modif.modification->getAccession();
474 peptide_str_verif = peptide_str_verif.replace(
475 modif.strModification, QString(
"[%1]").arg(modif.modification->getAccession()));
478 qDebug() << peptide_str_verif;
500 psm_protein.
protein_sp = std::make_shared<pappso::Protein>(accession,
"");
515 qDebug() << spectrum_string_id;
519 QStringList scan_list = spectrum_string_id.split(
"scan=");
520 if(scan_list.size() == 2)
548 qDebug() << spectrum_string_id;
558 auto it_insert =
m_sampleMap.insert({msrun_filename, {}});
563 it_insert.first->second.name = msrun_filename;
565 QCborMap identification_file;
567 it_insert.first->second.cbor_core_sample.insert(QString(
"name"),
568 QFileInfo(msrun_filename).baseName());
571 QCborArray identification_file_list;
572 identification_file.insert(QString(
"name"),
m_sageReader.getmJsonAbsoluteFilePath());
573 identification_file_list.push_back(identification_file);
574 it_insert.first->second.cbor_core_sample.insert(QString(
"identification_file_list"),
575 identification_file_list);
578 ms_file.insert(QString(
"name"),
m_sageReader.getMzmlPath(msrun_filename));
579 it_insert.first->second.cbor_core_sample.insert(QString(
"peaklist_file"), ms_file);
603 psm_protein.
protein_sp = std::make_shared<pappso::Protein>(accession,
"");
606 it.first->second.cborEval.insert(QString(
"protein_q"),
m_line.protein_q);
635 Scan *current_cbor_scan_p = &(it_insert.first->second);
639 QCborMap &scan_id = it_insert.first->second.cbor_id;
643 QCborMap &scan_ms2 = it_insert.first->second.cbor_ms2;
644 scan_ms2.insert(QString(
"rt"),
m_line.rt);
646 QCborMap &scan_precursor = it_insert.first->second.cbor_precursor;
647 scan_precursor.insert(QString(
"z"),
m_line.charge);
648 scan_precursor.insert(QString(
"mh"),
m_line.expmass);
650 scan_precursor.insert(QString(
"mz"), exp_mz);
662 one_psm.
cbor_eval.insert(QString(
"delta_mobility"),
m_line.delta_mobility);
664 one_psm.
cbor_eval.insert(QString(
"delta_rt_model"),
m_line.delta_rt_model);
665 one_psm.
cbor_eval.insert(QString(
"fragment_ppm"),
m_line.fragment_ppm);
667 one_psm.
cbor_eval.insert(QString(
"ion_mobility"),
m_line.ion_mobility);
668 one_psm.
cbor_eval.insert(QString(
"isotope_error"),
m_line.isotope_error);
670 one_psm.
cbor_eval.insert(QString(
"longest_b"), (qint64)
m_line.longest_b);
671 one_psm.
cbor_eval.insert(QString(
"longest_y"), (qint64)
m_line.longest_y);
672 one_psm.
cbor_eval.insert(QString(
"longest_y_pct"),
m_line.longest_y_pct);
673 one_psm.
cbor_eval.insert(QString(
"matched_intensity_pct"),
m_line.matched_intensity_pct);
674 one_psm.
cbor_eval.insert(QString(
"matched_peaks"), (qint64)
m_line.matched_peaks);
675 one_psm.
cbor_eval.insert(QString(
"missed_cleavages"),
m_line.missed_cleavages);
676 one_psm.
cbor_eval.insert(QString(
"ms2_intensity"),
m_line.ms2_intensity);
677 one_psm.
cbor_eval.insert(QString(
"peptide_len"), (qint64)
m_line.peptide_len);
680 one_psm.
cbor_eval.insert(QString(
"posterior_error"),
m_line.posterior_error);
681 one_psm.
cbor_eval.insert(QString(
"precursor_ppm"),
m_line.precursor_ppm);
682 one_psm.
cbor_eval.insert(QString(
"predicted_mobility"),
m_line.predicted_mobility);
683 one_psm.
cbor_eval.insert(QString(
"predicted_rt"),
m_line.predicted_rt);
686 one_psm.
cbor_eval.insert(QString(
"sage_discriminant_score"),
m_line.sage_discriminant_score);
687 one_psm.
cbor_eval.insert(QString(
"scored_candidates"), (qint64)
m_line.scored_candidates);
688 one_psm.
cbor_eval.insert(QString(
"semi_enzymatic"),
m_line.semi_enzymatic);
691 current_cbor_scan_p->
psm_list.emplace_back(one_psm);
700 QObject::tr(
"Sage TSV data reading process interrupted"));
714 m_sageReader.getCborStreamWriter().append(
"identification_file_list");
719 m_sageReader.getCborStreamWriter().append(
"peaklist_file");
725 for(
auto &it_scan : one_sample.
scan_map)
748 for(
auto &it_psm : one_scan.
psm_list)
763 m_sageReader.getCborStreamWriter().append(
"protein_list");
765 QCborArray cbor_protein_list;
769 QCborMap cbor_protein;
770 cbor_protein.insert(QString(
"accession"), accession);
774 QString protein_sequence =
775 QString(
m_psmProteinMap.getByAccession(accession).protein_sp.get()->getSequence())
779 QCborArray positions;
782 positions.push_back(position);
786 cbor_protein.insert(QString(
"positions"), positions);
788 cbor_protein_list.append(cbor_protein);
792 QCborValue(cbor_protein_list).toCbor(
m_sageReader.getCborStreamWriter());
store PsmProtein in a map with accession as key
std::vector< SageModification > getStaticModificationList() const
std::vector< SageModification > getVariableModificationList() const
QString getDecoyTag() const
std::vector< SageReader::SageModification > m_staticModificationList
QStringList m_proteinList
void parseProteins(const QString &proteins_str)
@ sage_discriminant_score
QString m_spectrumNativeId
const SageReader & m_sageReader
virtual void endSheet() override
pappso::UiMonitorInterface * mp_monitor
virtual void startSheet(const QString &sheet_name) override
std::vector< SageReader::SageModification > m_variableModificationList
virtual ~SageTsvHandler()
void parsePeptide(const QString &peptide_str)
bool parseSpectrumStringId(const QString &spectrum_string_id)
void writeSample(const Sample &one_sample)
std::size_t m_progressIndex
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::size_t m_columnNumber
std::size_t m_spectrumIndex
std::map< QString, Sample > m_sampleMap
virtual void endDocument() override
virtual void startLine() override
Sample * mp_currentSample
void parseMsRunFilename(const QString &msrun_filename)
virtual void endLine() override
pappso::PeptideSp msp_peptide
std::vector< Columns > m_columnTypeList
PsmProteinMap & m_psmProteinMap
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
const pappso_double MHPLUS(1.007276466879)
std::shared_ptr< Protein > protein_sp
QString peptide_sequence_li
QCborMap cbor_core_sample
std::map< QString, Scan > scan_map
std::vector< Psm > psm_list