libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::cbor::psm::PsmIonSeriesScan Class Reference

#include <psmionseries.h>

Inheritance diagram for pappso::cbor::psm::PsmIonSeriesScan:
pappso::cbor::psm::CborScanMapBase

Public Member Functions

 PsmIonSeriesScan (const PsmIonSeries &psm_specpeptidoms, pappso::PrecisionPtr fragment_tolerance)
virtual ~PsmIonSeriesScan ()
Public Member Functions inherited from pappso::cbor::psm::CborScanMapBase
 CborScanMapBase (const PsmFileScanProcess &psm_file_scan_process)
virtual ~CborScanMapBase ()
virtual void filterAndSortPsmList ()
void filterPsmListUniqueUniqueProforma ()
std::vector< double >::iterator addPsmEvalVectorDouble (const QString &eval_name, const QString &eval_value_key, std::vector< double >::iterator begin, std::vector< double >::const_iterator end)
 add a new eval key and double values (from a vector) to each PSM
QCborMap getCborScanId () const
QCborMap getCborScanPrecursor () const
QCborArray getCborPsmList () const
void populateProteinMapUsingOldProteinMap (const PsmProteinMap &old_protein_map, PsmProteinMap &new_protein_map) const

Protected Member Functions

void process () override
Protected Member Functions inherited from pappso::cbor::psm::CborScanMapBase
pappso::QualifiedMassSpectrumSPtr getCurrentQualifiedMassSpectrumSPtr () const

Private Attributes

const PsmIonSeriesmp_psmSpecPeptidOms
pappso::PrecisionPtr m_fragmentTolerance

Additional Inherited Members

Protected Attributes inherited from pappso::cbor::psm::CborScanMapBase
const PsmFileScanProcessm_PsmFileScanProcess

Detailed Description

Definition at line 73 of file psmionseries.h.

Constructor & Destructor Documentation

◆ PsmIonSeriesScan()

pappso::cbor::psm::PsmIonSeriesScan::PsmIonSeriesScan ( const PsmIonSeries & psm_specpeptidoms,
pappso::PrecisionPtr fragment_tolerance )

Default constructor

Definition at line 84 of file psmionseries.cpp.

86 : CborScanMapBase(psm_specpeptidoms)
87{
88 m_fragmentTolerance = fragment_tolerance;
89 mp_psmSpecPeptidOms = &psm_specpeptidoms;
90}
CborScanMapBase(const PsmFileScanProcess &psm_file_scan_process)
const PsmIonSeries * mp_psmSpecPeptidOms
pappso::PrecisionPtr m_fragmentTolerance

References pappso::cbor::psm::CborScanMapBase::CborScanMapBase(), m_fragmentTolerance, and mp_psmSpecPeptidOms.

◆ ~PsmIonSeriesScan()

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

Destructor

Definition at line 92 of file psmionseries.cpp.

93{
94}

Member Function Documentation

◆ process()

void pappso::cbor::psm::PsmIonSeriesScan::process ( )
overrideprotectedvirtual

Reimplemented from pappso::cbor::psm::CborScanMapBase.

Definition at line 97 of file psmionseries.cpp.

98{
99 // qWarning() <<"PsmIonSeriesScan::process" << keys();
100 if(!keys().contains("id"))
101 {
102 throw pappso::PappsoException(QObject::tr("missing scan id"));
103 }
104 if(keys().contains("psm_list"))
105 {
107
108 int precursor_charge = qualified_mass_spectrum.get()->getPrecursorCharge();
109
110 QCborArray new_psm_arr;
111 for(QCborValue cbor_psm : value("psm_list").toArray())
112 {
113 QCborMap cbor_psm_map = cbor_psm.toMap();
114
115 qDebug() << "PsmIonSeriesScan::process cbor_psm_map.keys() " << cbor_psm_map.keys();
116 if(!cbor_psm_map.keys().contains("proforma"))
117 {
118 throw pappso::PappsoException(
119 QObject::tr("missing proforma in psm %1").arg(cbor_psm_map.keys().size()));
120 }
121 pappso::PeptideSp peptide_sp =
122 pappso::PeptideProFormaParser::parseString(cbor_psm_map.value("proforma").toString());
123 qDebug() << peptide_sp.get()->toString();
124 pappso::PeptideIsotopeSpectrumMatch psm(
125 *(qualified_mass_spectrum.get()->getMassSpectrumSPtr().get()),
126 peptide_sp,
127 precursor_charge,
130 2,
131 0);
132
133 struct data_plot
134 {
135 pappso::DataPoint point;
136 double mz_th;
137 int charge;
138 int size;
139 int isotope_number;
140 int isotope_rank;
141 };
142 std::map<pappso::Enums::PeptideIon, std::vector<data_plot>> ion_map;
143
144
145 for(const pappso::PeakIonIsotopeMatch &peakion_match : psm)
146 {
147 data_plot one_ion_match;
148 one_ion_match.charge = (int)peakion_match.getCharge();
149 one_ion_match.isotope_number =
150 (int)peakion_match.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
151 one_ion_match.isotope_rank =
152 (int)peakion_match.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeRank();
153 one_ion_match.mz_th =
154 peakion_match.getPeptideNaturalIsotopeAverageSp().get()->getMz();
155 one_ion_match.point = peakion_match.getPeak();
156 one_ion_match.size = (int)peakion_match.getPeptideFragmentIonSp().get()->size();
157
158 auto it = ion_map.insert({peakion_match.getPeptideIonType(), {}});
159 it.first->second.push_back(one_ion_match);
160 }
161
162 QCborMap cbor_psm_props_peptide;
163 cbor_psm_props_peptide.insert(QString("mz"), peptide_sp.get()->getMz(precursor_charge));
164 cbor_psm_props_peptide.insert(QString("mh"), peptide_sp.get()->getMz(1));
165
166 QCborMap cbor_psm_props_ion_series;
167 for(auto &cle_valeur : ion_map)
168 {
169 std::vector<data_plot> &current_vector = cle_valeur.second;
170
171 std::sort(
172 current_vector.begin(),
173 current_vector.end(),
174 [](const data_plot &a, const data_plot &b) { return a.point.x < b.point.x; });
175 QCborArray current_ion_json_arr;
176
177 for(const data_plot &one_point : current_vector)
178 {
179 QCborMap current_ion;
180 current_ion.insert(QString("mz"), one_point.point.x);
181 current_ion.insert(QString("mzth"), one_point.mz_th);
182 current_ion.insert(QString("intensity"), one_point.point.y);
183 current_ion.insert(QString("size"), one_point.size);
184 current_ion.insert(QString("charge"), one_point.charge);
185 current_ion.insert(QString("isotope"), one_point.isotope_number);
186 current_ion.insert(QString("rank"), one_point.isotope_rank);
187
188 current_ion_json_arr.push_back(current_ion);
189 }
190
191 cbor_psm_props_ion_series.insert(pappso::Utils::toString(cle_valeur.first),
192 current_ion_json_arr);
193 }
194
195
196 QCborMap cbor_psm_props;
197 if(cbor_psm_map.keys().contains("props"))
198 {
199 cbor_psm_props = cbor_psm_map.value("props").toMap();
200 }
201 cbor_psm_props.remove(QString("peptide"));
202 cbor_psm_props.insert(QString("peptide"), cbor_psm_props_peptide);
203
204 cbor_psm_props.remove(QString("ion-series"));
205 cbor_psm_props.insert(QString("ion-series"), cbor_psm_props_ion_series);
206 cbor_psm_map.remove(QString("props"));
207 cbor_psm_map.insert(QString("props"), cbor_psm_props);
208
209 QCborValue copy_eval = cbor_psm_map.value("eval");
210 cbor_psm_map.remove(QString("eval"));
211 cbor_psm_map.insert(QString("eval"), copy_eval);
212
213 qDebug() << "PsmIonSeriesScan::process cbor_psm_map.keys() " << cbor_psm_map.keys();
214 new_psm_arr.push_back(cbor_psm_map);
215 }
216
217 // insert(QString("psm_list"), new_psm_arr);
218 // remove(QString("psm_list"));
219 insert(QString("psm_list"), new_psm_arr);
220 }
221}
static std::list< Enums::PeptideIon > getCIDionList()
static PeptideSp parseString(const QString &pepstr)
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:544
pappso::QualifiedMassSpectrumSPtr getCurrentQualifiedMassSpectrumSPtr() const
std::shared_ptr< QualifiedMassSpectrum > QualifiedMassSpectrumSPtr
std::shared_ptr< const Peptide > PeptideSp

References pappso::a, pappso::b, pappso::PeptideFragmentIonListBase::getCIDionList(), pappso::cbor::psm::CborScanMapBase::getCurrentQualifiedMassSpectrumSPtr(), m_fragmentTolerance, pappso::PeptideProFormaParser::parseString(), and pappso::Utils::toString().

Member Data Documentation

◆ m_fragmentTolerance

pappso::PrecisionPtr pappso::cbor::psm::PsmIonSeriesScan::m_fragmentTolerance
private

Definition at line 91 of file psmionseries.h.

Referenced by PsmIonSeriesScan(), and process().

◆ mp_psmSpecPeptidOms

const PsmIonSeries* pappso::cbor::psm::PsmIonSeriesScan::mp_psmSpecPeptidOms
private

Definition at line 90 of file psmionseries.h.

Referenced by PsmIonSeriesScan().


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