Loading...
Searching...
No Matches
psmspecglob.cpp
Go to the documentation of this file.
/**
* \file pappsomspp/processing/cbor/psm/evalscan/psmspecglob.cpp
* \date 19/07/2025
* \author Olivier Langella
* \brief compute specglob alignment on scan's PSM
*/
/*******************************************************************************
* Copyright (c) 2025 Olivier Langella <Olivier.Langella@universite-paris-saclay.fr>.
*
* This file is part of PAPPSOms-tools.
*
* PAPPSOms-tools is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PAPPSOms-tools is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PAPPSOms-tools. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "psmspecglob.h"
#include "psmspecglobscan.h"
#include "pappsomspp/core/processing/filters/filtersuitestring.h"
#include "pappsomspp/core/processing/filters/filterresample.h"
#include "pappsomspp/core/processing/filters/filterpass.h"
#include "pappsomspp/core/processing/filters/filterchargedeconvolution.h"
pappso::cbor::psm::PsmSpecGlob::PsmSpecGlob(std::size_t buffer_scan_size,
pappso::cbor::CborStreamWriter *cbor_output_p,
const QJsonObject &parameters)
: PsmFileScanProcessAndCopy(buffer_scan_size, cbor_output_p, "SpecGlob")
{
qDebug();
m_specglobParameters = parameters;
if(parameters.value("fragment_tolerance_unit").toString() == "dalton")
{
m_fragmentTolerance = pappso::PrecisionFactory::getDaltonInstance(
parameters.value("fragment_tolerance").toDouble());
}
else if(parameters.value("fragment_tolerance_unit").toString() == "ppm")
{
m_fragmentTolerance =
pappso::PrecisionFactory::getPpmInstance(parameters.value("fragment_tolerance").toDouble());
}
QJsonObject spectrum_param = parameters.value("spectrum").toObject();
m_minimumMz = spectrum_param.value("minimum_mz").toDouble();
m_nMostIntense = spectrum_param.value("n_most_intense").toInt();
m_deisotope = spectrum_param.value("deisotope").toBool();
qDebug();
}
pappso::cbor::psm::PsmSpecGlob::~PsmSpecGlob()
{
}
void
pappso::cbor::psm::PsmSpecGlob::parameterMapReady(pappso::UiMonitorInterface &monitor
[[maybe_unused]])
{
qDebug();
QCborMap cbor_specglob_parameters = QCborValue::fromJsonValue(m_specglobParameters).toMap();
if(m_cborParameterMap.contains(QString("matcher")))
{
m_isProteinMatcherResult = true;
}
m_cborParameterMap.insert(QString("specglob"), cbor_specglob_parameters);
mp_cborOutput->append("parameter_map");
mp_cborOutput->writeCborMap(m_cborParameterMap);
qDebug();
}
void
pappso::cbor::psm::PsmSpecGlob::filterMassSpectrum(pappso::MassSpectrum &mass_spectrum) const
{
if(m_deisotope)
pappso::FilterChargeDeconvolution(m_fragmentTolerance).filter(mass_spectrum);
pappso::FilterResampleKeepGreater(m_minimumMz).filter(mass_spectrum);
pappso::FilterGreatestY(m_nMostIntense).filter(mass_spectrum);
}
pappso::cbor::psm::CborScanMapBase *
pappso::cbor::psm::PsmSpecGlob::newCborScanMap()
{
return new PsmSpecGlobScan(*this, m_fragmentTolerance);
}
void
pappso::cbor::psm::PsmSpecGlob::processBufferScanDone(pappso::UiMonitorInterface &monitor)
{
PsmFileScanProcessAndCopy::processBufferScanDone(monitor);
m_countScanProcessed += m_bufferScanSize;
monitor.setStatus(QObject::tr("%1 scan processed").arg(m_countScanProcessed));
}
pappso::FilterChargeDeconvolution
Definition filterchargedeconvolution.h:43
pappso::FilterChargeDeconvolution::filter
Trace & filter(Trace &data_points) const override
get all the datapoints and remove different isotope and add their intensity and change to charge = 1 ...
Definition filterchargedeconvolution.cpp:115
pappso::FilterGreatestY
keep N datapoints form the greatest intensities to the lowest
Definition filterpass.h:96
pappso::FilterGreatestY::filter
Trace & filter(Trace &data_points) const override
Definition filterpass.cpp:163
pappso::FilterResampleKeepGreater
Definition filterresample.h:55
pappso::FilterResampleKeepGreater::filter
Trace & filter(Trace &trace) const override
Definition filterresample.cpp:79
pappso::MassSpectrum
Class to represent a mass spectrum.
Definition massspectrum.h:70
pappso::PrecisionFactory::getPpmInstance
static PrecisionPtr getPpmInstance(pappso_double value)
get a ppm precision pointer
Definition precision.cpp:155
pappso::PrecisionFactory::getDaltonInstance
static PrecisionPtr getDaltonInstance(pappso_double value)
get a Dalton precision pointer
Definition precision.cpp:136
pappso::UiMonitorInterface
Definition uimonitorinterface.h:50
pappso::UiMonitorInterface::setStatus
virtual void setStatus(const QString &status)=0
current status of the process
pappso::cbor::CborStreamWriter
overrides QCborStreamWriter base class to provide convenient functions
Definition cborstreamwriter.h:45
pappso::cbor::psm::CborScanMapBase
Definition cborscanmapbase.h:48
pappso::cbor::psm::PsmFileReaderBase::m_cborParameterMap
QCborMap m_cborParameterMap
Definition psmfilereaderbase.h:135
pappso::cbor::psm::PsmFileScanProcessAndCopy::mp_cborOutput
CborStreamWriter * mp_cborOutput
Definition psmfilescanprocessandcopy.h:87
pappso::cbor::psm::PsmFileScanProcessAndCopy::PsmFileScanProcessAndCopy
PsmFileScanProcessAndCopy(std::size_t buffer_scan_size, CborStreamWriter *cbor_output_p, const QString &operation)
Definition psmfilescanprocessandcopy.cpp:41
pappso::cbor::psm::PsmFileScanProcessAndCopy::processBufferScanDone
virtual void processBufferScanDone(pappso::UiMonitorInterface &monitor) override
Definition psmfilescanprocessandcopy.cpp:169
pappso::cbor::psm::PsmFileScanProcess::m_bufferScanSize
std::size_t m_bufferScanSize
Definition psmfilescanprocess.h:73
pappso::cbor::psm::PsmSpecGlob::m_isProteinMatcherResult
bool m_isProteinMatcherResult
Definition psmspecglob.h:73
pappso::cbor::psm::PsmSpecGlob::~PsmSpecGlob
virtual ~PsmSpecGlob()
Definition psmspecglob.cpp:62
pappso::cbor::psm::PsmSpecGlob::m_minimumMz
double m_minimumMz
Definition psmspecglob.h:70
pappso::cbor::psm::PsmSpecGlob::newCborScanMap
pappso::cbor::psm::CborScanMapBase * newCborScanMap() override
Definition psmspecglob.cpp:99
pappso::cbor::psm::PsmSpecGlob::m_fragmentTolerance
pappso::PrecisionPtr m_fragmentTolerance
Definition psmspecglob.h:69
pappso::cbor::psm::PsmSpecGlob::m_specglobParameters
QJsonObject m_specglobParameters
Definition psmspecglob.h:68
pappso::cbor::psm::PsmSpecGlob::processBufferScanDone
virtual void processBufferScanDone(pappso::UiMonitorInterface &monitor) override
Definition psmspecglob.cpp:107
pappso::cbor::psm::PsmSpecGlob::filterMassSpectrum
void filterMassSpectrum(pappso::MassSpectrum &mass_spectrum) const
Definition psmspecglob.cpp:89
pappso::cbor::psm::PsmSpecGlob::parameterMapReady
void parameterMapReady(pappso::UiMonitorInterface &monitor) override
Definition psmspecglob.cpp:67
pappso::cbor::psm::PsmSpecGlob::PsmSpecGlob
PsmSpecGlob(std::size_t buffer_scan_size, CborStreamWriter *cbor_output_p, const QJsonObject &parameters)
Definition psmspecglob.cpp:35
pappso::cbor::psm::PsmSpecGlob::m_deisotope
bool m_deisotope
Definition psmspecglob.h:72
pappso::cbor::psm::PsmSpecGlob::m_countScanProcessed
std::size_t m_countScanProcessed
Definition psmspecglob.h:74
pappso::cbor::psm::PsmSpecGlob::m_nMostIntense
std::size_t m_nMostIntense
Definition psmspecglob.h:71
pappso::cbor::psm::PsmSpecGlob::PsmSpecGlobScan
friend PsmSpecGlobScan
Definition psmspecglob.h:42
filterchargedeconvolution.h
filterpass.h
filterresample.h
filtersuitestring.h
psmspecglob.h
psmspecglobscan.h