49 this->setLayout(
new QHBoxLayout(
this));
51 this->layout()->setContentsMargins(0, 0, 0, 0);
81 painter.begin(device);
82 _custom_plot->toPainter(&painter, size.width(), size.height());
97 while(
auto item = this->layout()->takeAt(0))
99 delete item->widget();
108 _custom_plot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
143 qDebug() <<
"ms_level=" << ms_level;
161 qDebug() <<
"precision->toString()=" << precision->
toString();
168 qDebug() <<
"precision->toString()=" << precision->
toString();
284 return a.get()->getMz() < b.get()->getMz();
290 qDebug() <<
"precursor_peptide.get()->getMz()="
291 << precursor_peptide.get()->
getMz();
294 monoisotope_peak.
y = 0;
300 if(peak.y > monoisotope_peak.
y)
302 qDebug() <<
"SpectrumWidget::plot "
304 "monoisotope_peak.intensity) ";
305 monoisotope_peak = peak;
309 if(monoisotope_peak.
y > 0)
311 qDebug() <<
"addMs1IsotopePattern";
323 return a.getPeak().y >
b.getPeak().y;
335 QCPItemText *text_label =
new QCPItemText(
_custom_plot);
336 text_label->setVisible(
true);
338 text_label->setPositionAlignment(Qt::AlignBottom | Qt::AlignHCenter);
339 text_label->position->setType(QCPItemPosition::ptPlotCoords);
340 text_label->position->setCoords(
341 peak_ion_match.getPeak().x,
342 peak_ion_match.getPeak().y);
343 text_label->setFont(QFont(font().family(), 8));
345 peak_ion_match.getPeptideFragmentIonSp().get()->getCompletePeptideIonName(
346 peak_ion_match.getCharge()));
349 text_label->setColor(
368 qDebug() <<
"p_peak_match=" << p_peak_match;
386 emit
ionChanged(std::make_shared<const PeakIonIsotopeMatch>(
393 emit
ionChanged(std::shared_ptr<const PeakIonIsotopeMatch>());
398 qDebug() <<
"no peak";
407 qDebug() <<
"_p_ms1_precision->toString()=" <<
_p_ms1_precision->toString();
413 std::map<unsigned int, pappso::pappso_double> map_isotope_number =
416 for(
unsigned int i = 0; i < map_isotope_number.size(); i++)
419 unsigned int asked_rank = 0;
420 unsigned int given_rank = 0;
421 bool more_rank =
true;
428 if(given_rank < asked_rank)
465 QJsonObject psm_json;
472 psm_json.insert(
"proforma",
_peptide_sp.get()->toProForma());
487 std::map<pappso::Enums::PeptideIon, std::vector<data_plot>> ion_map;
489 QJsonObject spectrum_json;
496 data_plot one_ion_match;
497 one_ion_match.charge = (int)peakion_match.getCharge();
498 one_ion_match.isotope_number =
499 (int)peakion_match.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeNumber();
500 one_ion_match.isotope_rank =
501 (int)peakion_match.getPeptideNaturalIsotopeAverageSp().get()->getIsotopeRank();
502 one_ion_match.mz_th =
503 peakion_match.getPeptideNaturalIsotopeAverageSp().get()->getMz();
504 one_ion_match.point = peakion_match.getPeak();
505 one_ion_match.size = (int)peakion_match.getPeptideFragmentIonSp().get()->size();
507 auto it = ion_map.insert({peakion_match.getPeptideIonType(), {}});
508 it.first->second.push_back(one_ion_match);
511 QJsonObject psm_ion_json;
512 for(
auto &cle_valeur : ion_map)
514 std::vector<data_plot> ¤t_vector = cle_valeur.second;
517 current_vector.begin(),
518 current_vector.end(),
519 [](
const data_plot &
a,
const data_plot &
b) { return a.point.x < b.point.x; });
520 QJsonArray current_ion_json_arr;
522 for(
const data_plot &one_point : current_vector)
524 QJsonObject current_ion;
525 current_ion.insert(
"mz", one_point.point.x);
526 current_ion.insert(
"mzth", one_point.mz_th);
527 current_ion.insert(
"intensity", one_point.point.y);
528 current_ion.insert(
"size", one_point.size);
529 current_ion.insert(
"charge", one_point.charge);
530 current_ion.insert(
"isotope", one_point.isotope_number);
531 current_ion.insert(
"rank", one_point.isotope_rank);
533 current_ion_json_arr.push_back(current_ion);
540 psm_json.insert(
"ion-series", psm_ion_json);
541 psm_json.insert(
"spectra", spectrum_json);
547 QObject::tr(
"Unable to build JSON PSM object:\n%1").arg(error.
qwhat()));
bool contains(pappso_double) const
virtual const QString & qwhat() const
static std::list< Enums::PeptideIon > getCIDionList()
static const QColor getPeptideIonColor(Enums::PeptideIon ion_type)
const std::list< PeakIonIsotopeMatch > & getPeakIonIsotopeMatchList() const
unsigned int getIsotopeRank() const
pappso_double getIntensityRatio() const
pappso_double getMz() const
PeptideNaturalIsotopeAverageSp makePeptideNaturalIsotopeAverageSp() const
const std::map< unsigned int, pappso_double > getIntensityRatioPerIsotopeNumber() const
virtual QString toString() const =0
Class representing a fully specified mass spectrum.
uint getMsLevel() const
Get the mass spectrum level.
MassSpectrumCstSPtr getMassSpectrumCstSPtr() const
Get the MassSpectrumCstSPtr.
uint getPrecursorCharge(bool *ok=nullptr) const
get precursor charge
static QString toString(specglob::SpectralAlignmentType type)
Convenience function to return a string describing the specglob alingment type.
static QJsonArray toJson(const std::vector< double > &myVec)
convert vector of double into json array
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::shared_ptr< const Peptide > PeptideSp
double pappso_double
A type definition for doubles.
std::shared_ptr< const PeptideNaturalIsotopeAverage > PeptideNaturalIsotopeAverageSp
std::shared_ptr< const MassSpectrum > MassSpectrumCstSPtr
const PrecisionBase * PrecisionPtr
std::shared_ptr< const DataPoint > DataPointCstSPtr