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

#include <psmspecglobscan.h>

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

Public Member Functions

 PsmSpecGlobScan (const PsmSpecGlob &psm_specgloc, pappso::PrecisionPtr fragment_tolerance)
 
virtual ~PsmSpecGlobScan ()
 
- 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 PsmSpecGlobmp_psmSpecGlob
 
pappso::PrecisionPtr m_fragmentTolerance
 
bool m_checkMutations = false
 

Additional Inherited Members

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

Detailed Description

Todo:
write docs

Definition at line 37 of file psmspecglobscan.h.

Constructor & Destructor Documentation

◆ PsmSpecGlobScan()

pappso::cbor::psm::PsmSpecGlobScan::PsmSpecGlobScan ( const PsmSpecGlob psm_specgloc,
pappso::PrecisionPtr  fragment_tolerance 
)

Default constructor

Definition at line 35 of file psmspecglobscan.cpp.

37 : CborScanMapBase(psm_specgloc)
38{
39 m_fragmentTolerance = fragment_tolerance;
40 mp_psmSpecGlob = &psm_specgloc;
41}
CborScanMapBase(const PsmFileScanProcess &psm_file_scan_process)
pappso::PrecisionPtr m_fragmentTolerance

References m_fragmentTolerance, and mp_psmSpecGlob.

◆ ~PsmSpecGlobScan()

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

Destructor

Definition at line 43 of file psmspecglobscan.cpp.

44{
45}

Member Function Documentation

◆ process()

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

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

Definition at line 48 of file psmspecglobscan.cpp.

49{
50 if(!keys().contains("id"))
51 {
52 throw pappso::PappsoException(QObject::tr("missing scan id"));
53 }
54 if(keys().contains("psm_list"))
55 {
57 pappso::specglob::ExperimentalSpectrumCsp experimental_spectrum =
58 std::make_shared<pappso::specglob::ExperimentalSpectrum>(*qualified_mass_spectrum.get(),
60
61
63 *(qualified_mass_spectrum.get()->getMassSpectrumSPtr().get()));
64
65 QCborArray new_psm_arr;
66 for(QCborValue cbor_psm : value("psm_list").toArray())
67 {
68 QCborMap cbor_psm_map = cbor_psm.toMap();
69
70 if(!cbor_psm_map.keys().contains("proforma"))
71 {
73 QObject::tr("missing proforma in psm %1 spectrum %2")
74 .arg(cbor_psm_map.keys().size())
75 .arg(qualified_mass_spectrum.get()->getMassSpectrumId().getNativeId()));
76 }
77 QString proforma = cbor_psm_map.value("proforma").toString();
78 if(proforma.isEmpty())
79 {
80
82 QObject::tr("proforma is empty in psm %1 spectrum %2")
83 .arg(cbor_psm_map.keys().size())
84 .arg(qualified_mass_spectrum.get()->getMassSpectrumId().getNativeId()));
85 }
86 QCborMap cbor_psm_eval_specglob;
87 qDebug();
89
90 qDebug() << proforma << " " << peptide_sp.get()->toProForma();
92 std::make_shared<pappso::specglob::PeptideSpectrum>(peptide_sp);
93
94 qDebug();
95
96 qDebug();
99
100 spectral_alignment.align(peptide_spectra, experimental_spectrum);
101
102 cbor_psm_eval_specglob.insert(QString("max_score"), spectral_alignment.getMaxScore());
103
104 bool keep = false;
105
106 if(spectral_alignment.getMaxScore() > 0)
107 {
108 pappso::specglob::PeptideModel peptide_model = spectral_alignment.buildPeptideModel();
109
110 // peptide_model.eliminateComplementaryDelta(m_fragmentTolerance);
111 // peptide_model.matchExperimentalPeaks(m_fragmentTolerance);
112
113
114
115 pappso::specglob::PostTreatment post_treatment(m_fragmentTolerance, peptide_model);
117 post_treatment.findReplaceMutations();
118 peptide_model = post_treatment.getBetterPeptideModel();
119
120 cbor_psm_eval_specglob.insert(QString("count"),
121 (qint64)peptide_model.getCountSharedPeaks());
122
123 cbor_psm_eval_specglob.insert(QString("proforma"), peptide_model.toProForma());
124 cbor_psm_eval_specglob.insert(QString("bracket"), peptide_model.toString());
125
126 // peptide_model.checkForMutations()
127
129 {
130 keep = true;
131 }
132 }
133
134 QCborMap psm_eval = cbor_psm_map.value("eval").toMap();
135 psm_eval.remove(QString("specglob"));
136 psm_eval.insert(QString("specglob"), cbor_psm_eval_specglob);
137 cbor_psm_map.remove(QString("eval"));
138 cbor_psm_map.insert(QString("eval"), psm_eval);
139
141 {
142 if(keep)
143 {
144 QCborMap new_psm;
145 new_psm.insert(QString("proforma"),
146 cbor_psm_eval_specglob.value("proforma").toString());
147 new_psm.insert(QString("protein_list"), cbor_psm_map.value("protein_list"));
148 new_psm.insert(QString("eval"), cbor_psm_map.value("eval"));
149 new_psm_arr.push_back(new_psm);
150 }
151 }
152 else
153 {
154 new_psm_arr.push_back(cbor_psm_map);
155 }
156 }
157
158 // insert(QString("psm_list"), new_psm_arr);
159 remove(QString("psm_list"));
160 insert(QString("psm_list"), new_psm_arr);
161
162
164 }
165}
static PeptideSp parseString(const QString &pepstr)
pappso::QualifiedMassSpectrumSPtr getCurrentQualifiedMassSpectrumSPtr() const
void filterMassSpectrum(pappso::MassSpectrum &mass_spectrum) const
std::size_t getCountSharedPeaks() const
QString toProForma() const
get the peptide model in ProForma notation https://github.com/HUPO-PSI/ProForma/blob/master/README....
std::shared_ptr< const PeptideSpectrum > PeptideSpectraCsp
std::shared_ptr< const ExperimentalSpectrum > ExperimentalSpectrumCsp
std::shared_ptr< QualifiedMassSpectrum > QualifiedMassSpectrumSPtr
std::shared_ptr< const Peptide > PeptideSp

References pappso::specglob::SpectralAlignment::align(), pappso::specglob::SpectralAlignment::buildPeptideModel(), pappso::specglob::PostTreatment::findReplaceMutations(), pappso::specglob::PostTreatment::getBetterPeptideModel(), pappso::specglob::PeptideModel::getCountSharedPeaks(), pappso::specglob::SpectralAlignment::getMaxScore(), pappso::PeptideProFormaParser::parseString(), pappso::specglob::PeptideModel::toProForma(), and pappso::specglob::PeptideModel::toString().

Member Data Documentation

◆ m_checkMutations

bool pappso::cbor::psm::PsmSpecGlobScan::m_checkMutations = false
private

Definition at line 57 of file psmspecglobscan.h.

◆ m_fragmentTolerance

pappso::PrecisionPtr pappso::cbor::psm::PsmSpecGlobScan::m_fragmentTolerance
private

Definition at line 56 of file psmspecglobscan.h.

Referenced by PsmSpecGlobScan().

◆ mp_psmSpecGlob

const PsmSpecGlob* pappso::cbor::psm::PsmSpecGlobScan::mp_psmSpecGlob
private

Definition at line 55 of file psmspecglobscan.h.

Referenced by PsmSpecGlobScan().


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