31#include "../../../../peptide/peptideproformaparser.h"
32#include "../../../../psm/xtandem/xtandemhyperscore.h"
38 std::list<pappso::PeptideIon> &ion_list,
42 m_tandemSpectrumProcess(tandem_spectrum_process),
44 m_psmFeatures(psm_features)
65 if(keys().contains(
"psm_list"))
70 m_tandemSpectrumProcess.process(*qualified_mass_spectrum.get()->getMassSpectrumSPtr().get(),
71 qualified_mass_spectrum.get()->getPrecursorMz(),
72 qualified_mass_spectrum.get()->getPrecursorCharge());
74 QCborArray new_psm_arr;
75 for(QCborValue cbor_psm : value(
"psm_list").toArray())
77 QCborMap cbor_psm_map = cbor_psm.
toMap();
78 QCborMap cbor_psm_features;
83 std::size_t peptide_size = peptide_sp.get()->size();
84 cbor_psm_features.insert(QString(
"peptide_size"), (
unsigned int)peptide_size);
88 qualified_mass_spectrum.get()->getPrecursorCharge(),
92 cbor_psm_features.insert(QString(
"hyperscore"), QCborValue(hyperscore.
getHyperscore()));
95 m_psmFeatures.setPeptideSpectrumCharge(
97 qualified_mass_spectrum.get()->getMassSpectrumSPtr().get(),
98 qualified_mass_spectrum.get()->getPrecursorCharge(),
101 cbor_psm_features.insert(QString(
"total_intensity"),
102 std::log(m_psmFeatures.getTotalIntensity()));
104 cbor_psm_features.insert(QString(
"max_intensity"),
105 checkInf(std::log(qualified_mass_spectrum.get()
106 ->getMassSpectrumSPtr()
108 ->maxIntensityDataPoint()
112 cbor_psm_features.insert(
113 QString(
"MaxYionInt"),
117 cbor_psm_features.insert(
118 QString(
"MaxBionInt"),
122 cbor_psm_features.insert(
123 QString(
"SumYmatchInt"),
127 cbor_psm_features.insert(
128 QString(
"SumBmatchInt"),
132 cbor_psm_features.insert(
133 QString(
"FracYmatchInt"),
135 m_psmFeatures.getTotalIntensity()));
137 cbor_psm_features.insert(
138 QString(
"FracBmatchInt"),
140 m_psmFeatures.getTotalIntensity()));
143 cbor_psm_features.insert(
144 QString(
"SeqCoverYion"),
146 (
double)peptide_size);
148 cbor_psm_features.insert(
149 QString(
"SeqCoverBion"),
151 (
double)peptide_size);
155 cbor_psm_features.insert(
156 QString(
"ConsecutiveYion"),
159 cbor_psm_features.insert(
160 QString(
"ConsecutiveBion"),
164 cbor_psm_features.insert(QString(
"MassErrMean"), m_psmFeatures.getMatchedMzDiffMean());
167 cbor_psm_features.insert(QString(
"MassErrSD"), m_psmFeatures.getMatchedMzDiffSd());
170 cbor_psm_features.insert(QString(
"NumofAnnoPeaks"),
171 (
unsigned int)m_psmFeatures.getNumberOfMatchedIons());
174 std::size_t num_of_pairs = m_psmFeatures.countMatchedIonComplementPairs();
175 cbor_psm_features.insert(QString(
"NumofComplementPeaks"), (
unsigned int)num_of_pairs);
179 cbor_psm_features.insert(
180 QString(
"SumComplementPeaksInt"),
181 std::log(m_psmFeatures.getTotalIntensityOfMatchedIonComplementPairs()));
184 cbor_psm_features.insert(
185 QString(
"FracComplementPeaksInt"),
186 m_psmFeatures.getTotalIntensityOfMatchedIonComplementPairs() /
187 m_psmFeatures.getTotalIntensity());
189 cbor_psm_features.insert(
190 QString(
"SeqCoverComplementPeaks"),
191 (
double)m_psmFeatures.getComplementPairsAaSequenceCoverage() /
192 (
double)peptide_size);
195 cbor_psm_features.insert(QString(
"lrSize"), (
unsigned int)lr.
getSize());
199 if(std::isnan(coeff_of_determination))
204 cbor_psm_features.insert(QString(
"lrCoeffDet"), coeff_of_determination);
208 QCborMap psm_eval = cbor_psm_map.value(
"eval").toMap();
209 psm_eval.remove(QString(
"features"));
210 psm_eval.insert(QString(
"features"), cbor_psm_features);
211 cbor_psm_map.remove(QString(
"eval"));
212 cbor_psm_map.insert(QString(
"eval"), psm_eval);
214 new_psm_arr.push_back(cbor_psm_map);
217 insert(QString(
"psm_list"), new_psm_arr);
std::size_t getSize() const
get data size
double getCoefficientOfDetermination() const
get Coefficient of determination (R2)
Class to represent a mass spectrum.
std::map< pappso_double, pappso_double > toMap() const
pappso_double getHyperscore() const
virtual ~PsmFeaturesScan()
PsmFeaturesScan(const PsmFileScanProcess &psm_file_scan_process, pappso::XtandemSpectrumProcess &tandem_spectrum_process, std::list< pappso::PeptideIon > &ion_list, pappso::PsmFeatures &psm_features, pappso::PrecisionPtr fragment_tolerance)
double checkInf(double input) const
pappso::PrecisionPtr m_fragmentTolerance
Basic PSM file reader to process scan (parallelized scan processing)
std::shared_ptr< QualifiedMassSpectrum > QualifiedMassSpectrumSPtr
std::shared_ptr< const Peptide > PeptideSp
compute features on scan's PSM