Skip to content
Snippets Groups Projects
Commit 83e75fdc authored by Langella Olivier's avatar Langella Olivier
Browse files

WIP: finding best msrun for alignment reference

parent 9225e6b9
No related branches found
No related tags found
No related merge requests found
......@@ -27,6 +27,7 @@
#include "peptidematch.h"
#include "proteinmatch.h"
#include <QDebug>
#include <pappsomspp/exception/exceptionnotfound.h>
Project::Project()
{
......@@ -54,7 +55,7 @@ Project::readResultFile(QString filename)
_identification_data_source_store.getInstance(filename);
ident_source.get()->parseTo(this);
qDebug() << "Project::readResultFile end";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
const ProjectMode
......@@ -143,14 +144,13 @@ Project::updateAutomaticFilters(
const AutomaticFilterParameters &automatic_filter_parameters)
{
qDebug() << "Project::updateAutomaticFilters begin";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
_automatic_filter_parameters = automatic_filter_parameters;
for(auto &p_id_group : _identification_goup_list)
{
p_id_group->updateAutomaticFilters(_automatic_filter_parameters);
}
qDebug() << "Project::updateAutomaticFilters end";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
ProjectSp
Project::makeProjectSp() const
......@@ -168,16 +168,16 @@ Project::newIdentificationGroup()
void
Project::readXpipFile(WorkMonitorInterface *p_monitor, QFileInfo xpip_fileinfo)
{
qDebug() << "Project::readXpipFile begin";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
XpipSaxHandler *parser_java_xpip = new XpipSaxHandler(p_monitor, this);
QXmlSimpleReader simplereader;
simplereader.setContentHandler(parser_java_xpip);
simplereader.setErrorHandler(parser_java_xpip);
qDebug() << "Project::readXpipFile Read XPIP XML result file '"
<< xpip_fileinfo.absoluteFilePath() << "'";
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< " Read XPIP XML result file '" << xpip_fileinfo.absoluteFilePath()
<< "'";
QFile qfile(xpip_fileinfo.absoluteFilePath());
QXmlInputSource xmlInputSource(&qfile);
......@@ -189,7 +189,8 @@ Project::readXpipFile(WorkMonitorInterface *p_monitor, QFileInfo xpip_fileinfo)
}
else
{
qDebug() << parser_java_xpip->errorString();
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< parser_java_xpip->errorString();
// throw PappsoException(
// QObject::tr("error reading tandem XML result file :\n").append(
// parser->errorString()));
......@@ -213,7 +214,8 @@ Project::readXpipFile(WorkMonitorInterface *p_monitor, QFileInfo xpip_fileinfo)
simplereaderb.setContentHandler(parser_xtp_xpip);
simplereaderb.setErrorHandler(parser_xtp_xpip);
qDebug() << "Project::readXpipFile Read XPIP XML result file '"
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
<< " Read XPIP XML result file '"
<< xpip_fileinfo.absoluteFilePath() << "'";
QFile qfileb(xpip_fileinfo.absoluteFilePath());
......@@ -235,7 +237,8 @@ Project::readXpipFile(WorkMonitorInterface *p_monitor, QFileInfo xpip_fileinfo)
}
else
{
qDebug() << parser_xtp_xpip->errorString();
qDebug() << __FILE__ << " " << __FUNCTION__ << " "
<< __LINE__;
throw pappso::PappsoException(
QObject::tr(
"Error reading %1 XPIP file :\n it is not an XPIP file")
......@@ -281,11 +284,58 @@ Project::hasPtmExperiment() const
void
Project::getSameXicPeptideEvidenceList(
std::vector<const PeptideEvidence *> &peptide_evidence_list,
const MsRun *p_msrun, const PeptideXtp *p_peptide, unsigned int charge) const
const MsRun *p_msrun,
const PeptideXtp *p_peptide,
unsigned int charge) const
{
for(const IdentificationGroup *p_ident_group : _identification_goup_list)
{
p_ident_group->getSameXicPeptideEvidenceList(peptide_evidence_list,
p_msrun, p_peptide, charge);
p_ident_group->getSameXicPeptideEvidenceList(
peptide_evidence_list, p_msrun, p_peptide, charge);
}
}
void
Project::prepareMsrunRetentionTimesForAlignment() const
{
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
bool is_ok = true;
for(IdentificationDataSourceSp p_ident_data_source :
this->getIdentificationDataSourceStore()
.getIdentificationDataSourceList())
{
MsRunSp msrun_sp = p_ident_data_source->getMsRunSp();
if(msrun_sp->findMsRunFile())
{
// msrun_sp->checkMsRunStatistics();
msrun_sp->buildMsRunRetentionTime(
p_ident_data_source->getPeptideEvidenceStore());
}
else
{
is_ok = false;
throw pappso::ExceptionNotFound(
QObject::tr("MS run file %1 not found.")
.arg(msrun_sp.get()->getFileName()));
break;
}
}
if(is_ok)
{
for(auto &msrun_sp : this->getMsRunStore().getMsRunList())
{
msrun_sp->computeMsRunRetentionTime();
}
// find the best reference
}
else
{
for(auto &msrun_sp : this->getMsRunStore().getMsRunList())
{
msrun_sp->clearMsRunRetentionTime();
}
}
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
......@@ -97,9 +97,13 @@ class Project
*/
void getSameXicPeptideEvidenceList(
std::vector<const PeptideEvidence *> &peptide_evidence_list,
const MsRun *p_msrun, const PeptideXtp *p_peptide,
const MsRun *p_msrun,
const PeptideXtp *p_peptide,
unsigned int charge) const;
void prepareMsrunRetentionTimesForAlignment() const;
private:
LabelingMethodSp _labeling_method_sp;
ProjectMode _project_mode = ProjectMode::combined;
......
......@@ -38,6 +38,7 @@
#include <QFileDialog>
#include <pappsomspp/msrun/alignment/msrunretentiontime.h>
#include <pappsomspp/msfile/msfileaccessor.h>
#include <pappsomspp/pappsoexception.h>
ExportMasschroqDialog::ExportMasschroqDialog(QWidget *parent)
: QDialog(parent), ui(new Ui::ExportMasschroqDialog)
......@@ -268,27 +269,11 @@ ExportMasschroqDialog::doBrowseMsrunDirectory()
void
ExportMasschroqDialog::doFindBestMsrunForAlignment()
{
IdentificationGroup *p_identification_group = nullptr;
if(mp_project->getIdentificationGroupList().size() != 1)
{
}
else
{
// p_identification_group =
// mp_project->getIdentificationGroupList()[0]->get
}
bool is_ok = true;
for(IdentificationDataSourceSp p_ident_data_source :
mp_project->getIdentificationDataSourceStore()
.getIdentificationDataSourceList())
for(auto &msrun_sp : mp_project->getMsRunStore().getMsRunList())
{
MsRunSp msrun_sp = p_ident_data_source->getMsRunSp();
if(msrun_sp->findMsRunFile())
{
// msrun_sp->checkMsRunStatistics();
msrun_sp->buildMsRunRetentionTime(
p_ident_data_source->getPeptideEvidenceStore());
}
else
{
......@@ -301,19 +286,17 @@ ExportMasschroqDialog::doFindBestMsrunForAlignment()
break;
}
}
if(is_ok)
try
{
for(auto &msrun_sp : mp_project->getMsRunStore().getMsRunList())
{
msrun_sp->computeMsRunRetentionTime();
}
//find the best reference
mp_project->prepareMsrunRetentionTimesForAlignment();
}
else
catch(pappso::PappsoException &error)
{
for(auto &msrun_sp : mp_project->getMsRunStore().getMsRunList())
{
msrun_sp->clearMsRunRetentionTime();
}
QMessageBox msgBox;
msgBox.setWindowTitle("Error");
msgBox.setText(
tr("Error preparing MS run retention times: %1").arg(error.qwhat()));
msgBox.setIcon(QMessageBox::Critical);
msgBox.exec();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment