From 98f77814dd5358715564d2ec3be37d006c270725 Mon Sep 17 00:00:00 2001 From: Olivier Langella <olivier.langella@u-psud.fr> Date: Thu, 6 Jun 2019 17:07:18 +0200 Subject: [PATCH] WIP: using new pappsoms++ library --- .../identificationdatasource.cpp | 4 ++-- src/core/msrun.cpp | 24 +++++++++---------- src/core/msrun.h | 9 +++---- .../exportmasschroqdialog.cpp | 2 +- src/gui/peptide_detail_view/peptidewindow.cpp | 2 +- .../peptide_list_view/peptidelistwindow.cpp | 4 ++-- .../protein_list_view/proteinlistwindow.cpp | 4 ++-- .../proteintableproxymodel.cpp | 2 +- src/gui/xic_view/xic_box/xicbox.cpp | 8 +++---- src/gui/xic_view/xicworkerthread.cpp | 2 +- src/output/masschroqml.cpp | 2 +- src/output/mcqrspectralcount.cpp | 2 +- src/output/ods/samplesheet.cpp | 2 +- src/output/proticdbml.cpp | 2 +- src/output/xpip.cpp | 4 ++-- src/utils/msrunstore.cpp | 4 ++-- src/utils/msrunstore.h | 4 +--- 17 files changed, 38 insertions(+), 43 deletions(-) diff --git a/src/core/identification_sources/identificationdatasource.cpp b/src/core/identification_sources/identificationdatasource.cpp index d1c701709..cabdf57e8 100644 --- a/src/core/identification_sources/identificationdatasource.cpp +++ b/src/core/identification_sources/identificationdatasource.cpp @@ -209,7 +209,7 @@ IdentificationDataSource::getMassSpectrumCstSPtr(unsigned int scan_number) const { throw pappso::ExceptionNotFound( QObject::tr("mz data \"%1\" file not found") - .arg(_ms_run_sp.get()->getFilename())); + .arg(_ms_run_sp.get()->getFileName())); } } msrun_reader_sp = _ms_run_sp.get()->getMsRunReaderSp(); @@ -217,7 +217,7 @@ IdentificationDataSource::getMassSpectrumCstSPtr(unsigned int scan_number) const { throw pappso::ExceptionNotFound( QObject::tr("mz data \"%1\" file not found") - .arg(_ms_run_sp.get()->getFilename())); + .arg(_ms_run_sp.get()->getFileName())); } diff --git a/src/core/msrun.cpp b/src/core/msrun.cpp index 5935f6058..534766121 100644 --- a/src/core/msrun.cpp +++ b/src/core/msrun.cpp @@ -35,7 +35,6 @@ #include <QSettings> #include <QDebug> #include <QDir> -#include <pappsomspp/msrun/msrunreaderfactory.h> #include <pappsomspp/exception/exceptionnotfound.h> #include <pappsomspp/xicextractor/msrunxicextractorfactory.h> #include "../utils/msrunstatisticshandler.h" @@ -55,17 +54,17 @@ MsRun::MsRun(const MsRun &other) : pappso::MsRunId(other) MsRun::~MsRun() { } -pappso::MsRunReaderSp & -MsRun::getMsRunReaderSp() +pappso::MsRunReaderSPtr & +MsRun::getMsRunReaderSPtr() { qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ - << " filename=" << getFilename(); + << " filename=" << getFileName(); if(_msrun_reader_sp == nullptr) { try { - pappso::MsFileAccessor accessor(getFilename(), 0); + pappso::MsFileAccessor accessor(getFileName(), 0); qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"; auto msrunid_list = accessor.getMsRunIds(); if(msrunid_list.size() == 1) @@ -126,10 +125,10 @@ bool MsRun::findMsRunFile() { // first look at the file path :) - _msrun_reader_sp = getMsRunReaderSp(); + _msrun_reader_sp = getMsRunReaderSPtr(); if(_msrun_reader_sp != nullptr) { - QFileInfo real_file(this->getFilename()); + QFileInfo real_file(this->getFileName()); if(real_file.exists()) { return true; @@ -139,7 +138,7 @@ MsRun::findMsRunFile() _msrun_reader_sp = nullptr; } } - QFileInfo file_original(this->getFilename()); + QFileInfo file_original(this->getFileName()); QString basename = file_original.baseName(); QString onlyfilename = file_original.fileName(); QSettings settings; @@ -165,7 +164,7 @@ MsRun::findMsRunFile() if(_msrun_reader_sp == nullptr) { - pappso::MsFileAccessor accessor(getFilename(), 0); + pappso::MsFileAccessor accessor(getFileName(), 0); qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"; auto msrunid_list = accessor.getMsRunIds(); @@ -204,7 +203,7 @@ MsRun::findMsRunFile() if(_msrun_reader_sp == nullptr) { - pappso::MsFileAccessor accessor(getFilename(), 0); + pappso::MsFileAccessor accessor(getFileName(), 0); qDebug() << __FILE__ << "@" << __LINE__ << __FUNCTION__ << "()"; auto msrunid_list = accessor.getMsRunIds(); @@ -294,8 +293,9 @@ MsRun::getMsRunXicExtractorInterfaceSp() } else { - _xic_extractor_sp = pappso::MsRunXicExtractorFactory::getInstance() - .buildMsRunXicExtractorDiskBufferSp(_msrun_reader_sp); + _xic_extractor_sp = + pappso::MsRunXicExtractorFactory::getInstance() + .buildMsRunXicExtractorDiskBufferSp(_msrun_reader_sp); } //_xic_extractor_sp = pappso::MsRunXicExtractorFactory::getInstance() // .buildMsRunXicExtractorDiskBufferSp(*this); diff --git a/src/core/msrun.h b/src/core/msrun.h index 81677f42e..94b300cfa 100644 --- a/src/core/msrun.h +++ b/src/core/msrun.h @@ -30,8 +30,7 @@ ******************************************************************************/ -#ifndef MSRUN_H -#define MSRUN_H +#pragma once #include <memory> #include <QString> @@ -69,7 +68,7 @@ class MsRun : public pappso::MsRunId bool findMsRunFile(); - pappso::MsRunReaderSp &getMsRunReaderSp(); + pappso::MsRunReaderSPtr &getMsRunReaderSPtr(); /** @brief release shared pointer on MSrun reader */ @@ -82,9 +81,7 @@ class MsRun : public pappso::MsRunId private: std::map<MsRunStatistics, QVariant> _param_stats; - pappso::MsRunReaderSp _msrun_reader_sp; + pappso::MsRunReaderSPtr _msrun_reader_sp; pappso::MsRunXicExtractorInterfaceSp _xic_extractor_sp; }; - -#endif // MSRUN_H diff --git a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp index 589ae1fe8..3f841cbe8 100644 --- a/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp +++ b/src/gui/export/export_masschroq_dialog/exportmasschroqdialog.cpp @@ -228,7 +228,7 @@ ExportMasschroqDialog::doCheckMsrunFilepath() ui->warningDirectoryLabel->setText( tr("%1 not found : Please choose the directory to look for this MS " "run file.") - .arg(msrun_sp.get()->getFilename())); + .arg(msrun_sp.get()->getFileName())); ui->directorySelectWidget->setHidden(false); break; } diff --git a/src/gui/peptide_detail_view/peptidewindow.cpp b/src/gui/peptide_detail_view/peptidewindow.cpp index 33d21dad5..78da5131f 100644 --- a/src/gui/peptide_detail_view/peptidewindow.cpp +++ b/src/gui/peptide_detail_view/peptidewindow.cpp @@ -306,7 +306,7 @@ PeptideWindow::openInPeptideViewer() QStringList arguments; arguments << _p_peptide_evidence->getPeptideXtpSp().get()->toString() << QString("%1").arg(_p_peptide_evidence->getCharge()) - << _p_peptide_evidence->getMsRunP()->getFilename() + << _p_peptide_evidence->getMsRunP()->getFileName() << QString("%1").arg(_p_peptide_evidence->getScanNumber()); qDebug() << "PeptideWindow::openInPeptideViewer " << program << " " diff --git a/src/gui/peptide_list_view/peptidelistwindow.cpp b/src/gui/peptide_list_view/peptidelistwindow.cpp index d95537718..a56f7145b 100644 --- a/src/gui/peptide_list_view/peptidelistwindow.cpp +++ b/src/gui/peptide_list_view/peptidelistwindow.cpp @@ -215,9 +215,9 @@ PeptideListWindow::setProteinMatch(IdentificationGroup *p_identification_group, QStringList msrun_list; for(MsRunSp msrun_sp : _p_identification_group->getMsRunSpList()) { - msrun_list << msrun_sp.get()->getFilename(); + msrun_list << msrun_sp.get()->getFileName(); qDebug() << "PeptideListWindow::setIdentificationGroup " - << msrun_sp.get()->getFilename(); + << msrun_sp.get()->getFileName(); } QCompleter *completer = new QCompleter(msrun_list, this); completer->setCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/gui/protein_list_view/proteinlistwindow.cpp b/src/gui/protein_list_view/proteinlistwindow.cpp index c07b7aa67..4a0f1551a 100644 --- a/src/gui/protein_list_view/proteinlistwindow.cpp +++ b/src/gui/protein_list_view/proteinlistwindow.cpp @@ -384,9 +384,9 @@ ProteinListWindow::setIdentificationGroup( QStringList msrun_list; for(MsRunSp msrun_sp : _p_identification_group->getMsRunSpList()) { - msrun_list << msrun_sp.get()->getFilename(); + msrun_list << msrun_sp.get()->getFileName(); qDebug() << "ProteinListWindow::setIdentificationGroup " - << msrun_sp.get()->getFilename(); + << msrun_sp.get()->getFileName(); } QCompleter *completer = new QCompleter(msrun_list, this); completer->setCaseSensitivity(Qt::CaseInsensitive); diff --git a/src/gui/protein_list_view/proteintableproxymodel.cpp b/src/gui/protein_list_view/proteintableproxymodel.cpp index 7ebb39c35..a0d2ff594 100644 --- a/src/gui/protein_list_view/proteintableproxymodel.cpp +++ b/src/gui/protein_list_view/proteintableproxymodel.cpp @@ -143,7 +143,7 @@ ProteinTableProxyModel::filterAcceptsRow(int source_row, msrun_ok = false; if(p_peptide_match.getPeptideEvidence() ->getMsRunP() - ->getFilename() + ->getFileName() .toLower() .contains(file_search_string)) { diff --git a/src/gui/xic_view/xic_box/xicbox.cpp b/src/gui/xic_view/xic_box/xicbox.cpp index f5354fcbc..9cb7b2265 100644 --- a/src/gui/xic_view/xic_box/xicbox.cpp +++ b/src/gui/xic_view/xic_box/xicbox.cpp @@ -175,9 +175,9 @@ XicBox::XicBox(XicWindow *parent) : QWidget(parent), ui(new Ui::XicBox) ->getMsRunStore() .getMsRunList()) { - msrun_list << msrun_sp.get()->getFilename(); + msrun_list << msrun_sp.get()->getFileName(); qDebug() << "ProteinListWindow::setIdentificationGroup " - << msrun_sp.get()->getFilename(); + << msrun_sp.get()->getFileName(); } QCompleter *completer = new QCompleter(msrun_list, this); completer->setCaseSensitivity(Qt::CaseInsensitive); @@ -258,7 +258,7 @@ XicBox::setPeptideEvidence(const PeptideEvidence *p_peptide_evidence) ui->peptide_label->setText( _p_peptide_evidence->getPeptideXtpSp().get()->toString()); - ui->msrun_label->setText(_p_peptide_evidence->getMsRunP()->getFilename()); + ui->msrun_label->setText(_p_peptide_evidence->getMsRunP()->getFileName()); ui->charge_label->setText( QString("%1").arg(_p_peptide_evidence->getCharge())); ui->mz_label->setText( @@ -290,7 +290,7 @@ XicBox::setPeptideEvidenceInMsRun(const PeptideEvidence *p_peptide_evidence, ui->peptide_label->setText( _p_peptide_evidence->getPeptideXtpSp().get()->toString()); - ui->msrun_label->setText(msrun_sp->getFilename()); + ui->msrun_label->setText(msrun_sp->getFileName()); ui->charge_label->setText( QString("%1").arg(_p_peptide_evidence->getCharge())); ui->mz_label->setText( diff --git a/src/gui/xic_view/xicworkerthread.cpp b/src/gui/xic_view/xicworkerthread.cpp index 8b9e2386e..e038f0588 100644 --- a/src/gui/xic_view/xicworkerthread.cpp +++ b/src/gui/xic_view/xicworkerthread.cpp @@ -76,7 +76,7 @@ XicWorkerThread::doXicLoad(MsRunSp p_msrun, catch(pappso::PappsoException &error) { emit operationFailed(tr("Error extracting XIC for MSrun %1:\n%2") - .arg(p_msrun->getFilename()) + .arg(p_msrun->getFileName()) .arg(error.qwhat())); } } diff --git a/src/output/masschroqml.cpp b/src/output/masschroqml.cpp index dd2df3379..1baa9b397 100644 --- a/src/output/masschroqml.cpp +++ b/src/output/masschroqml.cpp @@ -150,7 +150,7 @@ MassChroQml::write(ProjectSp sp_project) { _output_stream->writeAttribute("format", "mzxml"); } - _output_stream->writeAttribute("path", msrun.get()->getFilename()); + _output_stream->writeAttribute("path", msrun.get()->getFileName()); _output_stream->writeAttribute("type", "centroid"); // <data_file id="samp1" format="mzxml" path="bsa2.mzXML" type="profile" // /> diff --git a/src/output/mcqrspectralcount.cpp b/src/output/mcqrspectralcount.cpp index 5f0346f49..60c8e45c0 100644 --- a/src/output/mcqrspectralcount.cpp +++ b/src/output/mcqrspectralcount.cpp @@ -175,7 +175,7 @@ McqrSpectralCount::writeOneProteinLabel(const pappso::GrpProtein *p_grp_protein, _p_writer->writeCell(p_grp_protein->getGroupingId()); _p_writer->writeCell(p_msrun->getXmlId()); - _p_writer->writeCell(p_msrun->getFilename()); + _p_writer->writeCell(p_msrun->getFileName()); if(p_label != nullptr) { diff --git a/src/output/ods/samplesheet.cpp b/src/output/ods/samplesheet.cpp index 5fe39259f..7f4f15705 100644 --- a/src/output/ods/samplesheet.cpp +++ b/src/output/ods/samplesheet.cpp @@ -156,7 +156,7 @@ SampleSheet::writeIdentificationDataSource( _p_writer->writeCell(msrun_sp.get()->getXmlId()); _p_writer->writeCell(msrun_sp.get()->getSampleName()); - _p_writer->writeCell(msrun_sp.get()->getFilename()); + _p_writer->writeCell(msrun_sp.get()->getFileName()); _p_writer->writeCell(p_ident_data_source->getIdentificationEngineName()); _p_writer->writeCell(p_ident_data_source->getIdentificationEngineVersion()); _p_writer->writeCell(p_ident_data_source->getResourceName()); diff --git a/src/output/proticdbml.cpp b/src/output/proticdbml.cpp index ada23f214..527fc88b9 100644 --- a/src/output/proticdbml.cpp +++ b/src/output/proticdbml.cpp @@ -336,7 +336,7 @@ ProticdbMl::writeIdentificationDataSource( _output_stream->writeStartElement("processingMethod"); // mzXml source file name writeCvParam("PROTICdbO:0000343", - p_identification_data_source->getMsRunSp().get()->getFilename(), + p_identification_data_source->getMsRunSp().get()->getFileName(), "MS/MS data source file name"); if(p_identification_data_source->getIdentificationEngine() == IdentificationEngine::XTandem) diff --git a/src/output/xpip.cpp b/src/output/xpip.cpp index 51a542c8a..f740efcd0 100644 --- a/src/output/xpip.cpp +++ b/src/output/xpip.cpp @@ -325,10 +325,10 @@ Xpip::writeMsrunList(const MsRunStore &msrun_store) _output_stream->writeAttribute("format", QString("%1").arg(static_cast<std::int8_t>( msrun_sp.get()->getMzFormat()))); - QFileInfo mz_info(msrun_sp.get()->getFilename()); + QFileInfo mz_info(msrun_sp.get()->getFileName()); if(mz_info.exists()) { - _output_stream->writeAttribute("path", msrun_sp.get()->getFilename()); + _output_stream->writeAttribute("path", msrun_sp.get()->getFileName()); } else { diff --git a/src/utils/msrunstore.cpp b/src/utils/msrunstore.cpp index 2a3719c49..e2641ffdd 100644 --- a/src/utils/msrunstore.cpp +++ b/src/utils/msrunstore.cpp @@ -79,12 +79,12 @@ MsRunStore::getInstance(const QString &location) _map_msrun.end(), [location](const MsRunSp &msrun_sp) { if(msrun_sp.get()->getSampleName() == - msrun_sp.get()->getFilename()) + msrun_sp.get()->getFileName()) { return msrun_sp.get()->getSampleName() == QFileInfo(location).baseName(); } - return msrun_sp.get()->getFilename() == location; + return msrun_sp.get()->getFileName() == location; }); } if(it != _map_msrun.end()) diff --git a/src/utils/msrunstore.h b/src/utils/msrunstore.h index e0853179a..4828d825e 100644 --- a/src/utils/msrunstore.h +++ b/src/utils/msrunstore.h @@ -29,8 +29,7 @@ *implementation ******************************************************************************/ -#ifndef MSRUNSTORE_H -#define MSRUNSTORE_H +#pragma once #include <QString> #include <map> @@ -52,4 +51,3 @@ class MsRunStore std::vector<MsRunSp> _map_msrun; }; -#endif // MSRUNSTORE_H -- GitLab