libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
psmfeatures.cpp
Go to the documentation of this file.
1/**
2 * \file pappsomspp/processing/cbor/psm/evalscan/psmfeatures.cpp
3 * \date 15/07/2025
4 * \author Olivier Langella
5 * \brief compute features on scan's PSM
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
28#include "psmfeatures.h"
29#include "psmfeaturesscan.h"
31
32namespace pappso
33{
34namespace cbor
35{
36namespace psm
37{
38
57
58PsmFeatures::PsmFeatures(std::size_t buffer_scan_size,
59 pappso::cbor::CborStreamWriter *cbor_output_p,
60 const QJsonObject &parameters)
61 : PsmFileScanProcessAndCopy(buffer_scan_size, cbor_output_p, "psm features")
62{
63
64 m_ionList.clear();
67
68 if(parameters.empty())
69 {
70 m_minimumMz = 150;
75 }
76 else
77 {
78
79 m_minimumMz = parameters.value("minimum_mz").toDouble();
82 parameters.value("hyperscore").toObject().value("n_most_intense").toInt());
84 parameters.value("hyperscore").toObject().value("dynamic_range").toInt());
85
86
87 if(parameters.value("fragment_tolerance_unit").toString() == "dalton")
88 {
90 parameters.value("fragment_tolerance").toDouble());
91 }
92 else if(parameters.value("fragment_tolerance_unit").toString() == "ppm")
93 {
95 parameters.value("fragment_tolerance").toDouble());
96 }
97 }
98
100}
101
102
107
108
109void
111 [[maybe_unused]])
112{
113 QCborMap cbor_features_parameters;
114
115 cbor_features_parameters.insert(QString("minimum_mz"), m_minimumMz);
116 cbor_features_parameters.insert(QString("fragment_tolerance_unit"),
118 cbor_features_parameters.insert(QString("fragment_tolerance"), m_fragmentTolerance->getNominal());
119 cbor_features_parameters.insert(QString("ion_list"), "y b");
120
121 QCborMap cbor_hyperscore;
122 cbor_hyperscore.insert(QString("minimum_mz"), m_minimumMz);
123 cbor_hyperscore.insert(QString("n_most_intense"), m_tandemSpectrumProcess.getNmostIntense());
124 cbor_hyperscore.insert(QString("dynamic_range"), m_tandemSpectrumProcess.getDynamicRange());
125
126 cbor_features_parameters.insert(QString("hyperscore"), cbor_hyperscore);
127
128 m_cborParameterMap.insert(QString("features"), cbor_features_parameters);
129
130 mp_cborOutput->append("parameter_map");
132}
133
134
141
142} // namespace psm
143} // namespace cbor
144} // namespace pappso
virtual pappso_double getNominal() const final
Definition precision.cpp:72
virtual Enums::PrecisionUnit unit() const =0
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition utils.cpp:517
pappso::pappso_double getDynamicRange() const
void setMinimumMz(pappso_double minimum_mz)
void setDynamicRange(pappso::pappso_double dynamic_range)
void setNmostIntense(unsigned int nmost_intense)
void writeCborMap(const QCborMap &cbor_map)
CborScanMapBase * newCborScanMap() override
pappso::XtandemSpectrumProcess m_tandemSpectrumProcess
Definition psmfeatures.h:68
void parameterMapReady(pappso::UiMonitorInterface &monitor) override
pappso::PsmFeatures * mpa_psmFeatures
Definition psmfeatures.h:72
pappso::PrecisionPtr m_fragmentTolerance
Definition psmfeatures.h:71
PsmFeatures(std::size_t buffer_scan_size, CborStreamWriter *cbor_output_p)
std::list< pappso::Enums::PeptideIon > m_ionList
Definition psmfeatures.h:70
Basic PSM file reader to process scan (parallelized scan processing) and write a new resulting PSM fi...
@ y
Cter amino ions.
@ b
Nter acylium ions.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition aa.cpp:39