libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
psmfilereaderbase.h
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/cbor/psm/psmfilereaderbase.h
3 * \date 05/07/2025
4 * \author Olivier Langella
5 * \brief Base class to read CBOR PSM file
6 */
7
8/*******************************************************************************
9 * Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
10 *
11 * This file is part of PAPPSOms-tools.
12 *
13 * PAPPSOms-tools is free software: you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation, either version 3 of the License, or
16 * (at your option) any later version.
17 *
18 * PAPPSOms-tools is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
25 *
26 ******************************************************************************/
27#pragma once
28
32#include "psmproteinmap.h"
35#include <QCborArray>
36
37
38namespace pappso
39{
40namespace cbor
41{
42namespace psm
43{
44
45
46struct PsmFile
47{
48 QString name;
49};
50
51
52/**
53 * @todo write docs
54 */
56{
57 public:
58 /**
59 * Default constructor
60 */
62
63 /**
64 * Destructor
65 */
66 virtual ~PsmFileReaderBase() override;
67 void readCbor(QFile *cborp, pappso::UiMonitorInterface &monitor);
68 void readCbor(QIODevice *cborp, pappso::UiMonitorInterface &monitor);
69
71 {
72 QString accession;
73 std::vector<std::size_t> positions;
74 };
75
76 protected:
78 virtual void readInformations(pappso::UiMonitorInterface &monitor);
79 virtual void readLog(pappso::UiMonitorInterface &monitor);
80 virtual void readParameterMap(pappso::UiMonitorInterface &monitor);
81 virtual void readProteinMap(pappso::UiMonitorInterface &monitor);
82 virtual void readSample(pappso::UiMonitorInterface &monitor);
83 virtual void readScan(pappso::UiMonitorInterface &monitor);
84 virtual void readPsm(pappso::UiMonitorInterface &monitor);
85 virtual void psmReady(pappso::UiMonitorInterface &monitor);
86 virtual void logReady(pappso::UiMonitorInterface &monitor);
87 virtual void informationsReady(pappso::UiMonitorInterface &monitor);
88 virtual void parameterMapReady(pappso::UiMonitorInterface &monitor);
89 virtual void fastaFilesReady(pappso::UiMonitorInterface &monitor);
90 virtual void proteinMapReady(pappso::UiMonitorInterface &monitor);
91 virtual void sampleListStarted(pappso::UiMonitorInterface &monitor);
92 virtual void sampleStarted(pappso::UiMonitorInterface &monitor);
93 virtual void scanStarted(pappso::UiMonitorInterface &monitor);
94 virtual void scanFinished(pappso::UiMonitorInterface &monitor);
95 virtual void sampleFinished(pappso::UiMonitorInterface &monitor);
97 PsmFile readPsmFile(bool &is_ok);
98 void writePsmFile(CborStreamWriter &writer, const PsmFile &psm_file);
99 void writePsmFileList(CborStreamWriter &writer, const std::vector<PsmFile> &file_list);
100 PsmProteinRef readPsmProteinRef(bool &is_ok);
101
102
104
105 /** @brief get the qualified Spectrum for the current PSM
106 * @return a qualified mass spectrum
107 */
109
110
111 /** @brief tells if the current PSM has a decoy accession
112 * @return boolean
113 */
115
116 /** @brief tells if the current PSM has a target accession
117 * @return boolean
118 */
120
121 /** @brief convenient function do compute precusor ion mass
122 */
123 double getPrecursorMass(double mz_prec, uint charge) const;
124
125
126 protected:
128 QStringList m_decoyFastaFiles;
134 QCborArray m_cborLog;
136 QCborMap m_cborScanId;
143 std::vector<PsmProteinRef> m_currentPsmProteinRefList;
144};
145
146} // namespace psm
147} // namespace cbor
148} // namespace pappso
overrides QCborStreamWriter base class to provide convenient functions
std::vector< PsmProteinRef > m_currentPsmProteinRefList
pappso::QualifiedMassSpectrumSPtr getCurrentQualifiedMassSpectrumSPtr() const
get the qualified Spectrum for the current PSM
pappso::PeptideSp getCurrentPsmPeptideSp() const
bool currentProteinRefListContainsTarget() const
tells if the current PSM has a target accession
virtual void sampleListStarted(pappso::UiMonitorInterface &monitor)
void writePsmFileList(CborStreamWriter &writer, const std::vector< PsmFile > &file_list)
double getPrecursorMass(double mz_prec, uint charge) const
convenient function do compute precusor ion mass
virtual void logReady(pappso::UiMonitorInterface &monitor)
virtual void scanStarted(pappso::UiMonitorInterface &monitor)
virtual void readPsm(pappso::UiMonitorInterface &monitor)
virtual void readLog(pappso::UiMonitorInterface &monitor)
virtual void proteinMapReady(pappso::UiMonitorInterface &monitor)
virtual void sampleStarted(pappso::UiMonitorInterface &monitor)
bool currentProteinRefListContainsDecoy() const
tells if the current PSM has a decoy accession
virtual void readParameterMap(pappso::UiMonitorInterface &monitor)
void readCbor(QFile *cborp, pappso::UiMonitorInterface &monitor)
virtual void readScan(pappso::UiMonitorInterface &monitor)
virtual void readInformations(pappso::UiMonitorInterface &monitor)
virtual void scanFinished(pappso::UiMonitorInterface &monitor)
virtual void sampleListFinished(pappso::UiMonitorInterface &monitor)
virtual void psmReady(pappso::UiMonitorInterface &monitor)
virtual void informationsReady(pappso::UiMonitorInterface &monitor)
void readRoot(pappso::UiMonitorInterface &monitor)
std::vector< PsmFile > m_currentIdentificationFileList
void writePsmFile(CborStreamWriter &writer, const PsmFile &psm_file)
virtual void fastaFilesReady(pappso::UiMonitorInterface &monitor)
virtual void parameterMapReady(pappso::UiMonitorInterface &monitor)
virtual void readProteinMap(pappso::UiMonitorInterface &monitor)
virtual void readSample(pappso::UiMonitorInterface &monitor)
PsmProteinRef readPsmProteinRef(bool &is_ok)
virtual void sampleFinished(pappso::UiMonitorInterface &monitor)
store PsmProtein in a map with accession as key
#define PMSPP_LIB_DECL
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39
std::shared_ptr< QualifiedMassSpectrum > QualifiedMassSpectrumSPtr
std::shared_ptr< const Peptide > PeptideSp
unsigned int uint
Definition types.h:67