libpappsomspp
Library for mass spectrometry
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"
30#include "../../../../utils.h"
31
33 CborStreamWriter *cbor_output_p)
34 : PsmFileScanProcessAndCopy(buffer_scan_size, cbor_output_p, "psm features")
35{
36 m_minimumMz = 150;
40
41
42 m_ionList.clear();
45
47
49}
50
52 pappso::cbor::CborStreamWriter *cbor_output_p,
53 const QJsonObject &parameters)
54 : PsmFileScanProcessAndCopy(buffer_scan_size, cbor_output_p, "psm features")
55{
56
57 m_ionList.clear();
60
61 if(parameters.empty())
62 {
63 m_minimumMz = 150;
68 }
69 else
70 {
71
72 m_minimumMz = parameters.value("minimum_mz").toDouble();
75 parameters.value("hyperscore").toObject().value("n_most_intense").toInt());
77 parameters.value("hyperscore").toObject().value("dynamic_range").toInt());
78
79
80 if(parameters.value("fragment_tolerance_unit").toString() == "dalton")
81 {
83 parameters.value("fragment_tolerance").toDouble());
84 }
85 else if(parameters.value("fragment_tolerance_unit").toString() == "ppm")
86 {
88 parameters.value("fragment_tolerance").toDouble());
89 }
90 }
91
93}
94
95
97{
98 delete mpa_psmFeatures;
99}
100
101
102void
104 [[maybe_unused]])
105{
106 QCborMap cbor_features_parameters;
107
108 cbor_features_parameters.insert(QString("minimum_mz"), m_minimumMz);
109 cbor_features_parameters.insert(QString("fragment_tolerance_unit"),
110 Utils::toString(m_fragmentTolerance->unit()));
111 cbor_features_parameters.insert(QString("fragment_tolerance"), m_fragmentTolerance->getNominal());
112 cbor_features_parameters.insert(QString("ion_list"), "y b");
113
114 QCborMap cbor_hyperscore;
115 cbor_hyperscore.insert(QString("minimum_mz"), m_minimumMz);
116 cbor_hyperscore.insert(QString("n_most_intense"), m_tandemSpectrumProcess.getNmostIntense());
117 cbor_hyperscore.insert(QString("dynamic_range"), m_tandemSpectrumProcess.getDynamicRange());
118
119 cbor_features_parameters.insert(QString("hyperscore"), cbor_hyperscore);
120
121 m_cborParameterMap.insert(QString("features"), cbor_features_parameters);
122
123 mp_cborOutput->append("parameter_map");
124 mp_cborOutput->writeCborMap(m_cborParameterMap);
125}
126
127
130{
131 return new PsmFeaturesScan(
132 *this, m_tandemSpectrumProcess, m_ionList, *mpa_psmFeatures, m_fragmentTolerance);
133}
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
Definition: precision.cpp:154
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
Definition: precision.cpp:135
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
Definition: utils.cpp:517
void setMinimumMz(pappso_double minimum_mz)
void setDynamicRange(pappso::pappso_double dynamic_range)
void setNmostIntense(unsigned int nmost_intense)
pappso::XtandemSpectrumProcess m_tandemSpectrumProcess
Definition: psmfeatures.h:63
void parameterMapReady(pappso::UiMonitorInterface &monitor) override
pappso::PsmFeatures * mpa_psmFeatures
Definition: psmfeatures.h:67
pappso::PrecisionPtr m_fragmentTolerance
Definition: psmfeatures.h:66
pappso::cbor::psm::CborScanMapBase * newCborScanMap() override
PsmFeatures(std::size_t buffer_scan_size, CborStreamWriter *cbor_output_p)
Definition: psmfeatures.cpp:32
std::list< pappso::PeptideIon > m_ionList
Definition: psmfeatures.h:65
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.
comutes various PSM (Peptide Spectrum Match) features
compute features on scan's PSM