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

new files to handle pep xml files

parent 1fc72b66
No related branches found
No related tags found
No related merge requests found
/**
* \file /core/identification_sources/identificationpepxmlfile.cpp
* \date 16/6/2018
* \author Olivier Langella
* \brief pep xml identification file handler
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include "identificationpepxmlfile.h"
#include <pappsomspp/pappsoexception.h>
#include "../project.h"
#include "../../input/mascot/mascotdatparser.h"
IdentificationPepXmlFile::IdentificationPepXmlFile(const QFileInfo & mascot_dat_file) : IdentificationDataSource(mascot_dat_file.absoluteFilePath()), _pep_xml_file(mascot_dat_file)
{
_engine = IdentificationEngine::unknown;
}
IdentificationPepXmlFile::IdentificationPepXmlFile(const IdentificationPepXmlFile& other) : IdentificationDataSource(other),_pep_xml_file (other._pep_xml_file)
{
_engine = IdentificationEngine::unknown;
}
IdentificationPepXmlFile::~IdentificationPepXmlFile()
{
}
bool IdentificationPepXmlFile::operator==(const IdentificationPepXmlFile& other) const
{
}
pappso::SpectrumSp IdentificationPepXmlFile::getSpectrumSp(unsigned int scan_number) const {
pappso::SpectrumSp spectrum_sp = IdentificationDataSource::getSpectrumSp(scan_number);
return spectrum_sp;
}
void IdentificationPepXmlFile::parseTo(Project* p_project) {
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
MsRunSp msrun_sp = p_project->getMsRunStore().getInstance(QFileInfo(_pep_xml_file).baseName());
setMsRunSp(msrun_sp);
std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList();
IdentificationGroup * identification_group_p = nullptr;
if (p_project->getProjectMode() == ProjectMode::combined) {
if (identification_list.size() == 0) {
identification_group_p = p_project->newIdentificationGroup();
}
else {
identification_group_p = identification_list[0];
}
}
else {
for (IdentificationGroup * identification_p_flist : identification_list) {
if (identification_p_flist->containSample(msrun_sp.get()->getSampleName())) {
identification_group_p = identification_p_flist;
break;
}
}
if (identification_group_p == nullptr) {
identification_group_p = p_project->newIdentificationGroup();
}
}
identification_group_p->addIdentificationDataSourceP(this);
MascotDatParser mascot_parser(p_project, identification_group_p, this);
QFile qfile(_pep_xml_file.absoluteFilePath());
mascot_parser.parse(&qfile);
qfile.close();
qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
}
/**
* \file /core/identification_sources/identificationpepxmlfile.h
* \date 16/6/2018
* \author Olivier Langella
* \brief pep xml identification file handler
*/
/*******************************************************************************
* Copyright (c) 2018 Olivier Langella <olivier.langella@u-psud.fr>.
*
* This file is part of XTPcpp.
*
* XTPcpp is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* XTPcpp is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef IDENTIFICATIONPEPXMLFILE_H
#define IDENTIFICATIONPEPXMLFILE_H
#include "identificationdatasource.h"
#include <QFileInfo>
class IdentificationPepXmlFile: public IdentificationDataSource
{
public:
IdentificationPepXmlFile(const QFileInfo & mascot_dat_file);
IdentificationPepXmlFile(const IdentificationPepXmlFile& other);
~IdentificationPepXmlFile();
bool operator==(const IdentificationPepXmlFile& other) const;
virtual pappso::SpectrumSp getSpectrumSp(unsigned int scan_number) const override;
virtual void parseTo(Project* p_project) override;
//virtual const bool isValid(const PeptideEvidence * p_peptide_evidence, const AutomaticFilterParameters & automatic_filter_parameters) const override;
private:
const QFileInfo _pep_xml_file;
};
#endif // IDENTIFICATIONPEPXMLFILE_H
......@@ -5,7 +5,6 @@
* \brief read identification files with proteowizard library
*/
/*******************************************************************************
* Copyright (c) 2017 Olivier Langella <olivier.langella@u-psud.fr>.
*
......@@ -25,77 +24,75 @@
* along with XTPcpp. If not, see <http://www.gnu.org/licenses/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and
*implementation
******************************************************************************/
#include "../../input/identificationpwizreader.h"
#include "../project.h"
#include "identificationpwizfile.h"
#include <pappsomspp/pappsoexception.h>
#include "../project.h"
#include "../../input/identificationpwizreader.h"
IdentificationPwizFile::IdentificationPwizFile(const QFileInfo & ident_file) : IdentificationDataSource(ident_file.absoluteFilePath()), _ident_file(ident_file)
{
//_engine = IdentificationEngine::XTandem;
_engine = IdentificationEngine::peptider;
}
IdentificationPwizFile::IdentificationPwizFile(const IdentificationPwizFile& other) : IdentificationDataSource(other),_ident_file (other._ident_file)
{
_engine = other._engine;
IdentificationPwizFile::IdentificationPwizFile(const QFileInfo &ident_file)
: IdentificationDataSource(ident_file.absoluteFilePath()),
_ident_file(ident_file) {
//_engine = IdentificationEngine::XTandem;
_engine = IdentificationEngine::peptider;
}
IdentificationPwizFile::~IdentificationPwizFile()
{
IdentificationPwizFile::IdentificationPwizFile(
const IdentificationPwizFile &other)
: IdentificationDataSource(other), _ident_file(other._ident_file) {
_engine = other._engine;
}
bool IdentificationPwizFile::operator==(const IdentificationPwizFile& other) const
{
IdentificationPwizFile::~IdentificationPwizFile() {}
}
bool IdentificationPwizFile::
operator==(const IdentificationPwizFile &other) const {}
pappso::SpectrumSp IdentificationPwizFile::getSpectrumSp(unsigned int scan_number) const {
pappso::SpectrumSp spectrum_sp = IdentificationDataSource::getSpectrumSp(scan_number);
return spectrum_sp;
pappso::SpectrumSp
IdentificationPwizFile::getSpectrumSp(unsigned int scan_number) const {
pappso::SpectrumSp spectrum_sp =
IdentificationDataSource::getSpectrumSp(scan_number);
return spectrum_sp;
}
void IdentificationPwizFile::parseTo(Project *p_project) {
qDebug() << "IdentificationPwizFile::parseTo begin";
void IdentificationPwizFile::parseTo(Project* p_project) {
qDebug() << "IdentificationPwizFile::parseTo begin";
IdentificationPwizReader pwiz_reader(_ident_file);
IdentificationPwizReader pwiz_reader(_ident_file);
MsRunSp msrun_sp =
p_project->getMsRunStore().getInstance(pwiz_reader.getMsrunName());
MsRunSp msrun_sp = p_project->getMsRunStore().getInstance(pwiz_reader.getMsrunName());
_engine = pwiz_reader.getIdentificationEngine();
setMsRunSp(msrun_sp);
std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList();
IdentificationGroup * identification_group_p = nullptr;
if (p_project->getProjectMode() == ProjectMode::combined) {
if (identification_list.size() == 0) {
identification_group_p = p_project->newIdentificationGroup();
}
else {
identification_group_p = identification_list[0];
}
_engine = pwiz_reader.getIdentificationEngine();
setMsRunSp(msrun_sp);
std::vector<IdentificationGroup *> identification_list =
p_project->getIdentificationGroupList();
IdentificationGroup *identification_group_p = nullptr;
if (p_project->getProjectMode() == ProjectMode::combined) {
if (identification_list.size() == 0) {
identification_group_p = p_project->newIdentificationGroup();
} else {
identification_group_p = identification_list[0];
}
else {
for (IdentificationGroup * identification_p_flist : identification_list) {
if (identification_p_flist->containSample(msrun_sp.get()->getSampleName())) {
identification_group_p = identification_p_flist;
break;
}
}
if (identification_group_p == nullptr) {
identification_group_p = p_project->newIdentificationGroup();
}
} else {
for (IdentificationGroup *identification_p_flist : identification_list) {
if (identification_p_flist->containSample(
msrun_sp.get()->getSampleName())) {
identification_group_p = identification_p_flist;
break;
}
}
identification_group_p->addIdentificationDataSourceP(this);
pwiz_reader.read(this, p_project, identification_group_p);
qDebug() << "IdentificationPwizFile::parseTo end";
// throw pappso::PappsoException(QObject::tr("Error reading %1 XPIP file :\n %2").arg(_xtandem_file.absoluteFilePath()).arg(parser->errorString()));
if (identification_group_p == nullptr) {
identification_group_p = p_project->newIdentificationGroup();
}
}
identification_group_p->addIdentificationDataSourceP(this);
pwiz_reader.read(this, p_project, identification_group_p);
qDebug() << "IdentificationPwizFile::parseTo end";
// throw pappso::PappsoException(QObject::tr("Error reading %1 XPIP file :\n
// %2").arg(_xtandem_file.absoluteFilePath()).arg(parser->errorString()));
}
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