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

new files to read pwiz identifications

parent 53536785
No related branches found
No related tags found
No related merge requests found
/**
* \filed core/identification_sources/identificationpwizfile.cpp
* \date 17/6/2017
* \author Olivier Langella
* \brief read identification files with proteowizard library
*/
/*******************************************************************************
* Copyright (c) 2017 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/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#include "identificationpwizfile.h"
#include <pappsomspp/pappsoexception.h>
#include "../project.h"
#include "../../input/xtandemsaxhandler.h"
IdentificationPwizFile::IdentificationPwizFile(const QFileInfo & xtandem_file) : IdentificationDataSource(xtandem_file.absoluteFilePath()), _xtandem_file(xtandem_file)
{
_engine = IdentificationEngine::XTandem;
}
IdentificationPwizFile::IdentificationPwizFile(const IdentificationPwizFile& other) : IdentificationDataSource(other),_xtandem_file (other._xtandem_file)
{
_engine = IdentificationEngine::XTandem;
}
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;
}
void IdentificationPwizFile::parseTo(Project* p_project) {
qDebug() << "Project::readXpipFile begin";
qDebug() << "Read X!Tandem XML result file '" << _xtandem_file.absoluteFilePath() << "'";
MsRunSp msrun_sp = p_project->getMsRunStore().getInstance(QFileInfo(_xtandem_file).baseName());
setMsRunSp(msrun_sp);
std::vector<IdentificationGroup *> identification_list = p_project->getIdentificationGroupList();
IdentificationGroup * identification_group_p = nullptr;
if (p_project->isCombineMode()) {
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->contains(msrun_sp.get())) {
identification_group_p = identification_p_flist;
break;
}
}
if (identification_group_p == nullptr) {
identification_group_p = p_project->newIdentificationGroup();
}
}
identification_group_p->addIdentificationDataSourceP(this);
XtandemSaxHandler * parser = new XtandemSaxHandler(p_project, identification_group_p, this);
QXmlSimpleReader simplereader;
simplereader.setContentHandler(parser);
simplereader.setErrorHandler(parser);
QFile qfile(_xtandem_file.absoluteFilePath());
QXmlInputSource xmlInputSource(&qfile);
if (simplereader.parse(xmlInputSource)) {
qfile.close();
} else {
qDebug() << parser->errorString();
// throw PappsoException(
// QObject::tr("error reading tandem XML result file :\n").append(
// parser->errorString()));
qfile.close();
throw pappso::PappsoException(QObject::tr("Error reading %1 XPIP file :\n %2").arg(_xtandem_file.absoluteFilePath()).arg(parser->errorString()));
}
}
/**
* \filed core/identification_sources/identificationpwizfile.h
* \date 17/6/2017
* \author Olivier Langella
* \brief read identification files with proteowizard library
*/
/*******************************************************************************
* Copyright (c) 2017 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/>.
*
* Contributors:
* Olivier Langella <olivier.langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef IDENTIFICATIONPWIZFILE_H
#define IDENTIFICATIONPWIZFILE_H
#include "identificationdatasource.h"
#include <QFileInfo>
class IdentificationPwizFile: public IdentificationDataSource
{
public:
IdentificationPwizFile(const QFileInfo & xtandem_file);
IdentificationPwizFile(const IdentificationPwizFile& other);
~IdentificationPwizFile();
bool operator==(const IdentificationPwizFile& other) const;
virtual pappso::SpectrumSp getSpectrumSp(unsigned int scan_number) const override;
virtual void parseTo(Project* p_project) override;
private:
const QFileInfo _xtandem_file;
};
#endif // IDENTIFICATIONPWIZFILE_H
/**
* \file input/identificationpwizreader.cpp
* \date 17/6/2017
* \author Olivier Langella
* \brief read identification files using pwiz library
*/
#include "identificationpwizreader.h"
/**
* \file input/identificationpwizreader.h
* \date 17/6/2017
* \author Olivier Langella
* \brief read identification files using pwiz library
*/
/*******************************************************************************
* Copyright (c) 2017 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/>.
*
* Contributors:
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and implementation
******************************************************************************/
#ifndef IDENTIFICATIONPWIZREADER_H
#define IDENTIFICATIONPWIZREADER_H
class IdentificationPwizReader
{
};
#endif // IDENTIFICATIONPWIZREADER_H
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