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

#include <psmfeaturesscan.h>

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

Public Member Functions

 PsmFeaturesScan (const PsmFileScanProcess &psm_file_scan_process, pappso::XtandemSpectrumProcess &tandem_spectrum_process, std::list< pappso::Enums::PeptideIon > &ion_list, pappso::PsmFeatures &psm_features, pappso::PrecisionPtr fragment_tolerance)
 
virtual ~PsmFeaturesScan ()
 
- 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
 
double checkInf (double input) const
 
- Protected Member Functions inherited from pappso::cbor::psm::CborScanMapBase
pappso::QualifiedMassSpectrumSPtr getCurrentQualifiedMassSpectrumSPtr () const
 

Private Attributes

pappso::XtandemSpectrumProcess & m_tandemSpectrumProcess
 
std::list< pappso::Enums::PeptideIon > & m_ionList
 
pappso::PsmFeatures m_psmFeatures
 
pappso::PrecisionPtr m_fragmentTolerance
 

Additional Inherited Members

- Protected Attributes inherited from pappso::cbor::psm::CborScanMapBase
const PsmFileScanProcess & m_PsmFileScanProcess
 

Detailed Description

Todo:
write docs

Definition at line 44 of file psmfeaturesscan.h.

Constructor & Destructor Documentation

◆ PsmFeaturesScan()

pappso::cbor::psm::PsmFeaturesScan::PsmFeaturesScan ( const PsmFileScanProcess &  psm_file_scan_process,
pappso::XtandemSpectrumProcess &  tandem_spectrum_process,
std::list< pappso::Enums::PeptideIon > &  ion_list,
pappso::PsmFeatures &  psm_features,
pappso::PrecisionPtr  fragment_tolerance 
)

Default constructor

Definition at line 42 of file psmfeaturesscan.cpp.

47 : CborScanMapBase(psm_file_scan_process),
48 m_tandemSpectrumProcess(tandem_spectrum_process),
49 m_ionList(ion_list),
50 m_psmFeatures(psm_features)
51{
52 m_fragmentTolerance = fragment_tolerance;
53}
CborScanMapBase(const PsmFileScanProcess &psm_file_scan_process)
pappso::XtandemSpectrumProcess & m_tandemSpectrumProcess
std::list< pappso::Enums::PeptideIon > & m_ionList
pappso::PrecisionPtr m_fragmentTolerance

References m_fragmentTolerance.

◆ ~PsmFeaturesScan()

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

Destructor

Definition at line 55 of file psmfeaturesscan.cpp.

56{
57}

Member Function Documentation

◆ checkInf()

double pappso::cbor::psm::PsmFeaturesScan::checkInf ( double  input) const
protected

Definition at line 60 of file psmfeaturesscan.cpp.

61{
62 if(input < 0)
63 return 0;
64 return input;
65}

Referenced by process().

◆ process()

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

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

Definition at line 68 of file psmfeaturesscan.cpp.

69{
70
71 if(keys().contains("psm_list"))
72 {
74
75 pappso::MassSpectrum spectrum =
76 m_tandemSpectrumProcess.process(*qualified_mass_spectrum.get()->getMassSpectrumSPtr().get(),
77 qualified_mass_spectrum.get()->getPrecursorMz(),
78 qualified_mass_spectrum.get()->getPrecursorCharge());
79
80 // qWarning() << qualified_mass_spectrum.get()->getMassSpectrumId().getSpectrumIndex();
81 QCborArray new_psm_arr;
82 for(QCborValue cbor_psm : value("psm_list").toArray())
83 {
84 QCborMap cbor_psm_map = cbor_psm.toMap();
85 QCborMap cbor_psm_features;
86 pappso::PeptideSp peptide_sp =
87 pappso::PeptideProFormaParser::parseString(cbor_psm_map.value("proforma").toString());
88
89 if(peptide_sp.get()->size() < 2)
90 {
91 throw pappso::PappsoException(QObject::tr("peptide in psm too small %1")
92 .arg(cbor_psm_map.value("proforma").toString()));
93 }
94 // qWarning() << cbor_psm_map.value("proforma").toString() << "end " <<
95 // qualified_mass_spectrum.get()->getMassSpectrumId().getSpectrumIndex();
96
97 std::size_t peptide_size = peptide_sp.get()->size();
98 cbor_psm_features.insert(QString("peptide_size"), (unsigned int)peptide_size);
99
100 pappso::XtandemHyperscore hyperscore(spectrum,
101 peptide_sp,
102 qualified_mass_spectrum.get()->getPrecursorCharge(),
104 m_ionList,
105 true);
106 cbor_psm_features.insert(QString("hyperscore"), QCborValue(hyperscore.getHyperscore()));
107 // qWarning() << cbor_psm_map.value("proforma").toString() << "end2 " <<
108 // qualified_mass_spectrum.get()->getMassSpectrumId().getSpectrumIndex();
109
111 peptide_sp,
112 qualified_mass_spectrum.get()->getMassSpectrumSPtr().get(),
113 qualified_mass_spectrum.get()->getPrecursorCharge(),
114 2);
115 // TIC
116 cbor_psm_features.insert(QString("total_intensity"),
117 std::log(m_psmFeatures.getTotalIntensity()));
118 cbor_psm_features.insert(QString("total_matched_intensity"),
120 // MaxIntALL
121 cbor_psm_features.insert(QString("max_intensity"),
122 checkInf(std::log(qualified_mass_spectrum.get()
123 ->getMassSpectrumSPtr()
124 .get()
125 ->maxIntensityDataPoint()
126 .y)));
127
128 // qWarning() << cbor_psm_map.value("proforma").toString() << "end3 " <<
129 // qualified_mass_spectrum.get()->getMassSpectrumId().getSpectrumIndex();
130 // MaxYionInt
131 cbor_psm_features.insert(
132 QString("MaxYionInt"),
134
135 // MaxBionInt
136 cbor_psm_features.insert(
137 QString("MaxBionInt"),
139
140 // SumYmatchInt
141 cbor_psm_features.insert(
142 QString("SumYmatchInt"),
144
145 // SumBmatchInt
146 cbor_psm_features.insert(
147 QString("SumBmatchInt"),
149
150 // FracYmatchInt
151 cbor_psm_features.insert(
152 QString("FracYmatchInt"),
155 // FracBmatchInt
156 cbor_psm_features.insert(
157 QString("FracBmatchInt"),
160
161 // SeqCoverYion
162 cbor_psm_features.insert(
163 QString("SeqCoverYion"),
165 (double)peptide_size);
166 // SeqCoverBion
167 cbor_psm_features.insert(
168 QString("SeqCoverBion"),
170 (double)peptide_size);
171
172
173 // ConsecutiveYion
174 cbor_psm_features.insert(
175 QString("ConsecutiveYion"),
177 // ConsecutiveBion
178 cbor_psm_features.insert(
179 QString("ConsecutiveBion"),
181
182 // MassErrMean
183 cbor_psm_features.insert(QString("MassErrMean"), m_psmFeatures.getMatchedMzDiffMean());
184
185 // MassErrSD
186 cbor_psm_features.insert(QString("MassErrSD"), m_psmFeatures.getMatchedMzDiffSd());
187
188 // NumofAnnoPeaks
189 cbor_psm_features.insert(QString("NumofAnnoPeaks"),
190 (unsigned int)m_psmFeatures.getNumberOfMatchedIons());
191
192 // qWarning() << cbor_psm_map.value("proforma").toString() << "end2 " <<
193 // qualified_mass_spectrum.get()->getMassSpectrumId().getSpectrumIndex();
194 // NumofComplementPeaks
195 std::size_t num_of_pairs = m_psmFeatures.countMatchedIonComplementPairs();
196 cbor_psm_features.insert(QString("NumofComplementPeaks"), (unsigned int)num_of_pairs);
197 if(num_of_pairs > 0)
198 {
199 // SumComplementPeaksInt
200 cbor_psm_features.insert(
201 QString("SumComplementPeaksInt"),
203
204 // FracComplementPeaksInt
205 cbor_psm_features.insert(
206 QString("FracComplementPeaksInt"),
209 // SeqCoverComplementPeaks
210 cbor_psm_features.insert(
211 QString("SeqCoverComplementPeaks"),
213 (double)peptide_size);
214 }
216 cbor_psm_features.insert(QString("lrSize"), (unsigned int)lr.getSize());
217
218
219 double coeff_of_determination = lr.getCoefficientOfDetermination();
220 if(std::isnan(coeff_of_determination))
221 {
222 }
223 else
224 {
225 cbor_psm_features.insert(QString("lrCoeffDet"), coeff_of_determination);
226 }
227
228
229 QCborMap psm_eval = cbor_psm_map.value("eval").toMap();
230 psm_eval.remove(QString("features"));
231 psm_eval.insert(QString("features"), cbor_psm_features);
232 cbor_psm_map.remove(QString("eval"));
233 cbor_psm_map.insert(QString("eval"), psm_eval);
234
235 new_psm_arr.push_back(cbor_psm_map);
236 }
237
238 insert(QString("psm_list"), new_psm_arr);
239 // qWarning() << "end " <<
240 // qualified_mass_spectrum.get()->getMassSpectrumId().getSpectrumIndex();
241 }
242}
std::size_t getSize() const
get data size
double getCoefficientOfDetermination() const
get Coefficient of determination (R2)
Class to represent a mass spectrum.
static PeptideSp parseString(const QString &pepstr)
double getMaxIntensityPeakIonMatch(Enums::PeptideIon ion_type) const
double getIntensityOfMatchedIon(Enums::PeptideIon ion_type)
get the sum of intensity of a specific ion
std::size_t getNumberOfMatchedIons() const
number of matched ions (peaks)
std::size_t getAaSequenceCoverage(Enums::PeptideIon ion_type)
number of amino acid covered by matched ions
double getTotalIntensity() const
sum of all peak intensities (matched or not)
double getMatchedMzDiffMean() const
get mean deviation of matched peak mass delta
double getTotalIntensityOfMatchedIonComplementPairs() const
intensity of matched ion complement
std::size_t countMatchedIonComplementPairs() const
count the number of matched ion complement
std::size_t getComplementPairsAaSequenceCoverage()
number of amino acid covered by matched complement pairs of ions
double getTotalIntensityOfMatchedIons() const
sum of matched peak intensities
std::size_t getMaxConsecutiveIon(Enums::PeptideIon ion_type)
get the maximum consecutive fragments of one ion type
LinearRegression getIonIsotopeLinearRegression() const
void setPeptideSpectrumCharge(const pappso::PeptideSp peptideSp, const MassSpectrum *p_spectrum, unsigned int parent_charge, unsigned int max_isotope_number)
double getMatchedMzDiffSd() const
get standard deviation of matched peak mass delta
std::map< pappso_double, pappso_double > toMap() const
Definition trace.cpp:725
MassSpectrum process(const MassSpectrum &spectrum, pappso_double parent_ion_mass, unsigned int parent_charge) const
process raw spectrum to prepare hyperscore computation
pappso::QualifiedMassSpectrumSPtr getCurrentQualifiedMassSpectrumSPtr() const
double checkInf(double input) const
@ y
Cter amino ions.
@ b
Nter acylium ions.
std::shared_ptr< QualifiedMassSpectrum > QualifiedMassSpectrumSPtr
std::shared_ptr< const Peptide > PeptideSp

References pappso::Enums::b, checkInf(), pappso::PsmFeatures::countMatchedIonComplementPairs(), pappso::PsmFeatures::getAaSequenceCoverage(), pappso::LinearRegression::getCoefficientOfDetermination(), pappso::PsmFeatures::getComplementPairsAaSequenceCoverage(), pappso::cbor::psm::CborScanMapBase::getCurrentQualifiedMassSpectrumSPtr(), pappso::XtandemHyperscore::getHyperscore(), pappso::PsmFeatures::getIntensityOfMatchedIon(), pappso::PsmFeatures::getIonIsotopeLinearRegression(), pappso::PsmFeatures::getMatchedMzDiffMean(), pappso::PsmFeatures::getMatchedMzDiffSd(), pappso::PsmFeatures::getMaxConsecutiveIon(), pappso::PsmFeatures::getMaxIntensityPeakIonMatch(), pappso::PsmFeatures::getNumberOfMatchedIons(), pappso::LinearRegression::getSize(), pappso::PsmFeatures::getTotalIntensity(), pappso::PsmFeatures::getTotalIntensityOfMatchedIonComplementPairs(), pappso::PsmFeatures::getTotalIntensityOfMatchedIons(), m_fragmentTolerance, m_ionList, m_psmFeatures, m_tandemSpectrumProcess, pappso::PeptideProFormaParser::parseString(), pappso::XtandemSpectrumProcess::process(), pappso::PsmFeatures::setPeptideSpectrumCharge(), pappso::Trace::toMap(), and pappso::Enums::y.

Member Data Documentation

◆ m_fragmentTolerance

pappso::PrecisionPtr pappso::cbor::psm::PsmFeaturesScan::m_fragmentTolerance
private

Definition at line 69 of file psmfeaturesscan.h.

Referenced by PsmFeaturesScan(), and process().

◆ m_ionList

std::list<pappso::Enums::PeptideIon>& pappso::cbor::psm::PsmFeaturesScan::m_ionList
private

Definition at line 67 of file psmfeaturesscan.h.

Referenced by process().

◆ m_psmFeatures

pappso::PsmFeatures pappso::cbor::psm::PsmFeaturesScan::m_psmFeatures
private

Definition at line 68 of file psmfeaturesscan.h.

Referenced by process().

◆ m_tandemSpectrumProcess

pappso::XtandemSpectrumProcess& pappso::cbor::psm::PsmFeaturesScan::m_tandemSpectrumProcess
private

Definition at line 66 of file psmfeaturesscan.h.

Referenced by process().


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