Commit b1fe1d9e authored by Olivier Langella's avatar Olivier Langella
Browse files

new columns in compar output. Isotope labeling OK. Print time references

parent a7db2457
......@@ -108,7 +108,7 @@ void PeptideSelectionWidget::updatePeptideList() {
qDebug() << "Select Peptide to msRUn id : " << msRunID;
int i;
for ( i = 0, it = list.begin(); it != list.end(); it++, i++) {
if ((*it)->getIsotopeLabel() == NULL) {
if ((*it)->getIsotopeLabel() == nullptr) {
if ((*it)->isObservedIn(msRunID)) {
_peptideComboBox->addItem((*it)->getXmlId(), QVariant(i));
}
......@@ -159,7 +159,7 @@ void PeptideSelectionWidget::setPeptideToExtract(int index) {
for (it = charges->begin(); it != charges->end(); it++) {
_zComboBox->addItem(QString().setNum(*it));
}
if (pep->getIsotopeLabel() == NULL) {
if (pep->getIsotopeLabel() == nullptr) {
_peptide_message->setText(pep->getSequence() + " "
+ pep->getMods());
......
......@@ -268,7 +268,7 @@ void MasschroqWriter::privWriteMatchedPeak(const Msrun * p_msrun, const QuantiIt
pepId = current_peptide->getXmlId();
_output_stream->writeAttribute("peptide", pepId);
if (current_peptide->getIsotopeLabel() != 0)
if (current_peptide->getIsotopeLabel() != nullptr)
{
isotopeLabel = current_peptide->getIsotopeLabel()->getXmlId();
_output_stream->writeAttribute("isotope", isotopeLabel);
......
......@@ -94,6 +94,8 @@ void MonitorComparInterfaceOutput::writeQuantifyEnd() {
_p_writer->setCellAnnotation("peptide id");
_p_writer->writeCell("peptide");
_p_writer->writeCell("m/z");
_p_writer->setCellAnnotation("retention time in seconds, adjusted by MassChroQ");
_p_writer->writeCell("rt reference (seconds)");
_p_writer->setCellAnnotation("peptide charge");
_p_writer->writeCell("z");
_p_writer->setCellAnnotation("natural isotope number");
......@@ -104,6 +106,8 @@ void MonitorComparInterfaceOutput::writeQuantifyEnd() {
_p_writer->writeCell("isotope ratio");
_p_writer->setCellAnnotation("peptide sequence (containing OBO PSIMOD modifications)");
_p_writer->writeCell("sequence");
_p_writer->setCellAnnotation("isotope label (tag)");
_p_writer->writeCell("isotope");
_p_writer->setCellAnnotation("peptide modifications (free text)");
_p_writer->writeCell("mods");
_p_writer->setCellAnnotation("protein ids");
......
......@@ -306,7 +306,7 @@ const std::vector<PeptideObservedIn *> & Peptide::getObservedInList() const {
const IsotopeLabel * Peptide::getIsotopeLabel() const {
return NULL;
return nullptr;
}
const std::vector<const Protein *> & Peptide::getProteinList() const {
......
......@@ -108,7 +108,7 @@ void PeptideRt::computeRetentionTimeReferences(McqMatchingMode matching_mode)
//compute peptide retention time references :
if ((matching_mode == McqMatchingMode::mean) || ( matching_mode == McqMatchingMode::real_or_mean) || ( matching_mode == McqMatchingMode::post_matching)) {
//sort observations by ms runs, with the most intense last
qDebug() << "PeptideRt::computeRetentionTimeReferences sort " << _msms_observation_list.size();
qDebug() << "PeptideRt::computeRetentionTimeReferences sort " << _msms_observation_list.size();
std::sort(_msms_observation_list.begin(), _msms_observation_list.end(), [](const MsMsObservation & a, const MsMsObservation & b) {
if (a._p_msrun == b._p_msrun) {
return (a.intensity < b.intensity);
......@@ -120,7 +120,7 @@ void PeptideRt::computeRetentionTimeReferences(McqMatchingMode matching_mode)
_accumulator.clear();
qDebug() << "PeptideRt::computeRetentionTimeReferences best observation mean ";
qDebug() << "PeptideRt::computeRetentionTimeReferences best observation mean ";
//gest best observation for each mz in each msrun, compute the mean of best observations inside an msrun
//MsMsObservation first(nullptr);
std::vector<MsMsObservation>::iterator it_last = _msms_observation_list.begin();
......@@ -160,8 +160,8 @@ qDebug() << "PeptideRt::computeRetentionTimeReferences best observation mean ";
}
}
else {
qDebug() << "PeptideRt::computeRetentionTimeReferences accumulate" << _accumulator.size();
qDebug() << "PeptideRt::computeRetentionTimeReferences accumulate" << _accumulator.size();
_aligned_rt = std::accumulate(_accumulator.begin(),_accumulator.end(),0.0) / _accumulator.size();
}
qDebug() << "PeptideRt::computeRetentionTimeReferences end " << _aligned_rt<< " " << _accumulator.size() << " " << std::accumulate(_accumulator.begin(),_accumulator.end(),0.0);
......@@ -223,3 +223,12 @@ void PeptideRt::postMatchingAlignedPeak(const AlignedXicPeak & aligned_peak) {
qDebug() << "PeptideRt::postMatchingAlignedPeak end";
}
pappso::pappso_double PeptideRt::getPostMatchedRtTarget() const {
return _aligned_rt;
}
pappso::pappso_double PeptideRt::getAlignedReferenceRt() const {
return _aligned_rt;
}
......@@ -81,7 +81,13 @@ public:
bool isObservedIn(Msrun* _p_msrun) const;
void postMatchingAlignedPeak(const AlignedXicPeak & aligned_peak);
void computePostMatchingTimeReferences();
pappso::pappso_double getPostMatchedRtTarget() const {return _aligned_rt;};
pappso::pappso_double getPostMatchedRtTarget() const;
/** \brief get the aligned reference retention time for this Peptide
* This gives the computed target reference time used by MassChroQ to find peaks
* This reference depends on the alignment method and the method used to compute time references
*/
pappso::pappso_double getAlignedReferenceRt() const;
private :
......
......@@ -77,6 +77,8 @@ void QuantiItemBase::writeOdsComparHeaderLine(CalcWriterInterface & writer) cons
writer.writeEmptyCell();
//_p_writer->writeCell("m/z");
writer.writeCell(getMz());
//_p_writer->writeCell("rt reference");
writer.writeEmptyCell();
//_p_writer->writeCell("z");
writer.writeEmptyCell();
//_p_writer->writeCell("isotope number");
......@@ -87,6 +89,8 @@ void QuantiItemBase::writeOdsComparHeaderLine(CalcWriterInterface & writer) cons
writer.writeEmptyCell();
//_p_writer->writeCell("sequence");
writer.writeEmptyCell();
//_p_writer->writeCell("isotope");
writer.writeEmptyCell();
//_p_writer->writeCell("mods");
writer.writeEmptyCell();
//_p_writer->writeCell("proteins");
......
......@@ -86,7 +86,7 @@ void QuantiItemPeptide::writeCurrentSearchItem(MCQXmlStreamWriter* _output_strea
_output_stream->writeAttribute("z", QString::number(_z, 'f',0));
const IsotopeLabel * p_isotopeLabel = _p_peptide->getIsotopeLabel();
if (p_isotopeLabel != 0) {
if (p_isotopeLabel != nullptr) {
_output_stream->writeAttribute("isotope", p_isotopeLabel->getXmlId());
}
}
......@@ -118,11 +118,13 @@ void QuantiItemPeptide::writeOdsPeptideLine(CalcWriterInterface & writer) const
void QuantiItemPeptide::writeOdsComparHeaderLine(CalcWriterInterface & writer) const {
//_p_writer->writeCell("peptide");
writer.writeCell(_p_peptide->getXmlId());
//_p_writer->writeCell("m/z");
writer.writeCell(getMz());
//_p_writer->writeCell("rt reference");
writer.writeCell(this->_p_peptide->getPeptideRtSp().get()->getAlignedReferenceRt());
//_p_writer->writeCell("z");
writer.writeCell(_z);
//_p_writer->writeCell("isotope number");
......@@ -132,12 +134,19 @@ void QuantiItemPeptide::writeOdsComparHeaderLine(CalcWriterInterface & writer) c
writer.writeEmptyCell();
//_p_writer->writeCell("sequence");
writer.writeCell(_p_peptide->getPappsoPeptideSp().get()->toString());
//_p_writer->writeCell("isotope");
if (_p_peptide->getIsotopeLabel() == nullptr) {
writer.writeEmptyCell();
}
else {
writer.writeCell(_p_peptide->getIsotopeLabel()->getXmlId());
}
//_p_writer->writeCell("mods");
writer.writeCell(_p_peptide->getMods());
//_p_writer->writeCell("proteins");
QStringList protein_list;
for (const Protein * p_protein : _p_peptide->getProteinList()) {
protein_list << p_protein->getXmlId();
protein_list << p_protein->getXmlId();
}
writer.writeCell(protein_list.join(" "));
}
......@@ -164,29 +173,29 @@ XicTraceBase* QuantiItemPeptide::newXicTrace(Quantificator * quantificator, Msru
}
void QuantiItemPeptide::storeAlignedXicPeakForPostMatching(const Msrun* p_current_msrun,AlignedXicPeakSp & xic_peak_sp) {
qDebug() << "QuantiItemPeptide::storeAlignedXicPeakForPostMatching begin";
qDebug() << "QuantiItemPeptide::storeAlignedXicPeakForPostMatching begin";
std::vector<AlignedXicPeakSp> vec_peak;
vec_peak.push_back(xic_peak_sp);
std::pair<std::map<const Msrun*, std::vector<AlignedXicPeakSp>>::iterator, bool> ret = _map_post_matched_aligned_peaks.insert(std::pair<const Msrun*, std::vector<AlignedXicPeakSp>> (p_current_msrun,vec_peak));
if (ret.second == false) {
ret.first->second.push_back(xic_peak_sp);
}
qDebug() << "QuantiItemPeptide::storeAlignedXicPeakForPostMatching end";
qDebug() << "QuantiItemPeptide::storeAlignedXicPeakForPostMatching end";
}
void QuantiItemPeptide::clearAlignedXicPeakForPostMatching(const Msrun* p_current_msrun) {
qDebug() << "QuantiItemPeptide::clearAlignedXicPeakForPostMatching begin";
qDebug() << "QuantiItemPeptide::clearAlignedXicPeakForPostMatching begin";
std::map<const Msrun*, std::vector<AlignedXicPeakSp>>::iterator it = _map_post_matched_aligned_peaks.find(p_current_msrun);
if (it != _map_post_matched_aligned_peaks.end()) {
_map_post_matched_aligned_peaks.erase (it);
}
qDebug() << "QuantiItemPeptide::clearAlignedXicPeakForPostMatching end";
qDebug() << "QuantiItemPeptide::clearAlignedXicPeakForPostMatching end";
}
void QuantiItemPeptide::doPostMatching(MonitorSpeedInterface & monitor_speed) {
qDebug() << "QuantiItemPeptide::doPostMatching begin";
qDebug() << "QuantiItemPeptide::doPostMatching begin";
// _p_monitor_speed.writeMatchedPeak();
pappso::pappso_double rt_target = _p_peptide->getPeptideRtSp().get()->getPostMatchedRtTarget();
for (std::map<const Msrun*, std::vector<AlignedXicPeakSp>>::iterator it=_map_post_matched_aligned_peaks.begin(); it!=_map_post_matched_aligned_peaks.end(); ++it) {
......@@ -205,8 +214,8 @@ void QuantiItemPeptide::doPostMatching(MonitorSpeedInterface & monitor_speed) {
monitor_speed.writeMatchedPeak(p_msrun, this, nullptr);
}
}
_map_post_matched_aligned_peaks.clear();
qDebug() << "QuantiItemPeptide::doPostMatching end";
qDebug() << "QuantiItemPeptide::doPostMatching end";
}
......@@ -24,20 +24,21 @@
#include "quantiitempeptidenaturalisotope.h"
#include "QStringList"
#include "../xic/xictracepeptidenaturalisotope.h"
#include "../peptides/isotope_label.h"
#include <odsstream/tsvdirectorywriter.h>
#include <odsstream/calcwriterinterface.h>
QuantiItemPeptideNaturalIsotope::QuantiItemPeptideNaturalIsotope(bool trace_peptide_on,
QuantiItemPeptideNaturalIsotope::QuantiItemPeptideNaturalIsotope(bool trace_peptide_on,
const Peptide * p_peptide,
const pappso::PeptideNaturalIsotopeAverageSp & peptide_natural_isotope_average_sp)
:
:
QuantiItemPeptide(trace_peptide_on, p_peptide)
QuantiItemPeptide(trace_peptide_on, p_peptide)
{
_mz = peptide_natural_isotope_average_sp.get()->getMz();
_z = peptide_natural_isotope_average_sp.get()->getCharge();
_mz = peptide_natural_isotope_average_sp.get()->getMz();
_z = peptide_natural_isotope_average_sp.get()->getCharge();
_peptide_natural_isotope_average_sp = peptide_natural_isotope_average_sp;
}
......@@ -65,22 +66,24 @@ void QuantiItemPeptideNaturalIsotope::writeCurrentSearchItem(MCQXmlStreamWriter*
void QuantiItemPeptideNaturalIsotope::writeOdsPeptideLine(CalcWriterInterface & writer) const {
QuantiItemPeptide::writeOdsPeptideLine(writer);
writer.writeCell(_peptide_natural_isotope_average_sp.get()->getIsotopeNumber());
writer.writeCell(_peptide_natural_isotope_average_sp.get()->getIsotopeRank());
writer.writeCell(_peptide_natural_isotope_average_sp.get()->getIntensityRatio());
}
void QuantiItemPeptideNaturalIsotope::writeOdsComparHeaderLine(CalcWriterInterface & writer) const {
//_p_writer->writeCell("peptide");
writer.writeCell(_p_peptide->getXmlId());
//_p_writer->writeCell("m/z");
writer.writeCell(getMz());
//_p_writer->writeCell("rt reference");
writer.writeCell(this->_p_peptide->getPeptideRtSp().get()->getAlignedReferenceRt());
//_p_writer->writeCell("z");
writer.writeCell(_z);
//_p_writer->writeCell("isotope number");
......@@ -90,19 +93,26 @@ void QuantiItemPeptideNaturalIsotope::writeOdsComparHeaderLine(CalcWriterInterfa
writer.writeCell(_peptide_natural_isotope_average_sp.get()->getIntensityRatio());
//_p_writer->writeCell("sequence");
writer.writeCell(_p_peptide->getPappsoPeptideSp().get()->toString());
//_p_writer->writeCell("isotope");
if (_p_peptide->getIsotopeLabel() == nullptr) {
writer.writeEmptyCell();
}
else {
writer.writeCell(_p_peptide->getIsotopeLabel()->getXmlId());
}
//_p_writer->writeCell("mods");
writer.writeCell(_p_peptide->getMods());
//_p_writer->writeCell("proteins");
QStringList protein_list;
for (const Protein * p_protein : _p_peptide->getProteinList()) {
protein_list << p_protein->getXmlId();
protein_list << p_protein->getXmlId();
}
writer.writeCell(protein_list.join(" "));
}
pappso::PeptideNaturalIsotopeAverageSp QuantiItemPeptideNaturalIsotope::getPeptideNaturalIsotopeAverageSp () const {
return _peptide_natural_isotope_average_sp;
return _peptide_natural_isotope_average_sp;
}
......@@ -111,7 +121,7 @@ CalcWriterInterface * QuantiItemPeptideNaturalIsotope::newCalcWriterInterface(co
trace_dir.mkpath(trace_dir.absolutePath());
CalcWriterInterface * _p_writer=nullptr;
if (quantificator->getTracesFormat() == McqTsvFormat::tsv) {
_p_writer = new TsvDirectoryWriter(QString("%1/%2_%3-z%4-%5-%6.d").arg(trace_dir.absolutePath()).arg(prefix).arg(this->getPeptide()->getXmlId()).arg(this->_z).arg(this->getPeptideNaturalIsotopeAverageSp()->getIsotopeNumber()).arg(this->getPeptideNaturalIsotopeAverageSp()->getIsotopeRank()));
_p_writer = new TsvDirectoryWriter(QString("%1/%2_%3-z%4-%5-%6.d").arg(trace_dir.absolutePath()).arg(prefix).arg(this->getPeptide()->getXmlId()).arg(this->_z).arg(this->getPeptideNaturalIsotopeAverageSp()->getIsotopeNumber()).arg(this->getPeptideNaturalIsotopeAverageSp()->getIsotopeRank()));
}
else {
_p_writer = new OdsDocWriter(QString("%1/%2_%3-z%4-%5-%6.ods").arg(trace_dir.absolutePath()).arg(prefix).arg(this->getPeptide()->getXmlId()).arg(this->_z).arg(this->getPeptideNaturalIsotopeAverageSp()->getIsotopeNumber()).arg(this->getPeptideNaturalIsotopeAverageSp()->getIsotopeRank()));
......@@ -123,7 +133,7 @@ CalcWriterInterface * QuantiItemPeptideNaturalIsotope::newCalcWriterInterface(co
XicTraceBase* QuantiItemPeptideNaturalIsotope::newXicTrace(Quantificator * quantificator, Msrun* p_msrun, const QString & prefix) const {
if (_trace_peptide_on == false) return nullptr;
return new XicTracePeptideNaturalIsotope(newCalcWriterInterface(quantificator, p_msrun, prefix), this, p_msrun);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment