89 QString tag = cell.getStringValue();
94 else if(tag ==
"peptide")
98 else if(tag ==
"proteins")
102 else if(tag ==
"num_proteins")
106 else if(tag ==
"filename")
110 else if(tag ==
"scannr")
114 else if(tag ==
"rank")
118 else if(tag ==
"label")
122 else if(tag ==
"expmass")
127 else if(tag ==
"calcmass")
131 else if(tag ==
"charge")
135 else if(tag ==
"peptide_len")
139 else if(tag ==
"missed_cleavages")
143 else if(tag ==
"semi_enzymatic")
147 else if(tag ==
"isotope_error")
151 else if(tag ==
"precursor_ppm")
155 else if(tag ==
"fragment_ppm")
159 else if(tag ==
"hyperscore")
163 else if(tag ==
"delta_next")
167 else if(tag ==
"delta_best")
175 else if(tag ==
"aligned_rt")
179 else if(tag ==
"predicted_rt")
183 else if(tag ==
"delta_rt_model")
187 else if(tag ==
"ion_mobility")
191 else if(tag ==
"predicted_mobility")
195 else if(tag ==
"delta_mobility")
199 else if(tag ==
"matched_peaks")
203 else if(tag ==
"longest_b")
207 else if(tag ==
"longest_y")
211 else if(tag ==
"longest_y_pct")
215 else if(tag ==
"matched_intensity_pct")
219 else if(tag ==
"scored_candidates")
223 else if(tag ==
"poisson")
227 else if(tag ==
"sage_discriminant_score")
231 else if(tag ==
"posterior_error")
235 else if(tag ==
"spectrum_q")
239 else if(tag ==
"peptide_q")
243 else if(tag ==
"protein_q")
247 else if(tag ==
"ms2_intensity")
261 QObject::tr(
"the value %1 is out of range").arg(cell.getStringValue()));
275 if((std::size_t)cell.getDoubleValue() != (std::size_t)
m_proteinList.size())
278 QObject::tr(
"column \"num_proteins\"!=%1").arg(
m_proteinList.size()));
288 m_line.rank = cell.getDoubleValue();
291 m_line.label = cell.getDoubleValue();
294 m_line.expmass = cell.getDoubleValue();
297 m_line.calcmass = cell.getDoubleValue();
300 m_line.charge = cell.getDoubleValue();
303 m_line.peptide_len = cell.getDoubleValue();
306 m_line.missed_cleavages = cell.getDoubleValue();
309 m_line.semi_enzymatic = cell.getDoubleValue();
312 m_line.isotope_error = cell.getDoubleValue();
316 m_line.precursor_ppm = cell.getDoubleValue();
319 m_line.fragment_ppm = cell.getDoubleValue();
322 m_line.hyperscore = cell.getDoubleValue();
325 m_line.delta_next = cell.getDoubleValue();
328 m_line.delta_best = cell.getDoubleValue();
331 m_line.rt = cell.getDoubleValue() * 60;
334 m_line.aligned_rt = cell.getDoubleValue();
337 m_line.predicted_rt = cell.getDoubleValue();
340 m_line.delta_rt_model = cell.getDoubleValue();
343 m_line.ion_mobility = cell.getDoubleValue();
346 m_line.predicted_mobility = cell.getDoubleValue();
349 m_line.delta_mobility = cell.getDoubleValue();
352 m_line.matched_peaks = cell.getDoubleValue();
355 m_line.longest_b = cell.getDoubleValue();
358 m_line.longest_y = cell.getDoubleValue();
361 m_line.longest_y_pct = cell.getDoubleValue();
364 m_line.matched_intensity_pct = cell.getDoubleValue();
367 m_line.scored_candidates = cell.getDoubleValue();
370 m_line.poisson = cell.getDoubleValue();
373 m_line.sage_discriminant_score = cell.getDoubleValue();
376 m_line.posterior_error = cell.getDoubleValue();
379 m_line.spectrum_q = cell.getDoubleValue();
382 m_line.peptide_q = cell.getDoubleValue();
385 m_line.protein_q = cell.getDoubleValue();
388 m_line.ms2_intensity = cell.getDoubleValue();
391 qDebug() <<
"m_line.calcmass=" <<
m_line.calcmass;
393 QObject::tr(
"column type %1 not implemented").arg((std::uint8_t)column_type));
430 mp_monitor->setStatus(QObject::tr(
"reading Sage TSV file"));
442 QString peptide_str_verif = peptide_str;
446 qDebug() << modif.strModification;
447 qDebug() << modif.modification->getAccession();
448 peptide_str_verif = peptide_str_verif.replace(
449 modif.strModification, QString(
"[%1]").arg(modif.modification->getAccession()));
454 qDebug() << modif.strModification;
455 qDebug() << modif.modification->getAccession();
456 peptide_str_verif = peptide_str_verif.replace(
457 modif.strModification, QString(
"[%1]").arg(modif.modification->getAccession()));
460 qDebug() << peptide_str_verif;
482 psm_protein.
protein_sp = std::make_shared<pappso::Protein>(accession,
"");
497 qDebug() << spectrum_string_id;
501 QStringList scan_list = spectrum_string_id.split(
"scan=");
502 if(scan_list.size() == 2)
530 qDebug() << spectrum_string_id;
540 auto it_insert =
m_sampleMap.insert({msrun_filename, {}});
545 it_insert.first->second.name = msrun_filename;
547 QCborMap identification_file;
549 it_insert.first->second.cbor_core_sample.insert(QString(
"name"),
550 QFileInfo(msrun_filename).baseName());
553 QCborArray identification_file_list;
554 identification_file.insert(QString(
"name"),
m_sageReader.getmJsonAbsoluteFilePath());
555 identification_file_list.push_back(identification_file);
556 it_insert.first->second.cbor_core_sample.insert(QString(
"identification_file_list"),
557 identification_file_list);
560 ms_file.insert(QString(
"name"),
m_sageReader.getMzmlPath(msrun_filename));
561 it_insert.first->second.cbor_core_sample.insert(QString(
"peaklist_file"), ms_file);
585 psm_protein.
protein_sp = std::make_shared<pappso::Protein>(accession,
"");
588 it.first->second.cborEval.insert(QString(
"protein_q"),
m_line.protein_q);
617 Scan *current_cbor_scan_p = &(it_insert.first->second);
621 QCborMap &scan_id = it_insert.first->second.cbor_id;
625 QCborMap &scan_ms2 = it_insert.first->second.cbor_ms2;
626 scan_ms2.insert(QString(
"rt"),
m_line.rt);
628 QCborMap &scan_precursor = it_insert.first->second.cbor_precursor;
629 scan_precursor.insert(QString(
"z"),
m_line.charge);
630 scan_precursor.insert(QString(
"mh"),
m_line.expmass);
632 scan_precursor.insert(QString(
"mz"), exp_mz);
644 one_psm.
cbor_eval.insert(QString(
"delta_mobility"),
m_line.delta_mobility);
646 one_psm.
cbor_eval.insert(QString(
"delta_rt_model"),
m_line.delta_rt_model);
647 one_psm.
cbor_eval.insert(QString(
"fragment_ppm"),
m_line.fragment_ppm);
649 one_psm.
cbor_eval.insert(QString(
"ion_mobility"),
m_line.ion_mobility);
650 one_psm.
cbor_eval.insert(QString(
"isotope_error"),
m_line.isotope_error);
652 one_psm.
cbor_eval.insert(QString(
"longest_b"), (qint64)
m_line.longest_b);
653 one_psm.
cbor_eval.insert(QString(
"longest_y"), (qint64)
m_line.longest_y);
654 one_psm.
cbor_eval.insert(QString(
"longest_y_pct"),
m_line.longest_y_pct);
655 one_psm.
cbor_eval.insert(QString(
"matched_intensity_pct"),
m_line.matched_intensity_pct);
656 one_psm.
cbor_eval.insert(QString(
"matched_peaks"), (qint64)
m_line.matched_peaks);
657 one_psm.
cbor_eval.insert(QString(
"missed_cleavages"),
m_line.missed_cleavages);
658 one_psm.
cbor_eval.insert(QString(
"ms2_intensity"),
m_line.ms2_intensity);
659 one_psm.
cbor_eval.insert(QString(
"peptide_len"), (qint64)
m_line.peptide_len);
662 one_psm.
cbor_eval.insert(QString(
"posterior_error"),
m_line.posterior_error);
663 one_psm.
cbor_eval.insert(QString(
"precursor_ppm"),
m_line.precursor_ppm);
664 one_psm.
cbor_eval.insert(QString(
"predicted_mobility"),
m_line.predicted_mobility);
665 one_psm.
cbor_eval.insert(QString(
"predicted_rt"),
m_line.predicted_rt);
668 one_psm.
cbor_eval.insert(QString(
"sage_discriminant_score"),
m_line.sage_discriminant_score);
669 one_psm.
cbor_eval.insert(QString(
"scored_candidates"), (qint64)
m_line.scored_candidates);
670 one_psm.
cbor_eval.insert(QString(
"semi_enzymatic"),
m_line.semi_enzymatic);
673 current_cbor_scan_p->
psm_list.emplace_back(one_psm);
682 QObject::tr(
"Sage TSV data reading process interrupted"));
696 m_sageReader.getCborStreamWriter().append(
"identification_file_list");
701 m_sageReader.getCborStreamWriter().append(
"peaklist_file");
707 for(
auto &it_scan : one_sample.
scan_map)
730 for(
auto &it_psm : one_scan.
psm_list)
745 m_sageReader.getCborStreamWriter().append(
"protein_list");
747 QCborArray cbor_protein_list;
751 QCborMap cbor_protein;
752 cbor_protein.insert(QString(
"accession"), accession);
756 QString protein_sequence =
757 QString(
m_psmProteinMap.getByAccession(accession).protein_sp.get()->getSequence())
761 QCborArray positions;
764 positions.push_back(position);
768 cbor_protein.insert(QString(
"positions"), positions);
770 cbor_protein_list.append(cbor_protein);
774 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